Jump to content

Module:syllables/testcases

Wiktionary වෙතින්

All tests passed. (refresh)

TextExpectedActual
test:
Passed/noʊ ˈhaɪweɪ ˈkaʊboɪz/55
Passedðɛɚ22
Passedðɛɹ11
Passed/avə(ʊ)ˈkeɪʃən/44
Passed/-eɪʃəs/(nil)(nil)
Passed/ɛː.e.lí.o͜i.o/55
Passed/vl̩k/11
Passed/ˈɑːmiɑi̯smɑjoi̯tus/66
Passed/ˈɛi̯ərə(n)/33

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
"https://si.wiktionary.org/w/index.php?title=Module:syllables/testcases&oldid=168888" වෙතින් සම්ප්‍රවේශනය කෙරිණි