mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 15:03:27 +00:00
* added constexpr * fix * improved stuff * added const * improvement * fix * fix * patch
22 lines
546 B
C++
22 lines
546 B
C++
// Unit tests to exercise Mat extra branches
|
|
#include "gtest/gtest.h"
|
|
#include "omath/linear_algebra/mat.hpp"
|
|
|
|
using omath::Mat;
|
|
|
|
TEST(MatMore, InitListAndMultiply)
|
|
{
|
|
Mat<3,3,float> m{{{1.f,2.f,3.f}, {0.f,1.f,4.f}, {5.f,6.f,0.f}}};
|
|
// multiply by scalar and check element
|
|
auto r = m * 1.f;
|
|
EXPECT_EQ(r.at(0,0), m.at(0,0));
|
|
EXPECT_EQ(r.at(1,2), m.at(1,2));
|
|
}
|
|
|
|
TEST(MatMore, Determinant)
|
|
{
|
|
const Mat<2,2,double> m{{{1.0,2.0},{2.0,4.0}}}; // singular
|
|
const double det = m.determinant();
|
|
EXPECT_DOUBLE_EQ(det, 0.0);
|
|
}
|