1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-09 22:55:42 +00:00

Add Sqrt tests

This commit is contained in:
Oliver Booth 2022-04-21 12:20:19 +01:00
parent 4855ae8bf2
commit 9b9b75ae5b
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
2 changed files with 26 additions and 0 deletions

View File

@ -102,4 +102,17 @@ public class DoubleTests
Assert.AreEqual(5.0, 7.0.Round(5));
Assert.AreEqual(10.0, 7.5.Round(5));
}
[TestMethod]
public void Sqrt()
{
Assert.AreEqual(0.0, 0.0.Sqrt());
Assert.AreEqual(1.414213562373095, 2.0.Sqrt());
Assert.AreEqual(3.0, 9.0.Sqrt());
Assert.AreEqual(4.0, 16.0.Sqrt());
Assert.AreEqual(double.NaN, double.NaN.Sqrt());
Assert.AreEqual(double.NaN, (-1.0).Sqrt());
Assert.AreEqual(double.NaN, double.NegativeInfinity.Sqrt());
Assert.AreEqual(double.PositiveInfinity, double.PositiveInfinity.Sqrt());
}
}

View File

@ -26,4 +26,17 @@ public class SingleTests
Assert.AreEqual(6.0f, 0.10471976f.RadiansToDegrees());
Assert.AreEqual(12.0f, 0.20943952f.RadiansToDegrees());
}
[TestMethod]
public void Sqrt()
{
Assert.AreEqual(0.0f, 0.0f.Sqrt());
Assert.AreEqual(1.4142135f, 2.0f.Sqrt());
Assert.AreEqual(3.0f, 9.0f.Sqrt());
Assert.AreEqual(4.0f, 16.0f.Sqrt());
Assert.AreEqual(float.NaN, float.NaN.Sqrt());
Assert.AreEqual(float.NaN, (-1.0f).Sqrt());
Assert.AreEqual(float.NaN, float.NegativeInfinity.Sqrt());
Assert.AreEqual(float.PositiveInfinity, float.PositiveInfinity.Sqrt());
}
}