Module:ar-IPA/testcases: difference between revisions

From Wiktionary, the free dictionary
Jump to navigation Jump to search
Content deleted Content added
No edit summary
rm dodgy test
Line 49: Line 49:
{ "خَاصّ", "χaːsˁsˁ" },
{ "خَاصّ", "χaːsˁsˁ" },
{ "خَاصَّة", "χaːsˁ.sˁa" },
{ "خَاصَّة", "χaːsˁ.sˁa" },
{ "إِنَّ بَيْتًا انْبَنَى", "ʔin.na bay.ta.ni‿n.ba.naː" },
--[[ Copy the following to add more examples:
--[[ Copy the following to add more examples:
{ "", "" },
{ "", "" },

Revision as of 07:20, 10 August 2017


local tests = require("Module:UnitTests")
local m_IPA = require("Module:ar-pronunciation")

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

function tests:check_output(term, expected, comment, transliteration)
	self:equals(
		transliteration and term or m_IPA.link(term),
		m_IPA.toIPA(transliteration and { tr = term} or { Arabic = term }, true),
		expected,
		{ comment = comment, display = tag_IPA }
	)
end

local function iterate(examples, transliteration)
	for _, example in ipairs(examples) do
		 tests:check_output(example[1], example[2], example[3], transliteration)
	end
end

function tests:test_Arabic()
	examples = {
		{
			"الْمَمْلَكَة الْعَرَبِيَّة السُّعُودِيَّة",
			"al.mam.la.ka‿l.ʕa.ra.bij.ja‿s.su.ʕuː.dij.ja"
		},
		{ "لِلّٰهِ", "lilˁ.lˁaː.hi"},	
		{"مَعَ اَلسَّلَامَة", "ma.ʕa‿s.sa.laː.ma"},
		{ "طَبَّ", "tˁab.ba" },
		{ "رُوسِيَا", "ruː.si.jaː" },
		{ "أَنْتَ", "ʔan.ta" },
		{ "ذٰلِكَ", "ðaː.li.ka" },
		{ "صَغِير", "sˁa.ʁiːr" },
		{ "إِصْبَع", "ʔisˁ.baʕ" },
		{ "عَلَى", "ʕa.laː" },
		{ "جَزِيرَة", "d͡ʒa.ziː.ra" },
		{ "أَرْبَعَة", "ʔar.ba.ʕa" },
		{ "حُبّ", "ħubb" },
		{ "عَرَبِيّ", "ʕa.ra.bijj" },
		{ "اللّٰه", "alˁ.lˁaːh", "special case" },
		{ "عَبْدُ اللّٰه", "ʕab.du‿lˁ.lˁaːh", "special case" },
		{ "لِلّٰه", "lil.laːh", "special case of the special case" },
		{ "لٰكِنَّ الرَّئِيسَ كَانَ أَذْكَى مِمَّا تَوَقَّعَ النَّاسُ", "laː.kin.na‿r.ra.ʔiː.sa kaː.na ʔað.kaː mim.maː ta.waq.qa.ʕa‿n.naː.su" },
		{ "بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيمِ", "bis.mi‿l.laː.hi‿r.raħ.maː.ni‿r.ra.ħiː.mi" },
		{ "إِنْ شَاءَ ٱللَٰهُ", "ʔin ʃaː.ʔa‿lˁ.lˁaː.hu" },
		{ "بِٱلْهَنَاءِ وَٱلشِّفَاء", "bil.ha.naː.ʔi waʃ.ʃi.faːʔ" },
		{ "خَاصّ", "χaːsˁsˁ" },
		{ "خَاصَّة", "χaːsˁ.sˁa" },
--[[	Copy the following to add more examples:
		{ "", "" },
]]
	}
	
	iterate(examples)
end

function tests:test1_transliteration()
	examples = {
		{ "tilivizyōn", "ti.li.viz.joːn" },
		{ "ʾinglīziyy", "ʔinɡliː.zijj" },		
--[[	Copy the following to add more examples:
		{ "", "" },
]]
	}
	
	iterate(examples, true)
end

return tests