mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
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.
24 lines
910 B
Swift
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")))
|
|
}
|
|
}
|