Jump to content

Module:fo-pron/testcases

From Wiktionary, the free dictionary

1 of 0 tests failed. (refresh)

TextExpectedActual
test_pron:
Script error during testing: Module:script_utilities:322: Invalid script face "0".
stack traceback:
	[C]: ?
	[C]: in function 'error'
	Module:script_utilities:322: in function 'tag_text'
	Module:links:946: in function <Module:links:789>
	(tail call): ?
	Module:fo-pron/testcases:14: in function 'func'
	Module:UnitTests:296: in function 'iterate'
	Module:fo-pron/testcases:133: in function <Module:fo-pron/testcases:21>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:370: in function <Module:UnitTests:329>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
	[C]: in function 'expandTemplate'
	mw.lua:333: in function 'expandTemplate'
	Module:documentation:892: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?

local tests = require('Module:UnitTests')
local m_IPA = require('Module:fo-pron')

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

local function generate_link(term)
	return mw.ustring.gsub(term, "[%-%.]", "")
end

function tests:check_output(term, expected)
	tests:equals(
		m_IPA.tag_text(m_IPA.link(generate_link(term))),
		m_IPA.toIPA(term),
		expected,
		{ display = tag_IPA }
	)
end
	
function tests:test_pron()
	list = {
		{"bilur", "ˈpiːlʊɹ" },
		{"dreymur", "ˈtɹɛiːmʊɹ" },
		{"djúpd", "ˈtʃʏpt" },
		{"fremmandur", "ˈfɹɛmːantʊɹ" },
		{"ganga", "ˈkaŋka" },
		{"gita", "ˈtʃiːta" },
		{"gjalda", "ˈtʃalta" },
		{"herur", "ˈheːɹʊɹ" },
		{"hjarta", "ˈjaʂʈa" },
		{"hjá", "ˈtʃɔaː" },
		{"hvørva", "ˈkvœɹʋa" },
		{"javnur", "ˈjaʋnʊɹ" },
		{"koma", "ˈkʰoːma" },
		{"kirkja", "ˈtʃʰɪʂtʃʰa" },
		{"kjøt", "ˈtʃʰøːt" },
		{"lykil", "ˈliːtʃʰɪl" },
		{"mostir", "ˈmɔstɪɹ" },
		{"nakar", "ˈnɛaːʰkaɹ" },
		{"njósa", "ˈɲɔuːsa" },
		{"næmingur", "ˈnɛaːmɪŋkʊɹ" },
		{"eingin", "ˈɔɲtʃɪn" },
		{"postur", "ˈpʰɔstʊɹ" },
		{"ríkur", "ˈɹʊiːkʊɹ" },
		{"særa", "ˈsɛaːɹa" },
		{"sjálvur", "ˈʃɔlʋʊɹ" },
		{"skomm", "ˈskɔmː" },
		{"skilja", "ˈʃɪlja" },
		{"skjóta", "ˈʃɔuːtʰa" },
		{"stjørna", "ˈʃœtn̥a" },
		{"taka", "ˈtʰɛaːkʰa" },
		{"tjóð", "ˈtʃʰɔuː" },
		{"vakur", "ˈvɛaːkʊɹ" },
		{"geva", "ˈtʃeːʋa" },
		
		{"hálsur", "ˈhɔl̥sʊɹ" },
		{"evstur", "ˈɛfstʊɹ" },
		{"allur", "ˈatl̥ʊɹ" },
		{"vinna", "ˈvɪnːa" },
		{"okkara", "ˈɔʰkaɹa" },
		{"gjørdur", "ˈtʃœɻʈʊɹ" },
		{"burtur", "ˈpʊʂʈʊɹ" },
		{"barn", "ˈpatn̥" },
		{"perla", "ˈpʰɛɻɭa" },
		{"tersur", "ˈtʰɛʂːʊɹ" },
		
		{"hjálpti", "jɔl̥tɪ" },
		{"yrkti", "ˈɪɻ̊ʈɪ" },
		{"føroyskt", "ˈføːɹɪst" },
		{"íslendskt", "ˈʊʃlɛŋ̊st" },
		{"enskt", "ɛŋ̊kst" },
		{"írskt", "ʊʂt" },
		
		{"bíða", "ˈpʊija" },
		{"seyður", "ˈsɛijʊɹ" },
		{"kvæði", "ˈkvɛajɪ" },
		{"Óðin", "ˈɔʊwɪn" },
		{"suður", "ˈsuːwʊɹ" },
		{"góðan morgun", "ˌkɔʊwan ˈmɔɹkʊn" },
		{"áður", "ˈɔavʊɹ" },
		{"leður", "ˈleːvʊɹ" },
		{"elskaðar", "ˈɛlskajaɹ" },
		{"ráða", "ˈɹɔːa" },
		{"boða", "ˈpoːa" },
		{"kvøða", "ˈkvøːa" },
		
		{"gjógv", "tʃɛkv" },
		{"kúgv", "kʰɪkv" },
		{"trúgva", "ˈtʂɪkva" },
		{"trúleysur", "ˈtʂʉuːlɛisʊɹ" },
		{"heyggjur", "ˈhɛtʃːʊɹ" },
		{"heygnum", "ˈhɛiːnʊn" },
		{"nýggjur", "ˈnʊtʃːʊɹ" },
		{"nýtt", "nʊiʰtː" },
		{"oyggj", "ɔtʃː" },
		
		{"linur", "ˈliːnʊɹ" },
		{"frekur", "ˈfɹeːkʊɹ" },
		{"mytisk", "ˈmyːtɪsk" },
		{"høgur", "ˈhøːʋʊɹ" },
		{"gulur", "ˈkuːlʊɹ" },
		{"tola", "ˈtʰoːla" },
		{"Kanada", "ˈkʰaːnata" },
		
		{"hvítur", "ˈkvʊiːtʊɹ" },
		{"deyður", "ˈteiːjʊɹ" },
		{"feitur", "ˈfaiːtʊɹ" },
		{"gloyma", "ˈklɔiːma" },
		{"spakur", "ˈspɛaːkʊɹ" },
		{"vátur", "ˈvɔaːtʊɹ" },
		{"fúlur", "ˈfʉuːlʊɹ" },
		{"tómur", "ˈtʰɔuːmʊɹ" },
		
		{"lint", "lɪn̥t" },
		{"frekt", "fɹɛʰkt" },
		{"mystisk", "ˈmʏstɪsk" },
		{"høgt", "hœkt" },
		{"gult", "kʊl̻t" },
		{"toldi", "ˈtʰɔltɪ" },
		{"land", "lant" },
		
		{"hvítt", "kvʊiʰtː" },
		{"deytt", "tɛʰtː" },
		{"feitt", "faiʰtː" },
		{"gloymdi", "ˈklɔimtɪ" },
		{"spakt", "spakt" },
		{"vátt", "vɔʰtː" },
		{"fúlt", "fʏl̥t" },
		{"tómt", "tʰœm̥t" },
	}

	self:iterate(list, "check_output")
end

return tests