21 #ifndef _GLIBCXX_CSTDARG
34 #if defined(_GLIBCXX_STRING) || defined(_LIBCPP_STRING)
35 #define TESTS_KNOW_STRING
38 #define TESTS_KNOW_ARBDB
41 #define TESTS_KNOW_ARB_ERROR
45 #define ENABLE_CRASH_TESTS // comment out this line to get rid of provoked SEGVs (e.g. while debugging test-code)
73 #if (GCC_PATCHLEVEL_CODE >= 40603)
74 # define __ATTR__NOVARTRACK __ATTR__OPTIMIZE("no-var-tracking") __ATTR__OPTIMIZE("no-var-tracking-assignments")
77 #define __ATTR__REDUCED_OPTIMIZE __ATTR__NOVARTRACK __ATTR__OPTIMIZE("s") // [*3] duration compared to [*1]: ~30%
78 #define __ATTR__NO_GCSE_OPTIMIZE __ATTR__OPTIMIZE("no-gcse")
83 # define __ATTR__REDUCED_OPTIMIZE
84 # define __ATTR__NO_GCSE_OPTIMIZE
88 # define __ATTR__REDUCED_OPTIMIZE__NO_GCSE __ATTR__REDUCED_OPTIMIZE __ATTR__NO_GCSE_OPTIMIZE
93 #define ANY_SETUP "any_env_setup"
104 str(
const str& other) : s(nulldup(other.s)) {}
105 explicit str(
char *S) : s(S) {}
118 const char *
value()
const {
return s; }
124 #define WITHVALISTFROM(format,CODE) do { va_list parg; va_start(parg, format); CODE; va_end(parg); } while(0)
125 #define VPRINTFORMAT(format) WITHVALISTFROM(format, vfprintf(stderr, format, parg))
126 #define VCOMPILERMSG(msgtype,format) WITHVALISTFROM(format, vcompiler_msg(msgtype, format, parg))
132 __attribute__((format(__printf__, 2, 0)))
void vcompiler_msg(
const char *message_type,
const char *format, va_list parg)
const {
133 fprintf(stderr,
"%s:%i: ", file, line);
134 if (message_type) fprintf(stderr,
"%s: ", message_type);
135 vfprintf(stderr, format, parg);
140 locinfo(
const char *file_,
int line_) : file(file_), line(line_) {}
147 __attribute__((format(printf, 2, 3))) bool
warningf(const
char *format, ...)
const {
148 GlobalTestData& global = test_data();
149 if (global.show_warnings) {
152 GlobalTestData::print_annotation();
155 return global.show_warnings;
158 __attribute__((format(printf, 3, 4))) void
errorf(
bool fail, const
char *format, ...)
const {
162 GlobalTestData::print_annotation();
164 if (fail) TRIGGER_ASSERTION(
false);
166 __attribute__((format(printf, 3, 4))) void ioerrorf(
bool fail, const
char *format, ...)
const {
170 fprintf(stderr,
" (errno=%i='%s')", errno, strerror(errno));
171 GlobalTestData::print_annotation();
173 if (fail) TRIGGER_ASSERTION(
false);
182 FlushedOutputNoLF
yes;
187 #undef WITHVALISTFROM
192 size_t len = strlen(s)*4;
193 char *res = (
char*)malloc(len+2+1);
198 for (
int i = 0; s[i]; ++i) {
199 unsigned char c =
static_cast<unsigned char>(s[i]);
202 case '\a': esc =
'a';
break;
203 case '\b': esc =
'b';
break;
204 case '\f': esc =
'f';
break;
205 case '\n': esc =
'n';
break;
206 case '\r': esc =
'r';
break;
207 case '\t': esc =
't';
break;
208 case '\v': esc =
'v';
break;
209 case '\"': esc =
'\"';
break;
210 case '\\': esc =
'\\';
break;
218 else if (c>=1 && c<=9) {
223 else if (c >= 32 && c<127) {
225 bool breakString = strchr(
"0123456789", c);
226 if (!breakString && needSep == 2) {
227 breakString = strchr(
"abcdefABCDEF", c);
239 j += sprintf(res+j,
"\\x%02x",
int(c));
248 return strdup(
"(null)");
256 static const size_t max_vstrf_size = 10000;
259 int printed = vsnprintf(vstrf_buf, max_vstrf_size, format, parg);
260 arb_assert(printed >= 0 &&
size_t(printed)<max_vstrf_size);
263 memcpy(result, vstrf_buf, printed);
268 static char *
strf(
const char *format, ...)
__attribute__((format(__printf__, 1, 2))) {
271 char *result =
vstrf(format, parg);
278 inline char *
val2readable(
bool b) {
return strdup(b ?
"true" :
"false"); }
303 #ifdef TESTS_KNOW_STRING
306 #if defined(TESTS_KNOW_ARBDB)
314 template <
typename T>
319 operator const T&()
const {
return t; }
327 operator const char *()
const {
return t.
value(); }
348 template <
typename T>
bool operator == (
const copy<T>& v1,
const copy<T>& v2) {
return static_cast<const T&
>(v1) == static_cast<const T&>(v2); }
352 const char *val1 = v1;
353 const char *val2 = v2;
355 return (val1 == val2) || (val1 && val2 && (strcmp(val1, val2) == 0));
359 template <
typename T>
inline void print(
const T& t) {
366 template <
typename T1,
typename T2>
inline void print_pair(T1 t1, T2 t2) {
383 if (diff<0.0) diff = -
diff;
384 return diff <= epsilon;
389 static bool not_empty(
const char *part) {
arb_assert(part);
return part[0]; }
390 #if defined(TESTS_KNOW_STRING)
391 static bool not_empty(
const std::string& part) {
return !part.empty(); }
397 return not_empty(part) && strstr(str, part);
399 #if defined(TESTS_KNOW_STRING)
402 return not_empty(part) && strstr(str.c_str(), part.c_str());
412 inline void print(
int i) { fprintf(stderr,
"%i", i); }
423 #define HASTOBE_CLONABLE(type) virtual type *clone() const = 0
424 #define MAKE_CLONABLE(type) type *clone() const OVERRIDE { return new type(*this); }
446 virtual void announce_failure()
const { TRIGGER_ASSERTION(
false); }
448 void err(
const char *format)
const { loc.errorf(
false, format, code); }
449 bool warn(
const char *format)
const {
return loc.warningf(format, code); }
453 : expected(e.clone()),
463 err(
"Failed expectation '%s'");
464 print(
"expectation fails because\n");
471 err(
"Previously broken expectation '%s' succeeds");
475 if (warn(
"Expectation '%s' known as broken (accepted until fixed)")) {
476 print(
"Broken because\n");
484 err(
"Wanted behavior '%s' reached");
488 if (warn(
"Wanted behavior: '%s'")) {
489 print(
"Unsatisfied because\n");
496 GlobalTestData& global = test_data();
498 char *old_annotation = nulldup(global.get_annotation());
502 null2empty(old_annotation));
504 global.annotate(new_annotation);
506 global.annotate(old_annotation);
508 free(new_annotation);
509 free(old_annotation);
514 void announce_failure()
const OVERRIDE {
515 print(
"<<< would trigger assertion now! >>>\n");
523 fprintf(stderr,
"-------------------- [Debugging expectations for '%s']\n",
get_code());
537 virtual const char *
name()
const = 0;
559 : thing(thing_.clone()),
560 condition(condition_.clone())
563 : thing(other.thing->clone()),
564 condition(other.condition->clone())
588 void erase_last_from_tmp()
const {
589 char *t =
const_cast<char*
>(tmp.
value());
594 static bool ends_with_s(
const char *s) {
596 return s[len-1] ==
's';
599 const char *make(
const char *desc,
bool got)
const {
600 if (ends_with_s(desc)) {
601 if (got)
return desc;
603 erase_last_from_tmp();
618 const char *
make(
bool expected,
bool got)
const {
619 if (expected)
return make(primary, got);
620 if (inverse)
return make(inverse, !got);
621 return make(primary, got);
625 template <
typename FUNC>
630 predicate(FUNC pred_,
const char *name) : pred(pred_), description(name) {}
631 predicate(FUNC pred_,
const char *name,
const char *inverse) : pred(pred_), description(name, inverse) {}
634 const char *
describe(
bool expected,
bool got)
const {
return description.make(expected, got); }
648 template <
typename T>
655 matchable_value(
const matchable_value<T>& other) : val(other.val), readable(other.readable), code(other.code) {}
665 return readable.
value();
668 template <
typename U>
inline match_expectation equals_expectation(
bool invert,
const U& other,
const char *code)
const;
669 template <
typename U>
inline match_expectation lessThan_expectation(
bool invert,
const U& other,
const char *code)
const;
670 template <
typename U>
inline match_expectation moreThan_expectation(
bool invert,
const U& other,
const char *code)
const;
675 template <
typename U,
typename FUNC>
inline match_expectation predicate_expectation(
bool wanted, FUNC pred,
const char *pred_code,
const U& arg,
const char *arg_code)
const;
678 template <
typename T,
typename U>
680 return matchable_value<T>(
T(other), code_);
682 #if defined(TESTS_KNOW_STRING)
684 inline const matchable_value<const char*> make_matchable_value<const char *, std::string>(
const std::string& other,
const char *code_) {
685 return matchable_value<const char *>(other.c_str(), code_);
688 template <
typename T>
template <
typename U>
689 inline match_expectation matchable_value<T>::equals_expectation(
bool wanted,
const U& other,
const char *code_)
const {
690 return predicate_expectation(wanted,
make_predicate(
equals<T>,
"equals",
"differs"), make_matchable_value<T,U>(other, code_));
692 template <
typename T>
template <
typename U>
693 inline match_expectation matchable_value<T>::lessThan_expectation(
bool wanted,
const U& other,
const char *code_)
const {
694 return predicate_expectation(wanted,
make_predicate(less<T>,
"less than",
"more or equal"), make_matchable_value<T,U>(other, code_));
696 template <
typename T>
template <
typename U>
697 inline match_expectation matchable_value<T>::moreThan_expectation(
bool wanted,
const U& other,
const char *code_)
const {
698 return predicate_expectation(wanted,
make_predicate(more<T>,
"more than",
"less or equal"), make_matchable_value<T,U>(other, code_));
700 template <
typename T>
701 inline match_expectation matchable_value<T>::null_expectation(
bool wantNULL)
const {
702 return equals_expectation(wantNULL, (
T)
NULp,
"NULp");
705 template <
typename T>
707 matchable_value<T> expected;
713 virtual const char *
relation(
bool isMatch)
const = 0;
718 const matchable_value<T>& value_thing =
dynamic_cast<const matchable_value<T>&
>(thing);
719 return matches(value_thing.value(), expected.value());
725 fprintf(stderr,
"'%s' %s '%s'", thing.name(),
relation(isMatch), expected.name());
727 const matchable_value<T>& value_thing =
dynamic_cast<const matchable_value<T>&
>(thing);
728 if (
equals<T>(value_thing.value(), expected.value())) {
729 fprintf(stderr,
" (both are %s)", value_thing.readable_value());
732 int diff = strlen(thing.name())-strlen(expected.name());
736 print_indent(
indent); fprintf(stderr,
"'%s'%*s is %s, and\n", thing.name(), (diff>0 ? 0 : -
diff),
"", thing.readable_value());
737 print_indent(
indent); fprintf(stderr,
"'%s'%*s is %s", expected.name(), (diff<0 ? 0 :
diff),
"", expected.readable_value());
753 template <
typename T,
typename FUNC>
757 bool expected_result;
763 expected_result(wanted)
771 template <
typename T>
template <
typename FUNC>
772 inline match_expectation matchable_value<T>::predicate_expectation(
bool wanted, predicate<FUNC> pred, matchable_value<T> arg)
const {
773 return match_expectation(*
this, predicate_matcher<T,FUNC>(wanted, pred, arg));
775 template <
typename T>
template <
typename U,
typename FUNC>
776 inline match_expectation matchable_value<T>::predicate_expectation(
bool wanted, FUNC pred,
const char *pred_code,
const U& arg,
const char *arg_code)
const {
777 return match_expectation(*
this, predicate_matcher<T,FUNC>(wanted, predicate<FUNC>(pred, pred_code), make_matchable_value<T,U>(arg, arg_code)));
794 depend_on[0] = e.clone();
797 depend_on[0] = e1.clone();
798 depend_on[1] = e2.clone();
801 for (
int i = 0; i<count; ++i) {
802 depend_on[i] = other.depend_on[i]->clone();
806 for (
int i = 0; i<count; ++i) {
815 return "<expectation_group>";
818 return "<value of expectation_group>";
822 int size()
const {
return count; }
825 for (
int i = 0; i<count; ++i) {
831 if (fulfilled||unfulfilled) {
832 bool all = fulfilled && unfulfilled;
833 bool wanted = fulfilled;
835 bool printed =
false;
836 for (
int i = 0; i<
size(); ++i) {
840 if (all || is_fulfilled == wanted) {
841 if (printed)
print(
'\n');
850 bool printed =
false;
851 for (
int i = 0; i<
size(); ++i) {
852 if (printed)
print(
", ");
868 int required(
int what)
const {
return what == -1 ? count : what; }
870 : count(egroup.size()),
871 fulfilled(egroup.count_fulfilled()),
874 diff(fulfilled<min_req
876 : (fulfilled>max_req ? fulfilled-max_req : 0))
888 if (amount != 1)
print(
's');
894 print(
"expectation ");
898 print(fulfilled ?
"fulfilled" :
"fails");
899 print(diff ?
" unexpectedly" :
" as expected");
904 if (min_req == max_req) {
905 if (diff>0 && min_req>0)
print(
"only ");
911 that_many = diff<0 ? min_req :
max_req;
914 fprintf(stderr,
"%i-", min_req);
925 if (diff == 0)
print(
"and ");
else print(
"but ");
927 if (diff<0 && fulfilled>0)
print(
"only ");
931 print(
", because\n");
932 bool show_fulfilled = diff >= 0;
933 bool show_unfulfilled = diff <= 0;
938 class group_matcher
FINAL_TYPE :
public matcher {
940 group_matcher(
int min_,
int max_) : min(min_), max(max_) {}
945 return group_match(dynamic_cast<const expectation_group&>(thing), min, max).
diff == 0;
955 static group_matcher
all() {
return group_matcher(-1, -1); }
956 static group_matcher
none() {
return group_matcher(0, 0); }
957 static group_matcher
atleast(
int min_) {
return group_matcher(min_, -1); }
958 static group_matcher
atmost(
int max_) {
return group_matcher(0, max_); }
959 static group_matcher
exactly(
int amount) {
return group_matcher(amount, amount); }
985 fprintf(stderr,
"atleast(%i)", min);
991 else if (min == max) {
992 fprintf(stderr,
"exactly(%i)", min);
995 fprintf(stderr,
"[%i-%i]", min, max);
1009 template <
typename T>
const matchable_value<T>
CREATE_matchable(
const copy<T>& val,
const char *code) {
return matchable_value<T>(val, code); }
1022 #define MATCHABLE_ARGS_UNTYPED(val) val, #val
1023 #define MATCHABLE_ARGS_TYPED(val) make_copy(val), #val
1025 #define is_equal_to(val) equals_expectation(true, MATCHABLE_ARGS_UNTYPED(val))
1026 #define does_differ_from(val) equals_expectation(false, MATCHABLE_ARGS_UNTYPED(val))
1028 #define is_equal_to_NULL() null_expectation(true)
1029 #define does_differ_from_NULL() null_expectation(false)
1031 #define is_less_than(val) lessThan_expectation(true, MATCHABLE_ARGS_UNTYPED(val))
1032 #define is_more_than(val) moreThan_expectation(true, MATCHABLE_ARGS_UNTYPED(val))
1034 #define is_less_or_equal(val) moreThan_expectation(false, MATCHABLE_ARGS_UNTYPED(val))
1035 #define is_more_or_equal(val) lessThan_expectation(false, MATCHABLE_ARGS_UNTYPED(val))
1037 #define fulfills(pred,arg) predicate_expectation(true, MATCHABLE_ARGS_UNTYPED(pred), MATCHABLE_ARGS_UNTYPED(arg))
1038 #define contradicts(pred,arg) predicate_expectation(false, MATCHABLE_ARGS_UNTYPED(pred), MATCHABLE_ARGS_UNTYPED(arg))
1040 #define does_contain(val) fulfills(containing(),val)
1041 #define doesnt_contain(val) contradicts(containing(),val)
1043 #define that(thing) CREATE_matchable(MATCHABLE_ARGS_TYPED(thing))
1048 #define TEST_EXPECTATION(EXPCTN) do { using namespace arb_test; asserter(EXPCTN, #EXPCTN, __FILE__, __LINE__).expect_that(); } while(0)
1049 #define TEST_EXPECTATION__BROKEN_SIMPLE(EXPCTN) do { using namespace arb_test; asserter(EXPCTN, #EXPCTN, __FILE__, __LINE__).expect_broken(); } while(0)
1050 #define TEST_EXPECTATION__BROKEN_AT_LOC(WANTED,GOT,FILE,LINE) do { using namespace arb_test; asserter(WANTED, #WANTED, FILE, LINE).expect_broken(); asserter(GOT, #GOT, FILE, LINE).expect_that(); } while(0)
1051 #define TEST_EXPECTATION__BROKEN(WANTED,GOT) TEST_EXPECTATION__BROKEN_AT_LOC(WANTED, GOT, __FILE__, __LINE__)
1052 #define TEST_EXPECTATION__WANTED(EXPCTN) do { using namespace arb_test; asserter(EXPCTN, #EXPCTN, __FILE__, __LINE__).expect_wanted_behavior(); } while(0)
1054 #define TEST_EXPECTATION__BROKENIF(COND,EXPCTN) do { using namespace arb_test; asserter(EXPCTN, #EXPCTN, __FILE__, __LINE__).expect_brokenif(COND,#COND); } while(0)
1056 #define DEBUG_TEST_EXPECTATION(EXPCTN) do { \
1057 using namespace arb_test; \
1058 debug_asserter(EXPCTN, #EXPCTN, __FILE__, __LINE__). \
1059 debug_expectations(); \
1060 debug_asserter(wrong(EXPCTN), "wrong(" #EXPCTN ")", __FILE__, __LINE__). \
1061 debug_expectations(); \
1066 #define HERE arb_test::locinfo(__FILE__, __LINE__)
1068 #define TEST_WARNING(format,strarg) HERE.warningf(format, (strarg))
1069 #define TEST_WARNING2(format,strarg1,strarg2) HERE.warningf(format, (strarg1), (strarg2))
1070 #define TEST_ERROR(format,strarg) HERE.errorf(true, format, (strarg))
1071 #define TEST_ERROR2(format,strarg1,strarg2) HERE.errorf(true, format, (strarg1), (strarg2))
1072 #define TEST_IOERROR(format,strarg) HERE.ioerrorf(true, format, (strarg))
1076 #define TEST_FAILS_INSIDE_VALGRIND(THETEST) do { \
1077 if (!GBK_running_on_valgrind()) { \
1079 TEST_WARNING("valgrind fails for '%s'", #THETEST); \
1085 #define TEST_EXPECT_ZERO(cond) TEST_EXPECT_EQUAL(cond, 0)
1086 #define TEST_EXPECT_ZERO__BROKEN(cond,got) TEST_EXPECT_EQUAL__BROKEN(cond, 0, got)
1087 #define TEST_REJECT_ZERO(cond) TEST_EXPECTATION(that(cond).does_differ_from(0))
1088 #define TEST_REJECT_ZERO__BROKEN(cond) TEST_EXPECTATION__BROKEN_SIMPLE(that(cond).does_differ_from(0))
1090 #define TEST_EXPECT_ZERO_OR_SHOW_ERRNO(iocond) \
1093 TEST_IOERROR("I/O-failure in '%s'", #iocond); \
1098 #define MISSING_TEST(description) \
1099 TEST_WARNING("Missing test '%s'", #description)
1107 #if defined(TESTS_KNOW_ARB_ERROR)
1114 #define TEST_EXPECT_ERROR_CONTAINS(call,part) TEST_EXPECTATION (reported_error_contains(call, part))
1115 #define TEST_EXPECT_ERROR_CONTAINS__BROKEN(call,part) instead_use__TEST_EXPECT_ANY_ERROR__BROKEN__or__TEST_EXPECT_ERROR_CONTAINS
1116 #define TEST_EXPECT_ANY_ERROR(call) TEST_EXPECTATION (reports_error(call))
1117 #define TEST_EXPECT_ANY_ERROR__BROKEN(call) TEST_EXPECTATION__BROKEN_SIMPLE(reports_error(call))
1118 #define TEST_EXPECT_NO_ERROR(call) TEST_EXPECTATION (doesnt_report_error(call))
1119 #define TEST_EXPECT_NO_ERROR__BROKEN(call) TEST_EXPECTATION__BROKEN_SIMPLE(doesnt_report_error(call))
1126 inline match_expectation no_forgotten_error_exported() {
return that(
GB_incur_error()).is_equal_to_NULL(); }
1138 match_expectation returns_result()
const {
return that(result).is_equal_to(
true); }
1139 match_expectation doesnt_return_result()
const {
return that(result).is_equal_to(
false); }
1140 match_expectation exports_error()
const {
return that(error).does_differ_from_NULL(); }
1141 match_expectation doesnt_export_error()
const {
return that(error).is_equal_to_NULL(); }
1142 match_expectation exports_error_containing(
const char *expected_part)
const {
1143 return error ?
that(error).does_contain(expected_part) : exports_error();
1146 match_expectation either_result_or_error()
const {
return exactly(1).of(returns_result(), exports_error()); }
1148 match_expectation does_neither_return_result_nor_export_error()
const {
1149 return all().of(doesnt_return_result(),
1150 doesnt_export_error());
1152 match_expectation returns_result_and_doesnt_export_error()
const {
1153 return all().of(either_result_or_error(),
1155 doesnt_export_error());
1157 match_expectation doesnt_return_result_but_exports_error_containing(
const char *expected_part)
const {
1158 return all().of(either_result_or_error(),
1159 doesnt_return_result(),
1160 exports_error_containing(expected_part));
1165 #define TEST_EXPECT_ERROR_CLEAR() TEST_EXPECTATION(no_forgotten_error_exported())
1167 #define TEST_EXPECT_RESULT__NOERROREXPORTED(create_result) do { TEST_EXPECT_ERROR_CLEAR(); TEST_EXPECTATION (calling((create_result)).returns_result_and_doesnt_export_error()); } while(0)
1168 #define TEST_EXPECT_RESULT__NOERROREXPORTED__BROKEN(create_result) do { TEST_EXPECT_ERROR_CLEAR(); TEST_EXPECTATION__BROKEN_SIMPLE(calling((create_result)).returns_result_and_doesnt_export_error()); } while(0)
1169 #define TEST_EXPECT_NORESULT__ERROREXPORTED_CONTAINS(create_result,expected_part) do { TEST_EXPECT_ERROR_CLEAR(); TEST_EXPECTATION (calling((create_result)).doesnt_return_result_but_exports_error_containing(expected_part)); } while(0)
1170 #define TEST_EXPECT_NORESULT__ERROREXPORTED_CONTAINS__BROKEN(create_result,expected_part) do { TEST_EXPECT_ERROR_CLEAR(); TEST_EXPECTATION__BROKEN_SIMPLE(calling((create_result)).doesnt_return_result_but_exports_error_containing(expected_part)); } while(0)
1171 #define TEST_EXPECT_NORESULT__NOERROREXPORTED(create_result) do { TEST_EXPECT_ERROR_CLEAR(); TEST_EXPECTATION (calling((create_result)).does_neither_return_result_nor_export_error()); } while(0)
1172 #define TEST_EXPECT_NORESULT__NOERROREXPORTED__BROKEN(create_result) do { TEST_EXPECT_ERROR_CLEAR(); TEST_EXPECTATION__BROKEN_SIMPLE(calling((create_result)).does_neither_return_result_nor_export_error()); } while(0)
1174 #define TEST_EXPECT_EQUAL_STRINGCOPY__NOERROREXPORTED(create_strcopy,expected_result) do { \
1176 TEST_EXPECT_RESULT__NOERROREXPORTED(result = create_strcopy); \
1177 TEST_EXPECT_EQUAL(result, expected_result); \
1181 #define TEST_EXPECT_EQUAL_STRINGCOPY__NOERROREXPORTED__BROKEN(create_strcopy,wanted,got) do { \
1183 TEST_EXPECT_RESULT__NOERROREXPORTED(result = create_strcopy); \
1184 TEST_EXPECT_EQUAL__BROKEN(result, wanted, got); \
1193 #ifdef ENABLE_CRASH_TESTS
1196 const bool DOES_SEGFAULT =
true;
1197 const bool DOESNT_SEGFAULT =
false;
1198 const bool CALL_WILL_SEGFAULT =
true;
1199 const bool CALL_WONT_SEGFAULT =
false;
1200 const bool FAILS_ASSERTION =
true;
1201 const bool FULFILLS_ASSERTIONS =
false;
1203 # ifdef ASSERTION_USED
1207 bool& assertion_failed = test_data().assertion_failed;
1208 bool old_state = assertion_failed;
1220 assertion_failed = old_state;
1221 return all().ofgroup(expected);
1228 return that(call_would_SEGV).is_equal_to(expect_SEGV);
1248 # ifdef ASSERTION_USED
1250 # define TEST_EXPECT_NO_SEGFAULT(cb) TEST_EXPECTATION(expect_callback(cb, DOESNT_SEGFAULT, FULFILLS_ASSERTIONS, CALL_WONT_SEGFAULT))
1251 # define TEST_EXPECT_NO_SEGFAULT__WANTED(cb) TEST_EXPECTATION__WANTED(expect_callback(cb, DOESNT_SEGFAULT, FULFILLS_ASSERTIONS, CALL_WILL_SEGFAULT))
1252 # define TEST_EXPECT_CODE_ASSERTION_FAILS(cb) TEST_EXPECTATION(expect_callback(cb, DOES_SEGFAULT, FAILS_ASSERTION, CALL_WILL_SEGFAULT))
1253 # define TEST_EXPECT_CODE_ASSERTION_FAILS__WANTED(cb) TEST_EXPECTATION__WANTED(expect_callback(cb, DOES_SEGFAULT, FAILS_ASSERTION, CALL_WONT_SEGFAULT))
1254 # define TEST_EXPECT_CODE_ASSERTION_FAILS__UNWANTED(cb) TEST_EXPECT_NO_SEGFAULT__WANTED(cb)
1255 # define TEST_EXPECT_SEGFAULT(cb) TEST_EXPECTATION(expect_callback(cb, DOES_SEGFAULT, FULFILLS_ASSERTIONS, CALL_WILL_SEGFAULT))
1256 # define TEST_EXPECT_SEGFAULT__WANTED(cb) TEST_EXPECTATION__WANTED(expect_callback(cb, DOES_SEGFAULT, FULFILLS_ASSERTIONS, CALL_WONT_SEGFAULT))
1257 # define TEST_EXPECT_SEGFAULT__UNWANTED(cb) TEST_EXPECT_NO_SEGFAULT__WANTED(cb)
1259 # else // ENABLE_CRASH_TESTS but no ASSERTION_USED (test segfaults in NDEBUG mode)
1261 # define TEST_EXPECT_NO_SEGFAULT(cb) TEST_EXPECTATION(expect_callback(cb, DOESNT_SEGFAULT, CALL_WONT_SEGFAULT))
1262 # define TEST_EXPECT_NO_SEGFAULT__WANTED(cb) TEST_EXPECTATION__WANTED(expect_callback(cb, DOESNT_SEGFAULT, CALL_WILL_SEGFAULT))
1263 # define TEST_EXPECT_CODE_ASSERTION_FAILS(cb)
1264 # define TEST_EXPECT_CODE_ASSERTION_FAILS__WANTED(cb)
1265 # define TEST_EXPECT_CODE_ASSERTION_FAILS__UNWANTED(cb)
1266 # define TEST_EXPECT_SEGFAULT(cb) TEST_EXPECTATION(expect_callback(cb, DOES_SEGFAULT, CALL_WILL_SEGFAULT))
1267 # define TEST_EXPECT_SEGFAULT__WANTED(cb) TEST_EXPECTATION__WANTED(expect_callback(cb, DOES_SEGFAULT, CALL_WONT_SEGFAULT))
1268 # define TEST_EXPECT_SEGFAULT__UNWANTED(cb) TEST_EXPECT_NO_SEGFAULT__WANTED(cb)
1272 #else // not ENABLE_CRASH_TESTS (i.e. skip these tests completely)
1274 # define TEST_EXPECT_NO_SEGFAULT(cb)
1275 # define TEST_EXPECT_NO_SEGFAULT__WANTED(cb)
1276 # define TEST_EXPECT_CODE_ASSERTION_FAILS(cb)
1277 # define TEST_EXPECT_CODE_ASSERTION_FAILS__WANTED(cb)
1278 # define TEST_EXPECT_CODE_ASSERTION_FAILS__UNWANTED(cb)
1279 # define TEST_EXPECT_SEGFAULT(cb)
1280 # define TEST_EXPECT_SEGFAULT__WANTED(cb)
1281 # define TEST_EXPECT_SEGFAULT__UNWANTED(cb)
1288 template <
typename T,
typename U,
typename V>
1289 inline void expect_broken(
const arb_test::matchable_value<T>& That,
const U& want,
const V& got,
const char *file,
int line) {
1294 #define TEST_EXPECT_EQUAL(expr,want) TEST_EXPECTATION(that(expr).is_equal_to(want))
1295 #define TEST_EXPECT_EQUAL__BROKEN(expr,want,got) do{ using namespace arb_test; expect_broken(that(expr), want, got, __FILE__, __LINE__); }while(0)
1296 #define TEST_EXPECT_EQUAL__IGNARG(expr,want,ign) TEST_EXPECTATION(that(expr).is_equal_to(want))
1298 #define TEST_EXPECT_SIMILAR(expr,want,epsilon) TEST_EXPECTATION(that(expr).fulfills(epsilon_similar(epsilon), want))
1299 #define TEST_EXPECT_SIMILAR__BROKEN(expr,want,epsilon) TEST_EXPECTATION__BROKEN_SIMPLE(that(expr).fulfills(epsilon_similar(epsilon), want))
1301 #define TEST_EXPECT_DIFFERENT(expr,want) TEST_EXPECTATION(that(expr).does_differ_from(want));
1302 #define TEST_EXPECT_DIFFERENT__BROKEN(expr,want) TEST_EXPECTATION__BROKEN_SIMPLE(that(expr).does_differ_from(want));
1304 #define TEST_EXPECT_LESS(val,ref) TEST_EXPECTATION(that(val).is_less_than(ref))
1305 #define TEST_EXPECT_LESS__BROKEN(val,ref) TEST_EXPECTATION__BROKEN_SIMPLE(that(val).is_less_than(ref))
1306 #define TEST_EXPECT_MORE(val,ref) TEST_EXPECTATION(that(val).is_more_than(ref))
1307 #define TEST_EXPECT_MORE__BROKEN(val,ref) TEST_EXPECTATION__BROKEN_SIMPLE(that(val).is_more_than(ref))
1308 #define TEST_EXPECT_LESS_EQUAL(val,ref) TEST_EXPECTATION(that(val).is_less_or_equal(ref))
1309 #define TEST_EXPECT_LESS_EQUAL__BROKEN(val,ref) TEST_EXPECTATION__BROKEN_SIMPLE(that(val).is_less_or_equal(ref))
1310 #define TEST_EXPECT_MORE_EQUAL(val,ref) TEST_EXPECTATION(that(val).is_more_or_equal(ref))
1311 #define TEST_EXPECT_MORE_EQUAL__BROKEN(val,ref) TEST_EXPECTATION__BROKEN_SIMPLE(that(val).is_more_or_equal(ref))
1313 #define TEST_EXPECT_IN_RANGE(val,lower,higher) TEST_EXPECTATION(all().of(that(val).is_more_or_equal(lower), that(val).is_less_or_equal(higher)))
1314 #define TEST_EXPECT_IN_RANGE__BROKEN(val,lower,higher) TEST_EXPECTATION__BROKEN_SIMPLE(all().of(that(val).is_more_or_equal(lower), that(val).is_less_or_equal(higher)))
1316 #define TEST_EXPECT_CONTAINS(str,part) TEST_EXPECTATION(that(str).does_contain(part))
1317 #define TEST_EXPECT_CONTAINS__BROKEN(str,part) TEST_EXPECTATION__BROKEN_SIMPLE(that(str).does_contain(part))
1319 #define TEST_EXPECT_DOESNT_CONTAIN(str,part) TEST_EXPECTATION(that(str).doesnt_contain(part))
1320 #define TEST_EXPECT_DOESNT_CONTAIN__BROKEN(str,part) TEST_EXPECTATION__BROKEN_SIMPLE(that(str).doesnt_contain(part))
1322 #define TEST_EXPECT_NULL(n) TEST_EXPECT_EQUAL(n, (typeof(n))NULp)
1323 #define TEST_EXPECT_NULL__BROKEN(n,got) TEST_EXPECT_EQUAL__BROKEN(n, (typeof(n))NULp, got)
1324 #define TEST_EXPECT_NULL__BROKEN_SIMPLE(n) TEST_EXPECTATION__BROKEN_SIMPLE(that(n).is_equal_to((typeof(n))NULp))
1325 #define TEST_REJECT_NULL(n) TEST_EXPECT_DIFFERENT(n, (typeof(n))NULp)
1326 #define TEST_REJECT_NULL__BROKEN(n) TEST_EXPECT_DIFFERENT__BROKEN(n, (typeof(n))NULp)
1328 #define TEST_EXPECT(cond) TEST_EXPECTATION(that(cond).is_equal_to(true))
1329 #define TEST_EXPECT__BROKEN(cond) TEST_EXPECTATION__BROKEN_SIMPLE(that(cond).is_equal_to(true))
1330 #define TEST_REJECT(cond) TEST_EXPECTATION(that(cond).is_equal_to(false))
1331 #define TEST_REJECT__BROKEN(cond) TEST_EXPECTATION__BROKEN_SIMPLE(that(cond).is_equal_to(false))
1334 #define TEST_VALIDITY(valid) TEST_EXPECT_NULL((valid).why_not())
1335 #define TEST_VALIDITY__BROKEN(valid,why) TEST_EXPECT_NULL__BROKEN((valid).why_not(),why)
1338 #define TEST_EXPECT_STRARRAY_CONTAINS(strings,separator,expected) do{ \
1339 char *joined = GBT_join_strings(strings,separator); \
1340 TEST_EXPECT_EQUAL(joined, expected); \
1344 #define TEST_EXPECT_STRARRAY_CONTAINS__BROKEN(strings,separator,want,got) do{ \
1345 char *joined = GBT_join_strings(strings,separator); \
1346 TEST_EXPECT_EQUAL__BROKEN(joined, want, got); \
1361 inline bool memory_is_equal(
const void *mem1,
const void *mem2,
size_t size) {
1362 FlushedOutputNoLF
yes;
1364 reinterpret_cast<const unsigned char *>(mem2), size, 0) == size;
1367 FlushedOutputNoLF
yes;
1370 inline bool files_differ(
const char *file1,
const char *file2) {
1371 FlushedOutputNoLF
yes;
1375 FlushedOutputNoLF
yes;
1378 inline bool textfiles_dont_have_difflines(
const char *fgot,
const char *fwant,
int unexpected_difflines) {
1379 FlushedOutputNoLF
yes;
1383 FlushedOutputNoLF
yes;
1388 #define TEST_COPY_FILE(src, dst) TEST_EXPECT_NO_ERROR(GB_copy_file(src, dst))
1389 #define TEST_DUMP_FILE(src, dst) TEST_EXPECT(system(GBS_global_string("hexdump -C '%s' > '%s'", src, dst)) == 0)
1393 #define TEST_EXPECT_TEXTFILE_DIFFLINES(fgot,fwant,diff) TEST_EXPECT(arb_test::textfiles_have_difflines(fgot,fwant, diff))
1394 #define TEST_EXPECT_TEXTFILE_DIFFLINES__BROKEN(fgot,fwant,diff) TEST_EXPECT__BROKEN(arb_test::textfiles_have_difflines(fgot,fwant, diff))
1396 #define TEST_EXPECT_TEXTFILE_DIFFLINES_IGNORE_DATES(fgot,fwant,diff) TEST_EXPECT(arb_test::textfiles_have_difflines_ignoreDates(fgot,fwant, diff))
1397 #define TEST_EXPECT_TEXTFILE_DIFFLINES_IGNORE_DATES__BROKEN(fgot,fwant,diff) TEST_EXPECT__BROKEN(arb_test::textfiles_have_difflines_ignoreDates(fgot,fwant, diff))
1399 #define TEST_EXPECT_FILES_EQUAL(f1,f2) TEST_EXPECT(arb_test::files_are_equal(f1,f2))
1400 #define TEST_EXPECT_FILES_EQUAL__BROKEN(f1,f2) TEST_EXPECT__BROKEN(arb_test::files_are_equal(f1,f2))
1401 #define TEST_EXPECT_TEXTFILES_EQUAL(fgot,fwant) TEST_EXPECT_TEXTFILE_DIFFLINES(fgot,fwant,0)
1402 #define TEST_EXPECT_TEXTFILES_EQUAL__BROKEN(fgot,fwant) TEST_EXPECT_TEXTFILE_DIFFLINES__BROKEN(fgot,fwant,0)
1404 #define TEST_EXPECT_FILES_DIFFER(f1,f2) TEST_EXPECT(arb_test::files_differ(f1,f2))
1405 #define TEST_EXPECT_FILES_DIFFER__BROKEN(f1,f2) TEST_EXPECT__BROKEN(arb_test::files_differ(f1,f2))
1406 #define TEST_EXPECT_TEXTFILES_DIFFER(fgot,fwant) TEST_EXPECT(arb_test::textfiles_dont_have_difflines(fgot,fwant,0))
1407 #define TEST_EXPECT_TEXTFILES_DIFFER__BROKEN(fgot,fwant) TEST_EXPECT__BROKEN(arb_test::textfiles_dont_have_difflines(fgot,fwant,0))
1409 #define TEST_EXPECT_MEM_EQUAL(m1,m2,size) TEST_EXPECT(arb_test::memory_is_equal(m1,m2,size))
1410 #define TEST_EXPECT_MEM_EQUAL__BROKEN(m1,m2,size) TEST_EXPECT__BROKEN(arb_test::memory_is_equal(m1,m2,size))
1414 #define WARN_MISS_ARBDIFF() need_include__arb_diff_h__BEFORE__test_unit_h
1416 #define TEST_EXPECT_TEXTFILE_DIFFLINES(fgot,fwant,diff) WARN_MISS_ARBDIFF()
1417 #define TEST_EXPECT_TEXTFILE_DIFFLINES__BROKEN(fgot,fwant,diff) WARN_MISS_ARBDIFF()
1419 #define TEST_EXPECT_TEXTFILE_DIFFLINES_IGNORE_DATES(fgot,fwant,diff) WARN_MISS_ARBDIFF()
1420 #define TEST_EXPECT_TEXTFILE_DIFFLINES_IGNORE_DATES__BROKEN(fgot,fwant,diff) WARN_MISS_ARBDIFF()
1422 #define TEST_EXPECT_FILES_EQUAL(f1,f2) WARN_MISS_ARBDIFF()
1423 #define TEST_EXPECT_FILES_EQUAL__BROKEN(f1,f2) WARN_MISS_ARBDIFF()
1424 #define TEST_EXPECT_TEXTFILES_EQUAL(fgot,fwant) WARN_MISS_ARBDIFF()
1425 #define TEST_EXPECT_TEXTFILES_EQUAL__BROKEN(fgot,fwant) WARN_MISS_ARBDIFF()
1427 #define TEST_EXPECT_FILES_DIFFER(f1,f2) WARN_MISS_ARBDIFF()
1428 #define TEST_EXPECT_FILES_DIFFER__BROKEN(f1,f2) WARN_MISS_ARBDIFF()
1429 #define TEST_EXPECT_TEXTFILES_DIFFER(fgot,fwant) WARN_MISS_ARBDIFF()
1430 #define TEST_EXPECT_TEXTFILES_DIFFER__BROKEN(fgot,fwant) WARN_MISS_ARBDIFF()
1432 #define TEST_EXPECT_MEM_EQUAL(m1,m2,size) WARN_MISS_ARBDIFF()
1433 #define TEST_EXPECT_MEM_EQUAL__BROKEN(m1,m2,size) WARN_MISS_ARBDIFF()
1435 #define memory_is_equal(m1,m2,size) WARN_MISS_ARBDIFF()
1436 #define files_are_equal(f1,f2) WARN_MISS_ARBDIFF()
1437 #define textfiles_have_difflines(f1,f2,ed) WARN_MISS_ARBDIFF()
1438 #define textfiles_have_difflines_ignoreDates(f1,f2,ed) WARN_MISS_ARBDIFF()
1440 #endif // ARB_DIFF_H
1464 expected.
add(expect_newick_equals(format, tree, expected_newick));
1467 return all().ofgroup(expected);
1471 #define TEST_EXPECT_NEWICK(format,tree,expected_newick) TEST_EXPECTATION(arb_test::expect_newick_equals(format, tree, expected_newick))
1472 #define TEST_EXPECT_NEWICK__BROKEN(format,tree,expected_newick) TEST_EXPECTATION__BROKEN_SIMPLE(arb_test::expect_newick_equals(format, tree, expected_newick))
1474 #define TEST_EXPECT_SAVED_NEWICK(format,gb_main,treename,expected_newick) TEST_EXPECTATION(arb_test::saved_newick_equals(format, gb_main, treename, expected_newick))
1475 #define TEST_EXPECT_SAVED_NEWICK__BROKEN(format,gb_main,treename,expected_newick) TEST_EXPECTATION__BROKEN_SIMPLE(arb_test::saved_newick_equals(format, gb_main, treename, expected_newick))
1479 #define WARN_MISS_ADTREE() need_include__TreeNode_h__BEFORE__test_unit_h
1481 #define TEST_EXPECT_NEWICK(format,tree,expected_newick) WARN_MISS_ADTREE()
1482 #define TEST_EXPECT_NEWICK__BROKEN(format,tree,expected_newick) WARN_MISS_ADTREE()
1484 #define TEST_EXPECT_SAVED_NEWICK(format,gb_main,treename,expected_newick) WARN_MISS_ADTREE()
1485 #define TEST_EXPECT_SAVED_NEWICK__BROKEN(format,gb_main,treename,expected_newick) WARN_MISS_ADTREE()
1491 #define TEST_SETUP_GLOBAL_ENVIRONMENT(modulename) do { \
1492 arb_test::test_data().raiseLocalFlag(ANY_SETUP); \
1493 TEST_EXPECT_NO_ERROR(GBK_system(GBS_global_string("../test_environment setup %s", (modulename)))); \
1515 #define TEST_PUBLISH(testfunction) void publish##testfunction() { testfunction(); }
1517 #define TEST_PUBLISH(testfunction)
1523 #error test_unit.h included twice
1524 #endif // TEST_UNIT_H
virtual const char * name() const =0
const char * name() const OVERRIDE
#define MAKE_CLONABLE(type)
const expectation & dependent(int i) const
match_expectation reports_error(const char *error)
virtual ~matchable()
can be matched with corresponding matcher.
predicate(FUNC pred_, const char *name, const char *inverse)
AliDataPtr format(AliDataPtr data, const size_t wanted_len, GB_ERROR &error)
const char * make(bool expected, bool got) const
GB_ERROR GB_incur_error()
bool ARB_files_differ(const char *file1, const char *file2)
size_t ARB_test_mem_equal(const unsigned char *buf1, const unsigned char *buf2, size_t common, size_t blockStartAddress)
bool ARB_files_are_equal(const char *file1, const char *file2)
return string(buffer, length)
const char * name() const OVERRIDE
void explain(int indent) const OVERRIDE
const char * readable_value() const OVERRIDE
void warningf(int warning_num, const char *warning_messagef,...) __ATTR__FORMAT(2)
virtual bool matches(const copy< T > &v1, const copy< T > &v2) const =0
static group_matcher atmost(int max_)
MAKE_CLONABLE(predicate_matcher)
match_expectation doesnt_report_error(const char *error)
char * GBT_tree_2_newick(const TreeNode *tree, NewickFormat format, bool compact)
~value_matcher() OVERRIDE
static char va_start(parg, format)
match_expectation reported_error_contains(const char *error, const char *part)
predicate_description(const char *primary_)
virtual const char * relation(bool isMatch) const =0
copy< T > make_copy(const T &t)
str & operator=(const str &other)
TreeNode * GBT_read_tree(GBDATA *gb_main, const char *tree_name, TreeRoot *troot)
#define VCOMPILERMSG(msgtype, format)
void expect_broken() const
const char * get_code() const
void dump_brief_description(const matchable &thing) const OVERRIDE
static char static char vstrf_buf[max_vstrf_size]
predicate< FUNC > make_predicate(FUNC func, const char *primary, const char *inverse)
virtual ~matcher()
can match things.
HASTOBE_CLONABLE(matcher)
virtual void dump_brief_description(const matchable &thing) const =0
bool matches(const matchable &thing) const FINAL_OVERRIDE
value_matcher(const matchable_value< T > &expected_)
~match_expectation() OVERRIDE
int count_fulfilled() const
expectation_group(const expectation &e1, const expectation &e2)
matchable_value(copy< T > val_, const char *nontemp_code)
DECLARE_ASSIGNMENT_OPERATOR(match_expectation)
virtual const char * readable_value() const =0
const char * plural(NUM val)
const char * get_file() const
static char * vstrf(const char *format, va_list &parg) __attribute__((format(__printf__
HASTOBE_CLONABLE(expectation)
asserter(const expectation &e, const char *nontmp_code, const char *file, int line)
bool GBK_raises_SIGSEGV(void(*cb)(void))
static int diff(int v1, int v2, int v3, int v4, int st, int en)
const char * readable_value() const OVERRIDE
MAKE_CLONABLE(expectation_group)
match_expectation ofgroup(const expectation_group &group)
void dump(const expectation_group &group, int indent) const
match_expectation wrong(const expectation &e)
debug_asserter(const expectation &e, const char *code_, const char *file, int line)
virtual ~expectation()
something expected. can be fulfilled or not (and can explain why/not)
bool operator()(const double &d1, const double &d2) const
void dump_expectation(const matchable &thing, int indent) const OVERRIDE
predicate_description(const predicate_description &other)
DECLARE_ASSIGNMENT_OPERATOR(predicate_description)
bool more(const copy< T > &t1, const copy< T > &t2)
match_expectation of(const expectation &e1, const expectation &e2, const expectation &e3) const
predicate_matcher(bool wanted, predicate< FUNC > pred_, const matchable_value< T > &arg)
virtual bool matches(const matchable &thing) const =0
const matchable_value< T > make_matchable_value(const U &other, const char *code_)
virtual bool fulfilled() const =0
static void error(const char *msg)
MAKE_CLONABLE(match_expectation)
bool less(const copy< T > &t1, const copy< T > &t2)
match_expectation of(const expectation &e) const
virtual void dump_brief_description() const =0
expectation_group & add(const expectation &e)
bool GBK_running_on_valgrind(void)
~expectation_group() OVERRIDE
predicate(FUNC pred_, const char *name)
void expect_brokenif(bool condition, const char *condcode)
static group_matcher exactly(int amount)
const char * relation(bool isMatch) const OVERRIDE
bool operator!=(const copy< T > &v1, const copy< T > &v2)
match_expectation(const matchable &thing_, const matcher &condition_)
#define does_differ_from_NULL()
int required(int what) const
const char * value() const
expectation_group(const expectation_group &other)
static group_matcher none()
bool ARB_textfiles_have_difflines(const char *file1, const char *file2, int expected_difflines, TextDiffMode tdmode)
void dump_brief_description() const
str readableHex(const copy< T > &v)
bool matches(const matchable &thing) const OVERRIDE
char * gen_description() const
void dump_brief_description(const matchable &thing) const OVERRIDE
void select_spaced(bool first, const char *singular, const char *plural)
predicate_description(const char *primary_, const char *inverse_)
group_match(const expectation_group &egroup, int min, int max)
const int count
result of matching an expectation_group with a group_matcher
void spaced(const char *word)
fputs(TRACE_PREFIX, stderr)
void print_pair(T1 t1, T2 t2)
#define textfiles_have_difflines(f1, f2, ed)
virtual void dump_expectation(const matchable &thing, int indent) const =0
bool operator()(const char *str, const char *part) const
group_matcher exactly(int amount)
group_matcher atleast(int min)
#define textfiles_have_difflines_ignoreDates(f1, f2, ed)
HASTOBE_CLONABLE(matchable)
char * val2readable(bool b)
str readable(const copy< T > &v)
const char * describe(bool expected, bool got) const
#define memory_is_equal(m1, m2, size)
static void errorf(const char *format,...) __attribute__((format(__printf__
bool equals(const copy< T > &t1, const copy< T > &t2)
void expect_wanted_behavior() const
void dump_brief_description() const OVERRIDE
void debug_expectations()
static void printf(const char *format,...) __attribute__((format(printf
const matchable_value< T > & get_expected() const
static char * readable_string(const char *s)
match_expectation(const match_expectation &other)
#define files_are_equal(f1, f2)
void dump_some_expectations(int indent, bool fulfilled, bool unfulfilled) const
matchable_value(const matchable_value< T > &other)
static void print_readable_string(const char *s, FILE *out)
void dump_expectation(const matchable &thing, int indent) const OVERRIDE
bool operator==(const copy< T > &v1, const copy< T > &v2)
#define TEST_EXPECTATION__BROKEN_AT_LOC(WANTED, GOT, FILE, LINE)
void print_indent(int indent)
expectation_group(const expectation &e)
bool matches(const copy< T > &v1, const copy< T > &v2) const
static char * strf(const char *format,...) __attribute__((format(__printf__
match_expectation of(const expectation &e1, const expectation &e2, const expectation &e3, const expectation &e4) const
const copy< T > & value() const
bool matches(const copy< T > &v1, const copy< T > &v2) const OVERRIDE
GB_transaction ta(gb_var)
memcpy(result, vstrf_buf, printed)
void destroy(TreeNode *that)
void print_hex(const T &t)
static group_matcher all()
group_matcher atmost(int max)
arb_assert(printed >=0 &&size_t(printed)< max_vstrf_size)
void dump_num_of(int amount, const char *thing) const
static group_matcher atleast(int min_)
const matchable_value< T > CREATE_matchable(const copy< T > &val, const char *code)
virtual void explain(int indent) const =0
bool fulfilled() const OVERRIDE
epsilon_similar(double epsilon_)
struct PT_short_chain_header __attribute__
void print_hex_pair(T1 t1, T2 t2)
static void VPRINTFORMAT(format)
static void amountzero(int a, const char *zero)
match_expectation of(const expectation &e1, const expectation &e2) const
locinfo(const char *file_, int line_)
void expect_broken(const arb_test::matchable_value< T > &That, const U &want, const V &got, const char *file, int line)
GB_write_int const char s