local tests = require "Module:UnitTests"
local m_pron = require "Module:User:Erutuon/en-pronunciation"
local convert = m_pron.convert
local smooth = m_pron.smooth
local function tag(text)
return '<span class="IPA">' .. text .. '</span>'
end
local options = { display = tag }
function tests:check_system_conversion(example, from, to, expected)
self:equals(tag(example) .. " (" .. from .. " → " .. to .. ")", convert(example, from, to), expected, options)
end
function tests:test_system_conversion()
local examples = {
{ "ˈlɔɪ.ə", "RP", "Lindsey", "ˈloj.ə" },
{ "ˈmeə", "RP", "Lindsey", "ˈmɛː" },
{ "æmbɪˈgjuːɪti", "RP", "Lindsey", "ambɪˈgjʉwɪtɪj" },
{ "ˈləʊə", "RP", "Lindsey", "ˈləwə" },
}
self:iterate(examples, "check_system_conversion")
end
function tests:check_smoothing(example, system, expected)
self:equals(
tag(example) .. " (" .. system .. ")",
smooth(example, system),
expected,
options)
end
function tests:test_smoothing()
local examples = {
{ "ˈlɔɪ.ə", "RP", "ˈlɔə" }, -- a pronunciation of lawyer
{ "ˈloj.ə", "Lindsey", "ˈloː" },
{ "ˈləʊə", "RP", "ˈləə" }, -- lower
{ "ˈləwə", "Lindsey", "ˈləː" },
{ "laɪəˈbɪlɪti", "RP", "laəˈbɪlɪti" }, -- liability
{ "lɑjəˈbɪlɪtɪj", "Lindsey", "lɑːˈbɪlɪtɪj" },
{ "ˈpeɪə", "RP", "ˈpeə" }, -- payer: smoothing unlikely?
{ "ˈpɛjə", "Lindsey", "ˈpɛː" },
{ "ˈfɹiːə", "RP", "ˈfɹɪə" }, -- freer: smoothing unlikely?
{ "ˈfɹɪjə", "Lindsey", "ˈfɹɪː" },
{ "sɪˈkjuːə", "RP", "sɪˈkjʊə" }, -- secure; this pronunciation probably not used in RP; better example?
{ "sɪˈkjʉwə", "Lindsey", "sɪˈkjɵː" },
{ "ˈflɑʊə", "RP", "ˈflɑə" }, -- flower
{ "ˈflawə", "Lindsey", "ˈflaː" },
--[[
{ "", "", "" },
--]]
}
self:iterate(examples, "check_smoothing")
end
return tests