summaryrefslogtreecommitdiff
path: root/src/test.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2021-12-21 01:09:07 -0600
committersanine <sanine.not@pm.me>2021-12-21 01:09:07 -0600
commitaa206b75f8c89ab5e0fdeede558775ae7c072113 (patch)
treebde11cad316c377aa0433793175f9eb9eaaf667e /src/test.c
parent781b61d0d0131c880d54bd9667fb0b9c81643ba7 (diff)
implement lily_assert_equal()
Diffstat (limited to 'src/test.c')
-rw-r--r--src/test.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/test.c b/src/test.c
index 146f636..8a5d141 100644
--- a/src/test.c
+++ b/src/test.c
@@ -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;