Files
j3ml/tests/LinearAlgebra/AxisAngleTests.hpp
josh 51d51a9cc7
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Failing after 1m2s
Build Docs With Doxygen / Explore-Gitea-Actions (push) Successful in 26s
Add AxisAngle members and fill out more unit tests.
2025-03-03 23:33:03 -05:00

46 lines
1.2 KiB
C++

#include <jtest/jtest.hpp>
#include <jtest/Unit.hpp>
jtest::Unit AxisAngleUnit {"AxisAngle"};
namespace AxisAngleTests {
inline void Define() {
using namespace jtest;
AxisAngleUnit += Test("CtorFromQuaternion", [] {
AxisAngle expected_result({0.3860166, 0.4380138, 0.8118714}, 0.6742209);
Quaternion q(0.1276794, 0.1448781, 0.2685358, 0.9437144);
AxisAngle from_quaternion(q);
jtest::check(expected_result.Equals(from_quaternion));
});
AxisAngleUnit += Test("CtorFromMatrix3x3", [] {
Matrix3x3 m {
0.9811029, -0.1925617, 0.0188971,
0.1925617, 0.9622058, -0.1925617,
0.0188971, 0.1925617, 0.9811029 };
AxisAngle expected { {0.7071068, 0, 0.7071068}, 0.2758069};
AxisAngle from_matrix(m);
jtest::check(expected.Equals(from_matrix));
});
AxisAngleUnit += Test("ToQuaternion", [] {});
AxisAngleUnit += Test("ToMatrix3x3", [] {});
AxisAngleUnit += Test("Normalize", [] {});
AxisAngleUnit += Test("Inverse", [] {});
}
inline void Run() {
AxisAngleUnit.RunAll();
}
}