mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-23 10:11:53 +00:00
Birdtest: bt_test_case() -> bt_test_suite()
This commit is contained in:
parent
8f5f52838e
commit
947018a7ef
@ -138,9 +138,9 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
bt_init(argc, argv);
|
bt_init(argc, argv);
|
||||||
|
|
||||||
bt_test_case(t_mkmask, "u32_mkmask()");
|
bt_test_suite(t_mkmask, "u32_mkmask()");
|
||||||
bt_test_case(t_masklen, "u32_masklen()");
|
bt_test_suite(t_masklen, "u32_masklen()");
|
||||||
bt_test_case(t_log2, "u32_log2()");
|
bt_test_suite(t_log2, "u32_log2()");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -145,10 +145,10 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
bt_init(argc, argv);
|
bt_init(argc, argv);
|
||||||
|
|
||||||
bt_test_case(t_buffer_push, "Pushing new elements");
|
bt_test_suite(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_suite(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_suite(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_flush, "Fill and flush all elements");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -91,8 +91,8 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
bt_init(argc, argv);
|
bt_init(argc, argv);
|
||||||
|
|
||||||
bt_test_case(t_calculate, "Checksum of pseudo-random data");
|
bt_test_suite(t_calculate, "Checksum of pseudo-random data");
|
||||||
bt_test_case(t_verify, "Verification of pseudo-random data.");
|
bt_test_suite(t_verify, "Verification of pseudo-random data.");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
bt_init(argc, 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -291,15 +291,15 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
bt_init(argc, argv);
|
bt_init(argc, argv);
|
||||||
|
|
||||||
bt_test_case(t_insert_find, "HASH_INSERT and HASH_FIND");
|
bt_test_suite(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_suite(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_suite(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_suite(t_walk, "HASH_WALK");
|
||||||
bt_test_case(t_walk_delsafe_delete, "HASH_WALK_DELSAFE and HASH_DELETE");
|
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_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_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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -175,11 +175,11 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
bt_init(argc, argv);
|
bt_init(argc, argv);
|
||||||
|
|
||||||
bt_test_case(t_heap_insert, "Inserting a descending sequence of numbers (the worst case)");
|
bt_test_suite(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_suite(t_heap_insert_random, "Inserting pseudo-random numbers");
|
||||||
bt_test_case(t_heap_increase_decrease, "Increasing/Decreasing");
|
bt_test_suite(t_heap_increase_decrease, "Increasing/Decreasing");
|
||||||
bt_test_case(t_heap_delete, "Deleting");
|
bt_test_suite(t_heap_delete, "Deleting");
|
||||||
bt_test_case(t_heap_0, "Is a heap[0] really unused?");
|
bt_test_suite(t_heap_0, "Is a heap[0] really unused?");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
bt_init(argc, 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -275,12 +275,12 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
bt_init(argc, argv);
|
bt_init(argc, argv);
|
||||||
|
|
||||||
bt_test_case(t_add_tail, "Adding nodes to tail of list");
|
bt_test_suite(t_add_tail, "Adding nodes to tail of list");
|
||||||
bt_test_case(t_add_head, "Adding nodes to head of list");
|
bt_test_suite(t_add_head, "Adding nodes to head of list");
|
||||||
bt_test_case(t_insert_node, "Inserting nodes to list");
|
bt_test_suite(t_insert_node, "Inserting nodes to list");
|
||||||
bt_test_case(t_remove_node, "Removing nodes from list");
|
bt_test_suite(t_remove_node, "Removing nodes from list");
|
||||||
bt_test_case(t_replace_node, "Replacing nodes in list");
|
bt_test_suite(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_list, "At the tail of a list adding the another list");
|
||||||
|
|
||||||
return 0;
|
return bt_end();
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
bt_init(argc, 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,6 @@ bt_init(int argc, char *argv[])
|
|||||||
if (optind != argc)
|
if (optind != argc)
|
||||||
goto usage;
|
goto usage;
|
||||||
|
|
||||||
|
|
||||||
if (do_core)
|
if (do_core)
|
||||||
{
|
{
|
||||||
struct rlimit rl = {RLIM_INFINITY, RLIM_INFINITY};
|
struct rlimit rl = {RLIM_INFINITY, RLIM_INFINITY};
|
||||||
@ -108,7 +107,7 @@ dump_stack(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
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)
|
if (list_tests)
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@ extern const char *bt_filename;
|
|||||||
extern const char *bt_test_id;
|
extern const char *bt_test_id;
|
||||||
|
|
||||||
void bt_init(int argc, char *argv[]);
|
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);
|
int bt_rand_num(void);
|
||||||
|
|
||||||
#define BT_SUCCESS 0
|
#define BT_SUCCESS 0
|
||||||
@ -32,8 +32,11 @@ int bt_rand_num(void);
|
|||||||
#define bt_test_case(fn,dsc) \
|
#define bt_test_case(fn,dsc) \
|
||||||
bt_test_case4(fn, dsc, BT_DEFAULT_FORKING, BT_DEFAULT_TIMEOUT)
|
bt_test_case4(fn, dsc, BT_DEFAULT_FORKING, BT_DEFAULT_TIMEOUT)
|
||||||
|
|
||||||
#define bt_test_case4(fn,dsc,f,t) \
|
#define bt_test_suite(fn,dsc) \
|
||||||
bt_test_case5(fn, #fn, dsc, f, t)
|
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, ...) \
|
#define bt_log(format, ...) \
|
||||||
fprintf(stderr, "%s: " format "\n", bt_filename, ##__VA_ARGS__)
|
fprintf(stderr, "%s: " format "\n", bt_filename, ##__VA_ARGS__)
|
||||||
|
Loading…
Reference in New Issue
Block a user