Files
XCEngine/tests/fixtures/MathFixtures.h
ssdfasd 7c54a62f9e feat: 添加Math库和Google Test测试框架
- 新增Math库: Vector2/3/4, Matrix3/4, Quaternion, Transform, Color等
- 新增测试框架: Google Test (gtest)
- 新增140个单元测试,覆盖Vector, Matrix, Quaternion, Geometry
- VolumeRenderer支持vcpkg的NanoVDB
- 添加TESTING.md测试文档
2026-03-13 18:43:14 +08:00

41 lines
1.1 KiB
C++

#pragma once
#include <gtest/gtest.h>
#include <XCEngine/Math/Math.h>
namespace XCEngine {
namespace Math {
namespace Test {
constexpr float TEST_EPSILON = 1e-5f;
constexpr double TEST_EPSILON_D = 1e-8;
class MathTest : public ::testing::Test {
protected:
void SetUp() override {
v1 = Vector3(1.0f, 0.0f, 0.0f);
v2 = Vector3(0.0f, 1.0f, 0.0f);
v3 = Vector3(0.0f, 0.0f, 1.0f);
v4 = Vector3(1.0f, 1.0f, 1.0f);
vZero = Vector3::Zero();
vOne = Vector3::One();
mIdentity = Matrix4x4::Identity();
mTranslation = Matrix4x4::Translation(Vector3(1.0f, 2.0f, 3.0f));
mScale = Matrix4x4::Scale(Vector3(2.0f, 2.0f, 2.0f));
qIdentity = Quaternion::Identity();
qRotationX = Quaternion::FromAxisAngle(Vector3::Right(), Math::PI * 0.5f);
qRotationY = Quaternion::FromAxisAngle(Vector3::Up(), Math::PI * 0.5f);
}
Vector3 v1, v2, v3, v4;
Vector3 vZero, vOne;
Matrix4x4 mIdentity, mTranslation, mScale;
Quaternion qIdentity, qRotationX, qRotationY;
};
} // namespace Test
} // namespace Math
} // namespace XCEngine