diff --git a/tests/test_cpu_simple.cpp b/tests/test_cpu_simple.cpp index fd14f3e..0fcf11f 100644 --- a/tests/test_cpu_simple.cpp +++ b/tests/test_cpu_simple.cpp @@ -172,3 +172,25 @@ TEST_CASE("CALL ; RET") CHECK(cpu.state.PC == 0x0006); CHECK(cpu.state.SP == 0x0010); } + +TEST_CASE("JR e") +{ + u8 test_ram[] = { + 0x18, 0x02, + 0x00, 0x00, + 0x18, (u8)(-0x06), + }; + + RAM r(test_ram, 0x6, true); + Cpu cpu(&r); + + CHECK(cpu.state.PC == 0x0); + + cpu.step(); + + CHECK(cpu.state.PC == 0x4); + + cpu.step(); + + CHECK(cpu.state.PC == 0x0); +}