2017-01-16 21:54:51 +00:00
|
|
|
#include <atf-c.h>
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2017-01-27 11:32:12 +00:00
|
|
|
#include "rk65c02.h"
|
2017-01-16 21:54:51 +00:00
|
|
|
#include "bus.h"
|
2017-01-27 11:32:12 +00:00
|
|
|
#include "utils.h"
|
2017-01-16 21:54:51 +00:00
|
|
|
|
2017-01-18 23:57:09 +00:00
|
|
|
ATF_TC_WITHOUT_HEAD(bus_init);
|
|
|
|
ATF_TC_BODY(bus_init, tc)
|
2017-01-16 21:54:51 +00:00
|
|
|
{
|
|
|
|
bus_t b;
|
|
|
|
|
|
|
|
b = bus_init();
|
|
|
|
|
|
|
|
ATF_CHECK(b.space != NULL);
|
|
|
|
|
|
|
|
bus_finish(&b);
|
|
|
|
}
|
|
|
|
|
2017-01-18 23:57:09 +00:00
|
|
|
ATF_TC_WITHOUT_HEAD(bus_load_file);
|
|
|
|
ATF_TC_BODY(bus_load_file, tc)
|
2017-01-16 21:54:51 +00:00
|
|
|
{
|
2017-01-18 23:57:09 +00:00
|
|
|
bus_t b;
|
2017-01-27 11:32:12 +00:00
|
|
|
const char *rompath;
|
2017-01-18 23:57:09 +00:00
|
|
|
|
|
|
|
b = bus_init();
|
|
|
|
|
2017-01-27 11:32:12 +00:00
|
|
|
rompath = rom_path("test_emulation_nop.rom", tc);
|
|
|
|
|
|
|
|
ATF_REQUIRE(bus_load_file(&b, 0xC000, rompath));
|
2017-01-18 23:57:09 +00:00
|
|
|
|
|
|
|
ATF_CHECK(b.space[0xC000] == 0xEA);
|
|
|
|
|
|
|
|
bus_finish(&b);
|
2017-01-16 21:54:51 +00:00
|
|
|
}
|
|
|
|
|
2017-02-03 21:37:48 +00:00
|
|
|
ATF_TC_WITHOUT_HEAD(bus_load_buf);
|
|
|
|
ATF_TC_BODY(bus_load_buf, tc)
|
|
|
|
{
|
|
|
|
bus_t b;
|
|
|
|
|
|
|
|
uint8_t buf[] = { 0xEA, 0xDB };
|
|
|
|
|
|
|
|
b = bus_init();
|
|
|
|
|
|
|
|
ATF_REQUIRE(bus_load_buf(&b, 0xC000, buf, 2));
|
|
|
|
|
|
|
|
ATF_CHECK(b.space[0xC000] == 0xEA);
|
|
|
|
ATF_CHECK(b.space[0xC001] == 0xDB);
|
|
|
|
|
|
|
|
bus_finish(&b);
|
|
|
|
}
|
|
|
|
|
2017-01-16 21:54:51 +00:00
|
|
|
ATF_TP_ADD_TCS(tp)
|
|
|
|
{
|
2017-01-18 23:57:09 +00:00
|
|
|
ATF_TP_ADD_TC(tp, bus_init);
|
|
|
|
ATF_TP_ADD_TC(tp, bus_load_file);
|
2017-02-03 21:37:48 +00:00
|
|
|
ATF_TP_ADD_TC(tp, bus_load_buf);
|
2017-01-16 21:54:51 +00:00
|
|
|
|
|
|
|
return (atf_no_error());
|
|
|
|
}
|
|
|
|
|