]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Birdtest: Replace BT_SUCCESS and BT_FAILURE with 1 and 0
authorPavel Tvrdik <pawel.tvrdik@gmail.com>
Fri, 11 Nov 2016 16:43:09 +0000 (17:43 +0100)
committerPavel Tvrdik <pawel.tvrdik@gmail.com>
Fri, 11 Nov 2016 16:43:09 +0000 (17:43 +0100)
20 files changed:
filter/filter_test.c
filter/tree_test.c
filter/trie_test.c
lib/bitops_test.c
lib/buffer_test.c
lib/checksum_test.c
lib/event_test.c
lib/fletcher16_test.c
lib/hash_test.c
lib/heap_test.c
lib/ip_test.c
lib/lists_test.c
lib/mac_test.c
lib/patmatch_test.c
lib/printf_test.c
lib/slist_test.c
nest/a-path_test.c
nest/a-set_test.c
test/birdtest.c
test/birdtest.h

index 693b1fe076d0af9c5f9300512ae0014f63c45f98..82efae0b433e649e8015b56a6481867cf3ad252a 100644 (file)
@@ -48,20 +48,20 @@ run_function(const void *parsed_fn_def)
   rfree(tmp);
 
   if (res.type == T_RETURN && res.val.i >= F_REJECT)
-    return BT_FAILURE;
+    return 0;
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static void
 bt_assert_filter(int result, struct f_inst *assert)
 {
-  int bt_suit_case_result = BT_SUCCESS;
+  int bt_suit_case_result = 1;
   if (!result)
   {
-    bt_result = BT_FAILURE;
-    bt_suite_result = BT_FAILURE;
-    bt_suit_case_result = BT_FAILURE;
+    bt_result = 0;
+    bt_suite_result = 0;
+    bt_suit_case_result = 0;
   }
 
   bt_log_suite_case_result(bt_suit_case_result, "Assertion at line %d (%s)", assert->lineno, (char *) assert->a2.p);
index abe955d0e45c426070a2169b655b8885a4a6af50..e224a559b610cec79b65fbe48215d015956c1b28 100644 (file)
@@ -174,7 +174,7 @@ t_balancing(void)
     bt_assert(same_tree(balanced_tree_from_simple, expected_balanced_tree));
   }
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 
@@ -205,7 +205,7 @@ t_balancing_random(void)
     }
   }
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -231,7 +231,7 @@ t_find(void)
     }
   }
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static uint
@@ -287,7 +287,7 @@ t_find_ranges(void)
     }
   }
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 int
index 3d7803357ae82c822fb55c296906e80c014a9d41..7529a5c5aa01d18df9e37c71a9a62b21e9374c83 100644 (file)
@@ -130,7 +130,7 @@ t_match_net(void)
   }
 
   bt_bird_cleanup();
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -170,7 +170,7 @@ t_trie_same(void)
     }
   }
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 int
index bd02fcccee48a476f327ea90d97d8821f7513d88..f816b9d1ef208fcccad5914510d240d92bce9572 100644 (file)
@@ -28,7 +28,7 @@ t_mkmask(void)
     bt_assert_msg(compute == expect, "u32_mkmask(%d) = 0x%08X, expected 0x%08X", i, compute, expect);
   }
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -78,7 +78,7 @@ t_masklen(void)
   for (i = 0; i <= MAX_NUM; i++)
     check_mask(bt_random());
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static void
@@ -107,7 +107,7 @@ t_log2(void)
   for (i = 1; i < MAX_NUM; i++)
     check_log2(((u32) bt_random()) % 0x0fffffff);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 int
index 38e540b7e17e2c3ee349f151a4c9511302bd0e66..55179e821727d8db78d333d62147fbff8e3925a7 100644 (file)
@@ -69,7 +69,7 @@ t_buffer_push(void)
     BUFFER_PUSH(buf) = expected[i];
   is_buffer_as_expected(&buf);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -97,7 +97,7 @@ t_buffer_pop(void)
     BUFFER_PUSH(buf) = expected[i];
   is_buffer_as_expected(&buf);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -114,7 +114,7 @@ t_buffer_resize(void)
   is_buffer_as_expected(&buf);
   bt_assert(buf.size >= MAX_NUM);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -130,7 +130,7 @@ t_buffer_flush(void)
   BUFFER_FLUSH(buf);
   bt_assert(buf.used == 0);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 int
index ae5a7f31ce7d54760e2892b6ff40470565602309..7e5658eb5965a4ddd775f410ccb29d3918c595c0 100644 (file)
@@ -60,7 +60,7 @@ t_calculate(void)
 
   bt_assert(sum_calculated == sum_expected);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -78,7 +78,7 @@ t_verify(void)
 
   bt_assert(ipsum_verify(a, sizeof(a), NULL));
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 
index 1997344db6a9567db0a02a34530ef26c4bc264dd..9217238964ccd36a125fb6c8033d936677630af3 100644 (file)
@@ -73,7 +73,7 @@ t_ev_run_list(void)
   for (i = 1; i < MAX_NUM; i++)
     bt_assert(event_check_points[i]);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 int
index 3e036900e653b8ddca4cad7d27d80b88c9cf6715..1020e6ecc8cac116dd45710ff7993f2e8641d694 100644 (file)
@@ -55,7 +55,7 @@ test_fletcher16(void *out_, const void *in_, const void *expected_out_)
   fletcher16_update(&ctxt, in, strlen(in));
   put_u16(out, fletcher16_compute(&ctxt));
 
-  return (*out == *expected_out) ? BT_SUCCESS : BT_FAILURE;
+  return *out == *expected_out;
 }
 
 static int
@@ -72,7 +72,7 @@ test_fletcher16_checksum(void *out_, const void *in_, const void *expected_out_)
   fletcher16_update(&ctxt, in, len);
   put_u16(out, fletcher16_final(&ctxt, len, len));
 
-  return (*out == *expected_out) ? BT_SUCCESS : BT_FAILURE;
+  return *out == *expected_out;
 }
 
 static int
index 07607f6ec6f2bb10fa7c0e375d2efd67482178b1..59beb7c0c70e4f44249c4a0a48d281d1e159dfac 100644 (file)
@@ -129,7 +129,7 @@ t_insert_find(void)
   fill_hash();
   validate_filled_hash();
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -148,7 +148,7 @@ t_insert_find_random(void)
 
   validate_filled_hash();
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -168,7 +168,7 @@ t_insert2_find(void)
 
   validate_filled_hash();
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -191,7 +191,7 @@ t_walk(void)
   for (i = 0; i < MAX_NUM; i++)
     bt_assert(check[i] == 1);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -208,7 +208,7 @@ t_walk_delsafe_delete(void)
 
   validate_empty_hash();
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -225,7 +225,7 @@ t_walk_delsafe_remove(void)
 
   validate_empty_hash();
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -242,7 +242,7 @@ t_walk_delsafe_delete2(void)
 
   validate_empty_hash();
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -259,7 +259,7 @@ t_walk_delsafe_remove2(void)
 
   validate_empty_hash();
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -283,7 +283,7 @@ t_walk_filter(void)
   for (i = 0; i < MAX_NUM; i++)
     bt_assert(check[i] == 1);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 int
index 40c9dd83373c315cb1460a8c37e0a3fe20870db3..c04a0450d152eda0dc84455f9076725a8fcc765d 100644 (file)
@@ -82,7 +82,7 @@ t_heap_insert(void)
     bt_assert(is_heap_valid(heap, num));
   }
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -110,7 +110,7 @@ t_heap_increase_decrease(void)
     bt_assert(is_heap_valid(heap, num));
   }
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -128,7 +128,7 @@ t_heap_delete(void)
     bt_assert(is_heap_valid(heap, num));
   }
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -139,7 +139,7 @@ t_heap_0(void)
   t_heap_increase_decrease();
   t_heap_delete();
 
-  return (heap[0] == SPECIAL_KEY) ? BT_SUCCESS : BT_FAILURE;
+  return heap[0] == SPECIAL_KEY;
 }
 
 static int
@@ -168,7 +168,7 @@ t_heap_insert_random(void)
        bt_abort_msg("Did not find a number %d in heap.", expected[i]);
       }
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 int
index 81b4897ea0e099952ecf0540ad98bbcd54c8989f..fd70c95792d813c2df54ad0f7111deb4d2018af5 100644 (file)
@@ -31,7 +31,7 @@ test_ipa_pton(void *out_, const void *in_, const void *expected_out_)
     /* ip_addr == ip6_addr */
   }
 
-  return ipa_equal(*out, *expected_out) ? BT_SUCCESS : BT_FAILURE;
+  return ipa_equal(*out, *expected_out);
 }
 
 static int
@@ -105,7 +105,7 @@ test_ipa_ntop(void *out_, const void *in_, const void *expected_out_)
     ip6_ntop(ipa_to_ip6(*in), out);
 
   int result = strncmp(out, expected_out, ipa_is_ip4(*in) ? IP4_MAX_TEXT_LENGTH : IP6_MAX_TEXT_LENGTH) == 0;
-  return result ? BT_SUCCESS : BT_FAILURE;
+  return result;
 }
 
 static int
index 56cc842720dae20f68c7119539922011fd0ffc7d..f26a88e22d2f177a4c752b30595632247984c05f 100644 (file)
@@ -111,7 +111,7 @@ t_add_tail(void)
   show_list();
   bt_assert(is_filled_list_well_linked());
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -135,7 +135,7 @@ t_add_head(void)
   show_list();
   bt_assert(is_filled_list_well_linked());
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static void
@@ -166,7 +166,7 @@ t_insert_node(void)
   bt_debug("\n");
   bt_assert(is_filled_list_well_linked());
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static void
@@ -218,7 +218,7 @@ t_remove_node(void)
     rem_node(&nodes[i]);
   bt_assert(is_empty_list_well_unlinked());
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -247,7 +247,7 @@ t_replace_node(void)
   bt_assert(tail.next == NODE &l.null);
   bt_assert(nodes[MAX_NUM-2].next == &tail);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -268,7 +268,7 @@ t_add_tail_list(void)
   bt_assert(nodes2[0].prev == &nodes[MAX_NUM-1]);
   bt_assert(l.tail == &nodes2[MAX_NUM-1]);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 int
index 8522f95e444d7bafa36e500b01671a57537fb01e..806fe3e46a69f12204eee7b32e25672cc2b76ec8 100644 (file)
@@ -28,7 +28,7 @@ test_##name(void *out_, const void *in_, const void *expected_out_)   \
   uint len = mac_type_length(id);                                      \
   bt_bytes_to_hex(out, out_bin, len);                                  \
                                                                        \
-  return strncmp(out, expected_out, 2*len+1) == 0 ? BT_SUCCESS : BT_FAILURE; \
+  return strncmp(out, expected_out, 2*len+1) == 0; \
 }
 
 define_test_hash_fn(md5,       ALG_MD5)
@@ -283,8 +283,8 @@ test_##name##_hmac(void *out_, const void *in_, const void *expected_out_)  \
                                                                        \
   uint len = mac_type_length(id);                                      \
   bt_bytes_to_hex(out, out_bin, len);                                  \
-                                                                       \
-  return strncmp(out, expected_out, 2*len+1) == 0 ? BT_SUCCESS : BT_FAILURE; \
+                                                                       \
+  return strncmp(out, expected_out, 2*len+1) == 0; \
 }
 
 define_test_hmac_fn(md5,       ALG_HMAC_MD5)
@@ -1092,7 +1092,7 @@ t_sha256_concating(void)
   int are_hash_a_b_equal = (strncmp(hash_a, hash_b, sizeof(hash_a)) == 0);
   bt_assert_msg(are_hash_a_b_equal, "Hashes A: %s, B: %s should be same", hash_a, hash_b);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 
@@ -1130,7 +1130,7 @@ t_sha512_concating(void)
   int are_hash_a_b_equal = (strncmp(hash_a, hash_b, sizeof(hash_a)) == 0);
   bt_assert_msg(are_hash_a_b_equal, "Hashes A: %s, B: %s should be same", hash_a, hash_b);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 int
index b2b4cb924db0747cb62e86a536babc69f53ca221..d65f316f701236dbb8b0ed0232257a1dcdc00e2c 100644 (file)
@@ -28,7 +28,7 @@ test_matching(void *out_, const void *in_, const void *expected_out_)
 
   *out = patmatch(in->pattern, in->data);
 
-  return (*out == *expected_out) ? BT_SUCCESS : BT_FAILURE;
+  return *out == *expected_out;
 }
 
 static void
index 9763b7b1009b9e22d8a40e0e20c123d2a1352188..3981d3dac8fc0f667b516e5e4230f70cfe4c7047 100644 (file)
@@ -56,7 +56,7 @@ t_simple(void)
   BSPRINTF(2, "-1", buf, "%d", -1);
   BSPRINTF(11, "-2147483648", buf, "%d", -2147483648);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 int
index fd0b1ca6ce59d9dd4759b3464845e8abbd38006a..069e361c6bafffeccf019807a389131996f33143 100644 (file)
@@ -103,7 +103,7 @@ t_add_tail(void)
 
   bt_assert(is_filled_list_well_linked());
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -127,7 +127,7 @@ t_add_head(void)
 
   bt_assert(is_filled_list_well_linked());
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static void
@@ -158,7 +158,7 @@ t_insert_node(void)
   bt_debug("\n");
   bt_assert(is_filled_list_well_linked());
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static void
@@ -211,7 +211,7 @@ t_remove_node(void)
     s_rem_node(&nodes[i]);
   bt_assert(is_empty_list_well_unlinked());
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -232,7 +232,7 @@ t_add_tail_list(void)
   bt_assert(nodes2[0].prev == &nodes[MAX_NUM-1]);
   bt_assert(lst.tail == &nodes2[MAX_NUM-1]);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 void
@@ -290,7 +290,7 @@ t_iterator_walk(void)
     i++;
   }
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -344,7 +344,7 @@ t_original(void)
   s_add_tail_list(&b, &a);
   dump("8 (after merge)", &b);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -363,7 +363,7 @@ t_safe_del_walk(void)
   }
   bt_assert(is_empty_list_well_unlinked());
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 int
index 2dc46dbec347c618c2dba644ed79f75e45854451..d2ca46a79a7499755717977e0652faed1b9dfa74 100644 (file)
@@ -66,7 +66,7 @@ t_as_path_match(void)
     rfree(lp);
   }
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -97,7 +97,7 @@ t_path_format(void)
 
   rfree(lp);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -152,7 +152,7 @@ t_path_include(void)
 
   rfree(lp);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -197,7 +197,7 @@ t_as_path_converting(void)
                   "\032\0310\030\039\030\038\030\037\030\036\030\035\030\034\030\033\030\032\030\031\030\030",
                   22));
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 int
index 763b6b9fb20624fde5741f3df5df6def59350b34..f4588d6567493e20fa4c08d647a43cd649b431fa 100644 (file)
@@ -86,7 +86,7 @@ t_set_int_contains(void)
     bt_assert_msg(data[i] == i, "(data[i] = %d) == i = %d)", data[i], i);
 
   rfree(lp);
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -105,7 +105,7 @@ t_set_int_union(void)
   bt_assert(int_set_format(set_union, 0, 2, buf, BUFFER_SIZE) == 0);
 
   rfree(lp);
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -127,7 +127,7 @@ t_set_int_format(void)
   bt_assert(strcmp(buf, "(0,0) (0,1) (0,2) (0,3) (0,4) (0,5) (0,6) (0,7) (0,8) (0,9)") == 0);
 
   rfree(lp);
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -149,7 +149,7 @@ t_set_int_delete(void)
 
   bt_assert(int_set_get_size(set_sequence) == SET_SIZE);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 /*
@@ -176,7 +176,7 @@ t_set_ec_contains(void)
 //    bt_assert_msg(data[i] == (SET_SIZE-1-i), "(data[i] = %d) == ((SET_SIZE-1-i) = %d)", data[i], SET_SIZE-1-i);
 
   rfree(lp);
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -195,7 +195,7 @@ t_set_ec_union(void)
   bt_assert(ec_set_format(set_union, 0, buf, BUFFER_SIZE) == 0);
 
   rfree(lp);
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -217,7 +217,7 @@ t_set_ec_format(void)
                "ec_set_format() returns '%s'", buf);
 
   rfree(lp);
-  return BT_SUCCESS;
+  return 1;
 }
 
 static int
@@ -238,7 +238,7 @@ t_set_ec_delete(void)
 
   bt_assert(ec_set_get_size(set_sequence) == SET_SIZE);
 
-  return BT_SUCCESS;
+  return 1;
 }
 
 int
index a39e37f52a5af79cde569dd248eef702097c688e..73cb990141a86115f2c696e16551ba73dcf9746e 100644 (file)
@@ -63,7 +63,7 @@ bt_init(int argc, char *argv[])
 
   bt_verbose = 0;
   bt_filename = argv[0];
-  bt_result = BT_SUCCESS;
+  bt_result = 1;
   bt_test_id = NULL;
   is_terminal = isatty(fileno(stdout));
 
@@ -160,8 +160,8 @@ int bt_run_test_fn(int (*fn)(const void *), const void *fn_arg, int timeout)
   else
     result = ((int (*)(void))fn)();
 
-  if (bt_suite_result != BT_SUCCESS)
-    result = BT_FAILURE;
+  if (!bt_suite_result)
+    result = 0;
 
   return result;
 }
@@ -177,7 +177,7 @@ get_num_terminal_cols(void)
 
 /**
  * bt_log_result - pretty print of test result
- * @result: BT_SUCCESS or BT_FAILURE
+ * @result: 1 or 0
  * @fmt: a description message (could be long, over more lines)
  * @argptr: variable argument list
  *
@@ -222,7 +222,7 @@ bt_log_result(int result, const char *fmt, va_list argptr)
     putchar(' ');
 
   const char *result_str = is_terminal ? BT_PROMPT_OK : BT_PROMPT_OK_NO_COLOR;
-  if (result != BT_SUCCESS)
+  if (!result)
     result_str = is_terminal ? BT_PROMPT_FAIL : BT_PROMPT_FAIL_NO_COLOR;
 
   printf("%s\n", result_str);
@@ -230,7 +230,7 @@ bt_log_result(int result, const char *fmt, va_list argptr)
 
 /**
  * bt_log_overall_result - pretty print of suite case result
- * @result: BT_SUCCESS or BT_FAILURE
+ * @result: 1 or 0
  * @fmt: a description message (could be long, over more lines)
  * ...: variable argument list
  *
@@ -247,7 +247,7 @@ bt_log_overall_result(int result, const char *fmt, ...)
 
 /**
  * bt_log_suite_result - pretty print of suite case result
- * @result: BT_SUCCESS or BT_FAILURE
+ * @result: 1 or 0
  * @fmt: a description message (could be long, over more lines)
  * ...: variable argument list
  *
@@ -256,7 +256,7 @@ bt_log_overall_result(int result, const char *fmt, ...)
 void
 bt_log_suite_result(int result, const char *fmt, ...)
 {
-  if(bt_verbose >= BT_VERBOSE_SUITE || result == BT_FAILURE)
+  if(bt_verbose >= BT_VERBOSE_SUITE || !result)
   {
     va_list argptr;
     va_start(argptr, fmt);
@@ -267,7 +267,7 @@ bt_log_suite_result(int result, const char *fmt, ...)
 
 /**
  * bt_log_suite_case_result - pretty print of suite result
- * @result: BT_SUCCESS or BT_FAILURE
+ * @result: 1 or 0
  * @fmt: a description message (could be long, over more lines)
  * ...: variable argument list
  *
@@ -296,7 +296,7 @@ bt_test_suite_base(int (*fn)(const void *), const char *id, const void *fn_arg,
     vprintf(dsc, args);
     va_end(args);
     printf("\n");
-    return BT_SUCCESS;
+    return 1;
   }
 
   if (no_fork)
@@ -306,9 +306,9 @@ bt_test_suite_base(int (*fn)(const void *), const char *id, const void *fn_arg,
     timeout = 0;
 
   if (request && strcmp(id, request))
-    return BT_SUCCESS;
+    return 1;
 
-  bt_suite_result = BT_SUCCESS;
+  bt_suite_result = 1;
   bt_test_id = id;
 
   if (bt_verbose >= BT_VERBOSE_ABSOLUTELY_ALL)
@@ -341,7 +341,7 @@ bt_test_suite_base(int (*fn)(const void *), const char *id, const void *fn_arg,
     else if (WIFSIGNALED(s))
     {
       /* Stopped by signal */
-      bt_suite_result = BT_FAILURE;
+      bt_suite_result = 0;
 
       int sn = WTERMSIG(s);
       if (sn == SIGALRM)
@@ -361,8 +361,8 @@ bt_test_suite_base(int (*fn)(const void *), const char *id, const void *fn_arg,
       bt_log("Core dumped");
   }
 
-  if (bt_suite_result == BT_FAILURE)
-    bt_result = BT_FAILURE;
+  if (!bt_suite_result)
+    bt_result = 0;
 
   bt_log_suite_result(bt_suite_result, NULL);
   bt_test_id = NULL;
@@ -373,9 +373,9 @@ bt_test_suite_base(int (*fn)(const void *), const char *id, const void *fn_arg,
 int
 bt_exit_value(void)
 {
-  if (!list_tests || (list_tests && bt_result != BT_SUCCESS))
+  if (!list_tests || (list_tests && !bt_result))
     bt_log_overall_result(bt_result, "");
-  return bt_result == BT_SUCCESS ? EXIT_SUCCESS : EXIT_FAILURE;
+  return bt_result ? EXIT_SUCCESS : EXIT_FAILURE;
 }
 
 /**
@@ -383,7 +383,7 @@ bt_exit_value(void)
  * @opts: includes all necessary data
  *
  * Should be called using macro bt_assert_batch().
- * Returns BT_SUCCESS or BT_FAILURE.
+ * Returns 1 or 0.
  */
 int
 bt_assert_batch__(struct bt_batch *opts)
@@ -393,8 +393,8 @@ bt_assert_batch__(struct bt_batch *opts)
   {
     int bt_suit_case_result = opts->test_fn(opts->out_buf, opts->data[i].in, opts->data[i].out);
 
-    if (bt_suit_case_result == BT_FAILURE)
-      bt_suite_result = BT_FAILURE;
+    if (bt_suit_case_result == 0)
+      bt_suite_result = 0;
 
     char b[BT_BUFFER_SIZE];
     snprintf(b, sizeof(b), "%s(", opts->test_fn_name);
@@ -403,7 +403,7 @@ bt_assert_batch__(struct bt_batch *opts)
     sprintf_concat(b, ") gives ");
     opts->out_fmt(b+strlen(b), sizeof(b)-strlen(b), opts->out_buf);
 
-    if (bt_suit_case_result == BT_FAILURE)
+    if (bt_suit_case_result == 0)
     {
       sprintf_concat(b, ", but expecting is ");
       opts->out_fmt(b+strlen(b), sizeof(b)-strlen(b), opts->data[i].out);
index 0090712d60f704103c8141bef77905a9e185acd6..4443bfc1c865a62124063748b6cad76455e81ec6 100644 (file)
@@ -38,9 +38,6 @@ long int bt_random(void);
 void bt_log_suite_result(int result, const char *fmt, ...);
 void bt_log_suite_case_result(int result, const char *fmt, ...);
 
-#define BT_SUCCESS                     42      /* 1 is too usual, filter quitbird returns 1 too */
-#define BT_FAILURE                     0
-
 #define BT_TIMEOUT                     5       /* Default timeout in seconds */
 #define BT_FORKING                     1       /* Forking is enabled in default */
 
@@ -101,12 +98,12 @@ void bt_log_suite_case_result(int result, const char *fmt, ...);
 #define bt_assert_msg(test, format, ...)                               \
   do                                                                   \
   {                                                                    \
-    int bt_suit_case_result = BT_SUCCESS;                              \
+    int bt_suit_case_result = 1;                               \
     if ((test) == 0)                                                   \
     {                                                                  \
-      bt_result = BT_FAILURE;                                          \
-      bt_suite_result = BT_FAILURE;                                    \
-      bt_suit_case_result = BT_FAILURE;                                        \
+      bt_result = 0;                                           \
+      bt_suite_result = 0;                                     \
+      bt_suit_case_result = 0;                                 \
     }                                                                  \
     bt_log_suite_case_result(bt_suit_case_result, format, ##__VA_ARGS__); \
   } while (0)
@@ -149,14 +146,13 @@ struct bt_batch {
    * @expected_out: expected data from tested function
    *
    * Input arguments should not be stringified using in_fmt() or out_fmt()
-   * function already. This function should return only BT_SUCCESS or
-   * BT_FAILURE  */
+   * function already. This function should return only 0 or 1 */
   int (*test_fn)(void *out, const void *in, const void *expected_out);
 
   /* Name of testing function @test_fn */
   const char *test_fn_name;
 
-  /* Number of items in data*/
+  /* Number of items in data */
   int ndata;
 
   /* Array of input and expected output pairs */