mirror of
https://github.com/logos-messaging/nim-ffi.git
synced 2026-06-20 16:29:31 +00:00
Regenerates Sources/MyTimer/MyTimer.swift via `nimble genbindings_swift` (replacing the hand-written wrapper) and points the tests at the derived MyTimerNode class. Proves the generator reproduces the validated create/version/echo path: build-xcframework.sh + `swift test` pass 2/2 on the macOS slice. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
23 lines
671 B
Swift
23 lines
671 B
Swift
import XCTest
|
|
@testable import MyTimer
|
|
|
|
final class MyTimerTests: XCTestCase {
|
|
func testCreateVersionEcho() throws {
|
|
let node = try MyTimerNode(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 MyTimerNode(name: "loop")
|
|
for i in 0..<200 {
|
|
let r = try node.echo("m\(i)")
|
|
XCTAssertEqual(r.echoed, "m\(i)")
|
|
}
|
|
}
|
|
}
|