Mercurial > hg > th-libs
comparison tests.c @ 276:56b0de9f9d44
Improve tests output per verbosity level.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 17 Feb 2016 17:24:02 +0200 |
parents | f875db8634b6 |
children | f0cb48b34463 886a42023415 |
comparison
equal
deleted
inserted
replaced
275:2799b2c3e64d | 276:56b0de9f9d44 |
---|---|
75 | 75 |
76 void test_result_msg_v(BOOL check, const char *fmt, va_list ap) | 76 void test_result_msg_v(BOOL check, const char *fmt, va_list ap) |
77 { | 77 { |
78 if (check) | 78 if (check) |
79 { | 79 { |
80 THPRINT(1, "%s: OK\n", test_str_header); | 80 THPRINT(2, "%s: OK\n", test_str_header); |
81 tests_passed++; | 81 tests_passed++; |
82 } | 82 } |
83 else | 83 else |
84 { | 84 { |
85 THPRINT(0, "%s: FAIL\n", test_str_header); | 85 THPRINT(0, "%s: FAIL\n", test_str_header); |
151 va_copy(tmp, ap); test_snprintf_do(1, fmt, tmp, "1"); | 151 va_copy(tmp, ap); test_snprintf_do(1, fmt, tmp, "1"); |
152 va_copy(tmp, ap); test_snprintf_do(2, fmt, tmp, "2"); | 152 va_copy(tmp, ap); test_snprintf_do(2, fmt, tmp, "2"); |
153 va_copy(tmp, ap); test_snprintf_do(16, fmt, tmp, "16"); | 153 va_copy(tmp, ap); test_snprintf_do(16, fmt, tmp, "16"); |
154 va_copy(tmp, ap); test_snprintf_do(SET_BUF_SIZE, fmt, tmp, "SET_BUF_SIZE"); | 154 va_copy(tmp, ap); test_snprintf_do(SET_BUF_SIZE, fmt, tmp, "SET_BUF_SIZE"); |
155 va_end(ap); | 155 va_end(ap); |
156 THPRINT(1, "----------------------------------------------\n"); | 156 THPRINT(2, "----------------------------------------------\n"); |
157 } | 157 } |
158 | 158 |
159 | 159 |
160 void tests_header(const char *str) | 160 void tests_header(const char *str) |
161 { | 161 { |
162 THPRINT(0, | 162 THPRINT(1, |
163 "======================================================\n" | 163 "======================================================\n" |
164 " Set #%d : %s tests\n" | 164 " Set #%d : %s tests\n" |
165 "======================================================\n", | 165 "======================================================\n", |
166 ++tests_set, | 166 ++tests_set, |
167 str); | 167 str); |
271 | 271 |
272 | 272 |
273 // | 273 // |
274 // Print summary and exit | 274 // Print summary and exit |
275 // | 275 // |
276 THPRINT(1, | |
277 "======================================================\n"); | |
278 | |
276 THPRINT(0, | 279 THPRINT(0, |
277 "======================================================\n" | |
278 "%d tests failed, %d passed (%d main tests), %d test sets.\n", | 280 "%d tests failed, %d passed (%d main tests), %d test sets.\n", |
279 tests_failed, tests_passed, tests_total, tests_set); | 281 tests_failed, tests_passed, tests_total, tests_set); |
280 | 282 |
281 return 0; | 283 return 0; |
282 } | 284 } |