Skip to content

[Testing] Unit tests for all TechnicalAnalysis indicators #10

@jackby03

Description

@jackby03

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

  • All 6 indicator classes have passing tests
  • Tests run in CI (no network access, no file I/O)
  • Code coverage for TechnicalAnalysis.cs ≥ 90%
  • Tests complete in < 100ms total

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions