From 0a695a33e4e23fb5a0d70c7a3500224cce931ccf Mon Sep 17 00:00:00 2001 From: dzwdz Date: Wed, 4 Aug 2021 11:30:20 +0200 Subject: rename TEST_IF to TEST_COND i'll be adding a TEST_STR macro soon, so TEST_COND makes more sense --- src/kernel/tests/base.h | 4 ++-- src/kernel/tests/util.c | 40 ++++++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src/kernel') diff --git a/src/kernel/tests/base.h b/src/kernel/tests/base.h index 877b179..4c91d10 100644 --- a/src/kernel/tests/base.h +++ b/src/kernel/tests/base.h @@ -14,10 +14,10 @@ extern bool _did_tests_fail; #define TEST_RUN(name) \ __test_##name(); -#define TEST_IF(cond) \ +#define TEST_COND(cond) \ if (!(cond)) { \ _did_tests_fail = true; \ - log_const("TEST_IF failed at " \ + log_const("test failed at " \ __FILE__ ":" NUM2STR(__LINE__) \ " "); \ } diff --git a/src/kernel/tests/util.c b/src/kernel/tests/util.c index 45c728e..3bc2124 100644 --- a/src/kernel/tests/util.c +++ b/src/kernel/tests/util.c @@ -3,34 +3,34 @@ TEST(memcmp) { // basic equality checks - TEST_IF(0 == memcmp("some", "thing", 0)); - TEST_IF(0 != memcmp("some", "thing", 1)); - TEST_IF(0 != memcmp("some", "thing", 4)); + TEST_COND(0 == memcmp("some", "thing", 0)); + TEST_COND(0 != memcmp("some", "thing", 1)); + TEST_COND(0 != memcmp("some", "thing", 4)); - TEST_IF(0 == memcmp("test", "tennis", 0)); - TEST_IF(0 == memcmp("test", "tennis", 1)); - TEST_IF(0 == memcmp("test", "tennis", 2)); - TEST_IF(0 != memcmp("test", "tennis", 3)); - TEST_IF(0 != memcmp("test", "tennis", 4)); - TEST_IF(0 != memcmp("test", "tennis", 5)); + TEST_COND(0 == memcmp("test", "tennis", 0)); + TEST_COND(0 == memcmp("test", "tennis", 1)); + TEST_COND(0 == memcmp("test", "tennis", 2)); + TEST_COND(0 != memcmp("test", "tennis", 3)); + TEST_COND(0 != memcmp("test", "tennis", 4)); + TEST_COND(0 != memcmp("test", "tennis", 5)); // test signs. does anyone even use that? - TEST_IF(0 > memcmp("foo", "moo", 4)); - TEST_IF(0 < memcmp("moo", "foo", 4)); - TEST_IF(0 > memcmp("555", "654", 3)); - TEST_IF(0 < memcmp("654", "555", 3)); + TEST_COND(0 > memcmp("foo", "moo", 4)); + TEST_COND(0 < memcmp("moo", "foo", 4)); + TEST_COND(0 > memcmp("555", "654", 3)); + TEST_COND(0 < memcmp("654", "555", 3)); } TEST(static_strcmp) { - TEST_IF(0 == static_strcmp("", "")); - TEST_IF(0 == static_strcmp("same", "same")); + TEST_COND(0 == static_strcmp("", "")); + TEST_COND(0 == static_strcmp("same", "same")); - TEST_IF(0 != static_strcmp("same", "diff")); - TEST_IF(0 != static_strcmp("same!", "same")); - TEST_IF(0 != static_strcmp("same", "same!")); + TEST_COND(0 != static_strcmp("same", "diff")); + TEST_COND(0 != static_strcmp("same!", "same")); + TEST_COND(0 != static_strcmp("same", "same!")); - TEST_IF(0 > static_strcmp("555", "654")); - TEST_IF(0 < static_strcmp("654", "555")); + TEST_COND(0 > static_strcmp("555", "654")); + TEST_COND(0 < static_strcmp("654", "555")); } void tests_utils() { -- cgit v1.2.3