vgbc/tests/test_cpu_simple.cpp

28 lines
416 B
C++
Raw Normal View History

2023-08-28 22:31:24 +02:00
#include "doctest.h"
#include "cpu/cpu.h"
#include "memory/ram.h"
TEST_CASE("simple load and add")
{
u8 test_ram[] = {
0x3E, 0x10, // LD A, $0x10
0x87, // ADD A, A
};
RAM r(test_ram, 3, true);
Cpu cpu(&r);
CHECK(cpu.state.PC == 0x0);
cpu.step();
CHECK(cpu.state.PC == 0x2);
CHECK(cpu.state.A == 0x10);
cpu.step();
CHECK(cpu.state.PC == 0x3);
CHECK(cpu.state.A == 0x20);
}