Skip to content

Commit 401dafa

Browse files
CopilotDaveSkender
andauthored
feat: Ichimoku BufferList updates (#1720)
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: DaveSkender <[email protected]>
1 parent 0f1681c commit 401dafa

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

tests/indicators/e-k/Ichimoku/Ichimoku.BufferList.Tests.cs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace BufferLists;
22

33
[TestClass]
4-
public class Ichimoku : BufferListTestBase, ITestQuoteBufferList
4+
public class Ichimoku : BufferListTestBase, ITestQuoteBufferList, ITestCustomBufferListCache
55
{
66
private const int tenkanPeriods = 9;
77
private const int kijunPeriods = 26;
@@ -82,4 +82,31 @@ IReadOnlyList<IchimokuResult> expected
8282
sut.Should().HaveCount(maxListSize);
8383
sut.Should().BeEquivalentTo(expected, static options => options.WithStrictOrdering());
8484
}
85+
86+
[TestMethod]
87+
public void CustomBuffer_OverMaxListSize_AutoAdjustsListAndBuffers()
88+
{
89+
const int maxListSize = 150;
90+
const int quotesSize = 1000;
91+
92+
// Use a test data that exceeds all cache size thresholds
93+
List<Quote> quotes = LongishQuotes
94+
.Take(quotesSize)
95+
.ToList();
96+
97+
// Expected results after pruning (tail end)
98+
IReadOnlyList<IchimokuResult> expected = quotes
99+
.ToIchimoku(tenkanPeriods, kijunPeriods, senkouBPeriods, senkouOffset, chikouOffset)
100+
.Skip(quotesSize - maxListSize)
101+
.ToList();
102+
103+
// Generate buffer list
104+
IchimokuList sut = new(tenkanPeriods, kijunPeriods, senkouBPeriods, senkouOffset, chikouOffset, quotes) {
105+
MaxListSize = maxListSize
106+
};
107+
108+
// Verify expected results matching equivalent series values
109+
sut.Count.Should().Be(maxListSize);
110+
sut.Should().BeEquivalentTo(expected, static options => options.WithStrictOrdering());
111+
}
85112
}

0 commit comments

Comments
 (0)