Module:haw-IPA/testcases
Appearance
- The following documentation is located at Module:haw-IPA/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 | Comments | |
---|---|---|---|---|
humuhumunukunukuāpuaʻa | /ˌhu.muˌhu.muˌnu.kuˌnu.kuˌaː.puˈa.ʔa/ | /ˌhu.muˌhu.muˌnu.kuˌnu.kuˌaː.puˈa.ʔa/ | compound word | |
ʻōmaʻimaʻi au | /ˌʔoː.ma.ʔiˈma.ʔi ˈau̯/ | /ˌʔoː.ma.ʔiˈma.ʔi ˈau̯/ | compound word, multiword | |
iā | /iˈaː/ | /iˈaː/ | syllable-final stress | |
ʻeleʻele | [ˌʔɛ.lɛˈʔɛ.lɛ] | [ˌʔɛ.lɛˈʔɛ.lɛ] | compound word, allophony | |
ʻaleʻale | [ˌʔɐ.leˈʔɐ.le] | [ˌʔɐ.leˈʔɐ.le] | compound word, allophony | |
pepeiao | [pe.pejˈjɐo̯] | [pe.pejˈjɐo̯] | glide insertion | |
puana | [puˈwɐ.nə] | [puˈwɐ.nə] | glide insertion | |
moana | [moˈwɐ.nə] | [moˈwɐ.nə] | glide insertion | |
kea | [ˈkɛ.jə] | [ˈkɛ.jə] | glide insertion | |
kau | [ˈkɐw, ˈkɔw] | [ˈkɐw, ˈkɔw] | rapid pronunciation |
local tests = require("Module:UnitTests")
local ipa = require("Module:haw-IPA")
local link = require("Module:links")
local lang = require("Module:languages").getByCode("haw")
local sc = require("Module:scripts").getByCode("Latn")
local function tag_IPA(IPA, is_phonetic)
return is_phonetic and '<span class="IPA">[' .. IPA .. ']</span>' or '<span class="IPA">/' .. IPA .. '/</span>'
end
function tests:check_output(term, is_phonetic, expected, comment)
local actual = ipa.toIPA(term, is_phonetic)
if ipa.rapid(ipa.toIPA(term, is_phonetic)) ~= actual then
actual = actual .. ", " .. ipa.rapid(ipa.toIPA(term, is_phonetic))
end
self:equals(
link.full_link({ term = mw.ustring.gsub(term, "[%+]", ""), lang = lang, sc = sc } ),
tag_IPA(actual, is_phonetic),
tag_IPA(expected, is_phonetic),
{ comment = comment }
)
end
function tests:test_all()
examples = {
{ "humu+humu+nuku+nuku+āpu+aʻa", false, "ˌhu.muˌhu.muˌnu.kuˌnu.kuˌaː.puˈa.ʔa", "compound word" },
{ "ʻōma+ʻimaʻi au", false, "ˌʔoː.ma.ʔiˈma.ʔi ˈau̯", "compound word, multiword" },
{ "iā", false, "iˈaː", "syllable-final stress" },
{ "ʻele+ʻele", true, "ˌʔɛ.lɛˈʔɛ.lɛ", "compound word, allophony" },
{ "ʻale+ʻale", true, "ˌʔɐ.leˈʔɐ.le", "compound word, allophony" },
{ "pepeiao", true, "pe.pejˈjɐo̯", "glide insertion" },
{ "puana", true, "puˈwɐ.nə", "glide insertion" },
{ "moana", true, "moˈwɐ.nə", "glide insertion" },
{ "kea", true, "ˈkɛ.jə", "glide insertion"},
{ "kau", true, "ˈkɐw, ˈkɔw", "rapid pronunciation" },
}
self:iterate(examples, "check_output")
end
return tests