Module:cu-pronunciation/testcases

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

Each testcase challenges different capabilities of the system, which serve to increase the template's accuracy. If all testcases pass, then the system has assigned the correct sound values to characters, transcribes ѵ in respect to surrounding sounds, knows which consonants are syllabic and transcribes them as such, and can identify and correctly transcribe tense, lax, strong and weak yers. This means that maximum historical accuracy has been achieved.


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

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,
		m_IPA.toIPA(term),
		expected,
		{ display = tag_IPA }
	)
end

function tests:test_all()
	list = {
		{ "пѣти", "pæː.t̪iː"},
		{ "кѫ̏ща", "kɔ̃ꜜɔ̃.ʃtʲæː"},
		{ "[[Ꙁеѵсъ]]", "z̪ɛ̠.ʋs̪ə̆"},
		{ "Сѵрий", "s̪iː.ɾ̪iː.jɪ̆"},
		{ "ю̏гъ", "jʉꜜʉ.ɡə̆"},
		{"ѣ̀сти", "jæꜛæ.s̪t̪iː"},
		{ "междоу̀", "mɛ̠.ʒdʲʉꜛʉ"},
		{ "съ́ѭꙁъ", "s̪ʊ.jɞ̃.z̪ə̆"},
		{ "ть̏нъкъ", "t̪ɪꜜ.n̪ʊ.kə̆"},
		{ "грь̏къ", "ɡr̩ꜜ.kə̆"},
		{ "влъ̏къ", "ʋɫ̩ꜜ.kə̆"},
		{ "чаꙗ̀ньѥ", "t͡ʃæː.jæꜛæ.n̪i.jɛ̠"},
		{ "мо̏р҄є", "mɔ̟ꜜ.ɾ̟ɛ̠"},
		{ "чрѣ̏шьнꙗ", "t͡ʃɾ̪æꜜæ.ʃɪ̆.ɲ̟æː"},
		{ "ꙁємлꙗ̏", "z̪ɛ̠.mʎ̟æꜜæ"},
		{ "прѣль̏стьнъ", "pɾ̪æː.l̪ɪꜜ.s̪t̪ɪ.n̪ə̆"},
		{ "хѣръ", "ɕæː.ɾ̪ə̆"},
	}
	self:iterate(list, "check_output")
end
		
return tests