Skip to content

Commit

Permalink
Add unit test for Matrix transposition
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Mott committed Mar 22, 2021
1 parent 8d489b1 commit 30452b7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/math/Matrix4.cpp
Expand Up @@ -124,6 +124,26 @@ TEST(MathTest, MatrixEquality)
EXPECT_TRUE(m2 != Matrix4::getIdentity());
}

TEST(MathTest, MatrixTranspose)
{
Matrix4 m = Matrix4::byRows(1, 2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16);
Matrix4 mT = Matrix4::byRows(1, 5, 9, 13,
2, 6, 10, 14,
3, 7, 11, 15,
4, 8, 12, 16);

// Return transposed copy
EXPECT_EQ(m.getTransposed(), mT);

// Transpose in place
EXPECT_NE(m, mT);
m.transpose();
EXPECT_EQ(m, mT);
}

TEST(MathTest, ConvertDegreesAndRadians)
{
math::Degrees thirtyD(30);
Expand Down

0 comments on commit 30452b7

Please sign in to comment.