29 #include "cx/test.h" |
29 #include "cx/test.h" |
30 |
30 |
31 CxTestSuite *cx_test_suite_testing_allocator(void); |
31 CxTestSuite *cx_test_suite_testing_allocator(void); |
32 CxTestSuite *cx_test_suite_utils(void); |
32 CxTestSuite *cx_test_suite_utils(void); |
33 CxTestSuite *cx_test_suite_hash_key(void); |
33 CxTestSuite *cx_test_suite_hash_key(void); |
|
34 CxTestSuite *cx_test_suite_string(void); |
34 |
35 |
35 CxTestSuite *cx_test_suite_string(void); |
36 CxTestSuite *cx_test_suite_printf(void); |
36 |
37 |
37 #define run_tests(suite) cx_test_run_stdout(suite); success += (suite)->success; failure += (suite)->failure |
38 #define run_tests(suite) cx_test_run_stdout(suite); success += (suite)->success; failure += (suite)->failure |
38 #define execute_test_suites(...) unsigned success = 0, failure = 0; CxTestSuite* test_suites[] = {__VA_ARGS__}; \ |
39 #define execute_test_suites(...) unsigned success = 0, failure = 0; CxTestSuite* test_suites[] = {__VA_ARGS__}; \ |
39 for (size_t i = 0; i < sizeof(test_suites)/sizeof(void*) ; i++) {run_tests(test_suites[i]);} (void)0 |
40 for (size_t i = 0; i < sizeof(test_suites)/sizeof(void*) ; i++) {run_tests(test_suites[i]);} (void)0 |
40 #define free_test_suites for (size_t i = 0 ; i < sizeof(test_suites)/sizeof(void*) ; i++) {cx_test_suite_free(test_suites[i]);} (void)0 |
41 #define free_test_suites for (size_t i = 0 ; i < sizeof(test_suites)/sizeof(void*) ; i++) {cx_test_suite_free(test_suites[i]);} (void)0 |
44 |
45 |
45 execute_test_suites( |
46 execute_test_suites( |
46 cx_test_suite_testing_allocator(), |
47 cx_test_suite_testing_allocator(), |
47 cx_test_suite_utils(), |
48 cx_test_suite_utils(), |
48 cx_test_suite_hash_key(), |
49 cx_test_suite_hash_key(), |
49 cx_test_suite_string() |
50 cx_test_suite_string(), |
|
51 cx_test_suite_printf() |
50 ); |
52 ); |
51 printf("=== OVERALL RESULT ===\n"); |
53 printf("=== OVERALL RESULT ===\n"); |
52 printf(" Total: %u\n Success: %u\n Failure: %u\n", |
54 printf(" Total: %u\n Success: %u\n Failure: %u\n", |
53 success + failure, success, failure); |
55 success + failure, success, failure); |
54 free_test_suites; |
56 free_test_suites; |