1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 20:58:34 +01:00
MLEM/Tests/NumberTests.cs

32 lines
892 B
C#
Raw Normal View History

2020-07-31 17:14:25 +02:00
using Microsoft.Xna.Framework;
using MLEM.Extensions;
using MonoGame.Extended;
using NUnit.Framework;
namespace Tests {
public class NumberTests {
[Test]
public void TestRounding() {
Assert.AreEqual(1.25F.Floor(), 1);
Assert.AreEqual(-1.25F.Floor(), -1);
Assert.AreEqual(1.25F.Ceil(), 2);
Assert.AreEqual(-1.25F.Ceil(), -2);
}
[Test]
public void TestEquals() {
Assert.IsTrue(0.25F.Equals(0.26F, 0.01F));
Assert.IsFalse(0.25F.Equals(0.26F, 0.009F));
}
[Test]
public void TestMatrixOps() {
var matrix = Matrix.CreateRotationX(2) * Matrix.CreateScale(2.5F);
Assert.AreEqual(matrix.Scale(), new Vector3(2.5F));
Assert.AreEqual(matrix.Rotation(), Quaternion.CreateFromAxisAngle(Vector3.UnitX, 2));
}
}
}