From 8e0893bd4227451d7b64a3efd478988dfef62668 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 6 Jul 2021 20:28:32 -0400 Subject: [PATCH] Clarifies control flow. --- .../Clock SignalTests/EnterpriseDaveTests.mm | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/OSBindings/Mac/Clock SignalTests/EnterpriseDaveTests.mm b/OSBindings/Mac/Clock SignalTests/EnterpriseDaveTests.mm index 18bb00193..781c57151 100644 --- a/OSBindings/Mac/Clock SignalTests/EnterpriseDaveTests.mm +++ b/OSBindings/Mac/Clock SignalTests/EnterpriseDaveTests.mm @@ -35,29 +35,27 @@ for(int c = 0; c < 250000; c++) { // Advance one cycle. Clock is 500,000 Hz. _interruptSource->run_for(Cycles(2)); + --nextSequencePoint; + // Check for a status bit change. const uint8_t newDividerState = _interruptSource->get_divider_state(); const bool didToggle = (dividerState^newDividerState)&0x1; - if(didToggle) { - ++toggles; - } dividerState = newDividerState; - - --nextSequencePoint; + toggles += didToggle; // Check for the relevant interrupt. const uint8_t newInterrupts = _interruptSource->get_new_interrupts(); - if(newInterrupts & 0x02) { - ++interrupts; + if(newInterrupts) { XCTAssertEqual(nextSequencePoint, 0); - XCTAssertTrue(didToggle); nextSequencePoint = _interruptSource->get_next_sequence_point().as(); - } - // Failing that, confirm that the other interrupt happend. - if(!nextSequencePoint) { - XCTAssertTrue(newInterrupts & 0x08); - nextSequencePoint = _interruptSource->get_next_sequence_point().as(); + if(newInterrupts & 0x02) { + ++interrupts; + XCTAssertTrue(didToggle); + } else { + // Failing that, confirm that the other interrupt happend. + XCTAssertTrue(newInterrupts & 0x08); + } } XCTAssertEqual(nextSequencePoint, _interruptSource->get_next_sequence_point().as(), @"At cycle %d", c);