From fd20323c258cc792ea1e28b781d7c8db2e39e7cf Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 25 Oct 2022 21:27:01 -0400 Subject: [PATCH] Refactor to permit newer-chip testing. --- .../Clock SignalTests/68000DecoderTests.mm | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/OSBindings/Mac/Clock SignalTests/68000DecoderTests.mm b/OSBindings/Mac/Clock SignalTests/68000DecoderTests.mm index 32844d16f..f67567f27 100644 --- a/OSBindings/Mac/Clock SignalTests/68000DecoderTests.mm +++ b/OSBindings/Mac/Clock SignalTests/68000DecoderTests.mm @@ -15,20 +15,20 @@ using namespace InstructionSet::M68k; @interface M68000DecoderTests : XCTestCase @end -@implementation M68000DecoderTests +namespace { -- (void)testInstructionSpecs { +template void test(NSString *filename, Class cls) { NSData *const testData = [NSData dataWithContentsOfURL: - [[NSBundle bundleForClass:[self class]] - URLForResource:@"68000ops" + [[NSBundle bundleForClass:cls] + URLForResource:filename withExtension:@"json" subdirectory:@"68000 Decoding"]]; NSDictionary *const decodings = [NSJSONSerialization JSONObjectWithData:testData options:0 error:nil]; XCTAssertNotNil(decodings); - Predecoder decoder; + Predecoder decoder; for(int instr = 0; instr < 65536; instr++) { NSString *const instrName = [NSString stringWithFormat:@"%04x", instr]; NSString *const expected = decodings[instrName]; @@ -41,4 +41,26 @@ using namespace InstructionSet::M68k; } } +} + +@implementation M68000DecoderTests + +- (void)test68000 { + test(@"68000ops", [self class]); +} + + +/* + TODO: generate new reference JSONs for tests below here. + For now these are here for manual verification of the diffs. +*/ + +- (void)test68010 { + test(@"68000ops", [self class]); +} + +- (void)test68020 { + test(@"68000ops", [self class]); +} + @end