mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-25 05:48:06 +00:00
Refactor documentation to remove "Zero-Allocation Design" sections across various trend indicators and implement a PowerShell script for automated cleanup
- Updated mathematical foundations and performance profiles where necessary to maintain clarity and coherence.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace QuanTAlib.Tests;
|
||||
|
||||
public class BesselValidationTests : IDisposable
|
||||
{
|
||||
private readonly ValidationTestData _testData;
|
||||
private readonly ITestOutputHelper _output;
|
||||
|
||||
public BesselValidationTests(ITestOutputHelper output)
|
||||
{
|
||||
_output = output;
|
||||
_testData = new ValidationTestData();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_testData.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_Internal_Span_Against_TSeries()
|
||||
{
|
||||
int[] lengths = { 5, 14, 20, 50 };
|
||||
|
||||
foreach (int length in lengths)
|
||||
{
|
||||
// QuanTAlib Bessel via TSeries API
|
||||
var (qResult, _) = Bessel.Calculate(_testData.Data, length);
|
||||
|
||||
// Same data via Span API
|
||||
var src = _testData.Data.Values.ToArray();
|
||||
var outSpan = new double[src.Length];
|
||||
Bessel.Calculate(src.AsSpan(), outSpan.AsSpan(), length);
|
||||
|
||||
// Verify last window for convergence and consistency
|
||||
ValidationHelper.VerifyData(qResult, outSpan, lookback: 0, skip: length, tolerance: 1e-9);
|
||||
}
|
||||
|
||||
_output.WriteLine("Bessel validated internally: Span vs TSeries are consistent.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user