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

50
tests/CMakeLists.txt Normal file
View File

@@ -0,0 +1,50 @@
cmake_minimum_required(VERSION 3.15)
project(XCEngineTests)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# ============================================================
# Test Configuration
# ============================================================
option(ENABLE_COVERAGE "Enable code coverage" OFF)
option(ENABLE_BENCHMARK "Enable benchmark tests" OFF)
# ============================================================
# Dependencies
# ============================================================
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://gitee.com/mirrors/googletest.git
GIT_TAG v1.14.0
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
enable_testing()
# ============================================================
# Engine Library
# ============================================================
add_subdirectory(../engine engine)
# ============================================================
# Test Subdirectories
# ============================================================
add_subdirectory(math)
# ============================================================
# Test Summary
# ============================================================
add_custom_target(print_tests
COMMAND ${CMAKE_COMMAND} -E echo "===== XCEngine Test Suite ====="
COMMAND ${CMAKE_CTEST_COMMAND} -N
COMMENT "Available tests:"
)