From cd7244874322d9e09239b3a98f47fc19fb508c57 Mon Sep 17 00:00:00 2001 From: whonore Date: Mon, 13 Dec 2021 17:47:33 -0500 Subject: [PATCH] Add tests --- tests/test-shunting-yard.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test-shunting-yard.c b/tests/test-shunting-yard.c index 4345b8d..be7d77a 100644 --- a/tests/test-shunting-yard.c +++ b/tests/test-shunting-yard.c @@ -71,6 +71,16 @@ static void test_modulus() ASSERT_RESULT("5 %5", 0); } +static void test_negation() +{ + ASSERT_RESULT("-1", -1); + ASSERT_RESULT("(-1)", -1); + ASSERT_RESULT("(-1) + 1", 0); + ASSERT_RESULT("(-1) + (-1)", -2); + ASSERT_RESULT("-1 + -1", -2); + ASSERT_RESULT("-1 + --1", 0); +} + static void test_functions() {