Module:grc-utilities/testcases
Jump to navigation
Jump to search
- The following documentation is located at Module:grc-utilities/testcases/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • tested module • sandbox
All tests passed. (refresh)
Text | Expected | Actual | Differs at | |
---|---|---|---|---|
Διονύσια | ι, υ, ι, α | ι, υ, ι, α | ||
πᾶς | ||||
οἵᾳ | ||||
μίᾰ | ι | ι | ||
ἐᾱ́ν |
Text | Expected | Actual | Differs at | |
---|---|---|---|---|
ἐᾱ́ν | ἐά¯ν | ἐά¯ν | ||
γᾰ́ρ | γά˘ρ | γά˘ρ | ||
ᾰ̓λλᾰ́ | ἀ˘λλά˘ | ἀ˘λλά˘ |
Text | Expected | Actual | Differs at | |
---|---|---|---|---|
ά̓̆νερ | ᾰ̓́νερ | ᾰ̓́νερ | ||
ᾰ̓́̄ | ᾱ̆̓́ | ᾱ̆̓́ | ||
ά̓̆̄ | ᾱ̆̓́ | ᾱ̆̓́ | ||
ά̓̄̆ | ᾱ̆̓́ | ᾱ̆̓́ |
Text | Expected | Actual | Differs at | |
---|---|---|---|---|
ἄ˘κρος | ἄ̆κρος | ἄ̆κρος |
Text | Expected | Actual | Differs at | |
---|---|---|---|---|
Διί | Δ, ι, ί | Δ, ι, ί | ||
ιυ | ι, υ | ι, υ | ||
υυ | υ, υ | υ, υ | ||
υι | υι | υι | ||
γᾰλεοῦ | γ, ᾰ, λ, ε, οῦ | γ, ᾰ, λ, ε, οῦ | ||
Λευίς | Λ, ευ, ί, ς | Λ, ευ, ί, ς | ||
ἀληθέι | ἀ, λ, η, θ, έ, ι | ἀ, λ, η, θ, έ, ι | ||
πόλεως (noun) | π, ό, λ, ε, ω, ς | π, ό, λ, ε, ω, ς | ||
πόλεων (noun) | π, ό, λ, ε, ω, ν | π, ό, λ, ε, ω, ν | ||
οἷαι | οἷ, αι | οἷ, αι | ||
ΟἿΑΙ | ΟἿ, ΑΙ | ΟἿ, ΑΙ | ||
Αἰσχύλος | Αἰ, σ, χ, ύ, λ, ο, ς | Αἰ, σ, χ, ύ, λ, ο, ς | ||
ἀναῡ̈τέω | ἀ, ν, α, ῡ̈, τ, έ, ω | ἀ, ν, α, ῡ̈, τ, έ, ω | ||
τούτῳ | τ, ού, τ, ῳ | τ, ού, τ, ῳ |
local tests = require("Module:UnitTests")
local m_utils = require("Module:grc-utilities")
local compose = mw.ustring.toNFC
local tag = m_utils.tag
function tests:checkStandardDiacritics(example, expected)
self:equals(
tag(example),
compose(m_utils.standardDiacritics(example)),
compose(expected),
{ display = tag }
)
end
function tests:testStandardDiacritics()
local examples = {
{ "ἄ˘κρος", "ἄ̆κρος" },
}
tests:iterate(examples, "checkStandardDiacritics")
end
function tests:checkReorderDiacritics(example, expected)
self:equals(
tag(example),
compose(m_utils.reorderDiacritics(example)),
compose(expected),
{ display = tag }
)
end
function tests:testReorderDiacritics()
local examples = {
{ "ά̓̆νερ", "ᾰ̓́νερ" },
{ "ᾰ̓́̄", "ᾱ̆̓́" },
{ "ά̓̆̄", "ᾱ̆̓́" },
{ "ά̓̄̆", "ᾱ̆̓́" },
}
tests:iterate(examples, "checkReorderDiacritics")
end
local function displayFindAmbig(word)
local vowel_list = m_utils.findAmbig(word, true)
return compose(table.concat(vowel_list, ", "))
end
function tests:checkFindAmbig(example, expected)
self:equals(
tag(example),
displayFindAmbig(example),
expected,
{ display = tag }
)
end
function tests:testFindAmbig()
local examples = {
{ "Διονύσια", "ι, υ, ι, α" },
{ "πᾶς", "" },
{ "οἵᾳ", "" },
{ "μίᾰ", "ι" },
{ "ἐᾱ́ν", "" },
}
tests:iterate(examples, "checkFindAmbig")
end
local function displayTokenization(example, isNoun)
return table.concat(m_utils.tokenize(example, isNoun), ", ")
end
function tests:checkTokenize(example, expected, isNoun)
self:equals(
tag(example) .. (isNoun and " (noun)" or ""),
compose(displayTokenization(example, isNoun)),
compose(expected),
{ display = tag }
)
end
function tests:testTokenize()
local examples = {
{ "Διί", "Δ, ι, ί" },
{ "ιυ", "ι, υ" },
{ "υυ", "υ, υ" },
{ "υι", "υι" },
{ "γᾰλεοῦ", "γ, ᾰ, λ, ε, οῦ" },
{ "Λευίς", "Λ, ευ, ί, ς" },
{ "ἀληθέι", "ἀ, λ, η, θ, έ, ι" },
{ "πόλεως", "π, ό, λ, ε, ω, ς", true },
{ "πόλεων", "π, ό, λ, ε, ω, ν", true },
{ "οἷαι", "οἷ, αι" },
{ "ΟἿΑΙ", "ΟἿ, ΑΙ" },
{ "Αἰσχύλος", "Αἰ, σ, χ, ύ, λ, ο, ς" },
{ "ἀναῡ̈τέω", "ἀ, ν, α, ῡ̈, τ, έ, ω"},
{ "τούτῳ", "τ, ού, τ, ῳ" },
}
tests:iterate(examples, "checkTokenize")
end
function tests:checkPronunciationOrder(example, expected)
self:equals(
tag(example),
compose(m_utils.pronunciationOrder(example)),
compose(expected),
{ display = tag }
)
end
function tests:testPronunciationOrder()
local examples = {
{ "ἐᾱ́ν", "ἐά¯ν" },
{ "γᾰ́ρ", "γά˘ρ" },
{ "ᾰ̓λλᾰ́", "ἀ˘λλά˘" },
}
tests:iterate(examples, "checkPronunciationOrder")
end
return tests