46 lines
1.2 KiB
C++
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();
|
|
}
|
|
} |