diff --git a/test/basic/operators.cpp b/test/basic/operators.cpp index b3fb8f6..a3051ad 100644 --- a/test/basic/operators.cpp +++ b/test/basic/operators.cpp @@ -10,8 +10,7 @@ #include "tts.hpp" template -void test_matrix_scalar_multiplication(std::size_t rows, std::size_t cols, double scalar, - const std::function& init_fn) +void test_matrix_scalar_multiplication(std::size_t rows, std::size_t cols, double scalar, auto init_fn) { MatrixType a(rows, cols); MatrixType ref(rows, cols); @@ -33,8 +32,7 @@ void test_matrix_scalar_multiplication(std::size_t rows, std::size_t cols, doubl } template -void test_matrix_scalar_division(std::size_t rows, std::size_t cols, double scalar, - const std::function& init_fn) +void test_matrix_scalar_division(std::size_t rows, std::size_t cols, double scalar, auto init_fn) { MatrixType a(rows, cols); MatrixType ref(rows, cols); @@ -53,8 +51,8 @@ void test_matrix_scalar_division(std::size_t rows, std::size_t cols, double scal TTS_EQUAL(a, ref); } -template -void test_matrix_multiplication(std::size_t n, std::size_t m, std::size_t p, InitA&& a_init_fn, InitB&& b_init_fn) +template +void test_matrix_multiplication(std::size_t n, std::size_t m, std::size_t p, auto a_init_fn, auto b_init_fn) { MatrixType a(n, m); MatrixType b(m, p); @@ -81,8 +79,8 @@ void test_matrix_multiplication(std::size_t n, std::size_t m, std::size_t p, Ini TTS_EQUAL(a, ref); } -template -void test_matrix_addition(std::size_t rows, std::size_t cols, InitA&& a_init_fn, InitB&& b_init_fn) +template +void test_matrix_addition(std::size_t rows, std::size_t cols, auto a_init_fn, auto b_init_fn) { MatrixType a(rows, cols); MatrixType b(rows, cols); @@ -104,8 +102,8 @@ void test_matrix_addition(std::size_t rows, std::size_t cols, InitA&& a_init_fn, TTS_EQUAL(a, ref); } -template -void test_matrix_substraction(std::size_t rows, std::size_t cols, InitA&& a_init_fn, InitB&& b_init_fn) +template +void test_matrix_substraction(std::size_t rows, std::size_t cols, auto a_init_fn, auto b_init_fn) { MatrixType a(rows, cols); MatrixType b(rows, cols); @@ -252,14 +250,14 @@ TTS_CASE("Matrix addition with zero matrix") [](auto& mat, std::size_t r, std::size_t c) { mat(r, c) = 0; }); }; -TTS_CASE("Matrix substraction") +TTS_CASE("Matrix subtraction") { test_matrix_substraction>(3, 4, [](auto& mat, std::size_t r, std::size_t c) { mat(r, c) = 6.78*r - 5.2*c - 0.01; }, [](auto& mat, std::size_t r, std::size_t c) { mat(r, c) = 3.1*r + 33.456*c*c; }); }; -TTS_CASE("Matrix substraction with zero matrix") +TTS_CASE("Matrix subtraction with zero matrix") { test_matrix_substraction>(3, 4, [](auto& mat, std::size_t r, std::size_t c) { mat(r, c) = r + c*c*c*c - 56.6; },