Module:zlw-opl-IPA/testcases

local tests = require("Module:UnitTests") local m_IPA = require("Module:zlw-opl-IPA") local m_table = require("Module:table") local lang = require("Module:languages").getByCode("zlw-opl")

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

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

local options = {display = tag_IPA}

function tests:check_ipa(term, expected_pre, expected_post, respelling) if expected_post == nil then expected_post = expected_pre end

local pre = m_IPA.phonemic(respelling or term) local post = m_IPA.phonemic(respelling or term, true) local show_both = not m_table.deepEquals(pre, post)

options.comment = show_both and "10th-15th CE" tests:equals(		link(term) .. (respelling and (" (respelled " .. respelling .. ")") or ""),		m_table.sparseConcat(pre, ", "),		expected_pre,		options	)

if show_both then options.comment = show_both and "15th CE" tests:equals(			link(term) .. (respelling and (" (respelled " .. respelling .. ")") or ""),			m_table.sparseConcat(post, ", "),			expected_post,			options		) end end

function tests:test_ipa local examples = { {"będąc", "bæ̃dɑ̃t͡s"}, {"przykład", "pr̝ikɫaːt", "pr̝ikɫɒt", "przykła:d"}, {"aczżeż", "ad͡ʒʲʒʲɛʃ"}, {"bleń", "blʲɛɲ"}, {"elkierz", "ɛlʲkjɛr̝"}, {"dobrzemówić", "dɔbr̝ɛmɔːvit͡ɕ", "dɔbr̝ɛmovit͡ɕ"}, {"połam", "pɔɫaːmʲ", "pɔɫɒmʲ", "poła:ḿ"}, {"gołąb", "ɡɔɫɑ̃pʲ", "ɡɔɫɑ̃pʲ", "gołąb́"}, {"brew", "brɛfʲ", "brɛfʲ", "breẃ"}, {"drap", "drapʲ", "drapʲ", "draṕ"}, {"żołdnierz", "ʒʲɔɫdɲɛ(ː)r̝", "ʒʲɔɫdɲɛr̝, ʒʲɔɫdɲer̝", "żołdnie?rz"}, {"wspowiedź", "fspɔvjɛ(ː)t͡ɕ", "fspɔvjɛt͡ɕ, fspɔvjet͡ɕ", "wspowie?dź"}, {"człowiectwo", "t͡ʃʲɫɔvjɛt͡stfɔ"}, {"kocieł", "kɔt͡ɕɛɫ"}, {"barzo", "barzɔ", "barzɔ", "bar-zo"} }

tests:iterate(examples, "check_ipa") end

return tests