Skip to content

Commit cd72448

Browse files
committed
Add tests
1 parent ba0ade2 commit cd72448

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/test-shunting-yard.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ static void test_modulus()
7171
ASSERT_RESULT("5 %5", 0);
7272
}
7373

74+
static void test_negation()
75+
{
76+
ASSERT_RESULT("-1", -1);
77+
ASSERT_RESULT("(-1)", -1);
78+
ASSERT_RESULT("(-1) + 1", 0);
79+
ASSERT_RESULT("(-1) + (-1)", -2);
80+
ASSERT_RESULT("-1 + -1", -2);
81+
ASSERT_RESULT("-1 + --1", 0);
82+
}
83+
7484

7585
static void test_functions()
7686
{

0 commit comments

Comments
 (0)