Use exceptions instead of panic
This commit is contained in:
parent
a0377959dc
commit
66c19caaee
8 changed files with 134 additions and 68 deletions
13
tests/test_cpu_exception.cpp
Normal file
13
tests/test_cpu_exception.cpp
Normal file
|
@ -0,0 +1,13 @@
|
|||
#include "doctest.h"
|
||||
#include <cpu/cpu.h>
|
||||
#include <memory/ram.h>
|
||||
#include <iostream>
|
||||
|
||||
TEST_CASE("Undefined instructions throw exception")
|
||||
{
|
||||
u8 test_mem[] = { 0xd3, 0x00, 0x00, 0x00 };
|
||||
RAM r(test_mem, 0x4, true);
|
||||
Cpu c(&r);
|
||||
|
||||
REQUIRE_THROWS_AS(c.step(), CpuException);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue