//================================================================================================== /* ROTGEN - Runtime Overlay for Eigen Copyright : CODE RECKONS SPDX-License-Identifier: BSL-1.0 */ //================================================================================================== #include "unit/tests.hpp" #include template using column = rotgen::matrix; template using column_ref = rotgen::ref>; template using const_column_ref = rotgen::ref const>; template void process( column_ref v ) { v(0) = rotgen::sum(v); } auto process( column_ref<> v ) { auto sz = v.size(); switch(sz) { case 1 : process<1>(v); break; case 2 : process<2>(v); break; case 3 : process<3>(v); break; default: break; } return sz; } TTS_CASE("Reference of reference check") { auto v1 = rotgen::matrix::Ones(); auto v2 = rotgen::matrix::Random(); auto v3 = rotgen::matrix::Constant(6.66); auto sum1 = v1(0); auto sum2 = v2(0) + v2(1); auto sum3 = v3(0) + v3(1) + v3(2); TTS_EQUAL(process(v1), 1); TTS_EQUAL(process(v2), 2); TTS_EQUAL(process(v3), 3); TTS_EQUAL(v1[0], sum1); TTS_EQUAL(v2[0], sum2); TTS_EQUAL(v3[0], sum3); };