testrunner.c merged into testcpu.c

This commit is contained in:
Aaron Culliney 2014-03-23 14:46:29 -07:00
parent 1dd72ec999
commit df668f0d6a
4 changed files with 29 additions and 44 deletions

View File

@ -79,7 +79,7 @@ src/asm386/glue.S: src/disk.c src/misc.c @AUDIO_GLUE_C@
LOG_DRIVER = testcpu ## hack TODO/FIXME ... should be wrapper shell script accepting standard GNU testing API args ...
A2_TEST_SOURCES = src/test/testrunner.c $(apple2ix_SOURCES)
A2_TEST_SOURCES = $(apple2ix_SOURCES)
A2_TEST_CFLAGS = -DTESTING=1 -Isrc/greatest
TESTS = testcpu

View File

@ -14,7 +14,4 @@
#include "common.h"
#define MSG_SIZE 256
void flags_to_string(uint8_t flags, char *buf);
#endif // whole file

View File

@ -9,9 +9,14 @@
*
*/
//
// Tests for virtual 65c02 CPU (opcodes and addressing modes)
//
#include "greatest.h"
#include "testcommon.h"
#include "common.h"
#define MSG_SIZE 256
#define fC C_Flag_6502 // [C]arry
#define fZ Z_Flag_6502 // [Z]ero
@ -113,6 +118,18 @@ static bool check_skip_illegal_bcd(uint8_t bcd0, uint8_t bcd1) {
return false;
}
static void flags_to_string(uint8_t flags, char *buf) {
snprintf(buf, MSG_SIZE, "%c%c%c%c%c%c%c%c",
(flags & N_Flag_6502) ? 'N' : '-',
(flags & V_Flag_6502) ? 'V' : '-',
(flags & X_Flag_6502) ? 'X' : '-',
(flags & B_Flag_6502) ? 'B' : '-',
(flags & D_Flag_6502) ? 'D' : '-',
(flags & I_Flag_6502) ? 'I' : '-',
(flags & Z_Flag_6502) ? 'Z' : '-',
(flags & C_Flag_6502) ? 'C' : '-' );
}
// ----------------------------------------------------------------------------
// ADC instructions
@ -1751,8 +1768,8 @@ TEST test_BRK() {
PASS();
}
// FIXME TODO : this tests the Apple //e vm, so it prolly should be moved machine/memory tests ...
TEST test_IRQ() {
// NOTE : not an opcode
testcpu_set_opcode1(0xea/*NOP*/); // Implementation NOTE: first an instruction, then reset is handled
cpu65_interrupt(IRQGeneric);
@ -7722,3 +7739,12 @@ GREATEST_SUITE(test_suite_cpu) {
}
}
SUITE(test_suite_cpu);
GREATEST_MAIN_DEFS();
int main(int argc, char **argv) {
GREATEST_MAIN_BEGIN();
RUN_SUITE(test_suite_cpu);
GREATEST_MAIN_END();
}

View File

@ -1,38 +0,0 @@
/*
* Apple // emulator for *nix
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
#include "greatest.h"
#include "testcommon.h"
void flags_to_string(uint8_t flags, char *buf) {
snprintf(buf, MSG_SIZE, "%c%c%c%c%c%c%c%c",
(flags & N_Flag_6502) ? 'N' : '-',
(flags & V_Flag_6502) ? 'V' : '-',
(flags & X_Flag_6502) ? 'X' : '-',
(flags & B_Flag_6502) ? 'B' : '-',
(flags & D_Flag_6502) ? 'D' : '-',
(flags & I_Flag_6502) ? 'I' : '-',
(flags & Z_Flag_6502) ? 'Z' : '-',
(flags & C_Flag_6502) ? 'C' : '-' );
}
extern SUITE(test_suite_cpu);
//extern SUITE(test_suite_memory);
GREATEST_MAIN_DEFS();
int main(int argc, char **argv) {
GREATEST_MAIN_BEGIN();
RUN_SUITE(test_suite_cpu);
//RUN_SUITE(test_suite_memory);
GREATEST_MAIN_END();
}