Make AM registers into an array

This commit is contained in:
2025-08-10 20:30:07 +01:00
parent 52a42d2937
commit 57c39fd00b
14 changed files with 311 additions and 288 deletions

View File

@@ -18,28 +18,30 @@ void tearDown(void)
static void test_expr_value_restored_after_push_modify_pop(void)
{
expr_t a, b;
am.expr = &a;
am.regs[EXPR] = &a;
am_push(&am);
am.expr = &b;
am.regs[EXPR] = &b;
am_pop(&am);
TEST_ASSERT_EQUAL(&a, am.expr);
TEST_ASSERT_EQUAL(&a, am.regs[EXPR]);
}
static void test_append_arg_42_with_empty_argl(void)
{
am.argl = expr_empty_list(&am);
am.val = expr_integer(&am, 42);
am.regs[ARGL] = expr_empty_list(&am);
am.regs[VAL] = expr_integer(&am, 42);
am_append_arg(&am);
TEST_ASSERT_FALSE(am.argl->is_atom);
TEST_ASSERT_NOT_NULL(CAR(am.argl));
TEST_ASSERT_FALSE(am.regs[ARGL]->is_atom);
TEST_ASSERT_NOT_NULL(CAR(am.regs[ARGL]));
TEST_ASSERT_TRUE(CAR(am.argl)->is_atom);
TEST_ASSERT_EQUAL(ATOM_TYPE_INTEGER, CAR(am.argl)->atom.type);
TEST_ASSERT_EQUAL(42, CAR(am.argl)->atom.integer);
TEST_ASSERT_TRUE(CAR(am.regs[ARGL])->is_atom);
TEST_ASSERT_EQUAL(ATOM_TYPE_INTEGER, CAR(am.regs[ARGL])->atom.type);
TEST_ASSERT_EQUAL(42, CAR(am.regs[ARGL])->atom.integer);
TEST_ASSERT_TRUE(CDR(am.argl)->is_atom);
TEST_ASSERT_EQUAL(ATOM_TYPE_EMPTY_LIST, CDR(am.argl)->atom.type);
TEST_ASSERT_TRUE(CDR(am.regs[ARGL])->is_atom);
TEST_ASSERT_EQUAL(ATOM_TYPE_EMPTY_LIST, CDR(am.regs[ARGL])->atom.type);
}
int main(void)