mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-24 22:03:07 +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:
@@ -6,9 +6,9 @@ TEST_BEGIN(test_nstime_init) {
|
||||
nstime_t nst;
|
||||
|
||||
nstime_init(&nst, 42000000043);
|
||||
assert_u64_eq(nstime_ns(&nst), 42000000043, "ns incorrectly read");
|
||||
assert_u64_eq(nstime_sec(&nst), 42, "sec incorrectly read");
|
||||
assert_u64_eq(nstime_nsec(&nst), 43, "nsec incorrectly read");
|
||||
expect_u64_eq(nstime_ns(&nst), 42000000043, "ns incorrectly read");
|
||||
expect_u64_eq(nstime_sec(&nst), 42, "sec incorrectly read");
|
||||
expect_u64_eq(nstime_nsec(&nst), 43, "nsec incorrectly read");
|
||||
}
|
||||
TEST_END
|
||||
|
||||
@@ -16,8 +16,8 @@ TEST_BEGIN(test_nstime_init2) {
|
||||
nstime_t nst;
|
||||
|
||||
nstime_init2(&nst, 42, 43);
|
||||
assert_u64_eq(nstime_sec(&nst), 42, "sec incorrectly read");
|
||||
assert_u64_eq(nstime_nsec(&nst), 43, "nsec incorrectly read");
|
||||
expect_u64_eq(nstime_sec(&nst), 42, "sec incorrectly read");
|
||||
expect_u64_eq(nstime_nsec(&nst), 43, "nsec incorrectly read");
|
||||
}
|
||||
TEST_END
|
||||
|
||||
@@ -27,8 +27,8 @@ TEST_BEGIN(test_nstime_copy) {
|
||||
nstime_init2(&nsta, 42, 43);
|
||||
nstime_init_zero(&nstb);
|
||||
nstime_copy(&nstb, &nsta);
|
||||
assert_u64_eq(nstime_sec(&nstb), 42, "sec incorrectly copied");
|
||||
assert_u64_eq(nstime_nsec(&nstb), 43, "nsec incorrectly copied");
|
||||
expect_u64_eq(nstime_sec(&nstb), 42, "sec incorrectly copied");
|
||||
expect_u64_eq(nstime_nsec(&nstb), 43, "nsec incorrectly copied");
|
||||
}
|
||||
TEST_END
|
||||
|
||||
@@ -37,31 +37,31 @@ TEST_BEGIN(test_nstime_compare) {
|
||||
|
||||
nstime_init2(&nsta, 42, 43);
|
||||
nstime_copy(&nstb, &nsta);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 0, "Times should be equal");
|
||||
assert_d_eq(nstime_compare(&nstb, &nsta), 0, "Times should be equal");
|
||||
expect_d_eq(nstime_compare(&nsta, &nstb), 0, "Times should be equal");
|
||||
expect_d_eq(nstime_compare(&nstb, &nsta), 0, "Times should be equal");
|
||||
|
||||
nstime_init2(&nstb, 42, 42);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 1,
|
||||
expect_d_eq(nstime_compare(&nsta, &nstb), 1,
|
||||
"nsta should be greater than nstb");
|
||||
assert_d_eq(nstime_compare(&nstb, &nsta), -1,
|
||||
expect_d_eq(nstime_compare(&nstb, &nsta), -1,
|
||||
"nstb should be less than nsta");
|
||||
|
||||
nstime_init2(&nstb, 42, 44);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), -1,
|
||||
expect_d_eq(nstime_compare(&nsta, &nstb), -1,
|
||||
"nsta should be less than nstb");
|
||||
assert_d_eq(nstime_compare(&nstb, &nsta), 1,
|
||||
expect_d_eq(nstime_compare(&nstb, &nsta), 1,
|
||||
"nstb should be greater than nsta");
|
||||
|
||||
nstime_init2(&nstb, 41, BILLION - 1);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 1,
|
||||
expect_d_eq(nstime_compare(&nsta, &nstb), 1,
|
||||
"nsta should be greater than nstb");
|
||||
assert_d_eq(nstime_compare(&nstb, &nsta), -1,
|
||||
expect_d_eq(nstime_compare(&nstb, &nsta), -1,
|
||||
"nstb should be less than nsta");
|
||||
|
||||
nstime_init2(&nstb, 43, 0);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), -1,
|
||||
expect_d_eq(nstime_compare(&nsta, &nstb), -1,
|
||||
"nsta should be less than nstb");
|
||||
assert_d_eq(nstime_compare(&nstb, &nsta), 1,
|
||||
expect_d_eq(nstime_compare(&nstb, &nsta), 1,
|
||||
"nstb should be greater than nsta");
|
||||
}
|
||||
TEST_END
|
||||
@@ -73,14 +73,14 @@ TEST_BEGIN(test_nstime_add) {
|
||||
nstime_copy(&nstb, &nsta);
|
||||
nstime_add(&nsta, &nstb);
|
||||
nstime_init2(&nstb, 84, 86);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
expect_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
"Incorrect addition result");
|
||||
|
||||
nstime_init2(&nsta, 42, BILLION - 1);
|
||||
nstime_copy(&nstb, &nsta);
|
||||
nstime_add(&nsta, &nstb);
|
||||
nstime_init2(&nstb, 85, BILLION - 2);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
expect_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
"Incorrect addition result");
|
||||
}
|
||||
TEST_END
|
||||
@@ -91,13 +91,13 @@ TEST_BEGIN(test_nstime_iadd) {
|
||||
nstime_init2(&nsta, 42, BILLION - 1);
|
||||
nstime_iadd(&nsta, 1);
|
||||
nstime_init2(&nstb, 43, 0);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
expect_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
"Incorrect addition result");
|
||||
|
||||
nstime_init2(&nsta, 42, 1);
|
||||
nstime_iadd(&nsta, BILLION + 1);
|
||||
nstime_init2(&nstb, 43, 2);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
expect_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
"Incorrect addition result");
|
||||
}
|
||||
TEST_END
|
||||
@@ -109,14 +109,14 @@ TEST_BEGIN(test_nstime_subtract) {
|
||||
nstime_copy(&nstb, &nsta);
|
||||
nstime_subtract(&nsta, &nstb);
|
||||
nstime_init_zero(&nstb);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
expect_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
"Incorrect subtraction result");
|
||||
|
||||
nstime_init2(&nsta, 42, 43);
|
||||
nstime_init2(&nstb, 41, 44);
|
||||
nstime_subtract(&nsta, &nstb);
|
||||
nstime_init2(&nstb, 0, BILLION - 1);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
expect_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
"Incorrect subtraction result");
|
||||
}
|
||||
TEST_END
|
||||
@@ -127,13 +127,13 @@ TEST_BEGIN(test_nstime_isubtract) {
|
||||
nstime_init2(&nsta, 42, 43);
|
||||
nstime_isubtract(&nsta, 42*BILLION + 43);
|
||||
nstime_init_zero(&nstb);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
expect_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
"Incorrect subtraction result");
|
||||
|
||||
nstime_init2(&nsta, 42, 43);
|
||||
nstime_isubtract(&nsta, 41*BILLION + 44);
|
||||
nstime_init2(&nstb, 0, BILLION - 1);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
expect_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
"Incorrect subtraction result");
|
||||
}
|
||||
TEST_END
|
||||
@@ -144,13 +144,13 @@ TEST_BEGIN(test_nstime_imultiply) {
|
||||
nstime_init2(&nsta, 42, 43);
|
||||
nstime_imultiply(&nsta, 10);
|
||||
nstime_init2(&nstb, 420, 430);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
expect_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
"Incorrect multiplication result");
|
||||
|
||||
nstime_init2(&nsta, 42, 666666666);
|
||||
nstime_imultiply(&nsta, 3);
|
||||
nstime_init2(&nstb, 127, 999999998);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
expect_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
"Incorrect multiplication result");
|
||||
}
|
||||
TEST_END
|
||||
@@ -162,14 +162,14 @@ TEST_BEGIN(test_nstime_idivide) {
|
||||
nstime_copy(&nstb, &nsta);
|
||||
nstime_imultiply(&nsta, 10);
|
||||
nstime_idivide(&nsta, 10);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
expect_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
"Incorrect division result");
|
||||
|
||||
nstime_init2(&nsta, 42, 666666666);
|
||||
nstime_copy(&nstb, &nsta);
|
||||
nstime_imultiply(&nsta, 3);
|
||||
nstime_idivide(&nsta, 3);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
expect_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
"Incorrect division result");
|
||||
}
|
||||
TEST_END
|
||||
@@ -180,7 +180,7 @@ TEST_BEGIN(test_nstime_divide) {
|
||||
nstime_init2(&nsta, 42, 43);
|
||||
nstime_copy(&nstb, &nsta);
|
||||
nstime_imultiply(&nsta, 10);
|
||||
assert_u64_eq(nstime_divide(&nsta, &nstb), 10,
|
||||
expect_u64_eq(nstime_divide(&nsta, &nstb), 10,
|
||||
"Incorrect division result");
|
||||
|
||||
nstime_init2(&nsta, 42, 43);
|
||||
@@ -188,7 +188,7 @@ TEST_BEGIN(test_nstime_divide) {
|
||||
nstime_imultiply(&nsta, 10);
|
||||
nstime_init(&nstc, 1);
|
||||
nstime_add(&nsta, &nstc);
|
||||
assert_u64_eq(nstime_divide(&nsta, &nstb), 10,
|
||||
expect_u64_eq(nstime_divide(&nsta, &nstb), 10,
|
||||
"Incorrect division result");
|
||||
|
||||
nstime_init2(&nsta, 42, 43);
|
||||
@@ -196,7 +196,7 @@ TEST_BEGIN(test_nstime_divide) {
|
||||
nstime_imultiply(&nsta, 10);
|
||||
nstime_init(&nstc, 1);
|
||||
nstime_subtract(&nsta, &nstc);
|
||||
assert_u64_eq(nstime_divide(&nsta, &nstb), 9,
|
||||
expect_u64_eq(nstime_divide(&nsta, &nstb), 9,
|
||||
"Incorrect division result");
|
||||
}
|
||||
TEST_END
|
||||
@@ -209,7 +209,7 @@ TEST_END
|
||||
TEST_BEGIN(test_nstime_update) {
|
||||
nstime_t nst;
|
||||
|
||||
assert_false(nstime_init_update(&nst), "Basic time update failed.");
|
||||
expect_false(nstime_init_update(&nst), "Basic time update failed.");
|
||||
|
||||
/* Only Rip Van Winkle sleeps this long. */
|
||||
{
|
||||
@@ -220,9 +220,9 @@ TEST_BEGIN(test_nstime_update) {
|
||||
{
|
||||
nstime_t nst0;
|
||||
nstime_copy(&nst0, &nst);
|
||||
assert_true(nstime_update(&nst),
|
||||
expect_true(nstime_update(&nst),
|
||||
"Update should detect time roll-back.");
|
||||
assert_d_eq(nstime_compare(&nst, &nst0), 0,
|
||||
expect_d_eq(nstime_compare(&nst, &nst0), 0,
|
||||
"Time should not have been modified");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user