added sanity checks
.NET Test / .NET tests (push) Successful in 3m55s

This commit is contained in:
2026-09-18 14:10:24 +04:00
parent b5a8bd2580
commit 5797bf4884
44 changed files with 419 additions and 146 deletions
@@ -0,0 +1,29 @@
namespace Just.PreciseMath.Tests.SanityChecks;
public class DoubleDoubleDivisionChecks
{
public static IEnumerable<TheoryDataRow<DoubleDouble, DoubleDouble, DoubleDouble>> ReferenceCases =>
[
(new DoubleDouble(6.0), new DoubleDouble(2.0), new DoubleDouble(3.0)),
(new DoubleDouble(6.0), new DoubleDouble(3.0), new DoubleDouble(2.0)),
(new DoubleDouble(5.0), new DoubleDouble(2.0), new DoubleDouble(2.5)),
(new DoubleDouble(1.0), new DoubleDouble(4.0), new DoubleDouble(0.25)),
(new DoubleDouble(3.75), new DoubleDouble(1.25), new DoubleDouble(3.0)),
(new DoubleDouble(65536.0), new DoubleDouble(1024.0), new DoubleDouble(64.0)),
(DoubleDouble.Parse("812563124576179134546", System.Globalization.CultureInfo.InvariantCulture), new DoubleDouble(2.0), DoubleDouble.Parse("406281562288089567273", System.Globalization.CultureInfo.InvariantCulture)),
(DoubleDouble.Parse("812563124576179134546", System.Globalization.CultureInfo.InvariantCulture), new DoubleDouble(4.0), DoubleDouble.Parse("203140781144044783636.5", System.Globalization.CultureInfo.InvariantCulture)),
(DoubleDouble.Parse("812563124576179134546", System.Globalization.CultureInfo.InvariantCulture), new DoubleDouble(8.0), DoubleDouble.Parse("101570390572022391818.25", System.Globalization.CultureInfo.InvariantCulture)),
(DoubleDouble.Parse("812563124576179134546", System.Globalization.CultureInfo.InvariantCulture), DoubleDouble.Parse("812563124576179134546", System.Globalization.CultureInfo.InvariantCulture), new DoubleDouble(1.0)),
];
[Theory]
[MemberData(nameof(ReferenceCases))]
public void DivisionShouldProduceExpectedResults(DoubleDouble left, DoubleDouble right, DoubleDouble expected)
{
DoubleDouble result = left / right;
result.High.ShouldBe(expected.High);
result.Low.ShouldBe(expected.Low);
result.ShouldBe(expected);
}
}