Module:User:AmazingJus/is/testcases

local tests = require('Module:UnitTests') local m_IPA = require('Module:User:AmazingJus/is')

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

local function generate_link(term) return mw.ustring.gsub(term, "[%-%.]", "") end

function tests:check_output(term, expected, respell) local generated_link = generate_link(term) local respelled_term = respell or term

return tests:equals(		m_IPA.tag_text(m_IPA.link(generated_link)) .. (respelled_term ~= generated_link and mw.ustring.format(" (respelled %s)", m_IPA.tag_text(respelled_term)) or ""), 		m_IPA.toIPA(term), 		expected, 		{ display = tag_IPA } 	) end

function tests:test_pron local list = { {"þorn", "ˈθɔrtn̥" }, {"himinn", "ˈhɪːmɪnː" }, {"brúnn", "ˈprutn̥" }, {"steinn", "ˈstɛi̯tn̥" }, {"geim-steinn", "ˈcɛi̯mstɛi̯tn̥" }, {"karl", "ˈkʰartl̥" }, {"rusl", "ˈrʏstl̥" }, {"bysna", "ˈpɪstn̥a" }, {"ráp.s", "ˈrau̯ːps" }, {"taka", "ˈtʰaːka" }, {"þökk", "ˈθœhk" }, {"vopn", "ˈvɔhpn̥" }, {"brotna", "ˈprɔhtn̥a" }, {"sakna", "ˈsahkn̥a" }, {"kembt", "ˈcʰɛm̥t" }, {"þið", "ˈθɪːð" }, {"guð", "ˈkvʏːð" }, {"byggja", "ˈpɪcːa" }, {"syngja", "ˈsinca" }, {"munkur", "ˈmuŋkʏr" }, {"öngull", "ˈœy̯ŋkʏtl̥"}, {"drengur", "ˈtrɛi̯ŋkʏr" }, {"svangur", "ˈsvau̯ŋkʏr" }, {"England", "ˈɛi̯ŋlant" }, {"segja", "ˈsɛi̯ːja" }, {"fluga", "ˈflʏːɣa" }, {"fljúga", "ˈfljuːa" }, {"bógur", "ˈpou̯ːʏr" }, {"lágur", "ˈlau̯ːʏr" }, {"prófa", "ˈpʰrou̯ːa" }, {"dags", "ˈtaxs" }, {"dragt", "ˈtraxt" }, {"guð-spjall", "ˈkvʏðspjatl̥" }, {"september", "ˈsɛftɛmpɛr" }, {"október", "ˈɔxtou̯pɛr" }, {"gjalda", "ˈcalta" }, {"geta", "ˈcɛːta" }, {"kjósa", "ˈcʰou̯ːsa" }, {"keyra", "ˈcʰɛi̯ːra" }, {"kirkja", "ˈcʰɪrca" }, {"hlýr", "ˈl̥iːr" }, {"hratt", "ˈr̥aht" }, {"spara", "ˈspaːra" }, {"þykja", "ˈθɪːca" }, {"lofa", "ˈlɔːva" }, {"rós", "ˈrou̯ːs" }, {"vaxa", "ˈvaxsa" }, {"myl-la", "ˈmɪlːa" }, {"nudda", "ˈnʏtːa" }, {"kaþólikki", "ˈkʰaːθou̯lɪhcɪ" } }	self:iterate(list, "check_output") end

--			Additions take this form –		{ "entry name", "IPA" },		{ "", "" },			or, if you are generating IPA from a respelling of the term –		{ "respelling", "IPA", "entry name" }		{ "", "", "" },			Make sure to include the comma, or the module will return an error. --

return tests