//================================================================================================== /* ROTGEN - Runtime Overlay for Eigen Copyright : CODE RECKONS SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== #define TTS_MAIN #include #include "tts.hpp" template void test_zero(const MatrixType& matrix, std::size_t rows, std::size_t cols) { for(std::size_t r=0;r void test_constant(const MatrixType& matrix, std::size_t rows, std::size_t cols, double constant) { for(std::size_t r=0;r void test_random(const MatrixType& matrix, std::size_t rows, std::size_t cols) { for(std::size_t r=0;r void test_identity(const MatrixType& matrix, std::size_t rows, std::size_t cols) { for(std::size_t r=0;r::Zero(), 3, 4); test_zero(rotgen::matrix::Zero(), 1, 1); test_zero(rotgen::matrix::Zero(), 10, 10); test_zero(rotgen::matrix::Zero(3, 4), 3, 4); test_zero(rotgen::matrix::Zero(7, 5), 7, 5); test_zero(rotgen::matrix::Zero(9, 3), 9, 3); test_zero(rotgen::matrix::Zero(2, 3), 2, 3); }; TTS_CASE("Test constant") { test_constant(rotgen::matrix::Constant(5.12), 3, 8, 5.12); test_constant(rotgen::matrix::Constant(2.2), 1, 1, 2.2); test_constant(rotgen::matrix::Constant(13), 11, 12, 13); test_constant(rotgen::matrix::Constant(2, 7, 5.6), 2, 7, 5.6); test_constant(rotgen::matrix::Constant(2, 2, 2.0), 2, 2, 2.0); test_constant(rotgen::matrix::Constant(9, 3, 1.1), 9, 3, 1.1); test_constant(rotgen::matrix::Constant(5, 9, 42), 5, 9, 42); }; TTS_CASE("Test random") { test_random(rotgen::matrix::Random(), 2, 3); test_random(rotgen::matrix::Random(), 1, 1); test_random(rotgen::matrix::Random(), 11, 17); test_random(rotgen::matrix::Random(7, 3), 7, 3); test_random(rotgen::matrix::Random(2, 2), 2, 2); test_random(rotgen::matrix::Random(4, 3), 4, 3); test_random(rotgen::matrix::Random(5, 5), 5, 5); }; TTS_CASE("Test identity") { test_identity(rotgen::matrix::Identity(), 4, 5); test_identity(rotgen::matrix::Identity(), 1, 1); test_identity(rotgen::matrix::Identity(), 21, 3); test_identity(rotgen::matrix::Identity(2, 7), 2, 7); test_identity(rotgen::matrix::Identity(2, 2), 2, 2); test_identity(rotgen::matrix::Identity(3, 3), 3, 3); test_identity(rotgen::matrix::Identity(5, 11), 5, 11); };