Explicitly test A2V3 data

This commit is contained in:
Aaron Culliney 2017-07-04 07:40:41 -10:00
parent c00a52cbc6
commit ccfaa0544a
3 changed files with 10459 additions and 0 deletions

38
src/test/a2v3-good1-mb.h Normal file
View File

@ -0,0 +1,38 @@
unsigned char mbData[] = {
0x07, 0x04, 0xff, 0x07, 0x1c, 0x14, 0x63, 0xe7, 0x87, 0x4f, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x01, 0x47, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x29, 0xd6, 0x34, 0x00, 0x03, 0x4a,
0x84, 0x00, 0x03, 0x4a, 0x84, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x29, 0xd7, 0x7d, 0x00, 0x15, 0x42,
0x94, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00, 0x01, 0x6e, 0x00, 0x00, 0x01, 0x6f, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf6, 0x3e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x6e, 0x01, 0x6f, 0x01, 0x00,
0x38, 0x09, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x05,
0x69, 0x00, 0x00, 0x00, 0x40, 0x0a, 0x07, 0x00, 0x00, 0x05, 0xc1, 0x00, 0x00, 0x00, 0x60, 0x09,
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x07, 0x04, 0xff, 0x07, 0x87, 0x4f, 0x00, 0x00,
0x87, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00,
0x6b, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x29, 0xd6, 0x74, 0x00, 0x03, 0x4a, 0x84, 0x00, 0x03, 0x4a, 0x84, 0x00, 0x00, 0x00,
0x0d, 0x00, 0x29, 0xd7, 0x7d, 0x00, 0x15, 0x42, 0x94, 0x00, 0x00, 0x01, 0x23, 0x00, 0x00, 0x00,
0xb8, 0x00, 0x00, 0x01, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf6,
0x3e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x23, 0x01, 0xb8, 0x00, 0x24, 0x01, 0x00, 0x38, 0x08, 0x09, 0x08, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0xb7, 0x00, 0x00, 0x00, 0x2d, 0x0a, 0x07, 0x00,
0x00, 0x04, 0x25, 0x00, 0x00, 0x00, 0x49, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0x00, 0x00, 0x00, 0x00, 0x87, 0x4f, 0x00, 0x00, 0x87, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0xe4, 0xff, 0x00, 0x06, 0xef,
0x4c, 0x00, 0x06, 0xef, 0x4c, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x74, 0xe4, 0xff, 0x00, 0x15, 0x42,
0x94, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x8e, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x4f, 0x00, 0x00, 0x87, 0x4f, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0xe4,
0xff, 0x00, 0x06, 0xef, 0x4c, 0x00, 0x06, 0xef, 0x4c, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x74, 0xe4,
0xff, 0x00, 0x15, 0x42, 0x94, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x8e, 0x35, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

10297
src/test/a2v3-good1.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -564,6 +564,128 @@ TEST test_load_A2V2_good2() {
PASS(); PASS();
} }
TEST test_load_A2V3_good1() {
// ensure stable test
disk6_eject(0);
c_debugger_set_timeout(1);
c_debugger_clear_watchpoints();
c_debugger_go();
c_debugger_set_timeout(0);
// write saved state to disk
#include "test/a2v3-good1.h"
const char *homedir = HOMEDIR;
char *savData = NULL;
ASPRINTF(&savData, "%s/a2_emul_a2v3.dat", homedir);
if (savData) {
unlink(savData);
}
FILE *fp = fopen(savData, "w");
ASSERT(fp);
size_t dataSiz = sizeof(data);
if (fwrite(data, 1, dataSiz, fp) != dataSiz) {
ASSERT(false);
}
fflush(fp); fclose(fp); fp = NULL;
// load state and assert
int fdState = -1;
TEMP_FAILURE_RETRY(fdState = open(savData, O_RDONLY));
ASSERT(fdState > 0);
bool ret = false;
int fdA = -1;
int fdB = -1;
{
JSON_ref jsonData;
int siz = json_createFromString("{}", &jsonData);
ASSERT(siz > 0);
ret = emulator_stateExtractDiskPaths(fdState, jsonData);
ASSERT(ret);
_get_fds(jsonData, &fdA, &fdB);
json_destroy(&jsonData);
}
ret = emulator_loadState(fdState, fdA, fdB);
ASSERT(ret);
// ASSERT framebuffer matches expected
ASSERT_SHA("D92EECDF3C7446097F3E884412D7911DDD968287");
// Disk6 ... AVOID ASSERT()ing for non-portable things ... in particular this a2state file contains Droid content://
// paths that will not be valid (even on the original device), so the disk6_insert() call will have failed.
// emulator_stateRestore() will have logged the fault but continued optimistically
ASSERT(disk6.motor_off == 1);
ASSERT(disk6.drive == 1);
ASSERT(disk6.ddrw == 0);
ASSERT(disk6.disk_byte == 0xAA);
extern int stepper_phases;
ASSERT(stepper_phases == 0x0);
ASSERT(disk6.disk[0].phase == 6);
ASSERT(disk6.disk[0].run_byte == 1141);
ASSERT(!disk6.disk[0].nibblized);
ASSERT(!disk6.disk[0].track_dirty);
ASSERT(disk6.disk[1].phase == 50);
ASSERT(disk6.disk[1].run_byte == 5277);
ASSERT(!disk6.disk[1].nibblized);
ASSERT(!disk6.disk[1].track_dirty);
// VM ...
ASSERT(softswitches == 0x000140f4);
ASSERT_SHA_BIN("16A730D3E709F096B693EA4029FC68672CE454B8", apple_ii_64k[0], /*len:*/sizeof(apple_ii_64k));
ASSERT_SHA_BIN("DF3EE367193484A6A1C28C2BAE0EFEF42E6D19BB", language_card[0], /*len:*/sizeof(language_card));
ASSERT_SHA_BIN("343C30374074AB3AEE22581A6477736121390B18", language_banks[0], /*len:*/sizeof(language_banks));
ASSERT(base_ramrd == apple_ii_64k[0]);
ASSERT(base_ramwrt == apple_ii_64k[0]);
ASSERT(base_textrd == apple_ii_64k[0]);
ASSERT(base_textwrt == apple_ii_64k[0]);
ASSERT(base_hgrrd == apple_ii_64k[0]);
ASSERT(base_hgrwrt == apple_ii_64k[0]);
ASSERT(base_stackzp == apple_ii_64k[0]);
ASSERT(base_c3rom == apple_ii_64k[1]);
ASSERT(base_cxrom == (void *)&iie_read_peripheral_card);
ASSERT(base_d000_rd == language_banks[0]-0xD000);
ASSERT(base_d000_wrt == language_banks[0]-0xD000);
ASSERT(base_e000_rd == language_card[0]-0xE000);
ASSERT(base_e000_wrt == language_card[0]-0xE000);
// CPU ...
ASSERT(cpu65_pc == 0x0E9C);
ASSERT(cpu65_ea == 0x0EB9);
ASSERT(cpu65_a == 0x00);
ASSERT(cpu65_f == 0xB0);
ASSERT(cpu65_x == 0x05);
ASSERT(cpu65_y == 0x04);
ASSERT(cpu65_sp == 0xE0);
// Timing ...
long scaleFactor = (long)(cpu_scale_factor * 100.);
ASSERT(scaleFactor == 100);
long altScaleFactor = (long)(cpu_altscale_factor * 100.);
ASSERT(altScaleFactor == 100);
ASSERT(!alt_speed_enabled);
// Mockingboard ...
#include "test/a2v3-good1-mb.h"
size_t mbSiz = sizeof(mbData);
mb_testAssertA2V2(mbData, mbSiz);
TEMP_FAILURE_RETRY(close(fdState));
TEMP_FAILURE_RETRY(close(fdA));
TEMP_FAILURE_RETRY(close(fdB));
unlink(savData);
FREE(savData);
PASS();
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Test Suite // Test Suite
@ -586,6 +708,8 @@ GREATEST_SUITE(test_suite_ui) {
RUN_TESTp(test_load_A2V2_good1); RUN_TESTp(test_load_A2V2_good1);
RUN_TESTp(test_load_A2V2_good2); RUN_TESTp(test_load_A2V2_good2);
RUN_TESTp(test_load_A2V3_good1);
#if INTERFACE_TOUCH #if INTERFACE_TOUCH
# warning TODO : touch joystick(s), keyboard, mouse, menu # warning TODO : touch joystick(s), keyboard, mouse, menu
#endif #endif