Module:aa-IPA/testcases

local tests = require("Module:UnitTests") local m_IPA = require("Module:aa-IPA") local lang = require("Module:languages").getByCode("aa")

local function tag_IPA(IPA) return ' ' .. IPA .. ' ' end local options = {display = tag_IPA}

local function link(word) return require("Module:links").full_link({term = word, lang = lang}, nil, true) end

function tests:check_pron(word, expected) self:equals(		link(word), m_IPA.pronunciation_phonemic(word), expected, options	) end

function tests:test_pron local examples = { {"derrél", "derˈrel"}, {"caxák", "ħʌˈɖʌk"}, {"qalék", "ʕʌˈlek"}, {"gúra", "ˈɡuɾʌ"}, {"mídga", "ˈmidɡʌ"}, {"bagitté", "bʌɡitˈte"}, {"bágu", "ˈbʌɡu"}, {"fóoca", "ˈfoːħʌ"}, {"darreerá", "dʌrːeːˈɾʌ"}, {"abbaasité", "ʌbːaːsiˈte"}, {"tabàn kee affará", "tʌˌbʌn keː ʌfːʌˈɾʌ"}, {"-í", "-ˈi"} }	tests:iterate(examples, "check_pron") end

function tests:test_hyphenation local function format_hyphenation(hyphenation) return table.concat(hyphenation, "‧") end self:iterate(		{			{ "abalsiise", { "a", "bal", "sii", "se" } },			{ "derrel", { "der", "rel" } },			{ "absuma", { "ab", "su", "ma" } },			{ "taban kee affara", { "ta", "ban kee af", "fa", "ra" } }		},		function(self, term, expected)			self:equals( link(term), format_hyphenation(m_IPA.syllabify(term)), format_hyphenation(expected) )		end	) end

return tests