40 lines
1.0 KiB
C
40 lines
1.0 KiB
C
#include <check.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
#include <emu.h>
|
|
|
|
#include <cpu.h>
|
|
#include <cart.h>
|
|
|
|
START_TEST(test_cart) {
|
|
bool b = cart_load("../../roms/cpu_instrs.gb");
|
|
ck_assert_uint_eq(b, true);
|
|
rom_header *header = get_rom_header();
|
|
ck_assert_str_eq(header->title, "CPU_INSTRS");
|
|
ck_assert_uint_eq(header->type, 0x01);
|
|
ck_assert_uint_eq(header->rom_size, 0x01);
|
|
ck_assert_uint_eq(header->ram_size, 0x00);
|
|
ck_assert_uint_eq(header->lic_code, 0x00);
|
|
ck_assert_uint_eq(header->version, 0x00);
|
|
ck_assert_uint_eq(header->checksum, 0x3B);
|
|
} END_TEST
|
|
|
|
Suite *stack_suite() {
|
|
Suite *s = suite_create("emu");
|
|
TCase *tc = tcase_create("core");
|
|
|
|
tcase_add_test(tc, test_cart);
|
|
suite_add_tcase(s, tc);
|
|
|
|
return s;
|
|
}
|
|
|
|
int main(int argc, char **argv) {
|
|
Suite *s = stack_suite();
|
|
SRunner *sr = srunner_create(s);
|
|
srunner_run_all(sr, CK_NORMAL);
|
|
int nf = srunner_ntests_failed(sr);
|
|
srunner_free(sr);
|
|
return nf == 0 ? 0 : -1;
|
|
} |