mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 21:23:06 +00: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:
@@ -4,9 +4,9 @@ TEST_BEGIN(test_malloc_strtoumax_no_endptr) {
|
||||
int err;
|
||||
|
||||
set_errno(0);
|
||||
assert_ju_eq(malloc_strtoumax("0", NULL, 0), 0, "Unexpected result");
|
||||
expect_ju_eq(malloc_strtoumax("0", NULL, 0), 0, "Unexpected result");
|
||||
err = get_errno();
|
||||
assert_d_eq(err, 0, "Unexpected failure");
|
||||
expect_d_eq(err, 0, "Unexpected failure");
|
||||
}
|
||||
TEST_END
|
||||
|
||||
@@ -89,14 +89,14 @@ TEST_BEGIN(test_malloc_strtoumax) {
|
||||
set_errno(0);
|
||||
result = malloc_strtoumax(test->input, &remainder, test->base);
|
||||
err = get_errno();
|
||||
assert_d_eq(err, test->expected_errno,
|
||||
expect_d_eq(err, test->expected_errno,
|
||||
"Expected errno %s for \"%s\", base %d",
|
||||
test->expected_errno_name, test->input, test->base);
|
||||
assert_str_eq(remainder, test->expected_remainder,
|
||||
expect_str_eq(remainder, test->expected_remainder,
|
||||
"Unexpected remainder for \"%s\", base %d",
|
||||
test->input, test->base);
|
||||
if (err == 0) {
|
||||
assert_ju_eq(result, test->expected_x,
|
||||
expect_ju_eq(result, test->expected_x,
|
||||
"Unexpected result for \"%s\", base %d",
|
||||
test->input, test->base);
|
||||
}
|
||||
@@ -111,10 +111,10 @@ TEST_BEGIN(test_malloc_snprintf_truncated) {
|
||||
size_t len;
|
||||
#define TEST(expected_str_untruncated, ...) do { \
|
||||
result = malloc_snprintf(buf, len, __VA_ARGS__); \
|
||||
assert_d_eq(strncmp(buf, expected_str_untruncated, len-1), 0, \
|
||||
expect_d_eq(strncmp(buf, expected_str_untruncated, len-1), 0, \
|
||||
"Unexpected string inequality (\"%s\" vs \"%s\")", \
|
||||
buf, expected_str_untruncated); \
|
||||
assert_zu_eq(result, strlen(expected_str_untruncated), \
|
||||
expect_zu_eq(result, strlen(expected_str_untruncated), \
|
||||
"Unexpected result"); \
|
||||
} while (0)
|
||||
|
||||
@@ -142,8 +142,8 @@ TEST_BEGIN(test_malloc_snprintf) {
|
||||
size_t result;
|
||||
#define TEST(expected_str, ...) do { \
|
||||
result = malloc_snprintf(buf, sizeof(buf), __VA_ARGS__); \
|
||||
assert_str_eq(buf, expected_str, "Unexpected output"); \
|
||||
assert_zu_eq(result, strlen(expected_str), "Unexpected result");\
|
||||
expect_str_eq(buf, expected_str, "Unexpected output"); \
|
||||
expect_zu_eq(result, strlen(expected_str), "Unexpected result");\
|
||||
} while (0)
|
||||
|
||||
TEST("hello", "hello");
|
||||
|
||||
Reference in New Issue
Block a user