1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Add ability to get min/max values for generic floating point

This commit is contained in:
Ron Zuckerman 2024-02-09 18:52:32 -06:00
parent 484b9716db
commit af7ca28707
No known key found for this signature in database
GPG key ID: 7EC17CB87028ABF8
3 changed files with 23 additions and 2 deletions

View file

@ -50,5 +50,20 @@ namespace Tests
FloatParseErrTest("6E+");
FloatParseErrTest("6e+");
}
public static void MinMaxTest<T>(T expectedMinValue, T expectedMaxValue)
where T : IMinMaxValue<T>
where int : operator T <=> T
{
Test.Assert(T.MinValue == expectedMinValue);
Test.Assert(T.MaxValue == expectedMaxValue);
}
[Test]
public static void TestMinMax()
{
MinMaxTest<float>(Float.MinValue, Float.MaxValue);
MinMaxTest<double>(Double.MinValue, Double.MaxValue);
}
}
}