mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
fixed naming in tests
This commit is contained in:
@@ -7,27 +7,27 @@
|
||||
#include <omath/engines/iw_engine/formulas.hpp>
|
||||
|
||||
|
||||
TEST(UnitTestIwEngine, ForwardVector)
|
||||
TEST(unit_test_iw_engine, ForwardVector)
|
||||
{
|
||||
const auto forward = omath::iw_engine::forward_vector({});
|
||||
|
||||
EXPECT_EQ(forward, omath::iw_engine::k_abs_forward);
|
||||
}
|
||||
|
||||
TEST(UnitTestIwEngine, RightVector)
|
||||
TEST(unit_test_iw_engine, RightVector)
|
||||
{
|
||||
const auto right = omath::iw_engine::right_vector({});
|
||||
|
||||
EXPECT_EQ(right, omath::iw_engine::k_abs_right);
|
||||
}
|
||||
|
||||
TEST(UnitTestIwEngine, UpVector)
|
||||
TEST(unit_test_iw_engine, UpVector)
|
||||
{
|
||||
const auto up = omath::iw_engine::up_vector({});
|
||||
EXPECT_EQ(up, omath::iw_engine::k_abs_up);
|
||||
}
|
||||
|
||||
TEST(UnitTestIwEngine, ForwardVectorRotationYaw)
|
||||
TEST(unit_test_iw_engine, ForwardVectorRotationYaw)
|
||||
{
|
||||
omath::iw_engine::ViewAngles angles;
|
||||
|
||||
@@ -39,7 +39,7 @@ TEST(UnitTestIwEngine, ForwardVectorRotationYaw)
|
||||
EXPECT_NEAR(forward.z, omath::iw_engine::k_abs_right.z, 0.00001f);
|
||||
}
|
||||
|
||||
TEST(UnitTestIwEngine, ForwardVectorRotationPitch)
|
||||
TEST(unit_test_iw_engine, ForwardVectorRotationPitch)
|
||||
{
|
||||
omath::iw_engine::ViewAngles angles;
|
||||
|
||||
@@ -51,7 +51,7 @@ TEST(UnitTestIwEngine, ForwardVectorRotationPitch)
|
||||
EXPECT_NEAR(forward.z, omath::iw_engine::k_abs_up.z, 0.01f);
|
||||
}
|
||||
|
||||
TEST(UnitTestIwEngine, ForwardVectorRotationRoll)
|
||||
TEST(unit_test_iw_engine, ForwardVectorRotationRoll)
|
||||
{
|
||||
omath::iw_engine::ViewAngles angles;
|
||||
|
||||
@@ -63,7 +63,7 @@ TEST(UnitTestIwEngine, ForwardVectorRotationRoll)
|
||||
EXPECT_NEAR(forward.z, omath::iw_engine::k_abs_right.z, 0.00001f);
|
||||
}
|
||||
|
||||
TEST(UnitTestIwEngine, ProjectTargetMovedFromCamera)
|
||||
TEST(unit_test_iw_engine, ProjectTargetMovedFromCamera)
|
||||
{
|
||||
constexpr auto fov = omath::projection::FieldOfView::from_degrees(90.f);
|
||||
const auto cam = omath::iw_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f);
|
||||
@@ -83,7 +83,7 @@ TEST(UnitTestIwEngine, ProjectTargetMovedFromCamera)
|
||||
}
|
||||
}
|
||||
|
||||
TEST(UnitTestIwEngine, CameraSetAndGetFov)
|
||||
TEST(unit_test_iw_engine, CameraSetAndGetFov)
|
||||
{
|
||||
constexpr auto fov = omath::projection::FieldOfView::from_degrees(90.f);
|
||||
auto cam = omath::iw_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f);
|
||||
@@ -94,7 +94,7 @@ TEST(UnitTestIwEngine, CameraSetAndGetFov)
|
||||
EXPECT_EQ(cam.get_field_of_view().as_degrees(), 50.f);
|
||||
}
|
||||
|
||||
TEST(UnitTestIwEngine, CameraSetAndGetOrigin)
|
||||
TEST(unit_test_iw_engine, CameraSetAndGetOrigin)
|
||||
{
|
||||
auto cam = omath::iw_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, {}, 0.01f, 1000.f);
|
||||
|
||||
|
||||
@@ -7,25 +7,25 @@
|
||||
#include <omath/engines/opengl_engine/formulas.hpp>
|
||||
|
||||
|
||||
TEST(UnitTestOpenGL, ForwardVector)
|
||||
TEST(unit_test_opengl, ForwardVector)
|
||||
{
|
||||
const auto forward = omath::opengl_engine::forward_vector({});
|
||||
EXPECT_EQ(forward, omath::opengl_engine::k_abs_forward);
|
||||
}
|
||||
|
||||
TEST(UnitTestOpenGL, RightVector)
|
||||
TEST(unit_test_opengl, RightVector)
|
||||
{
|
||||
const auto right = omath::opengl_engine::right_vector({});
|
||||
EXPECT_EQ(right, omath::opengl_engine::k_abs_right);
|
||||
}
|
||||
|
||||
TEST(UnitTestOpenGL, UpVector)
|
||||
TEST(unit_test_opengl, UpVector)
|
||||
{
|
||||
const auto up = omath::opengl_engine::up_vector({});
|
||||
EXPECT_EQ(up, omath::opengl_engine::k_abs_up);
|
||||
}
|
||||
|
||||
TEST(UnitTestOpenGL, ForwardVectorRotationYaw)
|
||||
TEST(unit_test_opengl, ForwardVectorRotationYaw)
|
||||
{
|
||||
omath::opengl_engine::ViewAngles angles;
|
||||
|
||||
@@ -39,7 +39,7 @@ TEST(UnitTestOpenGL, ForwardVectorRotationYaw)
|
||||
|
||||
|
||||
|
||||
TEST(UnitTestOpenGL, ForwardVectorRotationPitch)
|
||||
TEST(unit_test_opengl, ForwardVectorRotationPitch)
|
||||
{
|
||||
omath::opengl_engine::ViewAngles angles;
|
||||
|
||||
@@ -51,7 +51,7 @@ TEST(UnitTestOpenGL, ForwardVectorRotationPitch)
|
||||
EXPECT_NEAR(forward.z, omath::opengl_engine::k_abs_up.z, 0.00001f);
|
||||
}
|
||||
|
||||
TEST(UnitTestOpenGL, ForwardVectorRotationRoll)
|
||||
TEST(unit_test_opengl, ForwardVectorRotationRoll)
|
||||
{
|
||||
omath::opengl_engine::ViewAngles angles;
|
||||
|
||||
@@ -63,7 +63,7 @@ TEST(UnitTestOpenGL, ForwardVectorRotationRoll)
|
||||
EXPECT_NEAR(forward.z, omath::opengl_engine::k_abs_right.z, 0.00001f);
|
||||
}
|
||||
|
||||
TEST(UnitTestOpenGL, ProjectTargetMovedFromCamera)
|
||||
TEST(unit_test_opengl, ProjectTargetMovedFromCamera)
|
||||
{
|
||||
constexpr auto fov = omath::projection::FieldOfView::from_degrees(90.f);
|
||||
const auto cam = omath::opengl_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f);
|
||||
@@ -83,7 +83,7 @@ TEST(UnitTestOpenGL, ProjectTargetMovedFromCamera)
|
||||
}
|
||||
}
|
||||
|
||||
TEST(UnitTestOpenGL, CameraSetAndGetFov)
|
||||
TEST(unit_test_opengl, CameraSetAndGetFov)
|
||||
{
|
||||
constexpr auto fov = omath::projection::FieldOfView::from_degrees(90.f);
|
||||
auto cam = omath::opengl_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f);
|
||||
@@ -94,7 +94,7 @@ TEST(UnitTestOpenGL, CameraSetAndGetFov)
|
||||
EXPECT_EQ(cam.get_field_of_view().as_degrees(), 50.f);
|
||||
}
|
||||
|
||||
TEST(UnitTestOpenGL, CameraSetAndGetOrigin)
|
||||
TEST(unit_test_opengl, CameraSetAndGetOrigin)
|
||||
{
|
||||
auto cam = omath::opengl_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, {}, 0.01f, 1000.f);
|
||||
|
||||
|
||||
@@ -7,27 +7,27 @@
|
||||
#include <omath/engines/source_engine/formulas.hpp>
|
||||
|
||||
|
||||
TEST(UnitTestSourceEngine, ForwardVector)
|
||||
TEST(unit_test_source_engine, ForwardVector)
|
||||
{
|
||||
const auto forward = omath::source_engine::forward_vector({});
|
||||
|
||||
EXPECT_EQ(forward, omath::source_engine::k_abs_forward);
|
||||
}
|
||||
|
||||
TEST(UnitTestSourceEngine, RightVector)
|
||||
TEST(unit_test_source_engine, RightVector)
|
||||
{
|
||||
const auto right = omath::source_engine::right_vector({});
|
||||
|
||||
EXPECT_EQ(right, omath::source_engine::k_abs_right);
|
||||
}
|
||||
|
||||
TEST(UnitTestSourceEngine, UpVector)
|
||||
TEST(unit_test_source_engine, UpVector)
|
||||
{
|
||||
const auto up = omath::source_engine::up_vector({});
|
||||
EXPECT_EQ(up, omath::source_engine::k_abs_up);
|
||||
}
|
||||
|
||||
TEST(UnitTestSourceEngine, ForwardVectorRotationYaw)
|
||||
TEST(unit_test_source_engine, ForwardVectorRotationYaw)
|
||||
{
|
||||
omath::source_engine::ViewAngles angles;
|
||||
|
||||
@@ -39,7 +39,7 @@ TEST(UnitTestSourceEngine, ForwardVectorRotationYaw)
|
||||
EXPECT_NEAR(forward.z, omath::source_engine::k_abs_right.z, 0.00001f);
|
||||
}
|
||||
|
||||
TEST(UnitTestSourceEngine, ForwardVectorRotationPitch)
|
||||
TEST(unit_test_source_engine, ForwardVectorRotationPitch)
|
||||
{
|
||||
omath::source_engine::ViewAngles angles;
|
||||
|
||||
@@ -51,7 +51,7 @@ TEST(UnitTestSourceEngine, ForwardVectorRotationPitch)
|
||||
EXPECT_NEAR(forward.z, omath::source_engine::k_abs_up.z, 0.01f);
|
||||
}
|
||||
|
||||
TEST(UnitTestSourceEngine, ForwardVectorRotationRoll)
|
||||
TEST(unit_test_source_engine, ForwardVectorRotationRoll)
|
||||
{
|
||||
omath::source_engine::ViewAngles angles;
|
||||
|
||||
@@ -63,7 +63,7 @@ TEST(UnitTestSourceEngine, ForwardVectorRotationRoll)
|
||||
EXPECT_NEAR(forward.z, omath::source_engine::k_abs_right.z, 0.00001f);
|
||||
}
|
||||
|
||||
TEST(UnitTestSourceEngine, ProjectTargetMovedFromCamera)
|
||||
TEST(unit_test_source_engine, ProjectTargetMovedFromCamera)
|
||||
{
|
||||
constexpr auto fov = omath::projection::FieldOfView::from_degrees(90.f);
|
||||
const auto cam = omath::source_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f);
|
||||
@@ -83,7 +83,7 @@ TEST(UnitTestSourceEngine, ProjectTargetMovedFromCamera)
|
||||
}
|
||||
}
|
||||
|
||||
TEST(UnitTestSourceEngine, ProjectTargetMovedUp)
|
||||
TEST(unit_test_source_engine, ProjectTargetMovedUp)
|
||||
{
|
||||
constexpr auto fov = omath::projection::FieldOfView::from_degrees(90.f);
|
||||
const auto cam = omath::source_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f);
|
||||
@@ -103,7 +103,7 @@ TEST(UnitTestSourceEngine, ProjectTargetMovedUp)
|
||||
}
|
||||
}
|
||||
|
||||
TEST(UnitTestSourceEngine, CameraSetAndGetFov)
|
||||
TEST(unit_test_source_engine, CameraSetAndGetFov)
|
||||
{
|
||||
constexpr auto fov = omath::projection::FieldOfView::from_degrees(90.f);
|
||||
auto cam = omath::source_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f);
|
||||
@@ -114,7 +114,7 @@ TEST(UnitTestSourceEngine, CameraSetAndGetFov)
|
||||
EXPECT_EQ(cam.get_field_of_view().as_degrees(), 50.f);
|
||||
}
|
||||
|
||||
TEST(UnitTestSourceEngine, CameraSetAndGetOrigin)
|
||||
TEST(unit_test_source_engine, CameraSetAndGetOrigin)
|
||||
{
|
||||
auto cam = omath::source_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, {}, 0.01f, 1000.f);
|
||||
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
#include <omath/engines/unity_engine/formulas.hpp>
|
||||
#include <print>
|
||||
|
||||
TEST(UnitTestUnityEngine, ForwardVector)
|
||||
TEST(unit_test_unity_engine, ForwardVector)
|
||||
{
|
||||
const auto forward = omath::unity_engine::forward_vector({});
|
||||
|
||||
EXPECT_EQ(forward, omath::unity_engine::k_abs_forward);
|
||||
}
|
||||
|
||||
TEST(UnitTestUnityEngine, ForwardVectorRotationYaw)
|
||||
TEST(unit_test_unity_engine, ForwardVectorRotationYaw)
|
||||
{
|
||||
omath::unity_engine::ViewAngles angles;
|
||||
|
||||
@@ -26,7 +26,7 @@ TEST(UnitTestUnityEngine, ForwardVectorRotationYaw)
|
||||
EXPECT_NEAR(forward.z, omath::unity_engine::k_abs_right.z, 0.00001f);
|
||||
}
|
||||
|
||||
TEST(UnitTestUnityEngine, ForwardVectorRotationPitch)
|
||||
TEST(unit_test_unity_engine, ForwardVectorRotationPitch)
|
||||
{
|
||||
omath::unity_engine::ViewAngles angles;
|
||||
|
||||
@@ -38,7 +38,7 @@ TEST(UnitTestUnityEngine, ForwardVectorRotationPitch)
|
||||
EXPECT_NEAR(forward.z, omath::unity_engine::k_abs_up.z, 0.00001f);
|
||||
}
|
||||
|
||||
TEST(UnitTestUnityEngine, ForwardVectorRotationRoll)
|
||||
TEST(unit_test_unity_engine, ForwardVectorRotationRoll)
|
||||
{
|
||||
omath::unity_engine::ViewAngles angles;
|
||||
|
||||
@@ -50,20 +50,20 @@ TEST(UnitTestUnityEngine, ForwardVectorRotationRoll)
|
||||
EXPECT_NEAR(forward.z, omath::unity_engine::k_abs_right.z, 0.00001f);
|
||||
}
|
||||
|
||||
TEST(UnitTestUnityEngine, RightVector)
|
||||
TEST(unit_test_unity_engine, RightVector)
|
||||
{
|
||||
const auto right = omath::unity_engine::right_vector({});
|
||||
|
||||
EXPECT_EQ(right, omath::unity_engine::k_abs_right);
|
||||
}
|
||||
|
||||
TEST(UnitTestUnityEngine, UpVector)
|
||||
TEST(unit_test_unity_engine, UpVector)
|
||||
{
|
||||
const auto up = omath::unity_engine::up_vector({});
|
||||
EXPECT_EQ(up, omath::unity_engine::k_abs_up);
|
||||
}
|
||||
|
||||
TEST(UnitTestUnityEngine, ProjectTargetMovedFromCamera)
|
||||
TEST(unit_test_unity_engine, ProjectTargetMovedFromCamera)
|
||||
{
|
||||
constexpr auto fov = omath::projection::FieldOfView::from_degrees(60.f);
|
||||
const auto cam = omath::unity_engine::Camera({0, 0, 0}, {}, {1280.f, 720.f}, fov, 0.01f, 1000.f);
|
||||
@@ -82,7 +82,7 @@ TEST(UnitTestUnityEngine, ProjectTargetMovedFromCamera)
|
||||
EXPECT_NEAR(projected->y, 360, 0.00001f);
|
||||
}
|
||||
}
|
||||
TEST(UnitTestUnityEngine, Project)
|
||||
TEST(unit_test_unity_engine, Project)
|
||||
{
|
||||
constexpr auto fov = omath::projection::FieldOfView::from_degrees(60.f);
|
||||
|
||||
@@ -91,7 +91,7 @@ TEST(UnitTestUnityEngine, Project)
|
||||
std::println("{} {}", proj->x, proj->y);
|
||||
}
|
||||
|
||||
TEST(UnitTestUnityEngine, CameraSetAndGetFov)
|
||||
TEST(unit_test_unity_engine, CameraSetAndGetFov)
|
||||
{
|
||||
constexpr auto fov = omath::projection::FieldOfView::from_degrees(90.f);
|
||||
auto cam = omath::unity_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f);
|
||||
@@ -102,7 +102,7 @@ TEST(UnitTestUnityEngine, CameraSetAndGetFov)
|
||||
EXPECT_EQ(cam.get_field_of_view().as_degrees(), 50.f);
|
||||
}
|
||||
|
||||
TEST(UnitTestUnityEngine, CameraSetAndGetOrigin)
|
||||
TEST(unit_test_unity_engine, CameraSetAndGetOrigin)
|
||||
{
|
||||
auto cam = omath::unity_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, {}, 0.01f, 1000.f);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
using namespace omath;
|
||||
|
||||
class UnitTestColor : public ::testing::Test
|
||||
class unit_test_color : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
Color color1;
|
||||
@@ -21,7 +21,7 @@ protected:
|
||||
};
|
||||
|
||||
// Test constructors
|
||||
TEST_F(UnitTestColor, Constructor_Float)
|
||||
TEST_F(unit_test_color, Constructor_Float)
|
||||
{
|
||||
constexpr Color color(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
EXPECT_FLOAT_EQ(color.x, 0.5f);
|
||||
@@ -30,7 +30,7 @@ TEST_F(UnitTestColor, Constructor_Float)
|
||||
EXPECT_FLOAT_EQ(color.w, 1.0f);
|
||||
}
|
||||
|
||||
TEST_F(UnitTestColor, Constructor_Vector4)
|
||||
TEST_F(unit_test_color, Constructor_Vector4)
|
||||
{
|
||||
constexpr omath::Vector4 vec(0.2f, 0.4f, 0.6f, 0.8f);
|
||||
Color color(vec);
|
||||
@@ -41,7 +41,7 @@ TEST_F(UnitTestColor, Constructor_Vector4)
|
||||
}
|
||||
|
||||
// Test static methods for color creation
|
||||
TEST_F(UnitTestColor, FromRGBA)
|
||||
TEST_F(unit_test_color, FromRGBA)
|
||||
{
|
||||
constexpr Color color = Color::from_rgba(128, 64, 32, 255);
|
||||
EXPECT_FLOAT_EQ(color.x, 128.0f / 255.0f);
|
||||
@@ -50,7 +50,7 @@ TEST_F(UnitTestColor, FromRGBA)
|
||||
EXPECT_FLOAT_EQ(color.w, 1.0f);
|
||||
}
|
||||
|
||||
TEST_F(UnitTestColor, FromHSV)
|
||||
TEST_F(unit_test_color, FromHSV)
|
||||
{
|
||||
constexpr Color color = Color::from_hsv(0.0f, 1.0f, 1.0f); // Red in HSV
|
||||
EXPECT_FLOAT_EQ(color.x, 1.0f);
|
||||
@@ -60,7 +60,7 @@ TEST_F(UnitTestColor, FromHSV)
|
||||
}
|
||||
|
||||
// Test HSV conversion
|
||||
TEST_F(UnitTestColor, ToHSV)
|
||||
TEST_F(unit_test_color, ToHSV)
|
||||
{
|
||||
Hsv hsv = color1.to_hsv(); // Red color
|
||||
EXPECT_FLOAT_EQ(hsv.hue, 0.0f);
|
||||
@@ -69,7 +69,7 @@ TEST_F(UnitTestColor, ToHSV)
|
||||
}
|
||||
|
||||
// Test color blending
|
||||
TEST_F(UnitTestColor, Blend)
|
||||
TEST_F(unit_test_color, Blend)
|
||||
{
|
||||
Color blended = color1.blend(color2, 0.5f);
|
||||
EXPECT_FLOAT_EQ(blended.x, 0.5f);
|
||||
@@ -79,7 +79,7 @@ TEST_F(UnitTestColor, Blend)
|
||||
}
|
||||
|
||||
// Test predefined colors
|
||||
TEST_F(UnitTestColor, PredefinedColors)
|
||||
TEST_F(unit_test_color, PredefinedColors)
|
||||
{
|
||||
constexpr Color red = Color::red();
|
||||
constexpr Color green = Color::green();
|
||||
@@ -102,7 +102,7 @@ TEST_F(UnitTestColor, PredefinedColors)
|
||||
}
|
||||
|
||||
// Test non-member function: Blend for Vector3
|
||||
TEST_F(UnitTestColor, BlendVector3)
|
||||
TEST_F(unit_test_color, BlendVector3)
|
||||
{
|
||||
constexpr Color v1(1.0f, 0.0f, 0.0f, 1.f); // Red
|
||||
constexpr Color v2(0.0f, 1.0f, 0.0f, 1.f); // Green
|
||||
|
||||
@@ -31,10 +31,10 @@ namespace
|
||||
// -----------------------------------------------------------------------------
|
||||
// Fixture with one canonical right‑angled triangle in the XY plane.
|
||||
// -----------------------------------------------------------------------------
|
||||
class LineTracerFixture : public ::testing::Test
|
||||
class lline_tracer_fixture : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
LineTracerFixture() :
|
||||
lline_tracer_fixture() :
|
||||
triangle({0.f, 0.f, 0.f}, {1.f, 0.f, 0.f}, {0.f, 1.f, 0.f})
|
||||
{
|
||||
}
|
||||
@@ -51,7 +51,7 @@ namespace
|
||||
bool expected_clear; // true => segment does NOT hit the triangle
|
||||
};
|
||||
|
||||
class CanTraceLineParam : public LineTracerFixture,
|
||||
class CanTraceLineParam : public lline_tracer_fixture,
|
||||
public ::testing::WithParamInterface<TraceCase>
|
||||
{
|
||||
};
|
||||
@@ -79,7 +79,7 @@ namespace
|
||||
// -----------------------------------------------------------------------------
|
||||
// Validate that the reported hit point is correct for a genuine intersection.
|
||||
// -----------------------------------------------------------------------------
|
||||
TEST_F(LineTracerFixture, HitPointCorrect)
|
||||
TEST_F(lline_tracer_fixture, HitPointCorrect)
|
||||
{
|
||||
constexpr Ray ray{{0.3f, 0.3f, -1.f}, {0.3f, 0.3f, 1.f}};
|
||||
constexpr Vec3 expected{0.3f, 0.3f, 0.f};
|
||||
@@ -92,7 +92,7 @@ namespace
|
||||
// -----------------------------------------------------------------------------
|
||||
// Triangle far beyond the ray should not block.
|
||||
// -----------------------------------------------------------------------------
|
||||
TEST_F(LineTracerFixture, DistantTriangleClear)
|
||||
TEST_F(lline_tracer_fixture, DistantTriangleClear)
|
||||
{
|
||||
constexpr Ray short_ray{{0.f, 0.f, 0.f}, {0.f, 0.f, 1.f}};
|
||||
constexpr Triangle<Vec3> distant{{1000.f, 1000.f, 1000.f},
|
||||
@@ -102,7 +102,7 @@ namespace
|
||||
EXPECT_TRUE(LineTracer::can_trace_line(short_ray, distant));
|
||||
}
|
||||
|
||||
TEST(LineTracerTraceRayEdge, CantHit)
|
||||
TEST(unit_test_unity_engine, CantHit)
|
||||
{
|
||||
constexpr omath::Triangle<Vector3<float>> triangle{{2, 0, 0}, {2, 2, 0}, {2, 2, 2}};
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace
|
||||
|
||||
EXPECT_TRUE(omath::collision::LineTracer::can_trace_line(ray, triangle));
|
||||
}
|
||||
TEST(LineTracerTraceRayEdge, CanHit)
|
||||
TEST(unit_test_unity_engine, CanHit)
|
||||
{
|
||||
constexpr omath::Triangle<Vector3<float>> triangle{{2, 0, 0}, {2, 2, 0}, {2, 2, 2}};
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
using namespace omath;
|
||||
|
||||
class UnitTestMat : public ::testing::Test
|
||||
class unit_test_mat : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
Mat<2, 2> m1;
|
||||
@@ -19,7 +19,7 @@ protected:
|
||||
};
|
||||
|
||||
// Test constructors
|
||||
TEST_F(UnitTestMat, Constructor_Default)
|
||||
TEST_F(unit_test_mat, Constructor_Default)
|
||||
{
|
||||
Mat<3, 3> m;
|
||||
EXPECT_EQ(m.row_count(), 3);
|
||||
@@ -29,7 +29,7 @@ TEST_F(UnitTestMat, Constructor_Default)
|
||||
EXPECT_FLOAT_EQ(m.at(i, j), 0.0f);
|
||||
}
|
||||
|
||||
TEST_F(UnitTestMat, Constructor_InitializerList)
|
||||
TEST_F(unit_test_mat, Constructor_InitializerList)
|
||||
{
|
||||
constexpr Mat<2, 2> m{{1.0f, 2.0f}, {3.0f, 4.0f}};
|
||||
EXPECT_EQ(m.row_count(), 2);
|
||||
@@ -40,7 +40,7 @@ TEST_F(UnitTestMat, Constructor_InitializerList)
|
||||
EXPECT_FLOAT_EQ(m.at(1, 1), 4.0f);
|
||||
}
|
||||
|
||||
TEST_F(UnitTestMat, Operator_SquareBrackets)
|
||||
TEST_F(unit_test_mat, Operator_SquareBrackets)
|
||||
{
|
||||
EXPECT_EQ((m2[0, 0]), 1.0f);
|
||||
EXPECT_EQ((m2[0, 1]), 2.0f);
|
||||
@@ -48,7 +48,7 @@ TEST_F(UnitTestMat, Operator_SquareBrackets)
|
||||
EXPECT_EQ((m2[1, 1]), 4.0f);
|
||||
}
|
||||
|
||||
TEST_F(UnitTestMat, Constructor_Copy)
|
||||
TEST_F(unit_test_mat, Constructor_Copy)
|
||||
{
|
||||
Mat<2, 2> m3 = m2;
|
||||
EXPECT_EQ(m3.row_count(), m2.row_count());
|
||||
@@ -57,7 +57,7 @@ TEST_F(UnitTestMat, Constructor_Copy)
|
||||
EXPECT_FLOAT_EQ(m3.at(1, 1), m2.at(1, 1));
|
||||
}
|
||||
|
||||
TEST_F(UnitTestMat, Constructor_Move)
|
||||
TEST_F(unit_test_mat, Constructor_Move)
|
||||
{
|
||||
Mat<2, 2> m3 = std::move(m2);
|
||||
EXPECT_EQ(m3.row_count(), 2);
|
||||
@@ -68,7 +68,7 @@ TEST_F(UnitTestMat, Constructor_Move)
|
||||
}
|
||||
|
||||
// Test matrix operations
|
||||
TEST_F(UnitTestMat, Operator_Multiplication_Matrix)
|
||||
TEST_F(unit_test_mat, Operator_Multiplication_Matrix)
|
||||
{
|
||||
Mat<2, 2> m3 = m2 * m2;
|
||||
EXPECT_EQ(m3.row_count(), 2);
|
||||
@@ -79,14 +79,14 @@ TEST_F(UnitTestMat, Operator_Multiplication_Matrix)
|
||||
EXPECT_FLOAT_EQ(m3.at(1, 1), 22.0f);
|
||||
}
|
||||
|
||||
TEST_F(UnitTestMat, Operator_Multiplication_Scalar)
|
||||
TEST_F(unit_test_mat, Operator_Multiplication_Scalar)
|
||||
{
|
||||
Mat<2, 2> m3 = m2 * 2.0f;
|
||||
EXPECT_FLOAT_EQ(m3.at(0, 0), 2.0f);
|
||||
EXPECT_FLOAT_EQ(m3.at(1, 1), 8.0f);
|
||||
}
|
||||
|
||||
TEST_F(UnitTestMat, Operator_Division_Scalar)
|
||||
TEST_F(unit_test_mat, Operator_Division_Scalar)
|
||||
{
|
||||
Mat<2, 2> m3 = m2 / 2.0f;
|
||||
EXPECT_FLOAT_EQ(m3.at(0, 0), 0.5f);
|
||||
@@ -94,7 +94,7 @@ TEST_F(UnitTestMat, Operator_Division_Scalar)
|
||||
}
|
||||
|
||||
// Test matrix functions
|
||||
TEST_F(UnitTestMat, Transpose)
|
||||
TEST_F(unit_test_mat, Transpose)
|
||||
{
|
||||
Mat<2, 2> m3 = m2.transposed();
|
||||
EXPECT_FLOAT_EQ(m3.at(0, 0), m2.at(0, 0));
|
||||
@@ -103,19 +103,19 @@ TEST_F(UnitTestMat, Transpose)
|
||||
EXPECT_FLOAT_EQ(m3.at(1, 1), m2.at(1, 1));
|
||||
}
|
||||
|
||||
TEST_F(UnitTestMat, Determinant)
|
||||
TEST_F(unit_test_mat, Determinant)
|
||||
{
|
||||
const float det = m2.determinant();
|
||||
EXPECT_FLOAT_EQ(det, -2.0f);
|
||||
}
|
||||
|
||||
TEST_F(UnitTestMat, Sum)
|
||||
TEST_F(unit_test_mat, Sum)
|
||||
{
|
||||
const float sum = m2.sum();
|
||||
EXPECT_FLOAT_EQ(sum, 10.0f);
|
||||
}
|
||||
|
||||
TEST_F(UnitTestMat, Clear)
|
||||
TEST_F(unit_test_mat, Clear)
|
||||
{
|
||||
m2.clear();
|
||||
for (size_t i = 0; i < m2.row_count(); ++i)
|
||||
@@ -123,7 +123,7 @@ TEST_F(UnitTestMat, Clear)
|
||||
EXPECT_FLOAT_EQ(m2.at(i, j), 0.0f);
|
||||
}
|
||||
|
||||
TEST_F(UnitTestMat, ToString)
|
||||
TEST_F(unit_test_mat, ToString)
|
||||
{
|
||||
const std::string str = m2.to_string();
|
||||
EXPECT_FALSE(str.empty());
|
||||
@@ -131,7 +131,7 @@ TEST_F(UnitTestMat, ToString)
|
||||
}
|
||||
|
||||
// Test assignment operators
|
||||
TEST_F(UnitTestMat, AssignmentOperator_Copy)
|
||||
TEST_F(unit_test_mat, AssignmentOperator_Copy)
|
||||
{
|
||||
Mat<2, 2> m3;
|
||||
m3 = m2;
|
||||
@@ -140,7 +140,7 @@ TEST_F(UnitTestMat, AssignmentOperator_Copy)
|
||||
EXPECT_FLOAT_EQ(m3.at(0, 0), m2.at(0, 0));
|
||||
}
|
||||
|
||||
TEST_F(UnitTestMat, AssignmentOperator_Move)
|
||||
TEST_F(unit_test_mat, AssignmentOperator_Move)
|
||||
{
|
||||
Mat<2, 2> m3;
|
||||
m3 = std::move(m2);
|
||||
@@ -152,7 +152,7 @@ TEST_F(UnitTestMat, AssignmentOperator_Move)
|
||||
}
|
||||
|
||||
// Test static methods
|
||||
TEST_F(UnitTestMat, StaticMethod_ToScreenMat)
|
||||
TEST_F(unit_test_mat, StaticMethod_ToScreenMat)
|
||||
{
|
||||
Mat<4, 4> screenMat = Mat<4, 4>::to_screen_mat(800.0f, 600.0f);
|
||||
EXPECT_FLOAT_EQ(screenMat.at(0, 0), 400.0f);
|
||||
@@ -164,7 +164,7 @@ TEST_F(UnitTestMat, StaticMethod_ToScreenMat)
|
||||
|
||||
|
||||
// Test exception handling in At() method
|
||||
TEST_F(UnitTestMat, Method_At_OutOfRange)
|
||||
TEST_F(unit_test_mat, Method_At_OutOfRange)
|
||||
{
|
||||
#if !defined(NDEBUG) && defined(OMATH_SUPRESS_SAFETY_CHECKS)
|
||||
EXPECT_THROW(std::ignore = m2.At(2, 0), std::out_of_range);
|
||||
|
||||
Reference in New Issue
Block a user