Add integration tests for nested arithmetic

This commit is contained in:
2025-08-10 19:55:19 +01:00
parent ba0a543a4c
commit 52a42d2937

View File

@@ -40,9 +40,16 @@ static void test_unnested_arithmetic(void)
TEST_ASSERT_EQUAL_STRING("64", read_eval_print("(- 100 36)")); 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) int main(void)
{ {
UNITY_BEGIN(); UNITY_BEGIN();
RUN_TEST(test_unnested_arithmetic); RUN_TEST(test_unnested_arithmetic);
RUN_TEST(test_nested_arithmetic);
return UNITY_END(); return UNITY_END();
} }