docs: update TEST_SPEC.md and README.md to reflect new directory structure

- TEST_SPEC.md: Updated test directory structure to reflect Core/Asset,
  Core/IO, and Resources/<Type> subdirectories
- TEST_SPEC.md: Updated module names and test counts (852 total)
- TEST_SPEC.md: Updated build commands for new Resources subdirectories
- README.md: Updated engine structure with Core/Asset/ and Core/IO/
- README.md: Updated Resources section with layered architecture
- README.md: Updated test coverage table with accurate counts
This commit is contained in:
2026-03-24 16:14:05 +08:00
parent 0b3423966d
commit d575532966
153 changed files with 13975 additions and 6085 deletions

View File

@@ -16,12 +16,51 @@ tests/
├── CMakeLists.txt # 主 CMake 配置 (包含 enable_testing)
├── fixtures/ # 共享测试夹具
├── math/ # 数学库测试
├── core/ # 核心库测试
├── Core/ # 核心库测试
│ ├── CMakeLists.txt
│ ├── Asset/ # Core/Asset 模块测试
│ │ ├── CMakeLists.txt
│ │ ├── test_iresource.cpp
│ │ ├── test_resource_types.cpp
│ │ ├── test_resource_guid.cpp
│ │ ├── test_resource_handle.cpp
│ │ ├── test_resource_cache.cpp
│ │ └── test_resource_dependency.cpp
│ └── IO/ # Core/IO 模块测试
│ ├── CMakeLists.txt
│ ├── test_iresource_loader.cpp
│ ├── test_resource_path.cpp
│ ├── test_resource_filesystem.cpp
│ ├── test_file_archive.cpp
│ └── test_resource_package.cpp
├── containers/ # 容器测试
├── memory/ # 内存管理测试
├── threading/ # 线程测试
├── debug/ # 调试系统测试
├── resources/ # 资源系统测试
├── Resources/ # 资源系统测试 (按类型分目录)
│ ├── CMakeLists.txt
│ ├── Texture/ # 纹理资源测试
│ │ ├── CMakeLists.txt
│ │ ├── test_texture.cpp
│ │ ├── test_texture_loader.cpp
│ │ └── test_texture_import_settings.cpp
│ ├── Mesh/ # 网格资源测试
│ │ ├── CMakeLists.txt
│ │ ├── test_mesh.cpp
│ │ ├── test_mesh_loader.cpp
│ │ └── test_mesh_import_settings.cpp
│ ├── Material/ # 材质资源测试
│ │ ├── CMakeLists.txt
│ │ ├── test_material.cpp
│ │ └── test_material_loader.cpp
│ ├── Shader/ # 着色器资源测试
│ │ ├── CMakeLists.txt
│ │ ├── test_shader.cpp
│ │ └── test_shader_loader.cpp
│ └── AudioClip/ # 音频资源测试
│ ├── CMakeLists.txt
│ ├── test_audio_clip.cpp
│ └── test_audio_loader.cpp
├── input/ # 输入模块测试
├── scene/ # 场景测试
├── components/ # 组件测试
@@ -45,6 +84,8 @@ tests/
└── integration/ # OpenGL 集成测试
```
**注意**Windows 文件系统大小写不敏感,`tests/Core/``tests/core/` 为同一目录。实际文件位于 `tests/core/`(小写),但 CMakeLists.txt 中配置为 `tests/Core/`(大写)。
### 2.1 RHI 测试分层架构
RHI 测试分为三个层次,各层测试目标不同:
@@ -66,12 +107,16 @@ RHI 测试分为三个层次,各层测试目标不同:
| 模块 | 可执行文件 | CTest 名称前缀 |
|------|----------|---------------|
| math | math_tests | Math_* |
| core | core_tests | Core_* |
| Core | core_tests | Core_* |
| containers | containers_tests | Containers_* |
| memory | memory_tests | MemoryTest_* |
| threading | threading_tests | Threading_* |
| debug | debug_tests | Debug_* |
| resources | resources_tests | Resource*/Texture*/Mesh* 等 |
| Resources/Texture | resources_texture_tests | Texture_* |
| Resources/Mesh | resources_mesh_tests | Mesh_* |
| Resources/Material | resources_material_tests | Material_* |
| Resources/Shader | resources_shader_tests | Shader_* |
| Resources/AudioClip | resources_audioclip_tests | AudioClip_* |
| input | input_tests | Input*/WindowsInput* |
| scene | scene_tests | Scene*/SceneManager_* |
| components | components_tests | Component_*|TransformComponent_* |
@@ -321,21 +366,25 @@ jobs:
| 模块 | 构建时间 | 运行时间 | 测试数量 |
|------|---------|---------|---------|
| math | ~6s | ~26s | 140 |
| core | ~6s | ~4s | 18 |
| Core | ~6s | ~4s | 25 |
| containers | ~3s | ~10s | 51 |
| memory | ~3s | ~4s | 19 |
| threading | ~5s | ~4s | 13 |
| debug | ~3s | ~2s | 8 |
| components | ~3s | ~8s | 39 |
| scene | ~4s | ~2s | 14 |
| resources | ~4s | ~31s | 131 |
| Resources/Texture | ~4s | ~31s | 36 |
| Resources/Mesh | ~4s | ~31s | 29 |
| Resources/Material | ~4s | ~31s | 14 |
| Resources/Shader | ~4s | ~31s | 13 |
| Resources/AudioClip | ~4s | ~31s | 15 |
| input | ~4s | ~9s | 40 |
| RHI/unit (抽象层) | ~20s | ~60s | 138 (69×2后端) |
| D3D12 unit | ~3s | ~55s | 54 |
| OpenGL unit | ~46s | ~11s | 61 |
| **总计** | - | - | **~760** |
| **总计** | - | - | **852 (+1 disabled)** |
**注意**RHI/unit 抽象层测试数量为 69 个用例,每个用例同时在 D3D12 和 OpenGL 两个后端上执行,共 138 次测试运行。
**注意**RHI/unit 抽象层测试数量为 69 个用例,每个用例同时在 D3D12 和 OpenGL 两个后端上执行,共 138 次测试运行。Resources 模块测试已按类型拆分到独立子目录中。
### 9.2 分模块构建命令(推荐)
@@ -351,7 +400,11 @@ cmake --build . --target threading_tests --config Debug
cmake --build . --target debug_tests --config Debug
cmake --build . --target components_tests --config Debug
cmake --build . --target scene_tests --config Debug
cmake --build . --target resources_tests --config Debug
cmake --build . --target resources_texture_tests --config Debug
cmake --build . --target resources_mesh_tests --config Debug
cmake --build . --target resources_material_tests --config Debug
cmake --build . --target resources_shader_tests --config Debug
cmake --build . --target resources_audioclip_tests --config Debug
cmake --build . --target input_tests --config Debug
cmake --build . --target rhi_unit_tests --config Debug # RHI抽象层测试
cmake --build . --target rhi_d3d12_tests --config Debug
@@ -366,7 +419,7 @@ ctest -R "^Threading_" -C Debug --output-on-failure
ctest -R "^Debug_" -C Debug --output-on-failure
ctest -R "Component_Test|TransformComponent_" -C Debug --output-on-failure
ctest -R "^Scene_" -C Debug --output-on-failure
ctest -R "Resource[A-Z]|Texture[A-Z]|Mesh[A-Z]|Shader[A-Z]|Audio[A-Z]|Material[A-Z]" -C Debug --output-on-failure
ctest -R "Texture[A-Z]|Mesh[A-Z]|Shader[A-Z]|AudioClip[A-Z]|Material[A-Z]" -C Debug --output-on-failure
ctest -R "Input|WindowsInput" -C Debug --output-on-failure
ctest -R "^D3D12/|^OpenGL/" -C Debug --output-on-failure # RHI抽象层测试
ctest -R "D3D12TestFixture|SwapChainTestFixture" -C Debug --output-on-failure # D3D12后端测试
@@ -391,9 +444,13 @@ ctest -R "MemoryTest_|LinearAllocator|PoolAllocator|^Threading_|^Debug_" -C Debu
# ==================== 游戏引擎模块 ====================
cmake --build . --target components_tests --config Debug
cmake --build . --target scene_tests --config Debug
cmake --build . --target resources_tests --config Debug
cmake --build . --target resources_texture_tests --config Debug
cmake --build . --target resources_mesh_tests --config Debug
cmake --build . --target resources_material_tests --config Debug
cmake --build . --target resources_shader_tests --config Debug
cmake --build . --target resources_audioclip_tests --config Debug
cmake --build . --target input_tests --config Debug
ctest -R "Component_Test|TransformComponent_|^Scene_|Resource[A-Z]|Texture[A-Z]|Mesh[A-Z]|Input|WindowsInput" -C Debug --output-on-failure
ctest -R "Component_Test|TransformComponent_|^Scene_|Texture[A-Z]|Mesh[A-Z]|Shader[A-Z]|AudioClip[A-Z]|Material[A-Z]|Input|WindowsInput" -C Debug --output-on-failure
# ==================== RHI 模块 ====================
# RHI抽象层测试 (推荐优先测试同时验证D3D12和OpenGL)
@@ -417,7 +474,7 @@ ctest -R "OpenGLTestFixture" -C Debug --output-on-failure
---
**最后更新**: 2026-03-23
**最后更新**: 2026-03-24
---