rotgen/test/unit/matrix/norms.cpp
Jules Pénuchot 648dd768ee Adding clang-format configuration file and formatting all source files
Co-authored-by: Jules Pénuchot <jules@penuchot.com>
Co-authored-by: Joel FALCOU <jfalcou@codereckons.com>

See merge request oss/rotgen!41
2025-10-14 16:19:03 +02:00

39 lines
1.4 KiB
C++

//==================================================================================================
/*
ROTGEN - Runtime Overlay for Eigen
Copyright : CODE RECKONS
SPDX-License-Identifier: BSL-1.0
*/
//==================================================================================================
#include "unit/tests.hpp"
#include "unit/common/norms.hpp"
#include <rotgen/rotgen.hpp>
TTS_CASE_TPL("Test dynamic matrix norm operations",
rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
{
auto const cases = rotgen::tests::generate_matrix_references();
for (auto const& [rows, cols, fn] : cases)
{
rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, O::value> input(rows,
cols);
rotgen::tests::prepare(rows, cols, fn, input);
rotgen::tests::check_norms_functions(input);
}
};
TTS_CASE_TPL("Test static matrix norm operations",
rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
{
auto const cases = rotgen::tests::generate_static_matrix_references();
auto process = []<typename D>(D const& desc) {
rotgen::matrix<T, D::rows, D::cols, O::value> input;
rotgen::tests::prepare(input.rows(), input.cols(), desc.init_fn, input);
rotgen::tests::check_norms_functions(input);
};
std::apply([&](auto const&... d) { (process(d), ...); }, cases);
};