1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-09-27 18:55:48 +00:00

Improve dumped information on a mismatch.

This commit is contained in:
Thomas Harte 2023-09-17 17:09:40 -04:00
parent f8dc5b8ebc
commit 9d9194f194

View File

@ -76,12 +76,16 @@ constexpr char TestSuiteHome[] = "/Users/thomasharte/Projects/ProcessorTests/808
(unsigned long)[encoding count]
);
if(decoded.first != [encoding count]) {
auto log_hex = [&] {
NSMutableString *hexInstruction = [[NSMutableString alloc] init];
for(uint8_t byte: data) {
[hexInstruction appendFormat:@"%02x ", byte];
}
NSLog(@"Instruction was %@", hexInstruction);
};
if(decoded.first != [encoding count]) {
log_hex();
// Repeat the decoding, for ease of debugging.
Decoder straw_man;
@ -154,6 +158,9 @@ constexpr char TestSuiteHome[] = "/Users/thomasharte/Projects/ProcessorTests/808
XCTAssertEqualObjects(objcOperation, test[@"name"]);
if(![objcOperation isEqualToString:test[@"name"]]) {
log_hex();
// Repeat operand conversions, for debugging.
to_string(decoded.second.destination(), decoded.second);
to_string(decoded.second.source(), decoded.second);
return false;