Added more operators + tests

This commit is contained in:
Joel Falcou 2025-05-12 11:33:38 +02:00
parent 5f1d070547
commit 682202825e
4 changed files with 68 additions and 10 deletions

31
test/basic/operators.cpp Normal file
View file

@ -0,0 +1,31 @@
//==================================================================================================
/*
ROTGEN - Runtime Overlay for Eigen
Copyright : CODE RECKONS
SPDX-License-Identifier: BSL-1.0
*/
//==================================================================================================
#define TTS_MAIN
#include <rotgen/matrix.hpp>
#include "tts.hpp"
TTS_CASE("Check operator*")
{
rotgen::matrix<double> a(2,2);
rotgen::matrix<double> ref(2,2);
for(int r=0;r<a.rows();r++)
{
for(int c=0;c<a.cols();c++)
{
a(r,c) = (1+c) + 10*(1+r);
ref(r,c) = ((1+c) + 10*(1+r)) * 10.5;
}
}
TTS_EQUAL(a * 10.5, ref);
TTS_EQUAL(10.5 * a, ref);
a *= 10.5;
TTS_EQUAL(a, ref);
};