Implement primitive procedure application evaluation
This commit is contained in:
@@ -69,6 +69,25 @@ static void test_foo_evals_to_42_when_set_in_env(void)
|
||||
TEST_ASSERT_EQUAL(42, am.val->atom.integer);
|
||||
}
|
||||
|
||||
static void test_add_1_2_3_evals_to_6(void)
|
||||
{
|
||||
am.expr = expr_pair(
|
||||
&am, expr_str_symbol(&am, "+"),
|
||||
expr_pair(
|
||||
&am, expr_integer(&am, 1),
|
||||
expr_pair(
|
||||
&am, expr_integer(&am, 2),
|
||||
expr_pair(
|
||||
&am, expr_integer(&am, 3), expr_empty_list(&am)))));
|
||||
|
||||
eval(&am);
|
||||
|
||||
TEST_ASSERT_NOT_NULL(am.val);
|
||||
TEST_ASSERT_TRUE(am.val->is_atom);
|
||||
TEST_ASSERT_EQUAL(ATOM_TYPE_INTEGER, am.val->atom.type);
|
||||
TEST_ASSERT_EQUAL(6, am.val->atom.integer);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
@@ -76,5 +95,6 @@ int main(void)
|
||||
RUN_TEST(test_empty_list_self_evals);
|
||||
RUN_TEST(test_prim_proc_self_evals);
|
||||
RUN_TEST(test_foo_evals_to_42_when_set_in_env);
|
||||
RUN_TEST(test_add_1_2_3_evals_to_6);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user