From 57087cc7c68a4ea070e679fe131821de6a867fc5 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 13 Sep 2023 16:08:12 -0400 Subject: [PATCH] Provide feedback on prima facie failure. --- OSBindings/Mac/Clock SignalTests/8088Tests.mm | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/OSBindings/Mac/Clock SignalTests/8088Tests.mm b/OSBindings/Mac/Clock SignalTests/8088Tests.mm index 49152082d..865b17407 100644 --- a/OSBindings/Mac/Clock SignalTests/8088Tests.mm +++ b/OSBindings/Mac/Clock SignalTests/8088Tests.mm @@ -47,7 +47,7 @@ constexpr char TestSuiteHome[] = "/Users/tharte/Projects/ProcessorTests/8088/v1" return fullPaths; } -- (void)applyDecodingTest:(NSDictionary *)test { +- (bool)applyDecodingTest:(NSDictionary *)test { using Decoder = InstructionSet::x86::Decoder; Decoder decoder; @@ -61,7 +61,20 @@ constexpr char TestSuiteHome[] = "/Users/tharte/Projects/ProcessorTests/8088/v1" } } - NSLog(@""); + XCTAssert( + stage.first == [encoding count], + "Wrong length of instruction decoded for %@ — decoded %d rather than %lu", + test[@"name"], + stage.first, + (unsigned long)[encoding count] + ); + + if(stage.first != [encoding count]) { + return false; + } + // TODO: form string version, compare. + + return true; } - (void)testDecoding { @@ -69,7 +82,10 @@ constexpr char TestSuiteHome[] = "/Users/tharte/Projects/ProcessorTests/8088/v1" NSData *data = [NSData dataWithContentsOfGZippedFile:file]; NSArray *testsInFile = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; for(NSDictionary *test in testsInFile) { - [self applyDecodingTest:test]; + // A single failure per instruction is fine. + if(![self applyDecodingTest:test]) { + break; + } } } }