Skip to content

Commit 773bddf

Browse files
authored
fix: Update test files to ensure correct interface implementation and improve readability
1 parent 0401305 commit 773bddf

File tree

4 files changed

+46
-27
lines changed

4 files changed

+46
-27
lines changed

.specify/specs/001-develop-streaming-indicators/checklists/T175-test-interface-audit.md

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
- **Issues Fixed**: 10 of 13 (76.9%)
1616
- **Audit Errors**: 4 (already correct or architecturally correct)
17-
- Pivots: StreamHub<IQuote>, not ChainProvider
18-
- ForceIndex, Ultimate, Vwma: Can provide to chains but cannot observe them (IQuoteProvider constructor)
17+
- Pivots: `StreamHub<IQuote>`, not ChainProvider
18+
- ForceIndex, Ultimate, Vwma: Can provide to chains but cannot observe them (`IQuoteProvider` constructor)
1919
- **Remaining Issues**: 0 (all 13 items resolved or explained)
2020

2121
## Interface Selection Rules (from instruction file)
@@ -39,31 +39,31 @@ Per `.github/instructions/indicator-stream.instructions.md`, test interfaces sho
3939

4040
These indicators extend ChainProvider or QuoteProvider but were missing the `ITestChainProvider` interface:
4141

42-
- [x] **BollingerBands** (ChainProvider<IReusable>) ✅ FIXED
42+
- [x] **BollingerBands** (`ChainProvider<IReusable>`) ✅ FIXED
4343
- Was: `ITestQuoteObserver`
4444
- Now: `ITestQuoteObserver`, `ITestChainProvider`
4545
- File: `tests/indicators/a-d/BollingerBands/BollingerBands.StreamHub.Tests.cs`
46-
- Note: Kept ITestQuoteObserver (hub takes IQuote input), added ITestChainProvider
46+
- Note: Kept ITestQuoteObserver (hub takes `IQuote` input), added ITestChainProvider
4747

48-
- [x] **Cci** (ChainProvider<IQuote>) ✅ FIXED
48+
- [x] **Cci** (`ChainProvider<IQuote>`) ✅ FIXED
4949
- Was: `ITestQuoteObserver`
5050
- Now: `ITestQuoteObserver`, `ITestChainProvider`
5151
- File: `tests/indicators/a-d/Cci/Cci.StreamHub.Tests.cs`
5252
- Action: Added `ITestChainProvider`, renamed QuoteProvider→ChainProvider test
5353

54-
- [x] **Epma** (ChainProvider<IReusable>) ✅ FIXED
54+
- [x] **Epma** (`ChainProvider<IReusable>`) ✅ FIXED
5555
- Was: `ITestQuoteObserver`
5656
- Now: `ITestChainObserver`, `ITestChainProvider`
5757
- File: `tests/indicators/e-k/Epma/Epma.StreamHub.Tests.cs`
5858
- Action: Replaced `ITestQuoteObserver` with `ITestChainObserver`, added both test methods
5959

60-
- [x] **Kvo** (ChainProvider<IQuote>) ✅ FIXED
60+
- [x] **Kvo** (`ChainProvider<IQuote>`) ✅ FIXED
6161
- Was: `ITestQuoteObserver`
6262
- Now: `ITestQuoteObserver`, `ITestChainProvider`
6363
- File: `tests/indicators/e-k/Kvo/Kvo.StreamHub.Tests.cs`
6464
- Action: Added `ITestChainProvider` + ChainProvider test method
6565

66-
- [x] **Obv** (ChainProvider<IQuote>) ✅ FIXED
66+
- [x] **Obv** (`ChainProvider<IQuote>`) ✅ FIXED
6767
- Was: `ITestQuoteObserver`
6868
- Now: `ITestQuoteObserver`, `ITestChainProvider`
6969
- File: `tests/indicators/m-r/Obv/Obv.StreamHub.Tests.cs`
@@ -73,25 +73,25 @@ These indicators extend ChainProvider or QuoteProvider but were missing the `ITe
7373
- Hub extends: `StreamHub<IQuote>` (NOT ChainProvider)
7474
- Current: `ITestQuoteObserver` ✅ CORRECT
7575
- File: `tests/indicators/m-r/Pivots/Pivots.StreamHub.Tests.cs`
76-
- Note: Audit incorrectly identified as ChainProvider; StreamHub<IQuote> only needs ITestQuoteObserver
76+
- Note: Audit incorrectly identified as ChainProvider; `StreamHub<IQuote>` only needs ITestQuoteObserver
7777

7878
### Category 2: Wrong Observer Type (5 indicators) - 2 FIXED, 3 AUDIT ERRORS
7979

80-
These ChainProvider<IReusable> indicators should use `ITestChainObserver` instead of `ITestQuoteObserver`:
80+
These `ChainProvider<IReusable>` indicators should use `ITestChainObserver` instead of `ITestQuoteObserver`:
8181

8282
- [x] **ForceIndex** ❌ AUDIT ERROR - Already Correct
8383
- Hub extends: `ChainProvider<IReusable>` but constructor takes `IQuoteProvider<IQuote>`
8484
- Current: `ITestQuoteObserver`, `ITestChainProvider` ✅ CORRECT
8585
- File: `tests/indicators/e-k/ForceIndex/ForceIndex.StreamHub.Tests.cs`
86-
- Note: Can PROVIDE to chains but cannot OBSERVE chains (takes IQuoteProvider constructor)
86+
- Note: Can PROVIDE to chains but cannot OBSERVE chains (takes `IQuoteProvider` constructor)
8787

88-
- [x] **T3** (ChainProvider<IReusable>) ✅ FIXED
88+
- [x] **T3** (`ChainProvider<IReusable>`) ✅ FIXED
8989
- Was: `ITestQuoteObserver`, `ITestChainProvider`
9090
- Now: `ITestChainObserver`, `ITestChainProvider`
9191
- File: `tests/indicators/s-z/T3/T3.StreamHub.Tests.cs`
9292
- Action: Replaced `ITestQuoteObserver` with `ITestChainObserver`, added ChainObserver test
9393

94-
- [x] **Tema** (ChainProvider<IReusable>) ✅ FIXED
94+
- [x] **Tema** (`ChainProvider<IReusable>`) ✅ FIXED
9595
- Was: `ITestQuoteObserver`, `ITestChainProvider`
9696
- Now: `ITestChainObserver`, `ITestChainProvider`
9797
- File: `tests/indicators/s-z/Tema/Tema.StreamHub.Tests.cs`
@@ -111,15 +111,15 @@ These ChainProvider<IReusable> indicators should use `ITestChainObserver` instea
111111

112112
### Category 3: Wrong Observer Type for Quote Provider (2 indicators) - 2 FIXED
113113

114-
These ChainProvider<IQuote> indicators should use `ITestQuoteObserver` instead of `ITestChainObserver`:
114+
These `ChainProvider<IQuote>` indicators should use `ITestQuoteObserver` instead of `ITestChainObserver`:
115115

116-
- [x] **Bop** (ChainProvider<IQuote>) ✅ FIXED
116+
- [x] **Bop** (`ChainProvider<IQuote>`) ✅ FIXED
117117
- Was: `ITestChainObserver`, `ITestChainProvider`
118118
- Now: `ITestQuoteObserver`, `ITestChainProvider`
119119
- File: `tests/indicators/a-d/Bop/Bop.StreamHub.Tests.cs`
120120
- Action: Replaced `ITestChainObserver` with `ITestQuoteObserver`
121121

122-
- [x] **ChaikinOsc** (ChainProvider<IQuote>) ✅ FIXED
122+
- [x] **ChaikinOsc** (`ChainProvider<IQuote>`) ✅ FIXED
123123
- Was: `ITestChainObserver`, `ITestChainProvider`
124124
- Now: `ITestQuoteObserver`, `ITestChainProvider`
125125
- File: `tests/indicators/a-d/ChaikinOsc/ChaikinOsc.StreamHub.Tests.cs`
@@ -129,7 +129,7 @@ These ChainProvider<IQuote> indicators should use `ITestQuoteObserver` instead o
129129

130130
This indicator extends `StreamHub<IReusable>` directly (not ChainProvider) but implemented ChainProvider test interface:
131131

132-
- [x] **MaEnvelopes** (StreamHub<IReusable>) ✅ FIXED
132+
- [x] **MaEnvelopes** (`StreamHub<IReusable>`) ✅ FIXED
133133
- Was: `ITestChainObserver`, `ITestChainProvider`
134134
- Now: `ITestChainObserver`
135135
- File: `tests/indicators/m-r/MaEnvelopes/MaEnvelopes.StreamHub.Tests.cs`
@@ -151,15 +151,15 @@ Test files exist but corresponding hub implementation not found:
151151

152152
These indicators correctly implement test interfaces per guidelines:
153153

154-
**Ema** (ChainProvider<IReusable>): `ITestChainObserver`, `ITestChainProvider`
155-
**Sma** (ChainProvider<IReusable>): `ITestChainObserver`, `ITestChainProvider`
156-
**Rsi** (ChainProvider<IReusable>): `ITestChainObserver`, `ITestChainProvider`
157-
**Correlation** (PairsProvider): `ITestPairsObserver`
158-
**Beta** (PairsProvider): `ITestPairsObserver`
159-
**Adx** (ChainProvider<IQuote>): `ITestQuoteObserver`, `ITestChainProvider`
160-
**Atr** (ChainProvider<IQuote>): `ITestQuoteObserver`, `ITestChainProvider`
161-
**Chandelier** (StreamHub<IQuote>): `ITestQuoteObserver`
162-
**Alligator** (StreamHub<IReusable>): `ITestChainObserver`
154+
**Ema** (`ChainProvider<IReusable>`): `ITestChainObserver`, `ITestChainProvider`
155+
**Sma** (`ChainProvider<IReusable>`): `ITestChainObserver`, `ITestChainProvider`
156+
**Rsi** (`ChainProvider<IReusable>`): `ITestChainObserver`, `ITestChainProvider`
157+
**Correlation** (`PairsProvider`): `ITestPairsObserver`
158+
**Beta** (`PairsProvider`): `ITestPairsObserver`
159+
**Adx** (`ChainProvider<IQuote>`): `ITestQuoteObserver`, `ITestChainProvider`
160+
**Atr** (`ChainProvider<IQuote>`): `ITestQuoteObserver`, `ITestChainProvider`
161+
**Chandelier** (`StreamHub<IQuote>`): `ITestQuoteObserver`
162+
**Alligator** (`StreamHub<IReusable>`): `ITestChainObserver`
163163

164164
Full list available in `/tmp/audit_results_detailed.txt`
165165

@@ -169,10 +169,11 @@ Task T176 addressed the 13 issues identified above with the following results:
169169

170170
- **10 items fixed**: BollingerBands, Cci, Epma, Kvo, Obv, T3, Tema, Bop, ChaikinOsc, MaEnvelopes
171171
- **4 items identified as audit errors** (already correct):
172-
- Pivots: StreamHub<IQuote> correctly uses ITestQuoteObserver only
172+
- Pivots: `StreamHub<IQuote>` correctly uses ITestQuoteObserver only
173173
- ForceIndex, Ultimate, Vwma: Architecturally correct (can provide but not observe chains)
174174

175175
Each fix included:
176+
176177
- Updated test class declaration to implement correct interfaces
177178
- Added corresponding test methods where needed (ChainObserver, ChainProvider)
178179
- Followed canonical patterns from `Ema.StreamHub.Tests.cs`

tests/indicators/_base/StreamHub.InterfaceCompliance.Tests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ public void AllStreamHubTests_ImplementCorrectInterfaces()
7575

7676
// Skip if we don't have expectations defined (not all indicators validated yet)
7777
if (!_expectations.ContainsKey(className))
78+
{
7879
continue;
80+
}
7981

8082
validated++;
8183
(Type _, Type[] expectedInterfaces) = _expectations[className];

tests/public-api/Convergence.BufferList.Tests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#nullable enable
2+
13
namespace Behavioral;
24

35
/// <summary>

tests/public-api/Convergence.StreamHub.Tests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ public void Adx()
3333
AdxHub hub = provider.ToAdxHub(lookback);
3434

3535
foreach (Quote q in qts)
36+
{
3637
provider.Add(q);
38+
}
3739

3840
AdxResult l = hub.Results[^1];
3941
Console.WriteLine($"ADX({lookback}) StreamHub on {l.Timestamp:d} with {qts.Count,4} streaming qts: {l.Adx:N8}");
@@ -67,7 +69,9 @@ public void Atr()
6769
AtrHub hub = provider.ToAtrHub(lookback);
6870

6971
foreach (Quote q in qts)
72+
{
7073
provider.Add(q);
74+
}
7175

7276
AtrResult l = hub.Results[^1];
7377
Console.WriteLine($"ATR({lookback}) StreamHub on {l.Timestamp:d} with {qts.Count,4} periods: {l.Atr:N8}");
@@ -101,7 +105,9 @@ public void Ema()
101105
EmaHub hub = provider.ToEmaHub(lookback);
102106

103107
foreach (Quote q in qts)
108+
{
104109
provider.Add(q);
110+
}
105111

106112
EmaResult l = hub.Results[^1];
107113
Console.WriteLine($"EMA({lookback}) StreamHub on {l.Timestamp:d} with {qts.Count,4} periods: {l.Ema:N8}");
@@ -135,7 +141,9 @@ public void Macd()
135141
MacdHub hub = provider.ToMacdHub(fast, slow, signal);
136142

137143
foreach (Quote q in qts)
144+
{
138145
provider.Add(q);
146+
}
139147

140148
MacdResult l = hub.Results[^1];
141149
Console.WriteLine($"MACD StreamHub on {l.Timestamp:d} with {qts.Count,4} periods: {l.Macd:N8}");
@@ -169,7 +177,9 @@ public void Rsi()
169177
RsiHub hub = provider.ToRsiHub(lookback);
170178

171179
foreach (Quote q in qts)
180+
{
172181
provider.Add(q);
182+
}
173183

174184
RsiResult l = hub.Results[^1];
175185
Console.WriteLine($"RSI({lookback}) StreamHub on {l.Timestamp:d} with {qts.Count,4} periods: {l.Rsi:N8}");
@@ -203,7 +213,9 @@ public void Sma()
203213
SmaHub hub = provider.ToSmaHub(lookback);
204214

205215
foreach (Quote q in qts)
216+
{
206217
provider.Add(q);
218+
}
207219

208220
SmaResult l = hub.Results[^1];
209221
Console.WriteLine($"SMA({lookback}) StreamHub on {l.Timestamp:d} with {qts.Count,4} periods: {l.Sma:N8}");
@@ -237,7 +249,9 @@ public void Stoch()
237249
StochHub hub = provider.ToStochHub(lookbackPeriods, signalPeriods, smoothPeriods);
238250

239251
foreach (Quote q in qts)
252+
{
240253
provider.Add(q);
254+
}
241255

242256
StochResult l = hub.Results[^1];
243257
Console.WriteLine($"STOCH StreamHub on {l.Timestamp:d} with {qts.Count,4} periods: {l.K:N8}");

0 commit comments

Comments
 (0)