Module:User:Erutuon/ru-pronunciation/testcases

local tests = require('Module:UnitTests')

local m_IPA = require("Module:User:Erutuon/ru-pronunciation") local ru = require("Module:languages").getByCode("ru") local Cyrl = require("Module:scripts").getByCode("Cyrl")

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

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

function tests:check_pron(Cyrl, IPA) self:equals(		link(Cyrl),		m_IPA.toIPA(Cyrl),		IPA,		{ display = tag_IPA }	) end

local function iterate(list) for i, example in pairs(list) do		tests:check_pron(example[1], example[2]) end end

function tests:test_IPA local examples = { { "быть", "bɨtʲ" }, { "она́", "aˈna" }, { "то́лько", "ˈtolʲka" }, { "говори́ть", "gavaˈrʲitʲ" }, { "голова́", "galaˈva" }, { "семья́", "sʲiˈmʲja" }, { "но́вое", "ˈnovaja" }, { "де́лаете", "ˈdʲelajitʲe" }, { "три", "trʲi" }, { "ме́сяц", "ˈmʲesʲit͡s" }, { "жена́", "ʐɨˈna" }, { "жир", "ʐɨr" }, { "хоро́ший", "xaˈroʂɨj" }, { "ночь", "not͡ɕ" }, { "се́рдце", "ˈsʲert͡sa" }, --		{ "", "" },			}	iterate(examples) end

return tests