hex/ios/HEXMobileTests/KeyboardCoreLinkTests.swift
Sebastian Herrlinger e923bc6991 Keyboard core: the swipe fixture recorded again on dev's new English model
dev's English typing model changed (#2408: en.hextm 14370569… → c23e9c54…,
86,247 words and 417,182 pairs), so the swipe parity fixture is recorded
again from the Swift decoder it was ported from: SwipeDecoderOracle, still
dev's SwipeDecoder.swift verbatim (unchanged on dev since b719d45e),
restored for the export and not committed. The swipes are drawn on dev's
current rows (#2379, #2395), so 8 of the 10 key sets and every case's
touches are new; the contexts are unchanged.

The core reads the 1,600 cases bit for bit, and a 200,000-case export
(100,000 per language) too; the shipped decoder matched the oracle in one
process on 20,000 cases on iOS 27.0 and 26.3. The model tests that pin
English's word and pair counts take the new ones.
2026-11-22 20:20:31 +01:00

24 lines
910 B
Swift

import HexKeyboardCore
import XCTest
@testable import HEX
/// The keyboard's Rust core (`crates/keyboard`) links into the app and opens the model the
/// keyboard ships.
@MainActor
final class KeyboardCoreLinkTests: XCTestCase {
func testTheCoreIsTheHeadersVersion() {
XCTAssertEqual(hk_abi_version(), UInt32(HK_ABI_VERSION))
}
func testTheCoreOpensTheBundledEnglishModel() throws {
let model = try XCTUnwrap(TypingDecoderModel.bundled("en"), "the English model is bundled")
let core = try XCTUnwrap(KeyboardCoreModel(url: model.url))
XCTAssertEqual(core.wordCount, 86_247)
XCTAssertEqual(model.core?.wordCount, model.wordCount)
XCTAssertTrue(model.core === model.core, "opened once")
}
func testTheCoreOpensNothingWhereThereIsNoModel() {
XCTAssertNil(KeyboardCoreModel(url: URL(fileURLWithPath: "/nonexistent/en.hextm")))
}
}