1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-09 23:25:43 +00:00

Add Deg<->Rad tests

This commit is contained in:
Oliver Booth 2022-04-20 18:48:43 +01:00
parent 00571983c6
commit 778d8c6cf1
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
2 changed files with 37 additions and 0 deletions

View File

@ -37,6 +37,10 @@ namespace X10D.Tests.Core
{ {
Assert.AreEqual(Math.PI, 180.0.DegreesToRadians()); Assert.AreEqual(Math.PI, 180.0.DegreesToRadians());
Assert.AreEqual(Math.PI * 1.5, 270.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());
} }
/// <summary> /// <summary>
@ -78,6 +82,10 @@ namespace X10D.Tests.Core
{ {
Assert.AreEqual(180.0, Math.PI.RadiansToDegrees()); Assert.AreEqual(180.0, Math.PI.RadiansToDegrees());
Assert.AreEqual(360.0, (2.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());
} }
/// <summary> /// <summary>

View File

@ -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());
}
}