From 3781b5eb0ecff2e13225290a63c44c0d40c11554 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 6 Aug 2022 14:40:12 -0400 Subject: [PATCH] Provide further context. --- Machines/Amiga/Blitter.hpp | 19 ++++++++++++++++++- .../Clock SignalTests/AmigaBlitterTests.mm | 6 +++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Machines/Amiga/Blitter.hpp b/Machines/Amiga/Blitter.hpp index 1910334ba..c87a90edb 100644 --- a/Machines/Amiga/Blitter.hpp +++ b/Machines/Amiga/Blitter.hpp @@ -11,6 +11,7 @@ #include #include +#include #include #include "../../ClockReceiver/ClockReceiver.hpp" @@ -201,7 +202,7 @@ template class Blitter: public DMADevice<4, 4> { ReadC, AddToPipeline, WriteFromPipeline - } type; + } type = Type::SkippedSlot; uint32_t address = 0; uint16_t value = 0; @@ -209,6 +210,22 @@ template class Blitter: public DMADevice<4, 4> { Transaction() {} Transaction(Type type) : type(type) {} Transaction(Type type, uint32_t address, uint16_t value) : type(type), address(address), value(value) {} + + std::string to_string() const { + std::string result; + + switch(type) { + case Type::SkippedSlot: result = "SkippedSlot"; break; + case Type::ReadA: result = "ReadA"; break; + case Type::ReadB: result = "ReadB"; break; + case Type::ReadC: result = "ReadC"; break; + case Type::AddToPipeline: result = "AddToPipeline"; break; + case Type::WriteFromPipeline: result = "WriteFromPipeline"; break; + } + + result += " address:" + std::to_string(address) + " value:" + std::to_string(value); + return result; + } }; std::vector get_and_reset_transactions(); diff --git a/OSBindings/Mac/Clock SignalTests/AmigaBlitterTests.mm b/OSBindings/Mac/Clock SignalTests/AmigaBlitterTests.mm index 9c21e10f4..d5bd34bfe 100644 --- a/OSBindings/Mac/Clock SignalTests/AmigaBlitterTests.mm +++ b/OSBindings/Mac/Clock SignalTests/AmigaBlitterTests.mm @@ -181,9 +181,9 @@ struct Chipset { default: break; } - XCTAssertEqual(transaction.type, expected_transaction.type, @"Type mismatch at index %lu", (unsigned long)index); - XCTAssertEqual(transaction.value, expected_transaction.value, @"Value mismatch at index %lu", (unsigned long)index); - XCTAssertEqual(transaction.address, expected_transaction.address, @"Address mismatch at index %lu", (unsigned long)index); + XCTAssertEqual(transaction.type, expected_transaction.type, @"Type mismatch at index %lu: %s expected vs %s found", (unsigned long)index, expected_transaction.to_string().c_str(), transaction.to_string().c_str()); + XCTAssertEqual(transaction.value, expected_transaction.value, @"Value mismatch at index %lu: %s expected vs %s found", (unsigned long)index, expected_transaction.to_string().c_str(), transaction.to_string().c_str()); + XCTAssertEqual(transaction.address, expected_transaction.address, @"Address mismatch at index %lu: %s expected vs %s found", (unsigned long)index, expected_transaction.to_string().c_str(), transaction.to_string().c_str()); if( transaction.type != expected_transaction.type || transaction.value != expected_transaction.value ||