20 lines
766 B
Swift
20 lines
766 B
Swift
import Testing
|
|
@testable import SstData
|
|
|
|
struct VocabularyBuilderTests {
|
|
@Test func termsComeFirstThenCorrectionTargetsWithoutDuplicates() {
|
|
let entries = [pair("cloud code", "Claude Code"), term("Anthropic"), term("anthropic"), pair("versel", "Vercel"), term("Supabase")]
|
|
#expect(VocabularyBuilder.build(from: entries) == ["Anthropic", "Supabase", "Claude Code", "Vercel"])
|
|
}
|
|
|
|
@Test func listIsCapped() {
|
|
let entries = (1...40).map { term("Woord\($0)") }
|
|
#expect(VocabularyBuilder.build(from: entries).count == 24)
|
|
#expect(VocabularyBuilder.build(from: entries, maxTerms: 5).count == 5)
|
|
}
|
|
|
|
@Test func emptyDictionaryGivesNoVocabulary() {
|
|
#expect(VocabularyBuilder.build(from: []).isEmpty)
|
|
}
|
|
}
|