Files
sbox-public/engine/Sandbox.Test.Unit/Math/MatrixTest.cs
Lorenz Junglas 91f8fcf183 Speed up / parallelize tests (#3587)
- Added Sandbox.Test.Unit project (contains independent tests that can run in parallel) 
- Modify some slow/stress tests (e.g. instead of doing a million iterations settle for 10k).

Tests run almost twice as fast now.
2025-12-10 14:23:00 +01:00

40 lines
879 B
C#

namespace MathTest;
[TestClass]
public class MatrixTest
{
[TestMethod]
public void FromTransform()
{
var transform = new Transform(
new Vector3( 100, 420, 340 ),
Rotation.From( 90, 0, 45 ),
2.0f
);
var mat = Matrix.FromTransform( transform );
var expectedScale = Matrix.CreateScale( transform.Scale );
var expectedRotation = Matrix.CreateRotation( transform.Rotation );
var expectedTranslation = Matrix.CreateTranslation( transform.Position );
var expectedMatrix = expectedScale * expectedRotation * expectedTranslation;
Assert.AreEqual( mat, expectedMatrix );
}
[TestMethod]
public void ToTransform()
{
var transform = new Transform(
new Vector3( 100, 420, 340 ),
Rotation.From( 90, 0, 45 ),
2.0f
);
var mat = Matrix.FromTransform( transform );
var tx = mat.ExtractTransform();
Assert.AreEqual( transform, tx );
}
}