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测试文档
This commit is contained in:
2026-03-13 18:43:14 +08:00
parent 5efa171050
commit 7c54a62f9e
41 changed files with 8530 additions and 1845 deletions

33
tests/math/CMakeLists.txt Normal file
View File

@@ -0,0 +1,33 @@
# ============================================================
# Math Library Tests
# ============================================================
set(MATH_TEST_SOURCES
test_vector.cpp
test_matrix.cpp
test_quaternion.cpp
test_geometry.cpp
)
add_executable(xcengine_math_tests ${MATH_TEST_SOURCES})
# Exclude all static runtime libraries to avoid conflicts
if(MSVC)
set_target_properties(xcengine_math_tests PROPERTIES
LINK_FLAGS "/NODEFAULTLIB:libcpmt.lib /NODEFAULTLIB:libcmt.lib"
)
endif()
target_link_libraries(xcengine_math_tests
PRIVATE
XCEngine
GTest::gtest
GTest::gtest_main
)
target_include_directories(xcengine_math_tests PRIVATE
${CMAKE_SOURCE_DIR}/engine/include
${CMAKE_SOURCE_DIR}/tests/fixtures
)
add_test(NAME MathTests COMMAND xcengine_math_tests)