Module:fi-pronunciation/testcases

All tests passed. (refresh)

TextExpectedActual
test_phonetic:
rhyme detection
Passedkalaɑlɑɑlɑ
Passedlehtoehtoehto
Passedehtoehtoehto
Passed
Passedomenanammeɑmːeɑmːe
Passedliu'utusiu.utusiu.utus

local tests = require "Module:UnitTests"
local rhyme = require "Module:fi-pronunciation".generate_rhyme

local function link_fi(term)
	return '<span class="Latn" lang="fi">[[' .. term .. "#Finnish|" .. term .. ']]</span>'
end

local function tag_IPA(transcription)
	return '<span class="IPA">' .. transcription .. '</span>'
end

function tests:test_phonetic()
	local examples = {
		"rhyme detection",
		{ "kala", "ɑlɑ" },
		{ "lehto", "ehto" },
		{ "ehto", "ehto" },
		{ "yö", "yø" },
		{ "omenanamme", "ɑmːe" },
		{ "liu'utus", "iu.utus" }, -- iuʔutus
	}
	
	local options = { display = tag_IPA }
	
	self:iterate(examples,
		function (self, term, expected, respelling)
			self:equals(
				link_fi(term)
					.. (respelling and " (<kbd>" .. respelling .. "</kbd>)" or ""),
				rhyme(respelling or term, true),
				expected, options)
		end)
end

return tests