mirror of
https://github.com/logos-messaging/nim-ffi.git
synced 2026-06-21 00:40:16 +00:00
23 lines
667 B
Swift
23 lines
667 B
Swift
|
|
import XCTest
|
||
|
|
@testable import MyTimer
|
||
|
|
|
||
|
|
final class MyTimerTests: XCTestCase {
|
||
|
|
func testCreateVersionEcho() throws {
|
||
|
|
let node = try TimerNode(name: "ios-demo")
|
||
|
|
|
||
|
|
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 {
|
||
|
|
let node = try TimerNode(name: "loop")
|
||
|
|
for i in 0..<200 {
|
||
|
|
let r = try node.echo("m\(i)")
|
||
|
|
XCTAssertEqual(r.echoed, "m\(i)")
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|