2026-05-31 13:29:49 +02:00
|
|
|
import XCTest
|
|
|
|
|
@testable import MyTimer
|
|
|
|
|
|
|
|
|
|
final class MyTimerTests: XCTestCase {
|
|
|
|
|
func testCreateVersionEcho() throws {
|
2026-06-13 16:40:04 +02:00
|
|
|
let node = try MyTimerNode(name: "ios-demo")
|
2026-05-31 13:29:49 +02:00
|
|
|
|
|
|
|
|
XCTAssertEqual(try node.version(), "nim-timer v0.1.0")
|
|
|
|
|
|
|
|
|
|
let r = try node.echo("hello from Swift", delayMs: 2)
|
|
|
|
|
XCTAssertEqual(r.echoed, "hello from Swift")
|
|
|
|
|
XCTAssertEqual(r.timerName, "ios-demo") // proves the lib's own state round-tripped
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func testManyEchoes() throws {
|
2026-06-13 16:40:04 +02:00
|
|
|
let node = try MyTimerNode(name: "loop")
|
2026-05-31 13:29:49 +02:00
|
|
|
for i in 0..<200 {
|
|
|
|
|
let r = try node.echo("m\(i)")
|
|
|
|
|
XCTAssertEqual(r.echoed, "m\(i)")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|