Module:cu-pronunciation/sandbox/testcases

From Wiktionary, the free dictionary
Jump to navigation Jump to search


local tests = require('Module:UnitTests')
local m_IPA = require('Module:cu-pronunciation/sandbox')

local OCS = require('Module:languages').getByCode("cu")
local Cyrillic = require('Module:scripts').getByCode("Cyrl")

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

local function tag_IPA(IPA)
	return '<span class="IPA">' .. IPA .. '</span>'
end

function tests:check_output(term, expected)
	tests:equals(
		term,
		expected,
		m_IPA.toIPA(term),
		{ display = tag_IPA }
	)
end

function tests:test_all()
	list = {
		{ "сло̏во", "s̪ɫ̪ɔ̟˦vɔ̟˨"},
		{ "дальчьнъ", "dalɪt͡ʃɪnʊ̆"},
		{ "йгрь", "jɪgrɪ"},
		{ "ѿкаꙁъ", "ɔtʊ̆kazʊ̆"},
		{ "югъ", "juɡʊ"},
		{ "мєждоу", "mɛʒdu"},
		{ "съчѧстьнъ", "sʊ̆t͡ʃɛ̃stɪnʊ̆"}
	}
	self:iterate(list, "check_output")
end
		
return tests