20260829 Redesign
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
#include "c_Test.h"
|
||||
#include "c_Compiler.h"
|
||||
|
||||
// Math/matrix.t.c
|
||||
#include "c_Test.h"
|
||||
|
||||
void heavy_calculation(void) {
|
||||
double sum = 0.0;
|
||||
for (int i = 0; i < 5000000; ++i) {
|
||||
sum += sin((double)i) * cos((double)i);
|
||||
}
|
||||
// 随便加一个没意义的断言防止被编译器完全优化掉
|
||||
C_ASSERT(sum != 12345.6, "密集数学计算检验");
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// 🛠️ 步骤 A: 编写独立的测试用例函数 (C_TEST_CASE)
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
C_TEST_CASE(test_quick_operations) {
|
||||
int a = 1, b = 1;
|
||||
C_ASSERT_INT_EQ(a, b, "极速操作验证");
|
||||
}
|
||||
|
||||
C_TEST_CASE(test_heavy_workload) {
|
||||
heavy_calculation();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// 🚀 步骤 B: 在主执行块中注册并依次运行它们
|
||||
// ------------------------------------------------------------------------------
|
||||
int main(int argc, char** argv) {
|
||||
C_TEST_SUITE_BEGIN(MathMatrixFunctionSuite)
|
||||
|
||||
C_RUN_TEST_CASE(test_quick_operations);
|
||||
C_RUN_TEST_CASE(test_heavy_workload);
|
||||
|
||||
C_TEST_SUITE_END()
|
||||
}
|
||||
Reference in New Issue
Block a user