Skip to content

Commit

Permalink
Update ASL tests to verify cycle count
Browse files Browse the repository at this point in the history
  • Loading branch information
Shock9616 committed Nov 26, 2024
1 parent f751f05 commit 7487068
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/unit/execute_instruction_asl_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ static void init_test() {

// Allocate system memory
memory = calloc(MEMORY_SPACE, sizeof(uint8_t));
cycles = 0;
}

static void clean_test() {
Expand Down Expand Up @@ -76,6 +77,7 @@ void test_instr_asl_accum() {

CU_ASSERT_EQUAL(processor.A, 0x7E);
CU_ASSERT_EQUAL(processor.P, 0x30);
CU_ASSERT_EQUAL(cycles, 2);
}

void test_instr_asl_zp() {
Expand All @@ -87,6 +89,7 @@ void test_instr_asl_zp() {

CU_ASSERT_EQUAL(memory[0x0010], 0x7E);
CU_ASSERT_EQUAL(processor.P, 0x30);
CU_ASSERT_EQUAL(cycles, 5);
}

void test_instr_asl_zpx() {
Expand All @@ -99,6 +102,7 @@ void test_instr_asl_zpx() {

CU_ASSERT_EQUAL(memory[0x0010], 0x7E);
CU_ASSERT_EQUAL(processor.P, 0x30);
CU_ASSERT_EQUAL(cycles, 6);
}

void test_instr_asl_abs() {
Expand All @@ -111,6 +115,7 @@ void test_instr_asl_abs() {

CU_ASSERT_EQUAL(memory[0x1020], 0x7E);
CU_ASSERT_EQUAL(processor.P, 0x30);
CU_ASSERT_EQUAL(cycles, 6);
}

void test_instr_asl_absx() {
Expand All @@ -124,6 +129,7 @@ void test_instr_asl_absx() {

CU_ASSERT_EQUAL(memory[0x1025], 0x7E);
CU_ASSERT_EQUAL(processor.P, 0x30);
CU_ASSERT_EQUAL(cycles, 7);
}

void test_instr_asl_carry() {
Expand All @@ -134,6 +140,7 @@ void test_instr_asl_carry() {

CU_ASSERT_EQUAL(processor.A, 0x7C);
CU_ASSERT_EQUAL(processor.P, 0x31);
CU_ASSERT_EQUAL(cycles, 2);
}

void test_instr_asl_zero() {
Expand All @@ -144,6 +151,7 @@ void test_instr_asl_zero() {

CU_ASSERT_EQUAL(processor.A, 0x00);
CU_ASSERT_EQUAL(processor.P, 0x33);
CU_ASSERT_EQUAL(cycles, 2);
}

void test_instr_asl_neg() {
Expand All @@ -154,6 +162,7 @@ void test_instr_asl_neg() {

CU_ASSERT_EQUAL(processor.A, 0xFE);
CU_ASSERT_EQUAL(processor.P, 0xB0);
CU_ASSERT_EQUAL(cycles, 2);
}

// ---------- Run Tests ----------
Expand Down

0 comments on commit 7487068

Please sign in to comment.