feat: add EntryWarnings and VocabularyBuilder
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user