chore: Update project files and configurations; enhance .gitignore, add Qodana and SonarScanner scripts, and improve test project references

This commit is contained in:
Miha Kralj
2025-12-03 09:27:29 -08:00
parent 1d145d0622
commit 4a0a8d6da2
28 changed files with 257 additions and 88 deletions
-4
View File
@@ -1,7 +1,3 @@
using System;
using System.Collections;
using Xunit;
using QuanTAlib;
namespace QuanTAlib.Tests;
+20 -4
View File
@@ -423,7 +423,7 @@ public sealed class RingBuffer : IEnumerable<double>
/// <summary>
/// High-performance enumerator for the RingBuffer.
/// </summary>
public struct Enumerator : IEnumerator<double>
public struct Enumerator : IEnumerator<double>, IEquatable<Enumerator>
{
private readonly RingBuffer _buffer;
private readonly int _start;
@@ -453,8 +453,8 @@ public sealed class RingBuffer : IEnumerable<double>
return true;
}
public double Current => _current;
object IEnumerator.Current => Current;
public readonly double Current => _current;
readonly object IEnumerator.Current => Current;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Reset()
@@ -463,6 +463,22 @@ public sealed class RingBuffer : IEnumerable<double>
_current = default;
}
public void Dispose() { }
public readonly void Dispose() { }
public readonly bool Equals(Enumerator other) =>
ReferenceEquals(_buffer, other._buffer) &&
_start == other._start &&
_count == other._count &&
_index == other._index &&
_current == other._current;
public override readonly bool Equals(object? obj) =>
obj is Enumerator other && Equals(other);
public override readonly int GetHashCode() =>
HashCode.Combine(RuntimeHelpers.GetHashCode(_buffer), _start, _count, _index, _current);
public static bool operator ==(Enumerator left, Enumerator right) => left.Equals(right);
public static bool operator !=(Enumerator left, Enumerator right) => !left.Equals(right);
}
}
+4 -5
View File
@@ -1,6 +1,3 @@
using System;
using Xunit;
using QuanTAlib;
namespace QuanTAlib.Tests;
@@ -550,11 +547,13 @@ public class SimdExtensionsTests
Assert.True(avg > 0);
Assert.True(min > 0);
Assert.True(max > min);
Assert.Equal(min, minAlt);
Assert.Equal(max, maxAlt);
Assert.True(variance > 0);
Assert.True(stdDev > 0);
Assert.True(sw.ElapsedMilliseconds < 10,
$"SIMD operations took {sw.ElapsedMilliseconds}ms, expected < 10ms");
Assert.True(sw.ElapsedMilliseconds < 50,
$"SIMD operations took {sw.ElapsedMilliseconds}ms, expected < 50ms");
}
[Fact]
-3
View File
@@ -1,6 +1,3 @@
using System;
using Xunit;
using QuanTAlib;
namespace QuanTAlib.Tests
{
-6
View File
@@ -1,9 +1,3 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using QuanTAlib;
namespace QuanTAlib.Tests
{
-6
View File
@@ -1,9 +1,3 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using QuanTAlib;
namespace QuanTAlib.Tests
{
-3
View File
@@ -1,6 +1,3 @@
using System;
using Xunit;
using QuanTAlib;
namespace QuanTAlib.Tests
{