Increase testing of CPU branch logic, include 16bit underflow and overflow

- Unlikely that the original Apple //e ever saw this happen in reality?
    - TODO : test with valgrind for invalid code access ...
This commit is contained in:
Aaron Culliney 2015-02-16 12:18:59 -08:00
parent d8ae71ddb0
commit 20d3a67db8

View File

@ -7354,7 +7354,7 @@ GREATEST_SUITE(test_suite_cpu) {
HASH_ITER(hh, test_funcs, func, tmp) {
fprintf(GREATEST_STDOUT, "\n%s (SILENCED OUTPUT) :\n", func->name);
for (uint16_t addrs = 0x1f02; addrs < 0x2000; addrs+=0x80) {
for (uint16_t addrs = 0x1f02; addrs < 0x2000; addrs++) {
for (uint8_t flag = 0x00; flag < 0x02; flag++) {
uint8_t off=0x00;
do {
@ -7363,6 +7363,26 @@ GREATEST_SUITE(test_suite_cpu) {
}
}
// 16bit branch overflow tests
for (uint16_t addrs = 0xff00; addrs >= 0xff00 || addrs < 0x00fe; addrs++) {
for (uint8_t flag = 0x00; flag < 0x02; flag++) {
uint8_t off=0x00;
do {
A2_RUN_TESTp(func->func, off, flag, addrs);
} while (++off);
}
}
// 16bit branch underflow tests
for (uint16_t addrs = 0x00fe; addrs <= 0x00fe || addrs > 0xff00; addrs--) {
for (uint8_t flag = 0x00; flag < 0x02; flag++) {
uint8_t off=0x00;
do {
A2_RUN_TESTp(func->func, off, flag, addrs);
} while (++off);
}
}
fprintf(GREATEST_STDOUT, "...OK\n");
A2_REMOVE_TEST(func);
}