Module:mk-pronunciation/testcases

Definition from Wiktionary, the free dictionary
Jump to: navigation, search

All tests passed. (refresh)

test_all:
Text Expected Actual
Passed нананазад (nananazad) naˈnanazat naˈnanazat
Passed Тласолтеотл (Tlasolteotl) tɫasɔɫˈtɛɔtɫ̩ tɫasɔɫˈtɛɔtɫ̩
Passed њутн (njutn) ˈɲutn̩ ˈɲutn̩
Passed правци (pravci) ˈpraft͡si ˈpraft͡si
Passed надежта (nadežta) ˈnadɛʃta ˈnadɛʃta
Passed бели (beli) ˈbɛli ˈbɛli
Passed соседство (sosedstvo) ˈsɔsɛtstvɔ ˈsɔsɛtstvɔ
Passed зима́ва (zimáva) ziˈmava ziˈmava
Passed одва́j (odváj) ɔˈdvaj ɔˈdvaj
Passed Мавританија (Mavritanija) mavriˈtani(j)a mavriˈtani(j)a
Passed ’рѓа (’rǵa) ˈr̩ɟa ˈr̩ɟa
Passed бесчестен (besčesten) ˈbɛʃt͡ʃɛstɛn ˈbɛʃt͡ʃɛstɛn
Passed бара (bara) ˈbaɾa ˈbaɾa
Passed станбен (stanben) ˈstambɛn ˈstambɛn
Passed конфузен (konfuzen) ˈkɔɱfuzɛn ˈkɔɱfuzɛn
Passed рамка (ramka) ˈramka ˈramka
Passed амфора (amfora) ˈaɱfɔɾa ˈaɱfɔɾa
Passed емиграциски (emigraciski) ɛmiˈɡrat͡siski ɛmiˈɡrat͡siski
Passed соучесништво (součesništvo) sɔuˈt͡ʃɛsniʃtvɔ sɔuˈt͡ʃɛsniʃtvɔ

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

local Macedonian = require("Module:languages").getByCode("mk")
local Cyrillic = require("Module:scripts").getByCode("Cyrl")

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

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

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

function tests:test_all()
	local list = {
		{ "нананазад", "naˈnanazat" },
		{ "Тласолтеотл", "tɫasɔɫˈtɛɔtɫ̩" },
		{ "њутн", "ˈɲutn̩" },
		{ "правци", "ˈpraft͡si" },
		{ "надежта", "ˈnadɛʃta" },
		{ "бели", "ˈbɛli" },
		{ "соседство", "ˈsɔsɛtstvɔ" },
		{ "зима́ва", "ziˈmava" },
		{ "одва́j", "ɔˈdvaj" },
		{ "Мавританија", "mavriˈtani(j)a" },
		{ "’рѓа", "ˈr̩ɟa" },
		{ "бесчестен", "ˈbɛʃt͡ʃɛstɛn" },
		{ "бара", "ˈbaɾa"},
		{ "станбен", "ˈstambɛn"},
		{ "конфузен", "ˈkɔɱfuzɛn"},
		{ "рамка", "ˈramka"},
		{ "амфора", "ˈaɱfɔɾa"},
		{ "емиграциски", "ɛmiˈɡrat͡siski"},
		{ "соучесништво", "sɔuˈt͡ʃɛsniʃtvɔ"},
	}
--[[
	Additions take this form –
		{ "word with acutes", "IPA" },
		{ "", "" },
	Make sure to include the comma, or the module will return an error.
]]
	
	self:iterate(list, "check_output")
end

return tests