mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-15 05:31:30 +00:00
Switches to looking for "Result: all tests passed." as a success/failure test.
This commit is contained in:
parent
e0475343f5
commit
989628a024
@ -14,7 +14,7 @@ class PatrikRakTests: XCTestCase, CSTestMachineTrapHandler {
|
|||||||
fileprivate var done = false
|
fileprivate var done = false
|
||||||
fileprivate var output = ""
|
fileprivate var output = ""
|
||||||
|
|
||||||
private func runTest(_ name: String, targetOutput: String) {
|
private func runTest(_ name: String) {
|
||||||
if let filename = Bundle(for: type(of: self)).path(forResource: name, ofType: "tap") {
|
if let filename = Bundle(for: type(of: self)).path(forResource: name, ofType: "tap") {
|
||||||
if let testData = try? Data(contentsOf: URL(fileURLWithPath: filename)) {
|
if let testData = try? Data(contentsOf: URL(fileURLWithPath: filename)) {
|
||||||
|
|
||||||
@ -62,34 +62,34 @@ class PatrikRakTests: XCTestCase, CSTestMachineTrapHandler {
|
|||||||
machine.runForNumber(ofCycles: cyclesPerIteration)
|
machine.runForNumber(ofCycles: cyclesPerIteration)
|
||||||
}
|
}
|
||||||
|
|
||||||
XCTAssertEqual(targetOutput, output);
|
let successRange = output.range(of: "Result: all tests passed.")
|
||||||
|
XCTAssertNotEqual(successRange, nil)
|
||||||
|
|
||||||
|
if successRange == nil {
|
||||||
|
print("Output was: \(output)")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testCCF() {
|
func testCCF() {
|
||||||
let targetOutput = "???"
|
runTest("z80ccf")
|
||||||
runTest("z80ccf", targetOutput: targetOutput)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testDoc() {
|
func testDoc() {
|
||||||
let targetOutput = "???"
|
runTest("z80doc")
|
||||||
runTest("z80doc", targetOutput: targetOutput)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testDocFlags() {
|
func testDocFlags() {
|
||||||
let targetOutput = "???"
|
runTest("z80docflags")
|
||||||
runTest("z80docflags", targetOutput: targetOutput)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testFull() {
|
func testFull() {
|
||||||
let targetOutput = "???"
|
runTest("z80full")
|
||||||
runTest("z80full", targetOutput: targetOutput)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testMemptr() {
|
func testMemptr() {
|
||||||
let targetOutput = "???"
|
runTest("z80memptr")
|
||||||
runTest("z80memptr", targetOutput: targetOutput)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testMachine(_ testMachine: CSTestMachine, didTrapAtAddress address: UInt16) {
|
func testMachine(_ testMachine: CSTestMachine, didTrapAtAddress address: UInt16) {
|
||||||
@ -103,9 +103,13 @@ class PatrikRakTests: XCTestCase, CSTestMachineTrapHandler {
|
|||||||
characterCode = 32
|
characterCode = 32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Similarly, map down unprintables.
|
||||||
|
if characterCode >= 127 {
|
||||||
|
characterCode = 32
|
||||||
|
}
|
||||||
|
|
||||||
let textToAppend = UnicodeScalar(characterCode)!
|
let textToAppend = UnicodeScalar(characterCode)!
|
||||||
output += String(textToAppend)
|
output += String(textToAppend)
|
||||||
print(textToAppend, terminator:"")
|
|
||||||
|
|
||||||
case 0x7003:
|
case 0x7003:
|
||||||
done = true
|
done = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user