diff --git a/X10D.Tests/src/Core/DoubleTests.cs b/X10D.Tests/src/Core/DoubleTests.cs index 0c4caf8..7190cfe 100644 --- a/X10D.Tests/src/Core/DoubleTests.cs +++ b/X10D.Tests/src/Core/DoubleTests.cs @@ -37,6 +37,10 @@ namespace X10D.Tests.Core { Assert.AreEqual(Math.PI, 180.0.DegreesToRadians()); Assert.AreEqual(Math.PI * 1.5, 270.0.DegreesToRadians()); + Assert.AreEqual(0.0, 0.0.DegreesToRadians()); + Assert.AreEqual(0.017453292519943295, 1.0.DegreesToRadians()); + Assert.AreEqual(0.10471975511965978, 6.0.DegreesToRadians()); + Assert.AreEqual(0.20943951023931956, 12.0.DegreesToRadians()); } /// @@ -78,6 +82,10 @@ namespace X10D.Tests.Core { Assert.AreEqual(180.0, Math.PI.RadiansToDegrees()); Assert.AreEqual(360.0, (2.0 * Math.PI).RadiansToDegrees()); + Assert.AreEqual(0.0, 0.0.RadiansToDegrees()); + Assert.AreEqual(1.0, 0.017453292519943295.RadiansToDegrees()); + Assert.AreEqual(6.000000000000001, 0.10471975511965978.RadiansToDegrees()); // rounding errors are fun + Assert.AreEqual(12.0, 0.20943951023931953.RadiansToDegrees()); } /// diff --git a/X10D.Tests/src/Core/SingleTests.cs b/X10D.Tests/src/Core/SingleTests.cs new file mode 100644 index 0000000..d562e94 --- /dev/null +++ b/X10D.Tests/src/Core/SingleTests.cs @@ -0,0 +1,29 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace X10D.Tests.Core; + +[TestClass] +public class SingleTests +{ + [TestMethod] + public void DegreesToRadians() + { + Assert.AreEqual(MathF.PI, 180.0f.DegreesToRadians()); + Assert.AreEqual(MathF.PI * 1.5f, 270.0f.DegreesToRadians()); + Assert.AreEqual(0.0f, 0.0f.DegreesToRadians()); + Assert.AreEqual(0.017453292f, 1.0f.DegreesToRadians()); + Assert.AreEqual(0.10471976f, 6.0f.DegreesToRadians()); + Assert.AreEqual(0.20943952f, 12.0f.DegreesToRadians()); + } + + [TestMethod] + public void RadiansToDegrees() + { + Assert.AreEqual(180.0f, MathF.PI.RadiansToDegrees()); + Assert.AreEqual(270.0f, (MathF.PI * 1.5f).RadiansToDegrees()); + Assert.AreEqual(0.0, 0.0f.RadiansToDegrees()); + Assert.AreEqual(0.99999994f, 0.017453292f.RadiansToDegrees()); // rounding errors are fun + Assert.AreEqual(6.0f, 0.10471976f.RadiansToDegrees()); + Assert.AreEqual(12.0f, 0.20943952f.RadiansToDegrees()); + } +}