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:
parent
484b9716db
commit
af7ca28707
3 changed files with 23 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue