1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Ensured test raises only the intentional failure exceptions.

This commit is contained in:
Thomas Harte 2017-06-15 22:33:46 -04:00
parent 838b818cd3
commit 50cd617bd9

View File

@ -38,8 +38,15 @@ class Z80MachineCycleTests: XCTestCase {
let length = cycle.timeStamp - totalCycles
totalCycles += length
XCTAssertEqual(length, busCycles[index].length)
XCTAssertEqual(cycle.operation, busCycles[index].operation)
if index >= busCycles.count {
// this can't be reached without one of the asserts failing;
// it's to prevent an unintended exeception via out-of-bounds
// array access
break
} else {
XCTAssertEqual(length, busCycles[index].length)
XCTAssertEqual(cycle.operation, busCycles[index].operation)
}
index += 1
}