parent
083ada097e
commit
8e80d1d083
34 changed files with 1171 additions and 416 deletions
50
test/integration/specifics.cpp
Normal file
50
test/integration/specifics.cpp
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
//==================================================================================================
|
||||
/*
|
||||
ROTGEN - Runtime Overlay for Eigen
|
||||
Copyright : CODE RECKONS
|
||||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
#include "unit/tests.hpp"
|
||||
|
||||
bool categorize_as_scalar(double)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool categorize_as_scalar(rotgen::ref<rotgen::matrix<double, 1, 1>>)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TTS_CASE("Matrix product of 1xN by Nx1 yields a scalar-convertible object")
|
||||
{
|
||||
rotgen::matrix<double, 1, 2> a = {1, 2};
|
||||
rotgen::matrix<double, 2, 1> b = {10, 20};
|
||||
|
||||
double n = a * b;
|
||||
|
||||
TTS_EQUAL(n, 50);
|
||||
TTS_EXPECT(categorize_as_scalar(a * b));
|
||||
};
|
||||
|
||||
TTS_CASE_TPL("Static 1x1 matrix-like objects can be assigned as-if",
|
||||
rotgen::tests::types)
|
||||
|
||||
<typename T, typename O>(tts::type<tts::types<T, O>>)
|
||||
{
|
||||
rotgen::matrix<T, 1, 2> a = {1, 2};
|
||||
rotgen::matrix<T, 2, 1> b = {10, 20};
|
||||
|
||||
rotgen::matrix<T, -1, -1, O::value> big(10, 10);
|
||||
auto bk = extract<1, 1>(big, 2, 2);
|
||||
bk = a * b;
|
||||
TTS_EQUAL(big(2, 2), 50);
|
||||
|
||||
rotgen::map<rotgen::matrix<T, 1, 1, O::value>> big_map(big.data(), 1, 1);
|
||||
|
||||
big_map = a * b;
|
||||
TTS_EQUAL(big(0, 0), 50);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue