87 const char *bs,
const char *file,
int line);
101 const char *bs,
const char *file,
int line);
115 const char *bs,
const char *file,
int line);
129 const char *bs,
const char *file,
int line);
143 const char *bs,
const char *file,
int line);
157 const char *bs,
const char *file,
int line);
174 long long actual,
const char *ds,
const char *es,
175 const char *as,
const char *file,
int line);
213 const char *bs,
const char *file,
int line);
229 const char *as,
const char *bs,
230 const char *file,
int line);
245 long long len,
const char *es,
const char *as,
246 const char *file,
int line);
263 const char *ds,
const char *es,
264 const char *as,
const char *file,
int line);
281 double actual,
const char *ds,
282 const char *es,
const char *as,
283 const char *file,
int line);
300 const char *ms,
const char *es,
const char *as,
301 const char *file,
int line);
315 const char *as,
const char *file,
int line);
329 const char *as,
const char *file,
int line);
345 long long elem_size,
long long count,
346 const char *es,
const char *as,
const char *file,
364 const char *file,
int line);
379 const char *bs,
const char *msg,
const char *file,
396 const char *bs,
const char *msg,
397 const char *file,
int line);
410 const char *file,
int line);
423 const char *msg,
const char *file,
int line);
442 long long actual,
const char *ms,
const char *es,
443 const char *as,
const char *msg,
444 const char *file,
int line);
457#define Assert(cond) __builtin_assert(!!(cond), #cond, __FILE__, __LINE__)
464#define AssertTrue(cond) Assert(cond)
471#define AssertFalse(cond) \
472 __builtin_assert_false(!!(cond), #cond, __FILE__, __LINE__)
478#define AssertFail() __builtin_assert_fail(__FILE__, __LINE__)
485#define AssertFailMsg(msg) __builtin_assert_fail_msg(msg, __FILE__, __LINE__)
497#define AssertEq(a, b) \
498 __builtin_assert_eq((long long)(a), (long long)(b), #a, #b, __FILE__, \
507#define AssertNeq(a, b) \
508 __builtin_assert_neq((long long)(a), (long long)(b), #a, #b, __FILE__, \
517#define AssertGt(a, b) \
518 __builtin_assert_gt((long long)(a), (long long)(b), #a, #b, __FILE__, \
527#define AssertLt(a, b) \
528 __builtin_assert_lt((long long)(a), (long long)(b), #a, #b, __FILE__, \
537#define AssertGe(a, b) \
538 __builtin_assert_ge((long long)(a), (long long)(b), #a, #b, __FILE__, \
547#define AssertLe(a, b) \
548 __builtin_assert_le((long long)(a), (long long)(b), #a, #b, __FILE__, \
559#define AssertWithin(delta, expected, actual) \
560 __builtin_assert_within((long long)(delta), (long long)(expected), \
561 (long long)(actual), #delta, #expected, #actual, \
576#define AssertBits(mask, expected, actual) \
577 __builtin_assert_bits((long long)(mask), (long long)(expected), \
578 (long long)(actual), #mask, #expected, #actual, \
588#define AssertBitHigh(bit, actual) \
589 __builtin_assert_bit_high((int)(bit), (long long)(actual), #bit, #actual, \
599#define AssertBitLow(bit, actual) \
600 __builtin_assert_bit_low((int)(bit), (long long)(actual), #bit, #actual, \
614#define AssertFloatWithin(delta, expected, actual) \
615 __builtin_assert_float_within((double)(delta), (double)(expected), \
616 (double)(actual), #delta, #expected, \
617 #actual, __FILE__, __LINE__)
626#define AssertDoubleWithin(delta, expected, actual) \
627 __builtin_assert_double_within((double)(delta), (double)(expected), \
628 (double)(actual), #delta, #expected, \
629 #actual, __FILE__, __LINE__)
638#define AssertFloatEq(expected, actual) \
639 __builtin_assert_float_within(1e-6, (double)(expected), (double)(actual), \
640 #expected, #expected, #actual, __FILE__, \
650#define AssertDoubleEq(expected, actual) \
651 __builtin_assert_double_within(1e-15, (double)(expected), \
652 (double)(actual), #expected, #expected, \
653 #actual, __FILE__, __LINE__)
664#define AssertNull(p) \
665 __builtin_assert_null((const void *)(p), #p, __FILE__, __LINE__)
672#define AssertNotNull(p) \
673 __builtin_assert_not_null((const void *)(p), #p, __FILE__, __LINE__)
685#define AssertStrEq(a, b) \
686 __builtin_assert_streq((a), (b), #a, #b, __FILE__, __LINE__)
695#define AssertStrEqLen(a, b, len) \
696 __builtin_assert_streq_len((a), (b), (long long)(len), #a, #b, __FILE__, \
710#define AssertMemEq(expected, actual, len) \
711 __builtin_assert_mem_eq((const void *)(expected), (const void *)(actual), \
712 (long long)(len), #expected, #actual, __FILE__, \
727#define AssertArrayEq(expected, actual, count) \
728 __builtin_assert_eq_array( \
729 (const void *)(expected), (const void *)(actual), \
730 (long long)sizeof((expected)[0]), (long long)(count), #expected, \
731 #actual, __FILE__, __LINE__)
742#define AssertEachEq(expected, actual, count) \
744 long long _cccc_i_; \
745 for (_cccc_i_ = 0; _cccc_i_ < (long long)(count); _cccc_i_++) \
746 __builtin_assert_eq((long long)((expected)), \
747 (long long)(((const typeof(( \
748 actual)[0]) *)(actual))[_cccc_i_]), \
749 #expected, #actual "[i]", __FILE__, __LINE__); \
762#define AssertMsg(cond, msg) \
763 __builtin_assert_msg(!!(cond), #cond, msg, __FILE__, __LINE__)
772#define AssertTrueMsg(cond, msg) AssertMsg(cond, msg)
780#define AssertFalseMsg(cond, msg) \
781 __builtin_assert_msg(!(cond), #cond, msg, __FILE__, __LINE__)
790#define AssertEqMsg(a, b, msg) \
791 __builtin_assert_eq_msg((long long)(a), (long long)(b), #a, #b, msg, \
801#define AssertStrEqMsg(a, b, msg) \
802 __builtin_assert_streq_msg((a), (b), #a, #b, msg, __FILE__, __LINE__)
810#define AssertNullMsg(p, msg) \
811 __builtin_assert_null_msg((const void *)(p), #p, msg, __FILE__, __LINE__)
819#define AssertNotNullMsg(p, msg) \
820 __builtin_assert_not_null_msg((const void *)(p), #p, msg, __FILE__, \
831#define AssertBitsMsg(mask, expected, actual, msg) \
832 __builtin_assert_bits_msg((long long)(mask), (long long)(expected), \
833 (long long)(actual), #mask, #expected, #actual, \
834 msg, __FILE__, __LINE__)
void __builtin_assert_float_within(double delta, double expected, double actual, const char *ds, const char *es, const char *as, const char *file, int line)
Assert that a float is within a delta of an expected value.
void __builtin_assert_double_within(double delta, double expected, double actual, const char *ds, const char *es, const char *as, const char *file, int line)
Assert that a double is within a delta of an expected value.
void __builtin_assert_ge(long long a, long long b, const char *as, const char *bs, const char *file, int line)
Assert that one integer is greater than or equal to another.
void __builtin_assert_gt(long long a, long long b, const char *as, const char *bs, const char *file, int line)
Assert that one integer is greater than another.
void __builtin_assert_streq_len(const char *a, const char *b, long long len, const char *as, const char *bs, const char *file, int line)
Assert that two C strings are equal up to a given length.
void __builtin_assert_streq(const char *a, const char *b, const char *as, const char *bs, const char *file, int line)
Assert that two C strings are equal (full strcmp).
void __builtin_assert_bits(long long mask, long long expected, long long actual, const char *ms, const char *es, const char *as, const char *file, int line)
Assert that specific bits match between expected and actual values.
void __builtin_assert_false(int cond, const char *expr, const char *file, int line)
Assert that a condition is false.
void __builtin_assert_mem_eq(const void *expected, const void *actual, long long len, const char *es, const char *as, const char *file, int line)
Assert that two memory regions are byte-identical.
void __builtin_assert_le(long long a, long long b, const char *as, const char *bs, const char *file, int line)
Assert that one integer is less than or equal to another.
void __builtin_assert_eq_array(const void *expected, const void *actual, long long elem_size, long long count, const char *es, const char *as, const char *file, int line)
Assert that two arrays are element-by-element equal.
void __builtin_assert_bits_msg(long long mask, long long expected, long long actual, const char *ms, const char *es, const char *as, const char *msg, const char *file, int line)
Assert specific bits match with a custom message.
void __builtin_assert_not_null_msg(const void *p, const char *ps, const char *msg, const char *file, int line)
Assert a pointer is not NULL with a custom message.
void __builtin_assert_within(long long delta, long long expected, long long actual, const char *ds, const char *es, const char *as, const char *file, int line)
Assert that an integer is within a delta of an expected value.
void __builtin_assert_bit_high(int bit, long long actual, const char *bs, const char *as, const char *file, int line)
Assert that a specific bit is set (high/1).
void __builtin_assert_streq_msg(const char *a, const char *b, const char *as, const char *bs, const char *msg, const char *file, int line)
Assert two C strings are equal with a custom message.
void __builtin_assert_lt(long long a, long long b, const char *as, const char *bs, const char *file, int line)
Assert that one integer is less than another.
void __builtin_assert_eq(long long a, long long b, const char *as, const char *bs, const char *file, int line)
Assert that two integers are equal.
void __builtin_assert_null(const void *p, const char *ps, const char *file, int line)
Assert that a pointer is NULL.
void __builtin_assert_neq(long long a, long long b, const char *as, const char *bs, const char *file, int line)
Assert that two integers are not equal.
void __builtin_assert_null_msg(const void *p, const char *ps, const char *msg, const char *file, int line)
Assert a pointer is NULL with a custom message.
void __builtin_assert_fail(const char *file, int line)
Unconditionally fail a test.
void __builtin_assert(int cond, const char *expr, const char *file, int line)
Assert that a condition is true.
void __builtin_assert_eq_msg(long long a, long long b, const char *as, const char *bs, const char *msg, const char *file, int line)
Assert two integers are equal with a custom message.
void __builtin_assert_msg(int cond, const char *expr, const char *msg, const char *file, int line)
Assert a condition is true with a custom message.
void __builtin_assert_bit_low(int bit, long long actual, const char *bs, const char *as, const char *file, int line)
Assert that a specific bit is clear (low/0).
void __builtin_assert_fail_msg(const char *msg, const char *file, int line)
Unconditionally fail a test with a custom message.
void __builtin_assert_not_null(const void *p, const char *ps, const char *file, int line)
Assert that a pointer is not NULL.