From 52a42d29373e60287a0ab35718bde8481e62ff90 Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Sun, 10 Aug 2025 19:55:19 +0100 Subject: [PATCH] Add integration tests for nested arithmetic --- tests/integration_tests.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/integration_tests.c b/tests/integration_tests.c index d53d03e..0781ef8 100644 --- a/tests/integration_tests.c +++ b/tests/integration_tests.c @@ -40,9 +40,16 @@ static void test_unnested_arithmetic(void) TEST_ASSERT_EQUAL_STRING("64", read_eval_print("(- 100 36)")); } +static void test_nested_arithmetic(void) +{ + TEST_ASSERT_EQUAL_STRING("20", read_eval_print("(+ 1 (* 2 (+ 3 4)) 5)")); + TEST_ASSERT_EQUAL_STRING("-6", read_eval_print("(+ 1 (* 2 2 (- 3)) 5)")); +} + int main(void) { UNITY_BEGIN(); RUN_TEST(test_unnested_arithmetic); + RUN_TEST(test_nested_arithmetic); return UNITY_END(); }