Got first real unit test passing

This commit is contained in:
2024-12-10 23:55:23 -05:00
parent c04ee29e82
commit 1fb211912d
4 changed files with 83 additions and 32 deletions

View File

@@ -6,17 +6,7 @@
// any other libraries
#include <array>
unsigned int Factorial(unsigned int number) {
return number <= 1 ? number : Factorial(number - 1) * number;
}
TEST_CASE("Factorials are computed", "[factorial]") {
REQUIRE(Factorial(1) == 1);
REQUIRE(Factorial(2) == 2);
REQUIRE(Factorial(3) == 6);
REQUIRE(Factorial(10) == 3628800);
}
#include <iostream>
TEST_CASE("Matrix Addition", "Matrix::Add") {
std::array<float, 4> arr1{1, 2, 3, 4};
@@ -24,6 +14,10 @@ TEST_CASE("Matrix Addition", "Matrix::Add") {
Matrix<2, 2> mat1{arr1};
Matrix<2, 2> mat2{arr2};
std::string strBuf1 = "";
mat1.ToString(strBuf1);
std::cout << strBuf1 << std::endl;
Matrix<2, 2> mat3{};
mat1.Add(mat2, mat3);