Module:pl-IPA/testcases

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

3 tests failed. (refresh)

test_ipa:
Text Expected Actual
Passed klacz klat͡ʂ klat͡ʂ
Passed odrzut ˈɔd.ʐut ˈɔd.ʐut
Passed zupa ˈzu.pa ˈzu.pa
Passed przeżytek pʂɛˈʐɨ.tɛk pʂɛˈʐɨ.tɛk
Passed awers ˈa.vɛrs ˈa.vɛrs
Passed abażur aˈba.ʐur aˈba.ʐur
Passed haczyk ˈxa.t͡ʂɨk ˈxa.t͡ʂɨk
Passed różdżka ˈruʂ.t͡ʂka ˈruʂ.t͡ʂka
Passed będąc ˈbɛn.dɔnt͡s ˈbɛn.dɔnt͡s
Passed względnie ˈvzɡlɛn.dɲɛ ˈvzɡlɛn.dɲɛ
Passed łódka ˈwut.ka ˈwut.ka
Failed także ˈtaɡ.ʐɛ ˈtak.ʂɛ
Failed jakby ˈjaɡ.bɨ ˈjak.bɨ
Passed krzak kʂak kʂak
Passed odtworzyć ɔtˈtfɔ.ʐɨt͡ɕ ɔtˈtfɔ.ʐɨt͡ɕ
Failed dach domu daɣ dɔmu dax ˈdɔ.mu
Passed kawka ˈkaf.ka ˈkaf.ka
Passed kwaz-inorma kfa.ziˈnɔr.ma kfa.ziˈnɔr.ma
Passed na-ukowiec na.uˈkɔ.vʲɛt͡s na.uˈkɔ.vʲɛt͡s
Passed dżawa ˈd͡ʐa.va ˈd͡ʐa.va

local tests = require('Module:UnitTests')
local convert_to_IPA = require('Module:pl-IPA').convert_to_IPA

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

local options = { display = format_ipa }
function tests:check_ipa(word, expected, artificial)
	self:equals(
		word,
		convert_to_IPA(word),
		expected,
		options
	)
end

function tests:check_ipa_artif(word, expected, artificial)
	self:equals(
		'<code>' .. word .. '</code>',
		convert_to_IPA(word),
		expected,
		options
	)
end

function tests:test_ipa()
	local examples1 = {
		{ 'klacz'    , 'klat͡ʂ'       },
		{ 'odrzut'   , 'ˈɔd.ʐut'     },
		{ 'zupa'     , 'ˈzu.pa'      },
		{ 'przeżytek', 'pʂɛˈʐɨ.tɛk'  },
		{ 'awers'    , 'ˈa.vɛrs'     },
		{ 'abażur'   , 'aˈba.ʐur'    },
		{ 'haczyk'   , 'ˈxa.t͡ʂɨk'    },
		{ 'różdżka'  , 'ˈruʂ.t͡ʂka'   },
		{ 'będąc'    , 'ˈbɛn.dɔnt͡s'  },
		{ 'względnie', 'ˈvzɡlɛn.dɲɛ' },
		{ 'łódka'	 , 'ˈwut.ka'	 },
		{ 'także'	 , 'ˈtaɡ.ʐɛ'	 },
		{ 'jakby'	 , 'ˈjaɡ.bɨ'	 },
		{ 'krzak'	 , 'kʂak'		 },
		{ 'odtworzyć', 'ɔtˈtfɔ.ʐɨt͡ɕ'  },
		{ 'dach domu', 'daɣ dɔmu'	 },
		{ 'kawka'	 , 'ˈkaf.ka'	 },
	}
	
	self:iterate(examples1, "check_ipa")
	
	local examples2 = {
		{ 'kwaz-inorma',	'kfa.ziˈnɔr.ma' },
		{ 'na-ukowiec',		'na.uˈkɔ.vʲɛt͡s' },
		{ 'dżawa',			'ˈd͡ʐa.va'       },
	}
	
	self:iterate(examples2, "check_ipa_artif")
end

return tests