Summary
TechnicalAnalysis has no tests. Any change to an indicator formula is undetectable. The module does float arithmetic that is easy to get wrong and critical to get right.
What needs to be done
Add unit tests in tests/Omnijure.Core.Tests/ for every indicator:
| Test class |
Cases |
SmaTests |
Known sequence → expected value, period > buffer length returns 0 |
EmaTests |
Matches reference value from TradingView for BTCUSDT 1h data |
RsiTests |
Wilder smoothing matches known RSI(14) reference values |
MacdTests |
MACD line, signal line, histogram correct |
BollingerBandsTests |
Upper/Lower within tolerance, squeeze detection |
AtrTests |
Matches reference ATR(14) values |
- Use
[Theory] with inline data for deterministic inputs
- Tolerance:
Math.Abs(actual - expected) < 0.01f
- Add edge cases: empty buffer, buffer smaller than period, flat price sequence
Acceptance criteria
References
Summary
TechnicalAnalysishas no tests. Any change to an indicator formula is undetectable. The module does float arithmetic that is easy to get wrong and critical to get right.What needs to be done
Add unit tests in
tests/Omnijure.Core.Tests/for every indicator:SmaTestsEmaTestsRsiTestsMacdTestsBollingerBandsTestsAtrTests[Theory]with inline data for deterministic inputsMath.Abs(actual - expected) < 0.01fAcceptance criteria
TechnicalAnalysis.cs≥ 90%References
src/Omnijure.Core/Shared/Lib/Math/TechnicalAnalysis.cstests/Omnijure.Core.Tests/