Add UT for unary cwise
This commit is contained in:
parent
fbe54c9f2c
commit
1f8663aad2
4 changed files with 213 additions and 0 deletions
37
test/unit/matrix/cwise.cpp
Normal file
37
test/unit/matrix/cwise.cpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
//==================================================================================================
|
||||
/*
|
||||
ROTGEN - Runtime Overlay for Eigen
|
||||
Copyright : CODE RECKONS
|
||||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include "unit/common/cwise.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
TTS_CASE_TPL("Test dynamic matrix cwise operations", rotgen::tests::types)
|
||||
<typename T, typename O>( tts::type< tts::types<T,O>> )
|
||||
{
|
||||
auto const cases = rotgen::tests::generate_matrix_references();
|
||||
for (const auto& [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_cwise_functions(input);
|
||||
}
|
||||
};
|
||||
|
||||
TTS_CASE_TPL("Test static matrix cwise 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_cwise_functions(input);
|
||||
};
|
||||
|
||||
std::apply([&](auto const&... d) { (process(d),...);}, cases);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue