#include "TestHarness.h" #include TEST(matrix_identity, matrix) { matrix_t identity = matrix_identity(); CHECK(identity.rows[0].x == 1.0f); CHECK(identity.rows[0].y == 0.0f); CHECK(identity.rows[0].z == 0.0f); CHECK(identity.rows[1].x == 0.0f); CHECK(identity.rows[1].y == 1.0f); CHECK(identity.rows[1].z == 0.0f); CHECK(identity.rows[2].x == 0.0f); CHECK(identity.rows[2].y == 0.0f); CHECK(identity.rows[2].z == 1.0f); vector_t one_two_three = vector3(1.0f, 2.0f, 3.0f); vector_t one_two_three_again = matrix_vector_product(identity, one_two_three); CHECK(one_two_three_again.x == 1.0f); CHECK(one_two_three_again.y == 2.0f); CHECK(one_two_three_again.z == 3.0f); } TEST(matrix_scale, matrix) { matrix_t scale_by_three_two_one = matrix_scale(3.0f, 2.0f, 1.0f); vector_t one_two_three = vector3(1.0f, 2.0f, 3.0f); vector_t three_four_three = matrix_vector_product(scale_by_three_two_one, one_two_three); CHECK(three_four_three.x == 3.0f); CHECK(three_four_three.y == 4.0f); CHECK(three_four_three.z == 3.0f); }