Add primitive procedures to expression type
This commit is contained in:
@@ -1,9 +1,16 @@
|
||||
#include "am.h"
|
||||
#include "expr.h"
|
||||
#include "store.h"
|
||||
#include "unity.h"
|
||||
|
||||
static store_t store;
|
||||
|
||||
void test_prim_proc(am_t *am, store_t *store)
|
||||
{
|
||||
(void)am;
|
||||
(void)store;
|
||||
}
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
store_init(&store);
|
||||
@@ -92,6 +99,16 @@ static void test_expr_pair(void)
|
||||
TEST_ASSERT_EQUAL(cdr, expr->pair.cdr);
|
||||
}
|
||||
|
||||
static void test_expr_prim_proc(void)
|
||||
{
|
||||
|
||||
expr_t *expr = expr_prim_proc(&store, test_prim_proc);
|
||||
TEST_ASSERT_NOT_NULL(expr);
|
||||
TEST_ASSERT_TRUE(expr->is_atom);
|
||||
TEST_ASSERT_EQUAL(ATOM_TYPE_PRIM_PROC, expr->atom.type);
|
||||
TEST_ASSERT_EQUAL(test_prim_proc, expr->atom.prim_proc);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
@@ -103,5 +120,6 @@ int main(void)
|
||||
RUN_TEST(test_expr_str_symbol_quux);
|
||||
RUN_TEST(test_expr_empty_list);
|
||||
RUN_TEST(test_expr_pair);
|
||||
RUN_TEST(test_expr_prim_proc);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user