28 |
28 |
29 #include "cx/common.h" |
29 #include "cx/common.h" |
30 #include "cx/test.h" |
30 #include "cx/test.h" |
31 |
31 |
32 CxTestSuite *cx_test_suite_testing_allocator(void); |
32 CxTestSuite *cx_test_suite_testing_allocator(void); |
|
33 CxTestSuite *cx_test_suite_szmul(void); |
|
34 CxTestSuite *cx_test_suite_allocator(void); |
33 CxTestSuite *cx_test_suite_utils(void); |
35 CxTestSuite *cx_test_suite_utils(void); |
34 CxTestSuite *cx_test_suite_compare(void); |
36 CxTestSuite *cx_test_suite_compare(void); |
35 CxTestSuite *cx_test_suite_hash_key(void); |
|
36 CxTestSuite *cx_test_suite_allocator(void); |
|
37 CxTestSuite *cx_test_suite_string(void); |
37 CxTestSuite *cx_test_suite_string(void); |
38 CxTestSuite *cx_test_suite_buffer(void); |
38 CxTestSuite *cx_test_suite_buffer(void); |
39 CxTestSuite *cx_test_suite_printf(void); |
39 CxTestSuite *cx_test_suite_hash_key(void); |
|
40 CxTestSuite *cx_test_suite_hash_map(void); |
40 CxTestSuite *cx_test_suite_iterator(void); |
41 CxTestSuite *cx_test_suite_iterator(void); |
41 CxTestSuite *cx_test_suite_empty_list(void); |
42 CxTestSuite *cx_test_suite_empty_list(void); |
42 CxTestSuite *cx_test_suite_array_list(void); |
43 CxTestSuite *cx_test_suite_array_list(void); |
|
44 CxTestSuite *cx_test_suite_array_list_defaulted_funcs(void); |
43 CxTestSuite *cx_test_suite_linked_list(void); |
45 CxTestSuite *cx_test_suite_linked_list(void); |
44 CxTestSuite *cx_test_suite_array_list_defaulted_funcs(void); |
|
45 CxTestSuite *cx_test_suite_linked_list_defaulted_funcs(void); |
46 CxTestSuite *cx_test_suite_linked_list_defaulted_funcs(void); |
46 CxTestSuite *cx_test_suite_tree_low_level(void); |
47 CxTestSuite *cx_test_suite_tree_low_level(void); |
47 CxTestSuite *cx_test_suite_tree_high_level(void); |
48 CxTestSuite *cx_test_suite_tree_high_level(void); |
48 CxTestSuite *cx_test_suite_mempool(void); |
|
49 CxTestSuite *cx_test_suite_hash_map(void); |
|
50 CxTestSuite *cx_test_suite_properties(void); |
49 CxTestSuite *cx_test_suite_properties(void); |
51 CxTestSuite *cx_test_suite_json(void); |
50 CxTestSuite *cx_test_suite_json(void); |
|
51 CxTestSuite *cx_test_suite_printf(void); |
|
52 CxTestSuite *cx_test_suite_mempool(void); |
52 |
53 |
53 #define run_tests(suite) cx_test_run_stdout(suite); success += (suite)->success; failure += (suite)->failure |
54 #define run_tests(suite) cx_test_run_stdout(suite); success += (suite)->success; failure += (suite)->failure |
54 #define execute_test_suites(...) unsigned success = 0, failure = 0; CxTestSuite* test_suites[] = {__VA_ARGS__}; \ |
55 #define execute_test_suites(...) unsigned success = 0, failure = 0; CxTestSuite* test_suites[] = {__VA_ARGS__}; \ |
55 for (size_t i = 0; i < cx_nmemb(test_suites) ; i++) {run_tests(test_suites[i]);} (void)0 |
56 for (size_t i = 0; i < cx_nmemb(test_suites) ; i++) {run_tests(test_suites[i]);} (void)0 |
56 #define free_test_suites for (size_t i = 0 ; i < cx_nmemb(test_suites) ; i++) {cx_test_suite_free(test_suites[i]);} (void)0 |
57 #define free_test_suites for (size_t i = 0 ; i < cx_nmemb(test_suites) ; i++) {cx_test_suite_free(test_suites[i]);} (void)0 |
58 int main(void) { |
59 int main(void) { |
59 printf("UCX Tests\n---------\n"); |
60 printf("UCX Tests\n---------\n"); |
60 |
61 |
61 execute_test_suites( |
62 execute_test_suites( |
62 cx_test_suite_testing_allocator(), |
63 cx_test_suite_testing_allocator(), |
|
64 cx_test_suite_szmul(), |
|
65 cx_test_suite_allocator(), |
63 cx_test_suite_utils(), |
66 cx_test_suite_utils(), |
64 cx_test_suite_compare(), |
67 cx_test_suite_compare(), |
65 cx_test_suite_hash_key(), |
|
66 cx_test_suite_allocator(), |
|
67 cx_test_suite_string(), |
68 cx_test_suite_string(), |
68 cx_test_suite_buffer(), |
69 cx_test_suite_buffer(), |
69 cx_test_suite_printf(), |
70 cx_test_suite_hash_key(), |
|
71 cx_test_suite_hash_map(), |
70 cx_test_suite_iterator(), |
72 cx_test_suite_iterator(), |
71 cx_test_suite_empty_list(), |
73 cx_test_suite_empty_list(), |
72 cx_test_suite_array_list(), |
74 cx_test_suite_array_list(), |
|
75 cx_test_suite_array_list_defaulted_funcs(), |
73 cx_test_suite_linked_list(), |
76 cx_test_suite_linked_list(), |
74 cx_test_suite_array_list_defaulted_funcs(), |
|
75 cx_test_suite_linked_list_defaulted_funcs(), |
77 cx_test_suite_linked_list_defaulted_funcs(), |
76 cx_test_suite_tree_low_level(), |
78 cx_test_suite_tree_low_level(), |
77 cx_test_suite_tree_high_level(), |
79 cx_test_suite_tree_high_level(), |
|
80 cx_test_suite_properties(), |
78 cx_test_suite_mempool(), |
81 cx_test_suite_mempool(), |
79 cx_test_suite_hash_map(), |
82 cx_test_suite_json(), |
80 cx_test_suite_properties(), |
83 cx_test_suite_printf() |
81 cx_test_suite_json() |
|
82 ); |
84 ); |
83 printf("=== OVERALL RESULT ===\n"); |
85 printf("=== OVERALL RESULT ===\n"); |
84 printf(" Total: %u\n Success: %u\n Failure: %u\n", |
86 printf(" Total: %u\n Success: %u\n Failure: %u\n", |
85 success + failure, success, failure); |
87 success + failure, success, failure); |
86 free_test_suites; |
88 free_test_suites; |