mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 17:17:19 +03:00
Change assert_* to expect_* in tests
```
grep -Irl assert_ test/ | xargs sed -i \
's/witness_assert/witness_do_not_replace/g';
grep -Irl assert_ test/ | xargs sed -i \
's/malloc_mutex_assert_owner/malloc_mutex_do_not_replace_owner/g';
grep -Ir assert_ test/ | grep -o "[_a-zA-Z]*assert_[_a-zA-Z]*" | \
grep -v "^assert_"; # confirm no output
grep -Irl assert_ test/ | xargs sed -i 's/assert_/expect_/g';
grep -Irl witness_do_not_replace test/ | xargs sed -i \
's/witness_do_not_replace/witness_assert/g';
grep -Irl malloc_mutex_do_not_replace_owner test/ | xargs sed -i \
's/malloc_mutex_do_not_replace_owner/malloc_mutex_assert_owner/g';
```
This commit is contained in:
parent
162c2bcf31
commit
21dfa4300d
85 changed files with 1854 additions and 1854 deletions
|
|
@ -25,6 +25,6 @@ btalloc_##n(size_t size, unsigned bits) { \
|
|||
} \
|
||||
} \
|
||||
/* Intentionally sabotage tail call optimization. */ \
|
||||
assert_ptr_not_null(p, "Unexpected mallocx() failure"); \
|
||||
expect_ptr_not_null(p, "Unexpected mallocx() failure"); \
|
||||
return p; \
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,9 +86,9 @@ extent_alloc_hook(extent_hooks_t *extent_hooks, void *new_addr, size_t size,
|
|||
"*zero=%s, *commit=%s, arena_ind=%u)\n", __func__, extent_hooks,
|
||||
new_addr, size, alignment, *zero ? "true" : "false", *commit ?
|
||||
"true" : "false", arena_ind);
|
||||
assert_ptr_eq(extent_hooks, &hooks,
|
||||
expect_ptr_eq(extent_hooks, &hooks,
|
||||
"extent_hooks should be same as pointer used to set hooks");
|
||||
assert_ptr_eq(extent_hooks->alloc, extent_alloc_hook,
|
||||
expect_ptr_eq(extent_hooks->alloc, extent_alloc_hook,
|
||||
"Wrong hook function");
|
||||
called_alloc = true;
|
||||
if (!try_alloc) {
|
||||
|
|
@ -108,9 +108,9 @@ extent_dalloc_hook(extent_hooks_t *extent_hooks, void *addr, size_t size,
|
|||
TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, committed=%s, "
|
||||
"arena_ind=%u)\n", __func__, extent_hooks, addr, size, committed ?
|
||||
"true" : "false", arena_ind);
|
||||
assert_ptr_eq(extent_hooks, &hooks,
|
||||
expect_ptr_eq(extent_hooks, &hooks,
|
||||
"extent_hooks should be same as pointer used to set hooks");
|
||||
assert_ptr_eq(extent_hooks->dalloc, extent_dalloc_hook,
|
||||
expect_ptr_eq(extent_hooks->dalloc, extent_dalloc_hook,
|
||||
"Wrong hook function");
|
||||
called_dalloc = true;
|
||||
if (!try_dalloc) {
|
||||
|
|
@ -127,9 +127,9 @@ extent_destroy_hook(extent_hooks_t *extent_hooks, void *addr, size_t size,
|
|||
TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, committed=%s, "
|
||||
"arena_ind=%u)\n", __func__, extent_hooks, addr, size, committed ?
|
||||
"true" : "false", arena_ind);
|
||||
assert_ptr_eq(extent_hooks, &hooks,
|
||||
expect_ptr_eq(extent_hooks, &hooks,
|
||||
"extent_hooks should be same as pointer used to set hooks");
|
||||
assert_ptr_eq(extent_hooks->destroy, extent_destroy_hook,
|
||||
expect_ptr_eq(extent_hooks->destroy, extent_destroy_hook,
|
||||
"Wrong hook function");
|
||||
called_destroy = true;
|
||||
if (!try_destroy) {
|
||||
|
|
@ -147,9 +147,9 @@ extent_commit_hook(extent_hooks_t *extent_hooks, void *addr, size_t size,
|
|||
TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, offset=%zu, "
|
||||
"length=%zu, arena_ind=%u)\n", __func__, extent_hooks, addr, size,
|
||||
offset, length, arena_ind);
|
||||
assert_ptr_eq(extent_hooks, &hooks,
|
||||
expect_ptr_eq(extent_hooks, &hooks,
|
||||
"extent_hooks should be same as pointer used to set hooks");
|
||||
assert_ptr_eq(extent_hooks->commit, extent_commit_hook,
|
||||
expect_ptr_eq(extent_hooks->commit, extent_commit_hook,
|
||||
"Wrong hook function");
|
||||
called_commit = true;
|
||||
if (!try_commit) {
|
||||
|
|
@ -169,9 +169,9 @@ extent_decommit_hook(extent_hooks_t *extent_hooks, void *addr, size_t size,
|
|||
TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, offset=%zu, "
|
||||
"length=%zu, arena_ind=%u)\n", __func__, extent_hooks, addr, size,
|
||||
offset, length, arena_ind);
|
||||
assert_ptr_eq(extent_hooks, &hooks,
|
||||
expect_ptr_eq(extent_hooks, &hooks,
|
||||
"extent_hooks should be same as pointer used to set hooks");
|
||||
assert_ptr_eq(extent_hooks->decommit, extent_decommit_hook,
|
||||
expect_ptr_eq(extent_hooks->decommit, extent_decommit_hook,
|
||||
"Wrong hook function");
|
||||
called_decommit = true;
|
||||
if (!try_decommit) {
|
||||
|
|
@ -191,9 +191,9 @@ extent_purge_lazy_hook(extent_hooks_t *extent_hooks, void *addr, size_t size,
|
|||
TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, offset=%zu, "
|
||||
"length=%zu arena_ind=%u)\n", __func__, extent_hooks, addr, size,
|
||||
offset, length, arena_ind);
|
||||
assert_ptr_eq(extent_hooks, &hooks,
|
||||
expect_ptr_eq(extent_hooks, &hooks,
|
||||
"extent_hooks should be same as pointer used to set hooks");
|
||||
assert_ptr_eq(extent_hooks->purge_lazy, extent_purge_lazy_hook,
|
||||
expect_ptr_eq(extent_hooks->purge_lazy, extent_purge_lazy_hook,
|
||||
"Wrong hook function");
|
||||
called_purge_lazy = true;
|
||||
if (!try_purge_lazy) {
|
||||
|
|
@ -214,9 +214,9 @@ extent_purge_forced_hook(extent_hooks_t *extent_hooks, void *addr, size_t size,
|
|||
TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, offset=%zu, "
|
||||
"length=%zu arena_ind=%u)\n", __func__, extent_hooks, addr, size,
|
||||
offset, length, arena_ind);
|
||||
assert_ptr_eq(extent_hooks, &hooks,
|
||||
expect_ptr_eq(extent_hooks, &hooks,
|
||||
"extent_hooks should be same as pointer used to set hooks");
|
||||
assert_ptr_eq(extent_hooks->purge_forced, extent_purge_forced_hook,
|
||||
expect_ptr_eq(extent_hooks->purge_forced, extent_purge_forced_hook,
|
||||
"Wrong hook function");
|
||||
called_purge_forced = true;
|
||||
if (!try_purge_forced) {
|
||||
|
|
@ -238,9 +238,9 @@ extent_split_hook(extent_hooks_t *extent_hooks, void *addr, size_t size,
|
|||
"size_b=%zu, committed=%s, arena_ind=%u)\n", __func__, extent_hooks,
|
||||
addr, size, size_a, size_b, committed ? "true" : "false",
|
||||
arena_ind);
|
||||
assert_ptr_eq(extent_hooks, &hooks,
|
||||
expect_ptr_eq(extent_hooks, &hooks,
|
||||
"extent_hooks should be same as pointer used to set hooks");
|
||||
assert_ptr_eq(extent_hooks->split, extent_split_hook,
|
||||
expect_ptr_eq(extent_hooks->split, extent_split_hook,
|
||||
"Wrong hook function");
|
||||
called_split = true;
|
||||
if (!try_split) {
|
||||
|
|
@ -262,11 +262,11 @@ extent_merge_hook(extent_hooks_t *extent_hooks, void *addr_a, size_t size_a,
|
|||
"size_b=%zu, committed=%s, arena_ind=%u)\n", __func__, extent_hooks,
|
||||
addr_a, size_a, addr_b, size_b, committed ? "true" : "false",
|
||||
arena_ind);
|
||||
assert_ptr_eq(extent_hooks, &hooks,
|
||||
expect_ptr_eq(extent_hooks, &hooks,
|
||||
"extent_hooks should be same as pointer used to set hooks");
|
||||
assert_ptr_eq(extent_hooks->merge, extent_merge_hook,
|
||||
expect_ptr_eq(extent_hooks->merge, extent_merge_hook,
|
||||
"Wrong hook function");
|
||||
assert_ptr_eq((void *)((uintptr_t)addr_a + size_a), addr_b,
|
||||
expect_ptr_eq((void *)((uintptr_t)addr_a + size_a), addr_b,
|
||||
"Extents not mergeable");
|
||||
called_merge = true;
|
||||
if (!try_merge) {
|
||||
|
|
@ -284,6 +284,6 @@ extent_hooks_prep(void) {
|
|||
size_t sz;
|
||||
|
||||
sz = sizeof(default_hooks);
|
||||
assert_d_eq(mallctl("arena.0.extent_hooks", (void *)&default_hooks, &sz,
|
||||
expect_d_eq(mallctl("arena.0.extent_hooks", (void *)&default_hooks, &sz,
|
||||
NULL, 0), 0, "Unexpected mallctl() error");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ static const bool config_debug =
|
|||
#undef assert
|
||||
#undef not_reached
|
||||
#undef not_implemented
|
||||
#undef assert_not_implemented
|
||||
#undef expect_not_implemented
|
||||
|
||||
#define assert(e) do { \
|
||||
if (!(e)) { \
|
||||
|
|
@ -163,7 +163,7 @@ static const bool config_debug =
|
|||
abort(); \
|
||||
} while (0)
|
||||
|
||||
#define assert_not_implemented(e) do { \
|
||||
#define expect_not_implemented(e) do { \
|
||||
if (!(e)) { \
|
||||
not_implemented(); \
|
||||
} \
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#define ASSERT_BUFSIZE 256
|
||||
|
||||
#define assert_cmp(t, a, b, cmp, neg_cmp, pri, ...) do { \
|
||||
#define expect_cmp(t, a, b, cmp, neg_cmp, pri, ...) do { \
|
||||
const t a_ = (a); \
|
||||
const t b_ = (b); \
|
||||
if (!(a_ cmp b_)) { \
|
||||
|
|
@ -17,200 +17,200 @@
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
#define assert_ptr_eq(a, b, ...) assert_cmp(void *, a, b, ==, \
|
||||
#define expect_ptr_eq(a, b, ...) expect_cmp(void *, a, b, ==, \
|
||||
!=, "p", __VA_ARGS__)
|
||||
#define assert_ptr_ne(a, b, ...) assert_cmp(void *, a, b, !=, \
|
||||
#define expect_ptr_ne(a, b, ...) expect_cmp(void *, a, b, !=, \
|
||||
==, "p", __VA_ARGS__)
|
||||
#define assert_ptr_null(a, ...) assert_cmp(void *, a, NULL, ==, \
|
||||
#define expect_ptr_null(a, ...) expect_cmp(void *, a, NULL, ==, \
|
||||
!=, "p", __VA_ARGS__)
|
||||
#define assert_ptr_not_null(a, ...) assert_cmp(void *, a, NULL, !=, \
|
||||
#define expect_ptr_not_null(a, ...) expect_cmp(void *, a, NULL, !=, \
|
||||
==, "p", __VA_ARGS__)
|
||||
|
||||
#define assert_c_eq(a, b, ...) assert_cmp(char, a, b, ==, !=, "c", __VA_ARGS__)
|
||||
#define assert_c_ne(a, b, ...) assert_cmp(char, a, b, !=, ==, "c", __VA_ARGS__)
|
||||
#define assert_c_lt(a, b, ...) assert_cmp(char, a, b, <, >=, "c", __VA_ARGS__)
|
||||
#define assert_c_le(a, b, ...) assert_cmp(char, a, b, <=, >, "c", __VA_ARGS__)
|
||||
#define assert_c_ge(a, b, ...) assert_cmp(char, a, b, >=, <, "c", __VA_ARGS__)
|
||||
#define assert_c_gt(a, b, ...) assert_cmp(char, a, b, >, <=, "c", __VA_ARGS__)
|
||||
#define expect_c_eq(a, b, ...) expect_cmp(char, a, b, ==, !=, "c", __VA_ARGS__)
|
||||
#define expect_c_ne(a, b, ...) expect_cmp(char, a, b, !=, ==, "c", __VA_ARGS__)
|
||||
#define expect_c_lt(a, b, ...) expect_cmp(char, a, b, <, >=, "c", __VA_ARGS__)
|
||||
#define expect_c_le(a, b, ...) expect_cmp(char, a, b, <=, >, "c", __VA_ARGS__)
|
||||
#define expect_c_ge(a, b, ...) expect_cmp(char, a, b, >=, <, "c", __VA_ARGS__)
|
||||
#define expect_c_gt(a, b, ...) expect_cmp(char, a, b, >, <=, "c", __VA_ARGS__)
|
||||
|
||||
#define assert_x_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "#x", __VA_ARGS__)
|
||||
#define assert_x_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "#x", __VA_ARGS__)
|
||||
#define assert_x_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "#x", __VA_ARGS__)
|
||||
#define assert_x_le(a, b, ...) assert_cmp(int, a, b, <=, >, "#x", __VA_ARGS__)
|
||||
#define assert_x_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "#x", __VA_ARGS__)
|
||||
#define assert_x_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "#x", __VA_ARGS__)
|
||||
#define expect_x_eq(a, b, ...) expect_cmp(int, a, b, ==, !=, "#x", __VA_ARGS__)
|
||||
#define expect_x_ne(a, b, ...) expect_cmp(int, a, b, !=, ==, "#x", __VA_ARGS__)
|
||||
#define expect_x_lt(a, b, ...) expect_cmp(int, a, b, <, >=, "#x", __VA_ARGS__)
|
||||
#define expect_x_le(a, b, ...) expect_cmp(int, a, b, <=, >, "#x", __VA_ARGS__)
|
||||
#define expect_x_ge(a, b, ...) expect_cmp(int, a, b, >=, <, "#x", __VA_ARGS__)
|
||||
#define expect_x_gt(a, b, ...) expect_cmp(int, a, b, >, <=, "#x", __VA_ARGS__)
|
||||
|
||||
#define assert_d_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "d", __VA_ARGS__)
|
||||
#define assert_d_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "d", __VA_ARGS__)
|
||||
#define assert_d_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "d", __VA_ARGS__)
|
||||
#define assert_d_le(a, b, ...) assert_cmp(int, a, b, <=, >, "d", __VA_ARGS__)
|
||||
#define assert_d_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "d", __VA_ARGS__)
|
||||
#define assert_d_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "d", __VA_ARGS__)
|
||||
#define expect_d_eq(a, b, ...) expect_cmp(int, a, b, ==, !=, "d", __VA_ARGS__)
|
||||
#define expect_d_ne(a, b, ...) expect_cmp(int, a, b, !=, ==, "d", __VA_ARGS__)
|
||||
#define expect_d_lt(a, b, ...) expect_cmp(int, a, b, <, >=, "d", __VA_ARGS__)
|
||||
#define expect_d_le(a, b, ...) expect_cmp(int, a, b, <=, >, "d", __VA_ARGS__)
|
||||
#define expect_d_ge(a, b, ...) expect_cmp(int, a, b, >=, <, "d", __VA_ARGS__)
|
||||
#define expect_d_gt(a, b, ...) expect_cmp(int, a, b, >, <=, "d", __VA_ARGS__)
|
||||
|
||||
#define assert_u_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "u", __VA_ARGS__)
|
||||
#define assert_u_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "u", __VA_ARGS__)
|
||||
#define assert_u_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "u", __VA_ARGS__)
|
||||
#define assert_u_le(a, b, ...) assert_cmp(int, a, b, <=, >, "u", __VA_ARGS__)
|
||||
#define assert_u_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "u", __VA_ARGS__)
|
||||
#define assert_u_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "u", __VA_ARGS__)
|
||||
#define expect_u_eq(a, b, ...) expect_cmp(int, a, b, ==, !=, "u", __VA_ARGS__)
|
||||
#define expect_u_ne(a, b, ...) expect_cmp(int, a, b, !=, ==, "u", __VA_ARGS__)
|
||||
#define expect_u_lt(a, b, ...) expect_cmp(int, a, b, <, >=, "u", __VA_ARGS__)
|
||||
#define expect_u_le(a, b, ...) expect_cmp(int, a, b, <=, >, "u", __VA_ARGS__)
|
||||
#define expect_u_ge(a, b, ...) expect_cmp(int, a, b, >=, <, "u", __VA_ARGS__)
|
||||
#define expect_u_gt(a, b, ...) expect_cmp(int, a, b, >, <=, "u", __VA_ARGS__)
|
||||
|
||||
#define assert_ld_eq(a, b, ...) assert_cmp(long, a, b, ==, \
|
||||
#define expect_ld_eq(a, b, ...) expect_cmp(long, a, b, ==, \
|
||||
!=, "ld", __VA_ARGS__)
|
||||
#define assert_ld_ne(a, b, ...) assert_cmp(long, a, b, !=, \
|
||||
#define expect_ld_ne(a, b, ...) expect_cmp(long, a, b, !=, \
|
||||
==, "ld", __VA_ARGS__)
|
||||
#define assert_ld_lt(a, b, ...) assert_cmp(long, a, b, <, \
|
||||
#define expect_ld_lt(a, b, ...) expect_cmp(long, a, b, <, \
|
||||
>=, "ld", __VA_ARGS__)
|
||||
#define assert_ld_le(a, b, ...) assert_cmp(long, a, b, <=, \
|
||||
#define expect_ld_le(a, b, ...) expect_cmp(long, a, b, <=, \
|
||||
>, "ld", __VA_ARGS__)
|
||||
#define assert_ld_ge(a, b, ...) assert_cmp(long, a, b, >=, \
|
||||
#define expect_ld_ge(a, b, ...) expect_cmp(long, a, b, >=, \
|
||||
<, "ld", __VA_ARGS__)
|
||||
#define assert_ld_gt(a, b, ...) assert_cmp(long, a, b, >, \
|
||||
#define expect_ld_gt(a, b, ...) expect_cmp(long, a, b, >, \
|
||||
<=, "ld", __VA_ARGS__)
|
||||
|
||||
#define assert_lu_eq(a, b, ...) assert_cmp(unsigned long, \
|
||||
#define expect_lu_eq(a, b, ...) expect_cmp(unsigned long, \
|
||||
a, b, ==, !=, "lu", __VA_ARGS__)
|
||||
#define assert_lu_ne(a, b, ...) assert_cmp(unsigned long, \
|
||||
#define expect_lu_ne(a, b, ...) expect_cmp(unsigned long, \
|
||||
a, b, !=, ==, "lu", __VA_ARGS__)
|
||||
#define assert_lu_lt(a, b, ...) assert_cmp(unsigned long, \
|
||||
#define expect_lu_lt(a, b, ...) expect_cmp(unsigned long, \
|
||||
a, b, <, >=, "lu", __VA_ARGS__)
|
||||
#define assert_lu_le(a, b, ...) assert_cmp(unsigned long, \
|
||||
#define expect_lu_le(a, b, ...) expect_cmp(unsigned long, \
|
||||
a, b, <=, >, "lu", __VA_ARGS__)
|
||||
#define assert_lu_ge(a, b, ...) assert_cmp(unsigned long, \
|
||||
#define expect_lu_ge(a, b, ...) expect_cmp(unsigned long, \
|
||||
a, b, >=, <, "lu", __VA_ARGS__)
|
||||
#define assert_lu_gt(a, b, ...) assert_cmp(unsigned long, \
|
||||
#define expect_lu_gt(a, b, ...) expect_cmp(unsigned long, \
|
||||
a, b, >, <=, "lu", __VA_ARGS__)
|
||||
|
||||
#define assert_qd_eq(a, b, ...) assert_cmp(long long, a, b, ==, \
|
||||
#define expect_qd_eq(a, b, ...) expect_cmp(long long, a, b, ==, \
|
||||
!=, "qd", __VA_ARGS__)
|
||||
#define assert_qd_ne(a, b, ...) assert_cmp(long long, a, b, !=, \
|
||||
#define expect_qd_ne(a, b, ...) expect_cmp(long long, a, b, !=, \
|
||||
==, "qd", __VA_ARGS__)
|
||||
#define assert_qd_lt(a, b, ...) assert_cmp(long long, a, b, <, \
|
||||
#define expect_qd_lt(a, b, ...) expect_cmp(long long, a, b, <, \
|
||||
>=, "qd", __VA_ARGS__)
|
||||
#define assert_qd_le(a, b, ...) assert_cmp(long long, a, b, <=, \
|
||||
#define expect_qd_le(a, b, ...) expect_cmp(long long, a, b, <=, \
|
||||
>, "qd", __VA_ARGS__)
|
||||
#define assert_qd_ge(a, b, ...) assert_cmp(long long, a, b, >=, \
|
||||
#define expect_qd_ge(a, b, ...) expect_cmp(long long, a, b, >=, \
|
||||
<, "qd", __VA_ARGS__)
|
||||
#define assert_qd_gt(a, b, ...) assert_cmp(long long, a, b, >, \
|
||||
#define expect_qd_gt(a, b, ...) expect_cmp(long long, a, b, >, \
|
||||
<=, "qd", __VA_ARGS__)
|
||||
|
||||
#define assert_qu_eq(a, b, ...) assert_cmp(unsigned long long, \
|
||||
#define expect_qu_eq(a, b, ...) expect_cmp(unsigned long long, \
|
||||
a, b, ==, !=, "qu", __VA_ARGS__)
|
||||
#define assert_qu_ne(a, b, ...) assert_cmp(unsigned long long, \
|
||||
#define expect_qu_ne(a, b, ...) expect_cmp(unsigned long long, \
|
||||
a, b, !=, ==, "qu", __VA_ARGS__)
|
||||
#define assert_qu_lt(a, b, ...) assert_cmp(unsigned long long, \
|
||||
#define expect_qu_lt(a, b, ...) expect_cmp(unsigned long long, \
|
||||
a, b, <, >=, "qu", __VA_ARGS__)
|
||||
#define assert_qu_le(a, b, ...) assert_cmp(unsigned long long, \
|
||||
#define expect_qu_le(a, b, ...) expect_cmp(unsigned long long, \
|
||||
a, b, <=, >, "qu", __VA_ARGS__)
|
||||
#define assert_qu_ge(a, b, ...) assert_cmp(unsigned long long, \
|
||||
#define expect_qu_ge(a, b, ...) expect_cmp(unsigned long long, \
|
||||
a, b, >=, <, "qu", __VA_ARGS__)
|
||||
#define assert_qu_gt(a, b, ...) assert_cmp(unsigned long long, \
|
||||
#define expect_qu_gt(a, b, ...) expect_cmp(unsigned long long, \
|
||||
a, b, >, <=, "qu", __VA_ARGS__)
|
||||
|
||||
#define assert_jd_eq(a, b, ...) assert_cmp(intmax_t, a, b, ==, \
|
||||
#define expect_jd_eq(a, b, ...) expect_cmp(intmax_t, a, b, ==, \
|
||||
!=, "jd", __VA_ARGS__)
|
||||
#define assert_jd_ne(a, b, ...) assert_cmp(intmax_t, a, b, !=, \
|
||||
#define expect_jd_ne(a, b, ...) expect_cmp(intmax_t, a, b, !=, \
|
||||
==, "jd", __VA_ARGS__)
|
||||
#define assert_jd_lt(a, b, ...) assert_cmp(intmax_t, a, b, <, \
|
||||
#define expect_jd_lt(a, b, ...) expect_cmp(intmax_t, a, b, <, \
|
||||
>=, "jd", __VA_ARGS__)
|
||||
#define assert_jd_le(a, b, ...) assert_cmp(intmax_t, a, b, <=, \
|
||||
#define expect_jd_le(a, b, ...) expect_cmp(intmax_t, a, b, <=, \
|
||||
>, "jd", __VA_ARGS__)
|
||||
#define assert_jd_ge(a, b, ...) assert_cmp(intmax_t, a, b, >=, \
|
||||
#define expect_jd_ge(a, b, ...) expect_cmp(intmax_t, a, b, >=, \
|
||||
<, "jd", __VA_ARGS__)
|
||||
#define assert_jd_gt(a, b, ...) assert_cmp(intmax_t, a, b, >, \
|
||||
#define expect_jd_gt(a, b, ...) expect_cmp(intmax_t, a, b, >, \
|
||||
<=, "jd", __VA_ARGS__)
|
||||
|
||||
#define assert_ju_eq(a, b, ...) assert_cmp(uintmax_t, a, b, ==, \
|
||||
#define expect_ju_eq(a, b, ...) expect_cmp(uintmax_t, a, b, ==, \
|
||||
!=, "ju", __VA_ARGS__)
|
||||
#define assert_ju_ne(a, b, ...) assert_cmp(uintmax_t, a, b, !=, \
|
||||
#define expect_ju_ne(a, b, ...) expect_cmp(uintmax_t, a, b, !=, \
|
||||
==, "ju", __VA_ARGS__)
|
||||
#define assert_ju_lt(a, b, ...) assert_cmp(uintmax_t, a, b, <, \
|
||||
#define expect_ju_lt(a, b, ...) expect_cmp(uintmax_t, a, b, <, \
|
||||
>=, "ju", __VA_ARGS__)
|
||||
#define assert_ju_le(a, b, ...) assert_cmp(uintmax_t, a, b, <=, \
|
||||
#define expect_ju_le(a, b, ...) expect_cmp(uintmax_t, a, b, <=, \
|
||||
>, "ju", __VA_ARGS__)
|
||||
#define assert_ju_ge(a, b, ...) assert_cmp(uintmax_t, a, b, >=, \
|
||||
#define expect_ju_ge(a, b, ...) expect_cmp(uintmax_t, a, b, >=, \
|
||||
<, "ju", __VA_ARGS__)
|
||||
#define assert_ju_gt(a, b, ...) assert_cmp(uintmax_t, a, b, >, \
|
||||
#define expect_ju_gt(a, b, ...) expect_cmp(uintmax_t, a, b, >, \
|
||||
<=, "ju", __VA_ARGS__)
|
||||
|
||||
#define assert_zd_eq(a, b, ...) assert_cmp(ssize_t, a, b, ==, \
|
||||
#define expect_zd_eq(a, b, ...) expect_cmp(ssize_t, a, b, ==, \
|
||||
!=, "zd", __VA_ARGS__)
|
||||
#define assert_zd_ne(a, b, ...) assert_cmp(ssize_t, a, b, !=, \
|
||||
#define expect_zd_ne(a, b, ...) expect_cmp(ssize_t, a, b, !=, \
|
||||
==, "zd", __VA_ARGS__)
|
||||
#define assert_zd_lt(a, b, ...) assert_cmp(ssize_t, a, b, <, \
|
||||
#define expect_zd_lt(a, b, ...) expect_cmp(ssize_t, a, b, <, \
|
||||
>=, "zd", __VA_ARGS__)
|
||||
#define assert_zd_le(a, b, ...) assert_cmp(ssize_t, a, b, <=, \
|
||||
#define expect_zd_le(a, b, ...) expect_cmp(ssize_t, a, b, <=, \
|
||||
>, "zd", __VA_ARGS__)
|
||||
#define assert_zd_ge(a, b, ...) assert_cmp(ssize_t, a, b, >=, \
|
||||
#define expect_zd_ge(a, b, ...) expect_cmp(ssize_t, a, b, >=, \
|
||||
<, "zd", __VA_ARGS__)
|
||||
#define assert_zd_gt(a, b, ...) assert_cmp(ssize_t, a, b, >, \
|
||||
#define expect_zd_gt(a, b, ...) expect_cmp(ssize_t, a, b, >, \
|
||||
<=, "zd", __VA_ARGS__)
|
||||
|
||||
#define assert_zu_eq(a, b, ...) assert_cmp(size_t, a, b, ==, \
|
||||
#define expect_zu_eq(a, b, ...) expect_cmp(size_t, a, b, ==, \
|
||||
!=, "zu", __VA_ARGS__)
|
||||
#define assert_zu_ne(a, b, ...) assert_cmp(size_t, a, b, !=, \
|
||||
#define expect_zu_ne(a, b, ...) expect_cmp(size_t, a, b, !=, \
|
||||
==, "zu", __VA_ARGS__)
|
||||
#define assert_zu_lt(a, b, ...) assert_cmp(size_t, a, b, <, \
|
||||
#define expect_zu_lt(a, b, ...) expect_cmp(size_t, a, b, <, \
|
||||
>=, "zu", __VA_ARGS__)
|
||||
#define assert_zu_le(a, b, ...) assert_cmp(size_t, a, b, <=, \
|
||||
#define expect_zu_le(a, b, ...) expect_cmp(size_t, a, b, <=, \
|
||||
>, "zu", __VA_ARGS__)
|
||||
#define assert_zu_ge(a, b, ...) assert_cmp(size_t, a, b, >=, \
|
||||
#define expect_zu_ge(a, b, ...) expect_cmp(size_t, a, b, >=, \
|
||||
<, "zu", __VA_ARGS__)
|
||||
#define assert_zu_gt(a, b, ...) assert_cmp(size_t, a, b, >, \
|
||||
#define expect_zu_gt(a, b, ...) expect_cmp(size_t, a, b, >, \
|
||||
<=, "zu", __VA_ARGS__)
|
||||
|
||||
#define assert_d32_eq(a, b, ...) assert_cmp(int32_t, a, b, ==, \
|
||||
#define expect_d32_eq(a, b, ...) expect_cmp(int32_t, a, b, ==, \
|
||||
!=, FMTd32, __VA_ARGS__)
|
||||
#define assert_d32_ne(a, b, ...) assert_cmp(int32_t, a, b, !=, \
|
||||
#define expect_d32_ne(a, b, ...) expect_cmp(int32_t, a, b, !=, \
|
||||
==, FMTd32, __VA_ARGS__)
|
||||
#define assert_d32_lt(a, b, ...) assert_cmp(int32_t, a, b, <, \
|
||||
#define expect_d32_lt(a, b, ...) expect_cmp(int32_t, a, b, <, \
|
||||
>=, FMTd32, __VA_ARGS__)
|
||||
#define assert_d32_le(a, b, ...) assert_cmp(int32_t, a, b, <=, \
|
||||
#define expect_d32_le(a, b, ...) expect_cmp(int32_t, a, b, <=, \
|
||||
>, FMTd32, __VA_ARGS__)
|
||||
#define assert_d32_ge(a, b, ...) assert_cmp(int32_t, a, b, >=, \
|
||||
#define expect_d32_ge(a, b, ...) expect_cmp(int32_t, a, b, >=, \
|
||||
<, FMTd32, __VA_ARGS__)
|
||||
#define assert_d32_gt(a, b, ...) assert_cmp(int32_t, a, b, >, \
|
||||
#define expect_d32_gt(a, b, ...) expect_cmp(int32_t, a, b, >, \
|
||||
<=, FMTd32, __VA_ARGS__)
|
||||
|
||||
#define assert_u32_eq(a, b, ...) assert_cmp(uint32_t, a, b, ==, \
|
||||
#define expect_u32_eq(a, b, ...) expect_cmp(uint32_t, a, b, ==, \
|
||||
!=, FMTu32, __VA_ARGS__)
|
||||
#define assert_u32_ne(a, b, ...) assert_cmp(uint32_t, a, b, !=, \
|
||||
#define expect_u32_ne(a, b, ...) expect_cmp(uint32_t, a, b, !=, \
|
||||
==, FMTu32, __VA_ARGS__)
|
||||
#define assert_u32_lt(a, b, ...) assert_cmp(uint32_t, a, b, <, \
|
||||
#define expect_u32_lt(a, b, ...) expect_cmp(uint32_t, a, b, <, \
|
||||
>=, FMTu32, __VA_ARGS__)
|
||||
#define assert_u32_le(a, b, ...) assert_cmp(uint32_t, a, b, <=, \
|
||||
#define expect_u32_le(a, b, ...) expect_cmp(uint32_t, a, b, <=, \
|
||||
>, FMTu32, __VA_ARGS__)
|
||||
#define assert_u32_ge(a, b, ...) assert_cmp(uint32_t, a, b, >=, \
|
||||
#define expect_u32_ge(a, b, ...) expect_cmp(uint32_t, a, b, >=, \
|
||||
<, FMTu32, __VA_ARGS__)
|
||||
#define assert_u32_gt(a, b, ...) assert_cmp(uint32_t, a, b, >, \
|
||||
#define expect_u32_gt(a, b, ...) expect_cmp(uint32_t, a, b, >, \
|
||||
<=, FMTu32, __VA_ARGS__)
|
||||
|
||||
#define assert_d64_eq(a, b, ...) assert_cmp(int64_t, a, b, ==, \
|
||||
#define expect_d64_eq(a, b, ...) expect_cmp(int64_t, a, b, ==, \
|
||||
!=, FMTd64, __VA_ARGS__)
|
||||
#define assert_d64_ne(a, b, ...) assert_cmp(int64_t, a, b, !=, \
|
||||
#define expect_d64_ne(a, b, ...) expect_cmp(int64_t, a, b, !=, \
|
||||
==, FMTd64, __VA_ARGS__)
|
||||
#define assert_d64_lt(a, b, ...) assert_cmp(int64_t, a, b, <, \
|
||||
#define expect_d64_lt(a, b, ...) expect_cmp(int64_t, a, b, <, \
|
||||
>=, FMTd64, __VA_ARGS__)
|
||||
#define assert_d64_le(a, b, ...) assert_cmp(int64_t, a, b, <=, \
|
||||
#define expect_d64_le(a, b, ...) expect_cmp(int64_t, a, b, <=, \
|
||||
>, FMTd64, __VA_ARGS__)
|
||||
#define assert_d64_ge(a, b, ...) assert_cmp(int64_t, a, b, >=, \
|
||||
#define expect_d64_ge(a, b, ...) expect_cmp(int64_t, a, b, >=, \
|
||||
<, FMTd64, __VA_ARGS__)
|
||||
#define assert_d64_gt(a, b, ...) assert_cmp(int64_t, a, b, >, \
|
||||
#define expect_d64_gt(a, b, ...) expect_cmp(int64_t, a, b, >, \
|
||||
<=, FMTd64, __VA_ARGS__)
|
||||
|
||||
#define assert_u64_eq(a, b, ...) assert_cmp(uint64_t, a, b, ==, \
|
||||
#define expect_u64_eq(a, b, ...) expect_cmp(uint64_t, a, b, ==, \
|
||||
!=, FMTu64, __VA_ARGS__)
|
||||
#define assert_u64_ne(a, b, ...) assert_cmp(uint64_t, a, b, !=, \
|
||||
#define expect_u64_ne(a, b, ...) expect_cmp(uint64_t, a, b, !=, \
|
||||
==, FMTu64, __VA_ARGS__)
|
||||
#define assert_u64_lt(a, b, ...) assert_cmp(uint64_t, a, b, <, \
|
||||
#define expect_u64_lt(a, b, ...) expect_cmp(uint64_t, a, b, <, \
|
||||
>=, FMTu64, __VA_ARGS__)
|
||||
#define assert_u64_le(a, b, ...) assert_cmp(uint64_t, a, b, <=, \
|
||||
#define expect_u64_le(a, b, ...) expect_cmp(uint64_t, a, b, <=, \
|
||||
>, FMTu64, __VA_ARGS__)
|
||||
#define assert_u64_ge(a, b, ...) assert_cmp(uint64_t, a, b, >=, \
|
||||
#define expect_u64_ge(a, b, ...) expect_cmp(uint64_t, a, b, >=, \
|
||||
<, FMTu64, __VA_ARGS__)
|
||||
#define assert_u64_gt(a, b, ...) assert_cmp(uint64_t, a, b, >, \
|
||||
#define expect_u64_gt(a, b, ...) expect_cmp(uint64_t, a, b, >, \
|
||||
<=, FMTu64, __VA_ARGS__)
|
||||
|
||||
#define assert_b_eq(a, b, ...) do { \
|
||||
#define expect_b_eq(a, b, ...) do { \
|
||||
bool a_ = (a); \
|
||||
bool b_ = (b); \
|
||||
if (!(a_ == b_)) { \
|
||||
|
|
@ -226,7 +226,7 @@
|
|||
p_test_fail(prefix, message); \
|
||||
} \
|
||||
} while (0)
|
||||
#define assert_b_ne(a, b, ...) do { \
|
||||
#define expect_b_ne(a, b, ...) do { \
|
||||
bool a_ = (a); \
|
||||
bool b_ = (b); \
|
||||
if (!(a_ != b_)) { \
|
||||
|
|
@ -242,10 +242,10 @@
|
|||
p_test_fail(prefix, message); \
|
||||
} \
|
||||
} while (0)
|
||||
#define assert_true(a, ...) assert_b_eq(a, true, __VA_ARGS__)
|
||||
#define assert_false(a, ...) assert_b_eq(a, false, __VA_ARGS__)
|
||||
#define expect_true(a, ...) expect_b_eq(a, true, __VA_ARGS__)
|
||||
#define expect_false(a, ...) expect_b_eq(a, false, __VA_ARGS__)
|
||||
|
||||
#define assert_str_eq(a, b, ...) do { \
|
||||
#define expect_str_eq(a, b, ...) do { \
|
||||
if (strcmp((a), (b))) { \
|
||||
char prefix[ASSERT_BUFSIZE]; \
|
||||
char message[ASSERT_BUFSIZE]; \
|
||||
|
|
@ -258,7 +258,7 @@
|
|||
p_test_fail(prefix, message); \
|
||||
} \
|
||||
} while (0)
|
||||
#define assert_str_ne(a, b, ...) do { \
|
||||
#define expect_str_ne(a, b, ...) do { \
|
||||
if (!strcmp((a), (b))) { \
|
||||
char prefix[ASSERT_BUFSIZE]; \
|
||||
char message[ASSERT_BUFSIZE]; \
|
||||
|
|
@ -272,7 +272,7 @@
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
#define assert_not_reached(...) do { \
|
||||
#define expect_not_reached(...) do { \
|
||||
char prefix[ASSERT_BUFSIZE]; \
|
||||
char message[ASSERT_BUFSIZE]; \
|
||||
malloc_snprintf(prefix, sizeof(prefix), \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue