mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-12 22:53:27 +00:00
* Coverage * added fixes * removed spacing * removed junk * removed print * removed coverage * removed useless stuff * fix --------- Co-authored-by: Saikari <lin@sz.cn.eu.org>
57 lines
1.4 KiB
C++
57 lines
1.4 KiB
C++
#include "omath/linear_algebra/triangle.hpp"
|
|
#include "omath/linear_algebra/vector3.hpp"
|
|
#include "omath/linear_algebra/vector4.hpp"
|
|
#include <gtest/gtest.h>
|
|
|
|
// This test file exercises the non-inlined helpers added to headers
|
|
// (Vector3, Triangle, Vector4) to encourage symbol emission and
|
|
// runtime execution so coverage tools can attribute hits back to the
|
|
// header lines.
|
|
|
|
using namespace omath;
|
|
|
|
TEST(LinearAlgebraHelpers, Vector3NoInlineHelpersExecute)
|
|
{
|
|
Vector3<float> a{1.f, 2.f, 3.f};
|
|
Vector3<float> b{4.f, 5.f, 6.f};
|
|
|
|
// Execute helpers that were made non-inlined
|
|
auto l = a.length();
|
|
auto ang = a.angle_between(b);
|
|
auto perp = a.is_perpendicular(b);
|
|
auto norm = a.normalized();
|
|
|
|
(void)l; (void)ang; (void)perp; (void)norm;
|
|
SUCCEED();
|
|
}
|
|
|
|
TEST(LinearAlgebraHelpers, TriangleNoInlineHelpersExecute)
|
|
{
|
|
Vector3<float> v1{0.f,0.f,0.f};
|
|
Vector3<float> v2{3.f,0.f,0.f};
|
|
Vector3<float> v3{3.f,4.f,0.f};
|
|
|
|
Triangle<Vector3<float>> t{v1, v2, v3};
|
|
|
|
auto n = t.calculate_normal();
|
|
auto a = t.side_a_length();
|
|
auto b = t.side_b_length();
|
|
auto h = t.hypot();
|
|
auto r = t.is_rectangular();
|
|
|
|
(void)n; (void)a; (void)b; (void)h; (void)r;
|
|
SUCCEED();
|
|
}
|
|
|
|
TEST(LinearAlgebraHelpers, Vector4NoInlineHelpersExecute)
|
|
{
|
|
Vector4<float> v{1.f,2.f,3.f,4.f};
|
|
|
|
auto l = v.length();
|
|
auto s = v.sum();
|
|
v.clamp(-10.f, 10.f);
|
|
|
|
(void)l; (void)s;
|
|
SUCCEED();
|
|
}
|