Jump to content

Module:fa-ira-translit/testcases

From Wiktionary, the free dictionary

This is the unit testing module for Module:fa-ira-translit.

3 of 38 tests failed. (refresh)

TextExpectedActualDiffers at
test_translit_persian:
Passedسَرْاَنْجامsar-anjâmsar-anjâm
Passedکُروزkoruzkoruz
Passedکُرُوزkorowzkorowz
Passedواوvâvvâv
Passedنُوروزnowruznowruz
Passedقَهْوِه‌ایğahve-iğahve-i
Passedخوانْدَنxândanxândan
Passedخویشxišxiš
Passedخوَدxodxod
Passedچامِه‌سَراییčâme-sarâyičâme-sarâyi
Passedچامه‌سَرایی(nil)(nil)N/A
Passedطَنینtanintanin
Passedطَنِینtaneyntaneyn
Passedلِهٰذاlehâzâlehâzâ
Passedعَصاًasanasan
Passedخانه(nil)(nil)N/A
Passedخانِهxânexâne
Passedکُرِهٔ شُمالیkore-ye šomâlikore-ye šomâli
Passedضَمّه(nil)(nil)N/A
Passedضَمِّهzammezamme
Passedوُدْکاvodkâvodkâ
Passedاَرْمَنِسْتانarmanestânarmanestân
Passedباکوbâkubâku
Passedبَرادَرِ بُزُرْگbarâdar-e bozorgbarâdar-e bozorg
Passedقُرونِ وُسْطیٰğorun-e vostâğorun-e vostâ
Passedدَرْ-آمَدdar-âmaddar-âmad
Passedبازیِ شَطْرَنْجbâzi-ye šatranjbâzi-ye šatranj
Passedمتعلق(nil)(nil)N/A
Passedمُتَعَلِّقmota'alleğmota'alleğ
Passedاِتِّحادِیِهٔ اُروپاettehâdiye-ye orupâettehâdiye-ye orupâ
Failedآیَتُ‌اللّٰهâyato-llâhâyato-l-lâh8
Passedشِیْخšeyxšeyx
Passedنُوْروزnowruznowruz
Failedپَیامpayâmpeyâm2
Failedاَیّوبayyubeyّub1
Passedشِبْهِ‌جَزیرِهšebh-e-jazirešebh-e-jazire
Passedپایْگاهِ‌دادِهpâygâh-e-dâdepâygâh-e-dâde
Passedصَحْرایِ غَرْبیsahrâ-ye ğarbisahrâ-ye ğarbi

-- Unit tests for [[Module:fa-translit]]. Refresh page to run tests.
local tests = require('Module:UnitTests')
local fa_translit = require('Module:fa-ira-translit')
local m_links = require('Module:links')

local fa = require('Module:languages').getByCode('fa')
local function link(term)
	return m_links.full_link{term = term, lang = fa}
end

function tests:do_test_translit(Pers, roman, xlit)
	self:equals(link(Pers), fa_translit.tr(Pers, 'fa', 'fa-Arab'), roman)
end

function tests:test_translit_persian()
	local examples = {
		
		{ 'سَرْاَنْجام', "sar-anjâm" },
		{ 'کُروز', "koruz" },
		{ 'کُرُوز', "korowz" }, -- this word is intentionally incorrect but demonstrates that zamme before vaaw produces a diphthong
		{ 'واو', "vâv" },
		{'نُوروز', "nowruz"},
		{ 'قَهْوِه‌ای'
			, "ğahve-i" }, -- case for ه‌ای as e-yi
		{'خوانْدَن', "xândan"}, -- case for خوا as xâ
		{'خویش', "xiš"}, -- case for خوی as xi
		{'خوَد', "xod"}, -- case for خو as xo (Iranian Persian) and xwad (Classical Persian)
		{ 'چامِه‌سَرایی',
			"čâme-sarâyi" },
			{ 'چامه‌سَرایی',
			nil },
		{ 'طَنین', "tanin" },
		{ 'طَنِین', "taneyn" },	-- this word is intentionally incorrect but demonstrates that kasre before ye produces a diphthong
		{ 'لِهٰذا', "lehâzâ" },
		{ 'عَصاً', "asan" },
		{ 'خانه', nil },	
		{ 'خانِه', "xâne" },	
		{ 'کُرِهٔ شُمالی', "kore-ye šomâli" },	
		{ 'ضَمّه', nil },
		{ 'ضَمِّه', "zamme" },
		{ 'وُدْکا', "vodkâ" },
		{ 'اَرْمَنِسْتان', "armanestân" }, 
		{ 'باکو', "bâku" },
		{"بَرادَرِ بُزُرْگ", "barâdar-e bozorg"}, -- ezafe, need a hyphen
		{'قُرونِ وُسْطیٰ', "ğorun-e vostâ" }, -- a dagger alif case
		{'دَرْ-آمَد', "dar-âmad" }, -- alif madda test
		{ 'بازیِ شَطْرَنْج', "bâzi-ye šatranj" }, -- unmarked ezâfe with a kasra
		{'متعلق', nil}, -- should fail without vocalisations
		{'مُتَعَلِّق', "mota'alleğ"},
		{'اِتِّحادِیِهٔ اُروپا', "ettehâdiye-ye orupâ"},
		{ "آیَتُ‌اللّٰه", "âyato-llâh"},
		{ 'شِیْخ', "šeyx"}, -- kasra + ye + consonant should give "ey"
		{'نُوْروز', "nowruz"}, -- 'ow' , not 'ov'? Is this right?
		{'پَیام', "payâm"}, 
		{'اَیّوب', "ayyub"},
		{'شِبْهِ‌جَزیرِه', "šebh-e-jazire"}, -- ZWNJ should produce a hyphen 
		{'پایْگاهِ‌دادِه',"pâygâh-e-dâde"},  --ZWNJ should produce a hyphen
		{'صَحْرایِ غَرْبی', "sahrâ-ye ğarbi"},
	}
	self:iterate(examples, "do_test_translit")
end	

return tests