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() {