]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Birdtest: bt_test_case() -> bt_test_suite()
authorPavel Tvrdík <pawel.tvrdik@gmail.cz>
Mon, 13 Apr 2015 08:42:10 +0000 (10:42 +0200)
committerPavel Tvrdík <pawel.tvrdik@gmail.cz>
Mon, 13 Apr 2015 08:42:10 +0000 (10:42 +0200)
lib/bitops_test.c
lib/buffer_test.c
lib/checksum_test.c
lib/event_test.c
lib/hash_test.c
lib/heap_test.c
lib/ip_test.c
lib/lists_test.c
lib/md5_test.c
test/birdtest.c
test/birdtest.h

index 3b58ae1d48f545a6fdaa5495c4ab929ac6eee526..563c1b2d6e59d0e1afce54292304033714ad12e9 100644 (file)
@@ -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;
 }
index 84d51fa1f35548174ebfbb032a159af4aedf39a9..0ee9f3b4782b0e54cb8922c0396c50fc4d3369d0 100644 (file)
@@ -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;
 }
index e5eb03ddb829ce78fbc6d74c301f788a5442a1bc..868529a65551e85b8cd81dccea5ad2c8993c6067 100644 (file)
@@ -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;
 }
index 6d6995382aeafd9990653e249d259b9a10758e78..53ffcd3517bca1d0add9ef51fc6265c150dcc029 100644 (file)
@@ -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;
 }
index 01d1c33f19406fbc0e26e8c62aaa39b060e1a13d..aacc6a7e3940179d88a3f39ab04d8cecbd1f475f 100644 (file)
@@ -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;
 }
index 30ccb313f24bef11b6a70567230c1927664000e8..83f6def1e4c43fb30769166078974739cd508f0d 100644 (file)
@@ -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;
 }
index f099552623323dd332ffc80230dd3d8fc64dd4df..1d97391fc6fe02747fe3e2c270f5aa2fd5ae9325 100644 (file)
@@ -18,7 +18,7 @@ build_ip4(u8 a, u8 b, u8 c, u8 d)
 }
 
 static u32
-ip4_pton_(chars)
+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;
 }
index 5a971b4e84681069ea06a49f0b0086ca1f7bcaf3..7818ddad0fc0145531eb5d998d9992d8361dad58 100644 (file)
@@ -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");
-
-  return 0;
+  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 bt_end();
 }
index daa2e9e9348ed3dbf9843f318403e21630efcc31..601c7e2a4b0e1648b8a3a5e2452f6c1e7922ab98 100644 (file)
@@ -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;
 }
index 3b9617cec198660e758449c306d22773c46c974e..18560aa18f1c6578effa583455400398a3906899 100644 (file)
@@ -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)
   {
index 8f9d8c14f52f6377b137cf396e74fdee0d8d18de..d88b112177537294a5e3e756046e5bf5f0489f42 100644 (file)
@@ -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__)