Module:syllables/testcases
Appearance
- පහත දැක්වෙන උපදෙස්, Module:syllables/testcases/documentation හි පිහිටා ඇත. Module:syllables/testcases/documentation]]. [සංස්කරණය]
- ප්රයෝජනවත් සබැඳි: root page • root page’s subpages • සබැඳි • transclusions • tested module • sandbox
All tests passed. (refresh)
Text | Expected | Actual | |
---|---|---|---|
/noʊ ˈhaɪweɪ ˈkaʊboɪz/ | 5 | 5 | |
ðɛɚ | 2 | 2 | |
ðɛɹ | 1 | 1 | |
/avə(ʊ)ˈkeɪʃən/ | 4 | 4 | |
/-eɪʃəs/ | (nil) | (nil) | |
/ɛː.e.lí.o͜i.o/ | 5 | 5 | |
/vl̩k/ | 1 | 1 | |
/ˈɑːmiɑi̯smɑjoi̯tus/ | 6 | 6 | |
/ˈɛi̯ərə(n)/ | 3 | 3 |
local tests = require("Module:UnitTests")
local m_syllables = require("Module:syllables")
local langObjects = {}
local function tag(IPA)
return '<span class="IPA">' .. IPA .. '</span>'
end
function tests:check(example, expected, langCode)
if not langObjects[langCode] then
langObjects[langCode] = require("Module:languages").getByCode(langCode)
end
self:equals(tag(example),
m_syllables.getVowels(example, langObjects[langCode]),
expected)
end
function tests:test()
local examples = {
{ "/noʊ ˈhaɪweɪ ˈkaʊboɪz/", 5, "en" },
{ "ðɛɚ", 2, "en" },
{ "ðɛɹ", 1, "en" },
{ "/avə(ʊ)ˈkeɪʃən/", 4, "en" },
{ "/-eɪʃəs/", nil, "en"},
{ "/ɛː.e.lí.o͜i.o/", 5, "grc" },
{ "/vl̩k/", 1, "cs" },
{ "/ˈɑːmiɑi̯smɑjoi̯tus/", 6, "fi" },
{ "/ˈɛi̯ərə(n)/", 3, "nl" },
}
tests:iterate(examples, "check")
end
return tests