mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-24 13:38:05 +00:00
code reviews
This commit is contained in:
@@ -395,7 +395,7 @@ public class TBarTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TBar_WithInfinity_HandlesGracefully()
|
||||
public void TBar_WithPositiveInfinity_HandlesGracefully()
|
||||
{
|
||||
var bar = new TBar(12345, 100, double.PositiveInfinity, 90, 105, 1000);
|
||||
|
||||
@@ -404,6 +404,17 @@ public class TBarTests
|
||||
Assert.True(double.IsPositiveInfinity(bar.HL2)); // Uses High
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TBar_WithNegativeInfinity_HandlesGracefully()
|
||||
{
|
||||
var bar = new TBar(12345, 100, 110, double.NegativeInfinity, 105, 1000);
|
||||
|
||||
Assert.True(double.IsNegativeInfinity(bar.Low));
|
||||
Assert.True(double.IsNegativeInfinity(bar.L.Value));
|
||||
Assert.True(double.IsNegativeInfinity(bar.HL2)); // Uses Low
|
||||
Assert.True(double.IsNegativeInfinity(bar.HLC3)); // Uses Low
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TBar_WithMaxValue_HandlesGracefully()
|
||||
{
|
||||
@@ -412,8 +423,8 @@ public class TBarTests
|
||||
Assert.Equal(double.MaxValue, bar.Open);
|
||||
Assert.Equal(double.MaxValue, bar.High);
|
||||
Assert.Equal(double.MinValue, bar.Low);
|
||||
// HL2 calculation with extreme values
|
||||
Assert.True(double.IsFinite(bar.HL2) || double.IsInfinity(bar.HL2));
|
||||
// HL2 = (MaxValue + MinValue) * 0.5 = 0 (symmetric around zero)
|
||||
Assert.Equal(0.0, bar.HL2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -497,4 +508,4 @@ public class TBarTests
|
||||
// (90 + 120 + 60) / 3 = 270 / 3 = 90
|
||||
Assert.Equal(90.0, bar.OHL3);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user