diff --git a/lib/bitops_test.c b/lib/bitops_test.c index 3b58ae1d..563c1b2d 100644 --- a/lib/bitops_test.c +++ b/lib/bitops_test.c @@ -138,9 +138,9 @@ main(int argc, char *argv[]) { bt_init(argc, argv); - bt_test_case(t_mkmask, "u32_mkmask()"); - bt_test_case(t_masklen, "u32_masklen()"); - bt_test_case(t_log2, "u32_log2()"); + bt_test_suite(t_mkmask, "u32_mkmask()"); + bt_test_suite(t_masklen, "u32_masklen()"); + bt_test_suite(t_log2, "u32_log2()"); return 0; } diff --git a/lib/buffer_test.c b/lib/buffer_test.c index 84d51fa1..0ee9f3b4 100644 --- a/lib/buffer_test.c +++ b/lib/buffer_test.c @@ -145,10 +145,10 @@ main(int argc, char *argv[]) { bt_init(argc, argv); - bt_test_case(t_buffer_push, "Pushing new elements"); - bt_test_case(t_buffer_pop, "Fill whole buffer (PUSH), a half of elements POP and PUSH new elements"); - bt_test_case(t_buffer_resize, "Init a small buffer and try overfill"); - bt_test_case(t_buffer_flush, "Fill and flush all elements"); + bt_test_suite(t_buffer_push, "Pushing new elements"); + bt_test_suite(t_buffer_pop, "Fill whole buffer (PUSH), a half of elements POP and PUSH new elements"); + bt_test_suite(t_buffer_resize, "Init a small buffer and try overfill"); + bt_test_suite(t_buffer_flush, "Fill and flush all elements"); return 0; } diff --git a/lib/checksum_test.c b/lib/checksum_test.c index e5eb03dd..868529a6 100644 --- a/lib/checksum_test.c +++ b/lib/checksum_test.c @@ -91,8 +91,8 @@ main(int argc, char *argv[]) { bt_init(argc, argv); - bt_test_case(t_calculate, "Checksum of pseudo-random data"); - bt_test_case(t_verify, "Verification of pseudo-random data."); + bt_test_suite(t_calculate, "Checksum of pseudo-random data"); + bt_test_suite(t_verify, "Verification of pseudo-random data."); return 0; } diff --git a/lib/event_test.c b/lib/event_test.c index 6d699538..53ffcd35 100644 --- a/lib/event_test.c +++ b/lib/event_test.c @@ -70,7 +70,7 @@ main(int argc, char *argv[]) { bt_init(argc, argv); - bt_test_case(t_ev_run_list, "Schedule and run 3 events in right order."); + bt_test_suite(t_ev_run_list, "Schedule and run 3 events in right order."); return 0; } diff --git a/lib/hash_test.c b/lib/hash_test.c index 01d1c33f..aacc6a7e 100644 --- a/lib/hash_test.c +++ b/lib/hash_test.c @@ -291,15 +291,15 @@ main(int argc, char *argv[]) { bt_init(argc, argv); - bt_test_case(t_insert_find, "HASH_INSERT and HASH_FIND"); - bt_test_case(t_insert_find_random, "HASH_INSERT pseudo-random keys and HASH_FIND"); - bt_test_case(t_insert2_find, "HASH_INSERT2 and HASH_FIND. HASH_INSERT2 is HASH_INSERT and a smart auto-resize function"); - bt_test_case(t_walk, "HASH_WALK"); - bt_test_case(t_walk_delsafe_delete, "HASH_WALK_DELSAFE and HASH_DELETE"); + bt_test_suite(t_insert_find, "HASH_INSERT and HASH_FIND"); + bt_test_suite(t_insert_find_random, "HASH_INSERT pseudo-random keys and HASH_FIND"); + bt_test_suite(t_insert2_find, "HASH_INSERT2 and HASH_FIND. HASH_INSERT2 is HASH_INSERT and a smart auto-resize function"); + bt_test_suite(t_walk, "HASH_WALK"); + bt_test_suite(t_walk_delsafe_delete, "HASH_WALK_DELSAFE and HASH_DELETE"); //bt_test_case(t_walk_delsafe_delete2, "HASH_WALK_DELSAFE and HASH_DELETE2. HASH_DELETE2 is HASH_DELETE and smart auto-resize function"); - bt_test_case(t_walk_delsafe_remove, "HASH_WALK_DELSAFE and HASH_REMOVE"); + bt_test_suite(t_walk_delsafe_remove, "HASH_WALK_DELSAFE and HASH_REMOVE"); //bt_test_case(t_walk_delsafe_remove2, "HASH_WALK_DELSAFE and HASH_REMOVE2. HASH_REMOVE2 is HASH_REMOVE and smart auto-resize function"); - bt_test_case(t_walk_filter, "HASH_WALK_FILTER"); + bt_test_suite(t_walk_filter, "HASH_WALK_FILTER"); return 0; } diff --git a/lib/heap_test.c b/lib/heap_test.c index 30ccb313..83f6def1 100644 --- a/lib/heap_test.c +++ b/lib/heap_test.c @@ -175,11 +175,11 @@ main(int argc, char *argv[]) { bt_init(argc, argv); - bt_test_case(t_heap_insert, "Inserting a descending sequence of numbers (the worst case)"); - bt_test_case(t_heap_insert_random, "Inserting pseudo-random numbers"); - bt_test_case(t_heap_increase_decrease, "Increasing/Decreasing"); - bt_test_case(t_heap_delete, "Deleting"); - bt_test_case(t_heap_0, "Is a heap[0] really unused?"); + bt_test_suite(t_heap_insert, "Inserting a descending sequence of numbers (the worst case)"); + bt_test_suite(t_heap_insert_random, "Inserting pseudo-random numbers"); + bt_test_suite(t_heap_increase_decrease, "Increasing/Decreasing"); + bt_test_suite(t_heap_delete, "Deleting"); + bt_test_suite(t_heap_0, "Is a heap[0] really unused?"); return 0; } diff --git a/lib/ip_test.c b/lib/ip_test.c index f0995526..1d97391f 100644 --- a/lib/ip_test.c +++ b/lib/ip_test.c @@ -18,7 +18,7 @@ build_ip4(u8 a, u8 b, u8 c, u8 d) } static u32 -ip4_pton_(char* s) +ip4_pton_(char *s) { ip4_addr ip; ip4_pton(s,&ip); @@ -72,7 +72,7 @@ main(int argc, char *argv[]) { bt_init(argc, argv); - bt_test_case(t_ip4_pton, "Converting IPv4 string to IPv4 ip4_addr struct"); + bt_test_suite(t_ip4_pton, "Converting IPv4 string to ip4_addr struct"); return 0; } diff --git a/lib/lists_test.c b/lib/lists_test.c index 5a971b4e..7818ddad 100644 --- a/lib/lists_test.c +++ b/lib/lists_test.c @@ -275,12 +275,12 @@ main(int argc, char *argv[]) { bt_init(argc, argv); - bt_test_case(t_add_tail, "Adding nodes to tail of list"); - bt_test_case(t_add_head, "Adding nodes to head of list"); - bt_test_case(t_insert_node, "Inserting nodes to list"); - bt_test_case(t_remove_node, "Removing nodes from list"); - bt_test_case(t_replace_node, "Replacing nodes in list"); - bt_test_case(t_add_tail_list, "At the tail of a list adding the another list"); + bt_test_suite(t_add_tail, "Adding nodes to tail of list"); + bt_test_suite(t_add_head, "Adding nodes to head of list"); + bt_test_suite(t_insert_node, "Inserting nodes to list"); + bt_test_suite(t_remove_node, "Removing nodes from list"); + bt_test_suite(t_replace_node, "Replacing nodes in list"); + bt_test_suite(t_add_tail_list, "At the tail of a list adding the another list"); - return 0; + return bt_end(); } diff --git a/lib/md5_test.c b/lib/md5_test.c index daa2e9e9..601c7e2a 100644 --- a/lib/md5_test.c +++ b/lib/md5_test.c @@ -87,7 +87,7 @@ main(int argc, char *argv[]) { bt_init(argc, argv); - bt_test_case(t_md5, "Test Suite from RFC1321"); + bt_test_suite(t_md5, "Test Suite from RFC1321"); return 0; } diff --git a/test/birdtest.c b/test/birdtest.c index 3b9617ce..18560aa1 100644 --- a/test/birdtest.c +++ b/test/birdtest.c @@ -82,7 +82,6 @@ bt_init(int argc, char *argv[]) if (optind != argc) goto usage; - if (do_core) { struct rlimit rl = {RLIM_INFINITY, RLIM_INFINITY}; @@ -108,7 +107,7 @@ dump_stack(void) } void -bt_test_case5(int (*test_fn)(void), const char *test_id, const char *dsc, int forked, int timeout) +bt_test_suite5(int (*test_fn)(void), const char *test_id, const char *dsc, int forked, int timeout) { if (list_tests) { diff --git a/test/birdtest.h b/test/birdtest.h index 8f9d8c14..d88b1121 100644 --- a/test/birdtest.h +++ b/test/birdtest.h @@ -18,7 +18,7 @@ extern const char *bt_filename; extern const char *bt_test_id; void bt_init(int argc, char *argv[]); -void bt_test_case5(int (*fn)(void), const char *id, const char *dsc, int forked, int timeout); +void bt_test_suite5(int (*fn)(void), const char *id, const char *dsc, int forked, int timeout); int bt_rand_num(void); #define BT_SUCCESS 0 @@ -32,8 +32,11 @@ int bt_rand_num(void); #define bt_test_case(fn,dsc) \ bt_test_case4(fn, dsc, BT_DEFAULT_FORKING, BT_DEFAULT_TIMEOUT) -#define bt_test_case4(fn,dsc,f,t) \ - bt_test_case5(fn, #fn, dsc, f, t) +#define bt_test_suite(fn,dsc) \ + bt_test_suite4(fn, dsc, BT_DEFAULT_FORKING, BT_DEFAULT_TIMEOUT) + +#define bt_test_suite4(fn,dsc,f,t) \ + bt_test_suite5(fn, #fn, dsc, f, t) #define bt_log(format, ...) \ fprintf(stderr, "%s: " format "\n", bt_filename, ##__VA_ARGS__)