# 06 测试与验证计划 文档状态:0.6.3 版整理稿 ## 1. 测试分层 | 层级 | 目标 | |---|---| | 单元测试 | 材料点、积分、形函数、线性代数、局部工具 | | 模块测试 | 数据库、单元刚度/内力、接触、restart、输出、求解器 | | 接口测试 | C ABI、CLI、输出目录和错误边界 | | 示例 smoke | 小型可运行模型,检查方向、量级和关键输出 | | benchmark | 带 checker 的紧凑工程验收 | | release gate | 当前版本发布前必须通过的组合测试 | ## 2. 当前 0.6.3 Release Gate ```powershell cmake --build build-codex-gcc --parallel ctest --test-dir build-codex-gcc -R "^(smoke|element_infrastructure|database_topology|element_stiffness|shell_internal|c_api)$" --output-on-failure ctest --test-dir build-codex-gcc -R "^source_size$" --output-on-failure ctest --test-dir build-codex-gcc -L v5_acceptance --output-on-failure git diff --check ``` 当前本地 0.6.3 证据: - 完整编译通过。 - 0.6.3 聚焦回归 6/6 通过。 - `source_size` 1/1 通过。 - examples 精简后,`v5_acceptance` 34/34 通过。 - `git diff --check` 通过。 ## 3. 0.6.3 聚焦覆盖 | 测试 | 覆盖内容 | |---|---| | `element_infrastructure` | Abaqus 风格名称、`S4R`/`C3D8R` 拓扑、积分描述符、Gauss-Lobatto/Newton-Cotes 规则 | | `database_topology` | `S4R`/`C3D8R` 数据库识别、Fortran 元素查询 API、B 矩阵查询 | | `element_stiffness` | `S4R`/`C3D8R` 刚度、刚体检查、hourglass 稳定性 | | `shell_internal` | `S4R` 内力、patch 行为和 hourglass 力一致性 | | `smoke` | `C3D8R` INP 读入、质量、线弹性内力和状态平均 | | `c_api` | C ABI 元素查询、调用者缓冲区、小缓冲区失败 | ## 4. V5 验收子集 `v5_acceptance` 标签保持对第五版核心能力的回归覆盖。当前 examples 已精简,难度较大的历史示例不再作为当前示例交付项。 当前默认回归重点包括: - Mohr-Coulomb 材料与强度折减模块测试。 - mortar/AL 接触、摩擦和接触报告。 - cohesive 模块测试。 - particle acceptance 和颗粒耦合模块测试。 - 小规模 `*BUCKLING` 子集。 - contact two-block、large sliding、shell-shell、shell-solid 示例或模块测试。 - CLI 静力、隐式、buckling 子集。 以下历史示例目录已从当前 examples 中移除,不再写入当前默认示例矩阵:`strengthReduction`、`mohr_coulomb_yield_surface`、`ball_adhesion_decohesion`、`Dynamic_Grain_Packing_of_a_Flexible_Container`、`buckling_corrugated_shell`、`roll_forming`、`two_arches`、`block_on_arch`、`blasting_rock`、`failure_prediction_in_a_layered_shell`、`golfBallImpact`、`nonlinear_harmonic`、`stress_dependent_elasticity`、`cylinder_roller_contact`、`euler_column_buckling`、`membrane_airbag_inflation`、`pinched_hemispherical_shell`、`spherical_cap_with_central_point_load`。 ## 5. Source Size 门禁 `source_size` 用于防止单文件和单过程持续膨胀: - 普通过程 review target 为 100 行。 - 过程 hard limit 为 128 行。 - 普通源文件 review target 为 1500 行。 - 源文件 hard limit 为 2000 行。 - 必要例外必须登记并保持 stale exception 检查可通过。 ## 6. 文档与产物检查 发布前必须确认: - README、核心文档、版本历史和 benchmark 矩阵与实际版本一致。 - `git diff --check` 无 whitespace error。 - 根目录和示例目录没有误提交大型 CSV、VTK、restart 或临时结果。 - 文档使用 UTF-8 without BOM 编码。 ## 7. 非默认长跑 以下属于后续或专项验证,不作为 0.6.3 默认 gate: - 完整 `uz=-6.2 m` 球冠后屈曲 PDF 曲线匹配。 - Mohr-Coulomb 临界失稳云图长跑。 - 大规模工业级接触收敛验证。 - DEM/FEM 大规模颗粒长算例。 - 生产级滚压成形流程。