-
-
Notifications
You must be signed in to change notification settings - Fork 23
tests: add unit tests for matrix class increasing math utilities coverage #454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
||
// ========== INVERSE TESTS ========== | ||
|
||
TEST(MatrixTest, Inverse3x3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have inverse for 4x4 too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, i'm working on it ;)
EXPECT_NEAR(result(0, 1), 1.0f, EPSILON); // (0*0) + 1 - 0 = 1 | ||
EXPECT_NEAR(result(1, 1), 2.0f, EPSILON); // (1*2) + 1 - 1 = 2 | ||
} | ||
|
||
TEST(MatrixTest, ConstructionAndIndexingFloat) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be removed since there is not a comprehensive ParameterConstruction test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I remove the entire chainedOperations test ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohh @AmanMenda i meant just remove the ConstructionAndIndexingFloat
test
TEST(MatrixTest, MatrixMultiplication) | ||
{ | ||
Mat3f m1(1, 2, 3, 0, 1, 4, 5, 6, 0); | ||
Mat3f m2 = Identity<Mat3f>(); | ||
|
||
Mat3f result = m1 * m2; | ||
|
||
// Multiplying by identity should result in the original matrix | ||
for (size_t i = 0; i < 3; ++i) | ||
{ | ||
for (size_t j = 0; j < 3; ++j) | ||
{ | ||
EXPECT_NEAR(result(i, j), m1(i, j), EPSILON); | ||
} | ||
} | ||
|
||
// Test specific multiplication | ||
Mat3f a = Identity<Mat3f>(); | ||
Mat3f b(2, 0, 0, 0, 2, 0, 0, 0, 2); | ||
Mat3f product = a * b; | ||
|
||
EXPECT_NEAR(product(0, 0), 2.0f, EPSILON); | ||
EXPECT_NEAR(product(1, 1), 2.0f, EPSILON); | ||
EXPECT_NEAR(product(2, 2), 2.0f, EPSILON); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a Matrix-Vector Multiplication Testing
…nction; add the * operator support for mat4
Uh oh!
There was an error while loading. Please reload this page.