Started adding the first real unit test

This commit is contained in:
Quinn Henthorne
2024-12-10 17:06:07 -05:00
parent 1ef741ea93
commit 3233263ffc
2 changed files with 26 additions and 13 deletions

View File

@@ -13,4 +13,17 @@ TEST_CASE("Factorials are computed", "[factorial]") {
REQUIRE(Factorial(2) == 2);
REQUIRE(Factorial(3) == 6);
REQUIRE(Factorial(10) == 3628800);
}
TEST_CASE("Matrix Addition", "Matrix::Add") {
Matrix<2, 2> mat1{std::array<float, 4>{1, 2, 3, 4}};
Matrix<2, 2> mat2{std::array<float, 4>{5, 6, 7, 8}};
Matrix<2, 2> mat3{};
mat1.Add(mat2, mat3);
REQUIRE(mat3.Get(0, 0) == 6);
REQUIRE(mat3.Get(0, 1) == 8);
REQUIRE(mat3.Get(1, 0) == 10);
REQUIRE(mat3.Get(1, 1) == 12);
}