From a43fe0d38e8621f82ede539eb3dbbfdfe8e40301 Mon Sep 17 00:00:00 2001 From: Peter Evans Date: Fri, 13 Apr 2018 18:36:02 -0500 Subject: [PATCH] Modify test files to account for reorg --- tests/apple2.bank.c | 6 +- tests/apple2.c | 4 +- tests/apple2.dbuf.c | 6 +- tests/apple2.dd.c | 4 +- tests/apple2.dec.c | 6 +- tests/apple2.draw.c | 2 +- tests/apple2.enc.c | 4 +- tests/apple2.hires.c | 4 +- tests/apple2.kb.c | 4 +- tests/apple2.lores.c | 4 +- tests/apple2.mem.c | 8 +- tests/apple2.pc.c | 6 +- tests/apple2.reflect.c | 55 ++++++------- tests/apple2.text.c | 2 +- tests/mos6502.addr.c | 6 +- tests/mos6502.arith.c | 6 +- tests/mos6502.bits.c | 6 +- tests/mos6502.branch.c | 6 +- tests/mos6502.c | 6 +- tests/mos6502.dis.c | 6 +- tests/mos6502.exec.c | 6 +- tests/mos6502.loadstor.c | 6 +- tests/mos6502.stat.c | 6 +- tests/vm_debug.c | 161 +++++++++++++++++++-------------------- tests/vm_reflect.c | 72 ----------------- 25 files changed, 160 insertions(+), 242 deletions(-) delete mode 100644 tests/vm_reflect.c diff --git a/tests/apple2.bank.c b/tests/apple2.bank.c index 99bfc6c..092043f 100644 --- a/tests/apple2.bank.c +++ b/tests/apple2.bank.c @@ -1,8 +1,8 @@ #include -#include "apple2.bank.h" -#include "apple2.h" -#include "apple2.tests.h" +#include "apple2/apple2.h" +#include "apple2/bank.h" +#include "apple2/tests.h" #include "vm_segment.h" TestSuite(apple2_bank, .init = setup, .fini = teardown); diff --git a/tests/apple2.c b/tests/apple2.c index a5a7b92..8f6b9a5 100644 --- a/tests/apple2.c +++ b/tests/apple2.c @@ -1,7 +1,7 @@ #include -#include "apple2.h" -#include "mos6502.enums.h" +#include "apple2/apple2.h" +#include "mos6502/enums.h" #include "option.h" #include "vm_di.h" diff --git a/tests/apple2.dbuf.c b/tests/apple2.dbuf.c index 7ae6a61..8bb7f68 100644 --- a/tests/apple2.dbuf.c +++ b/tests/apple2.dbuf.c @@ -1,8 +1,8 @@ #include -#include "apple2.dbuf.h" -#include "apple2.h" -#include "apple2.tests.h" +#include "apple2/apple2.h" +#include "apple2/dbuf.h" +#include "apple2/tests.h" #include "vm_segment.h" TestSuite(apple2_dbuf, .init = setup, .fini = teardown); diff --git a/tests/apple2.dd.c b/tests/apple2.dd.c index 7852a26..77552ef 100644 --- a/tests/apple2.dd.c +++ b/tests/apple2.dd.c @@ -1,7 +1,7 @@ #include -#include "apple2.dd.h" -#include "apple2.enc.h" +#include "apple2/dd.h" +#include "apple2/enc.h" static apple2dd *drive; diff --git a/tests/apple2.dec.c b/tests/apple2.dec.c index 9ab0cb7..af156f9 100644 --- a/tests/apple2.dec.c +++ b/tests/apple2.dec.c @@ -1,8 +1,8 @@ #include -#include "apple2.dec.h" -#include "apple2.enc.h" -#include "apple2.dd.h" +#include "apple2/dd.h" +#include "apple2/dec.h" +#include "apple2/enc.h" /* * This is the DOS 3.3 order; just to have something to use as a basis diff --git a/tests/apple2.draw.c b/tests/apple2.draw.c index 1672096..cf73142 100644 --- a/tests/apple2.draw.c +++ b/tests/apple2.draw.c @@ -1,6 +1,6 @@ #include -#include "apple2.tests.h" +#include "apple2/tests.h" /* Test(apple2_draw, pixel) */ /* Test(apple2_draw, pixel_lores) */ diff --git a/tests/apple2.enc.c b/tests/apple2.enc.c index 4e475f4..f9cc402 100644 --- a/tests/apple2.enc.c +++ b/tests/apple2.enc.c @@ -1,7 +1,7 @@ #include -#include "apple2.dd.h" -#include "apple2.enc.h" +#include "apple2/dd.h" +#include "apple2/enc.h" #include "vm_segment.h" /* diff --git a/tests/apple2.hires.c b/tests/apple2.hires.c index a869cef..7692fda 100644 --- a/tests/apple2.hires.c +++ b/tests/apple2.hires.c @@ -1,7 +1,7 @@ #include -#include "apple2.hires.h" -#include "apple2.tests.h" +#include "apple2/hires.h" +#include "apple2/tests.h" TestSuite(apple2_hires, .init = setup, .fini = teardown); diff --git a/tests/apple2.kb.c b/tests/apple2.kb.c index 459bf4e..a1be1f6 100644 --- a/tests/apple2.kb.c +++ b/tests/apple2.kb.c @@ -1,7 +1,7 @@ #include -#include "apple2.kb.h" -#include "apple2.tests.h" +#include "apple2/kb.h" +#include "apple2/tests.h" TestSuite(apple2_kb, .init = setup, .fini = teardown); diff --git a/tests/apple2.lores.c b/tests/apple2.lores.c index a23a873..cb652ee 100644 --- a/tests/apple2.lores.c +++ b/tests/apple2.lores.c @@ -1,7 +1,7 @@ #include -#include "apple2.h" -#include "apple2.lores.h" +#include "apple2/apple2.h" +#include "apple2/lores.h" /* Test(apple2_lores, draw) */ diff --git a/tests/apple2.mem.c b/tests/apple2.mem.c index d3d917d..46059ff 100644 --- a/tests/apple2.mem.c +++ b/tests/apple2.mem.c @@ -1,9 +1,9 @@ #include -#include "apple2.bank.h" -#include "apple2.h" -#include "apple2.mem.h" -#include "apple2.tests.h" +#include "apple2/bank.h" +#include "apple2/apple2.h" +#include "apple2/mem.h" +#include "apple2/tests.h" TestSuite(apple2_mem, .init = setup, .fini = teardown); diff --git a/tests/apple2.pc.c b/tests/apple2.pc.c index 3add995..b7499f2 100644 --- a/tests/apple2.pc.c +++ b/tests/apple2.pc.c @@ -1,8 +1,8 @@ #include -#include "apple2.h" -#include "apple2.pc.h" -#include "apple2.tests.h" +#include "apple2/apple2.h" +#include "apple2/pc.h" +#include "apple2/tests.h" TestSuite(apple2_pc, .init = setup, .fini = teardown); diff --git a/tests/apple2.reflect.c b/tests/apple2.reflect.c index 314d55a..84b2ac1 100644 --- a/tests/apple2.reflect.c +++ b/tests/apple2.reflect.c @@ -1,64 +1,59 @@ #include -#include "apple2.h" -#include "apple2.reflect.h" +#include "apple2/apple2.h" +#include "apple2/event.h" #include "vm_di.h" -#include "vm_reflect.h" static apple2 *mach; -static vm_reflect *ref; static void setup() { - ref = vm_reflect_create(); - vm_di_set(VM_REFLECT, ref); - mach = apple2_create(100, 100); - vm_di_set(VM_MACHINE, mach); - vm_di_set(VM_CPU, mach->cpu); - apple2_reflect_init(); + mach->paused = false; + mach->debug = false; + + vm_di_set(VM_PAUSE_FUNC, NULL); + vm_di_set(VM_DEBUG_FUNC, NULL); + + apple2_event_init(); } static void teardown() { - vm_reflect_free(ref); apple2_free(mach); - vm_di_set(VM_REFLECT, NULL); - vm_di_set(VM_MACHINE, NULL); - vm_di_set(VM_CPU, NULL); + vm_di_set(VM_PAUSE_FUNC, NULL); + vm_di_set(VM_DEBUG_FUNC, NULL); } -TestSuite(apple2_reflect, .init = setup, .fini = teardown); +TestSuite(apple2_event, .init = setup, .fini = teardown); -Test(apple2_reflect, init) +Test(apple2_event, init) { - cr_assert_neq(ref->cpu_info, NULL); - cr_assert_neq(ref->machine_info, NULL); - cr_assert_neq(ref->pause, NULL); - cr_assert_neq(ref->disasm, NULL); + cr_assert_neq(vm_di_get(VM_PAUSE_FUNC), NULL); + cr_assert_neq(vm_di_get(VM_DEBUG_FUNC), NULL); } /* Test(apple2_reflect, cpu_info) */ /* Test(apple2_reflect, machine_info) */ -Test(apple2_reflect, pause) +Test(apple2_event, pause) { - mach->paused = false; - vm_reflect_pause(NULL); + apple2_event_pause(mach); cr_assert_eq(mach->paused, true); - vm_reflect_pause(NULL); + apple2_event_pause(mach); cr_assert_eq(mach->paused, false); } -Test(apple2_reflect, disasm) +Test(apple2_event, debug) { - mach->disasm = false; - vm_reflect_disasm(NULL); - cr_assert_eq(mach->disasm, true); - vm_reflect_disasm(NULL); - cr_assert_eq(mach->disasm, false); + apple2_event_debug(mach); + cr_assert_eq(mach->paused, true); + cr_assert_eq(mach->debug, true); + apple2_event_debug(mach); + cr_assert_eq(mach->paused, true); + cr_assert_eq(mach->debug, true); } diff --git a/tests/apple2.text.c b/tests/apple2.text.c index add5277..9beea31 100644 --- a/tests/apple2.text.c +++ b/tests/apple2.text.c @@ -1,6 +1,6 @@ #include -#include "apple2.text.h" +#include "apple2/text.h" #include "objstore.h" /* diff --git a/tests/mos6502.addr.c b/tests/mos6502.addr.c index 4d10af1..a975d41 100644 --- a/tests/mos6502.addr.c +++ b/tests/mos6502.addr.c @@ -1,8 +1,8 @@ #include -#include "mos6502.h" -#include "mos6502.enums.h" -#include "mos6502.tests.h" +#include "mos6502/mos6502.h" +#include "mos6502/enums.h" +#include "mos6502/tests.h" TestSuite(mos6502_addr, .init = setup, .fini = teardown); diff --git a/tests/mos6502.arith.c b/tests/mos6502.arith.c index ebf4638..aba1344 100644 --- a/tests/mos6502.arith.c +++ b/tests/mos6502.arith.c @@ -1,8 +1,8 @@ #include -#include "mos6502.h" -#include "mos6502.enums.h" -#include "mos6502.tests.h" +#include "mos6502/mos6502.h" +#include "mos6502/enums.h" +#include "mos6502/tests.h" TestSuite(mos6502_arith, .init = setup, .fini = teardown); diff --git a/tests/mos6502.bits.c b/tests/mos6502.bits.c index 6085292..19b6172 100644 --- a/tests/mos6502.bits.c +++ b/tests/mos6502.bits.c @@ -1,8 +1,8 @@ #include -#include "mos6502.h" -#include "mos6502.enums.h" -#include "mos6502.tests.h" +#include "mos6502/mos6502.h" +#include "mos6502/enums.h" +#include "mos6502/tests.h" TestSuite(mos6502_bits, .init = setup, .fini = teardown); diff --git a/tests/mos6502.branch.c b/tests/mos6502.branch.c index b4278ab..2ecbfe5 100644 --- a/tests/mos6502.branch.c +++ b/tests/mos6502.branch.c @@ -1,8 +1,8 @@ #include -#include "mos6502.h" -#include "mos6502.enums.h" -#include "mos6502.tests.h" +#include "mos6502/mos6502.h" +#include "mos6502/enums.h" +#include "mos6502/tests.h" TestSuite(mos6502_branch, .init = setup, .fini = teardown); diff --git a/tests/mos6502.c b/tests/mos6502.c index 85e4a6e..a542f58 100644 --- a/tests/mos6502.c +++ b/tests/mos6502.c @@ -1,8 +1,8 @@ #include -#include "mos6502.h" -#include "mos6502.enums.h" -#include "mos6502.tests.h" +#include "mos6502/mos6502.h" +#include "mos6502/enums.h" +#include "mos6502/tests.h" TestSuite(mos6502, .init = setup, .fini = teardown); diff --git a/tests/mos6502.dis.c b/tests/mos6502.dis.c index bd4cb81..b58edd2 100644 --- a/tests/mos6502.dis.c +++ b/tests/mos6502.dis.c @@ -1,9 +1,9 @@ #include #include -#include "mos6502.h" -#include "mos6502.dis.h" -#include "mos6502.enums.h" +#include "mos6502/mos6502.h" +#include "mos6502/dis.h" +#include "mos6502/enums.h" /* * BUFSIZ is the normal block-buffer size that a FILE stream would use diff --git a/tests/mos6502.exec.c b/tests/mos6502.exec.c index 2c0402d..4e65c4c 100644 --- a/tests/mos6502.exec.c +++ b/tests/mos6502.exec.c @@ -1,8 +1,8 @@ #include -#include "mos6502.h" -#include "mos6502.enums.h" -#include "mos6502.tests.h" +#include "mos6502/mos6502.h" +#include "mos6502/enums.h" +#include "mos6502/tests.h" TestSuite(mos6502_exec, .init = setup, .fini = teardown); diff --git a/tests/mos6502.loadstor.c b/tests/mos6502.loadstor.c index d1eb292..db063b7 100644 --- a/tests/mos6502.loadstor.c +++ b/tests/mos6502.loadstor.c @@ -1,8 +1,8 @@ #include -#include "mos6502.h" -#include "mos6502.enums.h" -#include "mos6502.tests.h" +#include "mos6502/mos6502.h" +#include "mos6502/enums.h" +#include "mos6502/tests.h" TestSuite(mos6502_loadstor, .init = setup, .fini = teardown); diff --git a/tests/mos6502.stat.c b/tests/mos6502.stat.c index 16ca2d5..30cdc2f 100644 --- a/tests/mos6502.stat.c +++ b/tests/mos6502.stat.c @@ -1,8 +1,8 @@ #include -#include "mos6502.h" -#include "mos6502.enums.h" -#include "mos6502.tests.h" +#include "mos6502/mos6502.h" +#include "mos6502/enums.h" +#include "mos6502/tests.h" TestSuite(mos6502_stat, .init = setup, .fini = teardown); diff --git a/tests/vm_debug.c b/tests/vm_debug.c index 87d8830..183478a 100644 --- a/tests/vm_debug.c +++ b/tests/vm_debug.c @@ -3,18 +3,16 @@ #include #include -#include "apple2.h" -#include "apple2.reflect.h" -#include "vm_debug.h" +#include "apple2/apple2.h" +#include "apple2/debug.h" +#include "apple2/event.h" #include "vm_di.h" -#include "vm_reflect.h" static char buf[BUFSIZ]; static FILE *stream = NULL; -static vm_debug_args args; +static apple2_debug_args args; static apple2 *mach; -static vm_reflect *ref; static void setup() @@ -33,14 +31,11 @@ setup() // Writing to stream will now write to buf setvbuf(stream, buf, _IOFBF, BUFSIZ); - ref = vm_reflect_create(); - vm_di_set(VM_REFLECT, ref); - mach = apple2_create(100, 100); vm_di_set(VM_MACHINE, mach); vm_di_set(VM_CPU, mach->cpu); - apple2_reflect_init(); + apple2_event_init(); } static void @@ -51,52 +46,52 @@ teardown() apple2_free(mach); - vm_debug_unbreak_all(); + apple2_debug_unbreak_all(); } -TestSuite(vm_debug, .init = setup, .fini = teardown); +TestSuite(apple2_debug, .init = setup, .fini = teardown); /* * I dunno what we'll end up printing! It'll change as we add commands, * so we just test if we print _something_. */ -Test(vm_debug, cmd_help) +Test(apple2_debug, cmd_help) { - vm_debug_cmd_help(&args); + apple2_debug_cmd_help(&args); cr_assert_neq(strlen(buf), 0); } -Test(vm_debug, execute) +Test(apple2_debug, execute) { - vm_debug_execute("help"); + apple2_debug_execute("help"); cr_assert_neq(strlen(buf), 0); } -Test(vm_debug, next_arg) +Test(apple2_debug, next_arg) { char *orig, *str = strdup("ok hey"); orig = str; - cr_assert_str_eq(vm_debug_next_arg(&str), "ok"); - cr_assert_str_eq(vm_debug_next_arg(&str), "hey"); + cr_assert_str_eq(apple2_debug_next_arg(&str), "ok"); + cr_assert_str_eq(apple2_debug_next_arg(&str), "hey"); free(orig); } /* - * Right now, there's not a great way of testing vm_debug_prompt() since + * Right now, there's not a great way of testing apple2_debug_prompt() since * it's dependent on stdin. Or, maybe there is with a hack, but I'd like * to do something more appropriate in the future. * - * Test(vm_debug, prompt) + * Test(apple2_debug, prompt) */ -Test(vm_debug, addr) +Test(apple2_debug, addr) { - cr_assert_eq(vm_debug_addr("faaa"), 0xfaaa); - cr_assert_eq(vm_debug_addr("123"), 0x123); - cr_assert_eq(vm_debug_addr("$34"), 0x34); - cr_assert_eq(vm_debug_addr("hey"), -1); + cr_assert_eq(apple2_debug_addr("faaa"), 0xfaaa); + cr_assert_eq(apple2_debug_addr("123"), 0x123); + cr_assert_eq(apple2_debug_addr("$34"), 0x34); + cr_assert_eq(apple2_debug_addr("hey"), -1); } /* @@ -104,95 +99,95 @@ Test(vm_debug, addr) * function is statically declared, and we don't have access to test it * here. * - * Test(vm_debug, cmd_compar) + * Test(apple2_debug, cmd_compar) */ -Test(vm_debug, find_cmd) +Test(apple2_debug, find_cmd) { - vm_debug_cmd *cmd; + apple2_debug_cmd *cmd; // Can we find anything? - cr_assert_neq(vm_debug_find_cmd("resume"), NULL); + cr_assert_neq(apple2_debug_find_cmd("resume"), NULL); // Make sure NULL is returned for bad commands - cr_assert_eq(vm_debug_find_cmd("THIS_DOESNT_EXIST"), NULL); + cr_assert_eq(apple2_debug_find_cmd("THIS_DOESNT_EXIST"), NULL); // Find a second command... - cmd = vm_debug_find_cmd("help"); + cmd = apple2_debug_find_cmd("help"); cr_assert_neq(cmd, NULL); // and see if we can find the short version - cr_assert_eq(vm_debug_find_cmd("h"), cmd); + cr_assert_eq(apple2_debug_find_cmd("h"), cmd); } -Test(vm_debug, cmd_resume) +Test(apple2_debug, cmd_resume) { mach->paused = true; - vm_debug_cmd_resume(&args); + apple2_debug_cmd_resume(&args); cr_assert_eq(mach->paused, false); } -Test(vm_debug, cmd_printstate) +Test(apple2_debug, cmd_printstate) { - vm_debug_cmd_printstate(&args); + apple2_debug_cmd_printstate(&args); cr_assert_neq(strlen(buf), 0); } -Test(vm_debug, cmd_printaddr) +Test(apple2_debug, cmd_printaddr) { args.addr1 = 123; mos6502_set(mach->cpu, args.addr1, 127); - vm_debug_cmd_printaddr(&args); + apple2_debug_cmd_printaddr(&args); cr_assert_str_eq(buf, "$7F\n"); } -Test(vm_debug, cmd_jump) +Test(apple2_debug, cmd_jump) { args.addr1 = 123; - vm_debug_cmd_jump(&args); + apple2_debug_cmd_jump(&args); cr_assert_eq(mach->cpu->PC, 123); } -Test(vm_debug, cmd_writeaddr) +Test(apple2_debug, cmd_writeaddr) { args.addr1 = 123; args.addr2 = 0xf5; - vm_debug_cmd_writeaddr(&args); + apple2_debug_cmd_writeaddr(&args); cr_assert_eq(mos6502_get(mach->cpu, args.addr1), args.addr2); } -Test(vm_debug, cmd_writestate) +Test(apple2_debug, cmd_writestate) { args.addr1 = 111; args.target = "a"; - vm_debug_cmd_writestate(&args); + apple2_debug_cmd_writestate(&args); cr_assert_eq(mach->cpu->A, args.addr2); args.addr1 = 112; args.target = "x"; - vm_debug_cmd_writestate(&args); + apple2_debug_cmd_writestate(&args); cr_assert_eq(mach->cpu->X, args.addr2); args.addr1 = 113; args.target = "y"; - vm_debug_cmd_writestate(&args); + apple2_debug_cmd_writestate(&args); cr_assert_eq(mach->cpu->Y, args.addr2); args.addr1 = 114; args.target = "p"; - vm_debug_cmd_writestate(&args); + apple2_debug_cmd_writestate(&args); cr_assert_eq(mach->cpu->P, args.addr2); args.addr1 = 115; args.target = "s"; - vm_debug_cmd_writestate(&args); + apple2_debug_cmd_writestate(&args); cr_assert_eq(mach->cpu->S, args.addr2); } -Test(vm_debug, break) +Test(apple2_debug, break) { - vm_debug_break(0x2); + apple2_debug_break(0x2); mos6502_set(mach->cpu, 0, 0xEA); mos6502_set(mach->cpu, 1, 0xEA); @@ -207,47 +202,47 @@ Test(vm_debug, break) cr_assert_eq(mach->cpu->PC, 2); } -Test(vm_debug, broke) +Test(apple2_debug, broke) { - cr_assert_eq(vm_debug_broke(0x23), false); - vm_debug_break(0x23); - cr_assert_eq(vm_debug_broke(0x23), true); + cr_assert_eq(apple2_debug_broke(0x23), false); + apple2_debug_break(0x23); + cr_assert_eq(apple2_debug_broke(0x23), true); } -Test(vm_debug, unbreak) +Test(apple2_debug, unbreak) { - vm_debug_break(0x23); + apple2_debug_break(0x23); - cr_assert_eq(vm_debug_broke(0x23), true); - vm_debug_unbreak(0x23); - cr_assert_eq(vm_debug_broke(0x23), false); + cr_assert_eq(apple2_debug_broke(0x23), true); + apple2_debug_unbreak(0x23); + cr_assert_eq(apple2_debug_broke(0x23), false); } -Test(vm_debug, cmd_break) +Test(apple2_debug, cmd_break) { args.addr1 = 123; - vm_debug_cmd_break(&args); + apple2_debug_cmd_break(&args); - cr_assert_eq(vm_debug_broke(123), true); + cr_assert_eq(apple2_debug_broke(123), true); } -Test(vm_debug, cmd_unbreak) +Test(apple2_debug, cmd_unbreak) { args.addr1 = 123; - vm_debug_cmd_break(&args); - cr_assert_eq(vm_debug_broke(123), true); - vm_debug_cmd_unbreak(&args); - cr_assert_eq(vm_debug_broke(123), false); + apple2_debug_cmd_break(&args); + cr_assert_eq(apple2_debug_broke(123), true); + apple2_debug_cmd_unbreak(&args); + cr_assert_eq(apple2_debug_broke(123), false); } -Test(vm_debug, unbreak_all) +Test(apple2_debug, unbreak_all) { - vm_debug_break(55555); - vm_debug_unbreak_all(); - cr_assert_eq(vm_debug_broke(55555), false); + apple2_debug_break(55555); + apple2_debug_unbreak_all(); + cr_assert_eq(apple2_debug_broke(55555), false); } -Test(vm_debug, cmd_step) +Test(apple2_debug, cmd_step) { // Just setting us up with some NOPs for the testing mos6502_set(mach->cpu, 0, 0xEA); @@ -255,7 +250,7 @@ Test(vm_debug, cmd_step) mos6502_set(mach->cpu, 2, 0xEA); mos6502_set(mach->cpu, 3, 0xEA); - vm_debug_break(1); + apple2_debug_break(1); mos6502_execute(mach->cpu); cr_assert_eq(mach->cpu->PC, 1); @@ -264,32 +259,32 @@ Test(vm_debug, cmd_step) cr_assert_eq(mach->cpu->PC, 1); // Step should a) unbreak at PC, b) execute at PC - vm_debug_cmd_step(&args); + apple2_debug_cmd_step(&args); cr_assert_eq(mach->cpu->PC, 2); } -/* Test(vm_debug, cmd_quit) */ +/* Test(apple2_debug, cmd_quit) */ -Test(vm_debug, cmd_disassemble) +Test(apple2_debug, cmd_disassemble) { cr_assert_eq(mach->disasm, false); - vm_debug_cmd_disasm(&args); + apple2_debug_cmd_disasm(&args); cr_assert_neq(strlen(buf), 0); cr_assert_eq(mach->disasm, true); - vm_debug_cmd_disasm(&args); + apple2_debug_cmd_disasm(&args); cr_assert_eq(mach->disasm, false); } -Test(vm_debug, cmd_dblock) +Test(apple2_debug, cmd_dblock) { mos6502_set(mach->cpu, 0, 0xEA); args.addr1 = 0; args.addr2 = 1; - vm_debug_cmd_dblock(&args); + apple2_debug_cmd_dblock(&args); cr_assert_neq(strlen(buf), 0); } -Test(vm_debug, cmd_hdump) +Test(apple2_debug, cmd_hdump) { for (int i = 0; i < 16; i++) { mos6502_set(mach->cpu, i, i + 0x30); @@ -298,7 +293,7 @@ Test(vm_debug, cmd_hdump) args.addr1 = 0; args.addr2 = 32; - vm_debug_cmd_hdump(&args); + apple2_debug_cmd_hdump(&args); cr_assert_neq(strlen(buf), 0); } diff --git a/tests/vm_reflect.c b/tests/vm_reflect.c deleted file mode 100644 index 0169526..0000000 --- a/tests/vm_reflect.c +++ /dev/null @@ -1,72 +0,0 @@ -#include - -#include "apple2.h" -#include "vm_reflect.h" - -static vm_reflect *ref; -static apple2 *mach; - -/* - * This is a tiny function we can use that will satisfy the - * vm_reflect_fn type so we can test that all of those are working in - * the vm_reflect struct. - */ -static void -fun(vm_reflect *ref) -{ - return; -} - -static void -have_fun() -{ - ref->cpu_info = fun; - ref->machine_info = fun; - ref->pause = fun; - ref->disasm = fun; -} - -static void -setup() -{ - mach = apple2_create(100, 100); - ref = vm_reflect_create(mach, mach->cpu, stdout); -} - -static void -teardown() -{ - vm_reflect_free(ref); - apple2_free(mach); -} - -TestSuite(vm_reflect, .init = setup, .fini = teardown); - -Test(vm_reflect, create) -{ - cr_assert_neq(ref, NULL); - cr_assert_eq(ref->cpu_info, NULL); - cr_assert_eq(ref->machine_info, NULL); - cr_assert_eq(ref->pause, NULL); - cr_assert_eq(ref->disasm, NULL); -} - -// Not much to do here -/* Test(vm_reflect, free) */ - -/* - * Because all of the reflect functions (aside from create/free) do the - * same thing, one test can stand in for all of them; hence the skips - * you see below. - */ -Test(vm_reflect, cpu_info) -{ - // We should always try to have fun - have_fun(); - - cr_assert_eq(vm_reflect_cpu_info(ref), OK); -} - -/* Test(vm_reflect, machine_info) */ -/* Test(vm_reflect, pause) */ -/* Test(vm_reflect, disasm) */