Jump to content

Module:lif-IPA/testcases

From Wiktionary, the free dictionary

1 of 11 tests failed. (refresh)

TextExpectedActualComments
test_phonetic:
Passedᤏᤡᤱᤄᤢᤶ (niṅghum)[niŋ.ɡʱum][niŋ.ɡʱum]
Passedᤕᤠᤰᤌᤢᤱ (yakthuṅ)[jak.tʰuŋ][jak.tʰuŋ]
Passedᤐᤠᤴ (pan)[pan][pan]
Passedᤁ᤺ᤰ (kô̄k)[kɔːk][kɔːk]
Passedᤁᤁ᤻ (kô̄k)[kɔːk][kɔːk]
Failedᤁ᥄᥅॥ (kô!?.)[kɔ!? ][kɔ!? ]
Passedᤁᤴ (kôn)[kɔn][kɔn]
Passedᤔᤩᤠᤱ (myaṅ)[mjaŋ][mjaŋ]
Passedᤁᤧᤖᤧᤀᤠᤱ (kêrêaṅ)[kɛ.rɛ.ʔaŋ][kɛ.rɛ.ʔaŋ]
Passedᤌᤡᤰᤁᤥ (thikko)[tʰik.koˑ][tʰik.koˑ]
Passedᤏᤠ᤺ᤵᤔᤠ (nāpma)[naːp.ma][naːp.ma]

local tests = require("Module:UnitTests")
local m_IPA = require("Module:lif-IPA")

local function tag_IPA(IPA)
		if phonetic then
			IPA = '/' .. IPA .. '/'
		else
			IPA = '[' .. IPA .. ']'
		end
	return '<span class="IPA">' .. IPA .. '</span>'
end
function tests:check_output(term, expected, comment)
	self:equals(
		m_IPA.link(term),
		tag_IPA(m_IPA.toIPA(term, "standard")),
		tag_IPA(expected),
		{ comment = comment }
	)
end

function tests:test_phonetic()
	examples = {
{ "ᤏᤡᤱᤄᤢᤶ", "niŋ.ɡʱum" },
{ "ᤕᤠᤰᤌᤢᤱ", "jak.tʰuŋ" },
{ "ᤐᤠᤴ", "pan" },
{ "ᤁ᤺ᤰ", "kɔːk" },
{ "ᤁᤁ᤻", "kɔːk" },
{ "ᤁ᥄᥅॥", "kɔ!? " },
{ "ᤁᤴ", "kɔn" },
{ "ᤔᤩᤠᤱ", "mjaŋ" },
{ "ᤁᤧᤖᤧᤀᤠᤱ", "kɛ.rɛ.ʔaŋ" },
{ "ᤌᤡᤰᤁᤥ", "tʰik.koˑ" },
{ "ᤏᤠ᤺ᤵᤔᤠ", "naːp.ma" },
	}
tests:iterate(examples, "check_output")

end

return tests