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,27 @@
namespace Just.PreciseMath.Tests.SanityChecks;
public class DoubleDoubleAdditionChecks
{
public static IEnumerable<TheoryDataRow<DoubleDouble, DoubleDouble, DoubleDouble>> ReferenceCases =>
[
(new DoubleDouble(1.0), new DoubleDouble(1.0), new DoubleDouble(2.0)),
(new DoubleDouble(1.0), new DoubleDouble(2.0), new DoubleDouble(3.0)),
(new DoubleDouble(1.25), new DoubleDouble(2.5), new DoubleDouble(3.75)),
(new DoubleDouble(65535.0), new DoubleDouble(1.0), new DoubleDouble(65536.0)),
(DoubleDouble.Parse("812563124576179134546", System.Globalization.CultureInfo.InvariantCulture), DoubleDouble.Parse("-812563124576179134504", System.Globalization.CultureInfo.InvariantCulture), new DoubleDouble(42.0)),
(DoubleDouble.Parse("812563124576179134546", System.Globalization.CultureInfo.InvariantCulture), new DoubleDouble(127.0), DoubleDouble.Parse("812563124576179134673", System.Globalization.CultureInfo.InvariantCulture)),
(DoubleDouble.Parse("812563124576179134546", System.Globalization.CultureInfo.InvariantCulture), new DoubleDouble(27.0), DoubleDouble.Parse("812563124576179134573", System.Globalization.CultureInfo.InvariantCulture)),
(DoubleDouble.Parse("812563124576179134546", System.Globalization.CultureInfo.InvariantCulture), new DoubleDouble(2.70), DoubleDouble.Parse("812563124576179134548.7", System.Globalization.CultureInfo.InvariantCulture)),
];
[Theory]
[MemberData(nameof(ReferenceCases))]
public void AdditionShouldProduceExpectedResults(DoubleDouble left, DoubleDouble right, DoubleDouble expected)
{
DoubleDouble result = left + right;
result.High.ShouldBe(expected.High);
result.Low.ShouldBe(expected.Low);
result.ShouldBe(expected);
}
}