$ ./test <-- 默认执行, 没有参数 test.c:34: error: Failure in TEST(sample, ret_int_failed) expected <3> but was <4> difference starts at position 0 at: < 4 > ^ .. Errors (1 failures, 2 tests, 2 ran, 2 checks, 0 ignored, 0 filtered out, 1 ms) ================================================================================= $ ./test -c <-- -c 执行结果加上颜色 (成功绿色, 失败红色) test.c:34: error: Failure in TEST(sample, ret_int_failed) expected <3> but was <4> difference starts at position 0 at: < 4 > ^ .. Errors (1 failures, 2 tests, 2 ran, 2 checks, 0 ignored, 0 filtered out, 1 ms) <-- bash中显示红色 ================================================================================= $ ./test -v <-- -v 显示更为详细的信息 TEST(sample, ret_int_failed) test.c:34: error: Failure in TEST(sample, ret_int_failed) expected <3> but was <4> difference starts at position 0 at: < 4 > ^ - 1 ms TEST(sample, ret_int_success) - 0 ms Errors (1 failures, 2 tests, 2 ran, 2 checks, 0 ignored, 0 filtered out, 1 ms) ================================================================================= $ ./test -r 2 <-- -r 指定测试执行的次数, 这里把测试重复执行2遍 Test run 1 of 2 test.c:34: error: Failure in TEST(sample, ret_int_failed) expected <3> but was <4> difference starts at position 0 at: < 4 > ^ .. Errors (1 failures, 2 tests, 2 ran, 2 checks, 0 ignored, 0 filtered out, 0 ms) Test run 2 of 2 test.c:34: error: Failure in TEST(sample, ret_int_failed) expected <3> but was <4> difference starts at position 0 at: < 4 > ^ .. Errors (1 failures, 2 tests, 2 ran, 2 checks, 0 ignored, 0 filtered out, 1 ms) ================================================================================= $ ./test -g sample <-- -g 指定 TEST_GROUP, 本例其实只有一个 TEST_GROUP sample test.c:34: error: Failure in TEST(sample, ret_int_failed) expected <3> but was <4> difference starts at position 0 at: < 4 > ^ .. Errors (1 failures, 2 tests, 2 ran, 2 checks, 0 ignored, 0 filtered out, 1 ms) ================================================================================= $ ./test -n ret_int_success <-- -s 指定执行其中一个 TEST, 名称为 ret_int_success . OK (2 tests, 1 ran, 1 checks, 0 ignored, 1 filtered out, 0 ms) ================================================================================= $ ./test -v -n ret_int_success <-- 参数也可以搭配使用 TEST(sample, ret_int_success) - 0 ms OK (2 tests, 1 ran, 1 checks, 0 ignored, 1 filtered out, 0 ms) |