Module:User:Fenakhay/mt-IPA/testcases

local tests = require("Module:UnitTests") local m_IPA = require("Module:User:Fenakhay/mt-IPA") local m_links = require("Module:links") local lang = require("Module:languages").getByCode("mt")

function link(term) return require("Module:links").full_link { term = term, lang = lang, sc = sc   } end

local function tag_IPA(IPA) return ' ' .. IPA .. ' ' end

local options = { display = tag_IPA }

function tests:check_ipa(term, expected_archaic, expected_rural, respelling) if respelling == nil then respelling = expected_rural expected_rural = nil end local archaic = m_IPA.mt_IPA(respelling or term, "archaic") local rural_archaic = m_IPA.mt_IPA(respelling or term, "rural") local show_both = archaic ~= rural_archaic options.comment = show_both and "archaic" self:equals(		link(term) .. (respelling and (" (respelled " .. respelling .. ")") or ""),		archaic,		expected_archaic,		options	) if show_both then options.comment = show_both and "archaic rural" self:equals(			link(term) .. (respelling and (" (respelled " .. respelling .. ")") or ""),			rural_archaic,			expected_rural,			options		) end end

function tests:test_pron examples = { { "għoxx", "ɔˤːʃ"}, { "għoxa", "ɔˤːʃa", "ɣɔʃa", "ḡoxa"}, { "bajd", "bajt"}, { "bgħid", "bəˤjt", "bgħîd"}, { "Alla jagħtih il-ġenna", "alla jaˤːtɪːħ ɪld͡ʒɛnna", "Alla jagħtîh il-ġenna"}, { "baħar", "baħar"}, { "bieb", "bɪːp"}, { "bagħat", "baˤːt"}, { "bagħal", "baˤːl", "baɣal", "baḡal"}, { "bgħula", "bəˤwla", "bɣuːla", "bḡûla"}, { "bejjiegħ", "bɛjjɪːħ"}, { "begħtu", "bɛˤːtu"}, { "għoxrin", "ɔˤːʃriːn", "għoxrîn"}, { "għira", "əˤjra", "ɣiːra", "ḡîra"}, { "ikrah", "ɪkraħ"}, { "jixbhu", "jɪʃpħu", "jixbħu"}, { "hedded", "ɛːddɛt"}, { "fehmet", "fɛːmɛt"}, { "jibniha", "jɪbnɪːja", "jibnîha"}, { "nħobbuhom", "(ɪ)nħɔbbuːwɔm", "nħobbûhom"}, { "rahom", "rɔːm", "râhom"}, { "ftehim", "ftɛjm, ftɛjiːm", "ftehîm"}, { "lbieraħ", "(ɪ)lbɪːraħ"}, { "għandek bżonn għajnuna", "aˤːndɛk bzɔnn aˤːjnuːna", "għandek bżonn għajnûna"}, { "tista' tgħinni", "tɪstaˤ təˤjnnɪ", "tista' tgħînni"}, { "attakkaha", "attakkaː", "attakkâha"}, { "ħtabtu", "ħtaptu"}, { "dsatax", "t͡sataːʃ", "dsatâx"}, { "bgħadt", "baˤːt", "bɣat", "bḡadt"}, { "televixin", "tɛlɛvɪʒɪn", "televižin"}, { "bgħadtu", "baˤːttu", "bɣattu", "bḡadtu"}, { "obogħdu", "ɔbɔˤːdu", "ɔbɔɣdu", "oboḡdu"}, { "obogħtu", "ɔbɔˤːtu", "ɔbɔħtu", "oboḡtu"}, { "nnazzjonalizza", "(ɪ)nnatt͡sjɔnalɪdd͡za"}, { "nazzjonalizzazzjonijiet", "natt͡sjɔnalɪdd͡zatt͡sjɔnɪjɪːt"}, { "ġġeneralizzajtu", "(ɪ)dd͡ʒɛnɛralɪdd͡zajtu"}, { "tagħha", "taħħa"}, { "tiegħek", "tɪːəˤk"}, { "tiegħu", "tɪːəˤw"}, { "spallti", "spalltɪ"}, { "żbajjeb", "zbajjɛp"}, { "jisimgħu", "jɪsɪməˤw"}, { "qabilha", "ʔabɪla"}, { "jarawhx", "jarawħʃ", "jarawħx"}, { "għereq", "ɛˤːrɛʔ"}, { "għereq", "ɛˤːrɛʔ", "ɣɛrɛʔ", "ḡèreq"}, { "bigħ", "bɪːħ", "bîgħ"}, { "pitgħada", "pɪtaˤːda", "pɪdɣada", "pitḡada"}, }

tests:iterate(examples, "check_ipa") end

return tests