import XCTest @testable import Closer final class WordlistTests: XCTestCase { func testWordlistMatchesAndroidSource() throws { let words = try Wordlist.load() // Correction from SPEC.md: the Android source actually has 248 words, not 256. XCTAssertEqual(words.count, 248, "Wordlist count must match Android source") // All lowercase, no whitespace, no empties. for word in words { XCTAssertEqual(word, word.lowercased(), "Word must be lowercase: \(word)") XCTAssertFalse(word.contains(" "), "Word must not contain whitespace: \(word)") XCTAssertFalse(word.isEmpty, "Word must not be empty") } // All unique. let unique = Set(words) XCTAssertEqual(unique.count, words.count, "All words must be unique") } func testWordlistFirstAndLastEntries() throws { let words = try Wordlist.load() XCTAssertEqual(words.first, "able") XCTAssertEqual(words.last, "real") } }