Module:ps-translit/testcases

Revision as of 06:08, 31 December 2024 by wikt>Scarletmarisol (Corrected the test case orthographies to match WT:PS TR)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:ps-translit/testcases/doc

-- Unit tests for [[Module:ps-translit]]. Refresh page to run tests.
local tests = require('Module:UnitTests')
local ps_translit = require('Module:ps-translit')

local full_link = require('Module:links').full_link
local ps = require('Module:languages').getByCode('ps')

local function link(word)
	return full_link{ term = word, lang = ps, tr = "-" }
end

--TO DO
function tests:do_test_translit(arabic, roman)
	self:equals(link(arabic), ps_translit.tr(arabic, 'ps', 'ps-Arab'), roman)
end

function tests:test_translit_arabic()
	local examples = {
		-- h sematnics
		{"الله", "allâh"},
		{"اَذهان", "aẕhân"},
		{"اَژدَهار", "aždahâr"},
    	{"غَټه", "ǧaṭa"},
    	{"غَټَه", "ǧaṭah"},
    	{"غَټَهْ", "ǧaṭah"},
    	{"غَټْه", "ǧaṭh"},
    	{"دْوه", "dwa"},
    	{"دوه", "doh"},
    	{"دُوه", "duh"},
    	{"اوه", "oh"},
    	{"اَوه", "awa"},
    	{"کْيه", "kya"},
    	{"کيه", "kih"},
    	{"ايه", "ih"},
    	{"اَيه", "aya"},
    	
    	-- inital alif
		{"ايمان", "imân"},
    	{"اوسيږې", "osiǵe"},
    	{"اېران", "erân"},
    	
    	-- final y dipthongs
		{"دُوی", "duy"},
		{"زوی", "zoy"},
		{"ځای", "źây"},
		{"يُوسٙفزی", "yusəfzay"},
    	{"دے", "day"},
    	{"بېی", "bey"},
    	{"څْوی", "śway"},
    	{"شْيی", "šyay"},
    	{"وی", "way"},
    	{"وي", "wi"},
    	{"يی", "yay"},
    	{"يئ", "yəy"},
		
		-- other dipthongs
		{"پَلَو", "palaw"},
		{"اُووۀ", "uwə"},
		{"نِيا", "niâ"},
		{"ؤ", "wə"},
		
		-- u/y stuff
		{"يو", "yo"},
		{"بايو", "bâyo"},
		{"باوي", "bâwi"},
		{"وايُو", "wâyu"},
		{"بَيوت", "bayot"},
		{"کِيوډ", "kioḍ"},
		{"کيوْډ", "kiwḍ"},
		{"کيوډ", "kyoḍ"},
		{"کْيوډ", "kyoḍ"},
		{"کُوِيډ", "kuiḍ"},
		{"کويْډ", "koyḍ"},
		{"کُويْډ", "kuyḍ"},
		{"کْويډ", "kwiḍ"},
		{"کويډ", "koyḍ"},
		{"کيوي", "kiwi"},
		{"کِيوي", "kioy"},
		{"کْيوي", "kyoy"},
		{"وو", "wo"},
		
		-- short vowels
		{"پِنځۀ", "pĭnźə"},
		{"ګُلُونه", "gŭluna"},
		
		-- miscellaneous
		{"حِسّه", "ḥĭssa"},
    	{"بيزو", "bizo"},
    	{"پٙښتو", "pəx̌to"},
    	{"خوَړٙل", "xwaṛəl"},
    	{"خَلاص", "xalâṣ"},
    	{"دْرې", "dre"},
    	{"ډَير", "ḍayr"},
    	{"سپين", "spin"},
    	{"کَچالُو", "kačâlu"},
    	{"دوبي", "dobi"},
    	{"نْجٙلۍ", "njələy"},
    	{"وايئ", "wâyəy"},
    	{"ورور", "wror"},
    	{"هَلٙک", "halək"},
	}
	
	self:iterate(examples, "do_test_translit")
end
 
return tests