1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-11-15 16:06:38 +00:00
rk65c02/test/test_stepping.c
Radosław Kujawa 442c8dc3df Add instruction stepping test.
That was written some time ago but forgot to plug it into test suite.
2017-02-06 22:05:16 +01:00

37 lines
554 B
C

#include <atf-c.h>
#include <stdio.h>
#include "bus.h"
#include "rk65c02.h"
#include "utils.h"
ATF_TC_WITHOUT_HEAD(step1);
ATF_TC_BODY(step1, tc)
{
rk65c02emu_t e;
bus_t b;
b = bus_init();
e = rk65c02_init(&b);
e.regs.PC = ROM_LOAD_ADDR;
ATF_REQUIRE(bus_load_file(&b, ROM_LOAD_ADDR,
rom_path("test_stepping_step1.rom", tc)));
rk65c02_step(&e, 1);
ATF_CHECK(e.regs.PC == ROM_LOAD_ADDR+1);
rk65c02_step(&e, 1);
ATF_CHECK(e.regs.PC == ROM_LOAD_ADDR+2);
}
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, step1);
return (atf_no_error());
}