mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-05 21:32:55 +00:00
Adds separate entry points for zexall and zexdoc.
This commit is contained in:
parent
851cba0b25
commit
825b68e5c4
@ -14,8 +14,8 @@ class ZexallTests: XCTestCase, CSTestMachineTrapHandler {
|
||||
fileprivate var done = false
|
||||
fileprivate var output = ""
|
||||
|
||||
func testZexall() {
|
||||
if let filename = Bundle(for: type(of: self)).path(forResource: "zexdoc", ofType: "com") {
|
||||
private func runTest(_ name: String) {
|
||||
if let filename = Bundle(for: type(of: self)).path(forResource: name, ofType: "com") {
|
||||
if let testData = try? Data(contentsOf: URL(fileURLWithPath: filename)) {
|
||||
|
||||
// install test program, at the usual CP/M place
|
||||
@ -47,10 +47,11 @@ class ZexallTests: XCTestCase, CSTestMachineTrapHandler {
|
||||
var cyclesToDate: TimeInterval = 0
|
||||
let startDate = Date()
|
||||
var printDate = Date()
|
||||
let printMhz = false
|
||||
while !done {
|
||||
machine.runForNumber(ofCycles: cyclesPerIteration)
|
||||
cyclesToDate += TimeInterval(cyclesPerIteration)
|
||||
if printDate.timeIntervalSinceNow < -5.0 {
|
||||
if printMhz && printDate.timeIntervalSinceNow < -5.0 {
|
||||
print("\(cyclesToDate / -startDate.timeIntervalSinceNow) Mhz")
|
||||
printDate = Date()
|
||||
}
|
||||
@ -131,6 +132,14 @@ class ZexallTests: XCTestCase, CSTestMachineTrapHandler {
|
||||
}
|
||||
}
|
||||
|
||||
func testZexAll() {
|
||||
runTest("zexall")
|
||||
}
|
||||
|
||||
func testZexDoc() {
|
||||
runTest("zexdoc")
|
||||
}
|
||||
|
||||
func testMachine(_ testMachine: CSTestMachine, didTrapAtAddress address: UInt16) {
|
||||
let testMachineZ80 = testMachine as! CSTestMachineZ80
|
||||
switch address {
|
||||
|
Loading…
x
Reference in New Issue
Block a user