mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-13 16:18:05 +00:00
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat> Co-authored-by: Warp <agent@warp.dev>
38 lines
1012 B
C#
38 lines
1012 B
C#
using TALib;
|
|
|
|
namespace QuanTAlib.Tests;
|
|
|
|
public sealed class TrimaToleranceTests : IDisposable
|
|
{
|
|
private readonly ValidationTestData _testData;
|
|
|
|
public TrimaToleranceTests()
|
|
{
|
|
_testData = new ValidationTestData();
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
_testData.Dispose();
|
|
}
|
|
|
|
[Fact]
|
|
public void Check_Talib_Tolerance()
|
|
{
|
|
const int period = 20;
|
|
var trima = new Trima(period);
|
|
var qResult = trima.Update(_testData.Data);
|
|
|
|
double[] output = new double[_testData.RawData.Length];
|
|
var retCode = TALib.Functions.Trima<double>(_testData.RawData.Span, 0..^0, output, out var outRange, period);
|
|
Assert.Equal(Core.RetCode.Success, retCode);
|
|
|
|
int lookback = TALib.Functions.TrimaLookback(period);
|
|
|
|
ValidationHelper.VerifyData(qResult, output, outRange, lookback, tolerance: ValidationHelper.OoplesTolerance);
|
|
|
|
// Add explicit assertion to satisfy SonarQube
|
|
Assert.True(qResult.Count > 0);
|
|
}
|
|
}
|