Jump to content

Module:lt-pron/testcases

From Wiktionary, the free dictionary

6 of 20 tests failed. (refresh)

TextExpectedActualComments
test_pron:
Failedstovė́tistoːˈʋʲeː.tʲɪstoːˈʋʲêː.tʲɪ
Passedgaliàɡɐˈlʲɛɡɐˈlʲɛ
Passedgàliaˈɡɐ.lʲɛˈɡɐ.lʲɛ
Passedapniū̃ktiɐpʲˈnʲuːk.tʲɪɐpʲˈnʲuːk.tʲɪ
Passedpažìntipɐˈʑɪnʲ.tʲɪpɐˈʑɪnʲ.tʲɪ
Passedtamsùstɐmˈsʊstɐmˈsʊs
Failedabúojasɐˈbûə.jɐsɐˈbʊ̂ə.jɐs
Passedkóšėˈkôː.ɕeːˈkôː.ɕeː
Passedkõšėˈkoː.ɕeːˈkoː.ɕeː
Failedpriepʲrʲiəpʲrʲɪ
Passednórsˈnôːrsˈnôːrs
Failedgyvẽnimasɡʲiːˈʋʲɛː.nʲɪ.mɐsɡʲiːˈʋʲɛ.nʲɪ.mɐs
Failedkauburỹskɐʊ̯ˑ.bʊˈrʲiːskɐʊ̯.bʊˈrʲiːs
TextExpectedActualComments
test_respell:
Passedpãieškospãjieškospãjieškos
Passedievàjievàjievà
Passeddiẽmedisdʲiẽmʲedʲisdʲiẽmʲedʲis
Passedapkeliáujantiapʲkʲelʲiáujanʲtʲiapʲkʲelʲiáujanʲtʲi
Passedapniū̃ktiapʲnʲū̃ktʲiapʲnʲū̃ktʲi
Passedabchãząabçãząabçãzą
Failedbiŏlŏ̀gijabʲijɔlɔ̀gʲijabʲiɔlɔ̀gʲija

local tests = require("Module:UnitTests")
local m_IPA = require("Module:lt-pron")

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

function tests:check_IPA(term, func, expected, comment)
	self:equals(
		m_IPA.link(term),
		tag_IPA(mw.ustring.toNFC(func(term))),
		tag_IPA(expected),
		{ comment = comment, show_difference = true }
	)
end

function tests:test_pron()
	local examples = {
		{ "stovė́ti", "stoːˈʋʲeː.tʲɪ", "" },
		{ "galià", "ɡɐˈlʲɛ", "" },
		{ "gàlia", "ˈɡɐ.lʲɛ", "" },
		{ "apniū̃kti", "ɐpʲˈnʲuːk.tʲɪ", "" },
		{ "pažìnti", "pɐˈʑɪnʲ.tʲɪ", "" },
		{ "tamsùs", "tɐmˈsʊs", "" },
		{ "abúojas", "ɐˈbûə.jɐs", "" },
		{ "kóšė", "ˈkôː.ɕeː", ""},
		{ "kõšė", "ˈkoː.ɕeː", ""},
		{ "prie", "pʲrʲiə", ""},
		{ "nórs", "ˈnôːrs", ""},
		{ "gyvẽnimas", "ɡʲiːˈʋʲɛː.nʲɪ.mɐs", ""},
		{ "kauburỹs", "kɐʊ̯ˑ.bʊˈrʲiːs", ""},
	}
	--[[	Copy the following to add more examples:
		{ "", "", "" },
	]]

	for _, example in ipairs(examples) do
		local term, expected, comment = unpack(example)
		self:check_IPA(term, m_IPA.toIPA, expected, comment)
	end
end

function tests:test_respell()
	local examples = {
		{ "pãieškos", "pãjieškos", "" },
		{ "ievà", "jievà", "" },
		{ "diẽmedis", "dʲiẽmʲedʲis", "" },
		{ "apkeliáujanti", "apʲkʲelʲiáujanʲtʲi", "" },
		{ "apniū̃kti", "apʲnʲū̃ktʲi", "" },
		{ "abchãzą", "abçãzą", "" },
		{ "biŏlŏ̀gija", "bʲijɔlɔ̀gʲija", "" },
	}
	--[[	Copy the following to add more examples:
		{ "", "", "" },
	]]

	for _, example in ipairs(examples) do
		local term, expected, comment = unpack(example)
		self:check_IPA(term, m_IPA.respell, expected, comment)
	end
end

return tests