diff options
Diffstat (limited to 'src/test.c')
-rw-r--r-- | src/test.c | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -77,9 +77,31 @@ lily_test check_assert() } +const char *assert_eq_true() +{ + lily_assert_equal(15, 15); + return 0; +} +const char *assert_eq_false() +{ + lily_assert_equal(14, 15); + return 0; +} + lily_test check_other_asserts() { - + if (assert_eq_true() != 0) + return "equality assertion returned non-zero when true!"; + const char *result = assert_eq_false(); + if (result == 0) + return "equality assertion returned zero when false!"; + char *message; + if (!get_message(&message, result)) + return "false equality assertion returned malformed message!"; + if (strcmp(message, "'14' is not equal to '15'") != 0) + return "false equality assertion returned incorrect message!"; + + return 0; } @@ -87,6 +109,7 @@ int main() { run_test("check LILY_INIT()", check_init); run_test("check basic assertion", check_assert); + run_test("check other asserts", check_other_asserts); printf("all tests finished.\n"); return 0; |