Module:pi-Latn-translit/testcases

local tests = require('Module:UnitTests') tr = require('Module:pi-Latn-translit').tr

-- A single letter field is the principal transliteration to the script, encoded as the lowercase letter usable for Template pi-alt. -- (No transliteration, no test.) An explanation for the choice of transliteration may be given in the field whose name is formed -- by suffix '_just', e.g fields 'l' and 'l_just' for the script encoded as 'Lana'. The explanation is printed out if the test is -- deemed to have failed.

-- The field aborts is set to a true value if converting the string causes a test terminating error condition to be reported.

local cases = { {"vulhati", l = "ᩅᩩᩃ᩠ᩉᨲᩥ"}, {"khalvapi", l = "ᨡᩃ᩠ᩅᨷᩥ"}, -- Clusters with final 'y': {"vākyaṃ", l = "ᩅᩤᨠ᩠ᨿᩴ"}, {"kyāhaṃ", l = "ᨠ᩠ᨿᩣᩉᩴ"}, {"khyāte", l = "ᨡ᩠ᨿᩣᨲᩮ"}, {"mukhyato", l = "ᨾᩩᨡ᩠ᨿᨲᩮᩣ"}, {"saṅkhyāvāro", l = "ᩈᩘᨡ᩠ᨿᩣᩅᩤᩁᩮᩣ", aborts = 1}, {"asaṅkhyeyyāni", l = "ᩋᩈᩘᨡ᩠ᨿᩮᨿ᩠ᨿᩣᨶᩥ", aborts = 1}, {"gyadā", l = "ᨣ᩠ᨿᨴᩤ", l_just = "Cf. NT ᨴᩤ"}, {"ārogyaṃ", l = "ᩋᩣᩁᩮᩣᨣ᩠ᨿᩴ"}, {"ghyaṇa", l = "ᨥ᩠ᨿᨱ"}, {"māghya", l = "ᨾᩣᨥ᩠ᨿ"}, {"laṅghyate", l = "ᩃᩘᨥ᩠ᨿᨲᩮ", aborts = 1}, {"cyatthe", l = "ᨧ᩠ᨿᨲ᩠ᨳᩮ"}, {"ucyate", l = "ᩏᨧ᩠ᨿᨲᩮ"}, {"jyādīhi", l = "ᨩ᩠ᨿᩣᨴᩦᩉᩥ"}, {"pavvajyanti", l = "ᨷᩅ᩠ᩅᨩ᩠ᨿᨶ᩠ᨲᩥ"}, {"nāṭyaṃ", l = "ᨶᩣᨭ᩠ᨿᩴ"}, {"saṭhye", l = "ᩈᨮ᩠ᨿᩮ"}, {"chaṭṭhyatthe", l = "ᨨᨭᩛ᩠ᨿᨲ᩠ᨳᩮ"}, {"kaḍyādīhi", l = "ᨠᨯ᩠ᨿᩣᨴᩦᩉᩥ"}, {"tuṇḍyādīhi", l = "ᨲᩩᨱ᩠ᨯ᩠ᨿᩣᨴᩦᩉᩥ", aborts = 1}, {"ṇyamhi", l = "ᨱ᩠ᨿᨾ᩠ᩉᩥ"}, {"āṇaṇyaṃ", l = "ᩋᩣᨱᨱ᩠ᨿᩴ"}, {"tyāhaṃ", l = "ᨲ᩠ᨿᩣᩉᩴ"}, {"ratyā", l = "ᩁᨲ᩠ᨿᩣ"}, {"thyaṃpañcantehidādhikā", l = "ᨳ᩠ᨿᩴᨷᨬ᩠ᨧᨶ᩠ᨲᩮᩉᩥᨴᩤᨵᩥᨠᩣ"}, {"kathyate", l = "ᨠᨳ᩠ᨿᨲᩮ"}, {"titthyā", l = "ᨲᩥᨲ᩠ᨳ᩠ᨿᩣ"}, {"dyassa", l = "ᨴ᩠ᨿᩔ"}, {"syādyuppatti", l = "ᩈ᩠ᨿᩣᨴ᩠ᨿᩩᨷ᩠ᨷᨲ᩠ᨲᩥ"}, {"dhyādīhi", l = "ᨵ᩠ᨿᩣᨴᩦᩉᩥ", l_just="Cf. NT ᨻ᩠ᨿᩣᨵᩥ from Pali byādhi"}, {"osadhyo", l = "ᩋᩰᩈᨵ᩠ᨿᩮᩣ", l_just="Cf. NT ᨻ᩠ᨿᩣᨵᩥ from Pali byādhi"}, {"nyādayo", l = "ᨶ᩠ᨿᩣᨴᨿᩮᩣ"}, {"atthantaranyāso", l = "ᩋᨲ᩠ᨳᨶ᩠ᨲᩁᨶ᩠ᨿᩣᩈᩮᩣ"}, {"pyatha", l = "ᨷ᩠ᨿᨳ"}, {"ṇiṇāpyāpīhi", l = "ᨱᩥᨱᩣᨷ᩠ᨿᩣᨷᩦᩉᩥ", l_just="Cf. NT ᨻ᩠ᨿᩣᨵᩥ from Pali byādhi"}, {"phyasīnāmake", l = "ᨹ᩠ᨿᩈᩦᨶᩣᨾᨠᩮ"}, {"byākāsi", l = "ᨻ᩠ᨿᩣᨠᩣᩈᩥ", l_just="Cf. NT ᨻ᩠ᨿᩣᨵᩥ from Pali byādhi"}, {"abyākato", l = "ᩋᨻ᩠ᨿᩣᨠᨲᩮᩣ", l_just="Cf. NT ᨻ᩠ᨿᩣᨵᩥ from Pali byādhi"}, {"bhyādīhi", l = "ᨽ᩠ᨿᩣᨴᩦᩉᩥ"}, {"nabhyā", l = "ᨶᨽ᩠ᨿᩣ"}, {"myāyaṃ", l = "ᨾ᩠ᨿᩣᨿᩴ"}, {"paṇamāmyahaṃ", l = "ᨷᨱᨾᩣᨾ᩠ᨿᩉᩴ"}, {"seyyathāpi", l = "ᩈᩮᨿ᩠ᨿᨳᩣᨷᩥ"}, {"ryamhi", l = "ᩁ᩠ᨿᨾ᩠ᩉᩥ"}, {"kalyāṇaṃ", l = "ᨠᩃ᩠ᨿᩣᨱᩴ"}, {"vyaggha", l = "ᩅ᩠ᨿᨣ᩠ᨥ"}, {"syādyantaṃ", l = "ᩈ᩠ᨿᩣᨴ᩠ᨿᨶ᩠ᨲᩴ"}, {"ālasyaṃ", l = "ᩋᩣᩃᩈ᩠ᨿᩴ"}, {"bāhye", l = "ᨻᩤᩉ᩠ᨿᩮ"}, -- Clusters with final v	{"kvaci", l = "ᨠ᩠ᩅᨧᩥ"}, {"yāvatakvassa", l = "ᨿᩣᩅᨲᨠ᩠ᩅᩔ"}, {"khvāhaṃ", l = "ᨡ᩠ᩅᩣᩉᩴ"}, {"yadākhvāhaṃ", l = "ᨿᨴᩤᨡ᩠ᩅᩣᩉᩴ", l_just = "Pali dāna is loaned into NT as ᨴᩤ᩠ᨶ"}, {"cakkhvādito", l = "ᨧᨠ᩠ᨡ᩠ᩅᩣᨴᩥᨲᩮᩣ"}, {"tiṭṭhagvādīni", l = "ᨲᩥᨭᩛᨣ᩠ᩅᩣᨴᩦᨶᩥ"}, {"laghvāhārova", l = "ᩃᨥ᩠ᩅᩣᩉᩣᩁᩮᩣᩅ"}, {"paṭilaṅvarappadāno", l = "ᨷᨭᩥᩃᩘᩅᩁᨷ᩠ᨷᨴᩤᨶᩮᩣ", l_just = "Pali dāna is loaned into NT as ᨴᩤ᩠ᨶ"}, {"cve", l = "ᨧ᩠ᩅᩮ"}, {"kyecvā", l = "ᨠ᩠ᨿᩮᨧ᩠ᩅᩣ"}, {"jvā", l = "ᨩ᩠ᩅᩣ"}, {"sajjva", l = "ᩈᨩ᩠ᨩ᩠ᩅ"}, {"nañvacanena", l = "ᨶᨬ᩠ᩅᨧᨶᩮᨶ"}, {"ṇvu", l = "ᨱ᩠ᩅᩩ"}, {"ṇvādi", l = "ᨱ᩠ᩅᩣᨴᩥ"}, {"tvaṃ", l = "ᨲ᩠ᩅᩴ"}, {"nikkhamitvā", l = "ᨶᩥᨠ᩠ᨡᨾᩥᨲ᩠ᩅᩣ"}, {"vatthvettha", l = "ᩅᨲ᩠ᨳ᩠ᩅᩮᨲ᩠ᨳ"}, {"dve", l = "ᨴ᩠ᩅᩮ", c = "𑄘𑄳𑄤𑄬"}, {"vidvā", l = "ᩅᩥᨴ᩠ᩅᩣ"}, {"anveti", l = "ᩋᨶ᩠ᩅᩮᨲᩥ"}, {"nānvāgameyya", l = "ᨶᩣᨶ᩠ᩅᩣᨣᨾᩮᨿ᩠ᨿ"}, {"nvajja", l = "ᨶ᩠ᩅᨩ᩠ᨩ"}, {"pvā", l = "ᨷ᩠ᩅᩤ", l_just="Cf. NT ᨣ᩠ᩅᩤ᩠ᨯ"}, {"pubvenivāsoti", l = "ᨷᩩᨻ᩠ᩅᩮᨶᩥᩅᩤᩈᩮᩣᨲᩥ"}, {"ambvādīhi", l = "ᩋᨾᩛ᩠ᩅᩣᨴᩦᩉᩥ", aborts = 1}, {"bhvāpā", l = "ᨽ᩠ᩅᩣᨷᩤ"}, {"pubbanipātabhvassa", l = "ᨷᩩᨻᩛᨶᩥᨷᩤᨲᨽ᩠ᩅᩔ"}, {"mve", l = "ᨾ᩠ᩅᩮ"}, {"yvāyaṃ", l = "ᨿ᩠ᩅᩣᨿᩴ"}, -- See above for -vv-. I didn't trust vv- example. {"svāssa", l = "ᩈ᩠ᩅᩣᩔ"}, {"disvā", l = "ᨴᩥᩈ᩠ᩅᩣ"}, {"hvayati", l = "ᩉ᩠ᩅᨿᨲᩥ"}, {"juhvati", l = "ᨩᩩᩉ᩠ᩅᨲᩥ"}, {"bahvābādho", l = "ᨻᩉ᩠ᩅᩣᨻᩤᨵᩮᩤ", l_just = "Cf. NT ᨵᩤᨲᩩ from Pali dhātu."}, -- Clusters with final h	{"mayhaṃ", l = "ᨾᨿ᩠ᩉᩴ"}, {"mūḷho", l = "ᨾᩪᩊ᩠ᩉᩮᩣ"}, {"nhatvā", l = "ᨶ᩠ᩉᨲ᩠ᩅᩣ"}, {"nhāru", l = "ᨶ᩠ᩉᩣᩁᩩ"}, {"sāyanhe", l = "ᩈᩣᨿᨶ᩠ᩉᩮ"}, -- Clusters with initial niggahita {"tasmiṃyeva", l = "ᨲᩈ᩠ᨾᩥᩴᨿᩮᩅ"}, {"evaṃrūpo", l = "ᩑᩅᩴᩁᩪᨷᩮᩤ"}, {"evaṃladdhanāmo", l = "ᩑᩅᩴᩃᨴ᩠ᨵᨶᩣᨾᩮᩣ"}, {"saṃvattati", l = "ᩈᩴᩅᨲ᩠ᨲᨲᩥ"}, {"āhaṃsu", l = "ᩋᩣᩉᩴᩈᩩ"}, {"taṃhetu", l = "ᨲᩴᩉᩮᨲᩩ"}, {"taṃḷīkaṃ", l = "ᨲᩴᩊᩦᨠᩴ"}, -- Clusters with final r	{"kriyā", l = "ᨠᩕᩥᨿᩣ"}, {"ukre", l = "ᩏᨠᩕᩮ"}, {"nigrodha", l = "ᨶᩥᨣᩕᩮᩣᨵ", l_just = "Cf. NT ᨣᩕᩣ."}, {"saṃghraṭṭhaṃ", l = "ᩈᩴᨥᩕᨭᩛᩴ"}, {"jrā", l = "ᨩᩕᩣ"}, {"tre", l = "ᨲᩕᩮ"}, {"tatra", l = "ᨲᨲᩕ"}, {"dravatā", l = "ᨴᩕᩅᨲᩣ"}, {"indriyā", l = "ᩍᨶ᩠ᨴᩕᩥᨿᩣ", aborts = 1}, {"bhadro", l = "ᨽᨴᩕᩮᩣ", l_just="Cf. NT ᨴᩕᩣ᩠ᨶ Round AA is the commoner, not universal. Borrowed into NT as ᨽᨴᩕ."}, {"tanra", l = "ᨲᨶᩕ"}, {"prānadassī", l = "ᨷᩕᩣᨶᨴᩔᩦ", ["l_just"]="Cf. NT ᨷᩕᩣᨠᩣ᩠ᩁ"}, {"kaphrū", l = "ᨠᨹᩕᩪ"}, {"brāhmaṇo", l = "ᨻᩕᩣᩉ᩠ᨾᨱᩮᩣ", ["l_just"]="Cf. NT ᨻᩕᩣᩉ᩠ᨾᨱ᩺"}, {"bhrūnahā", l = "ᨽᩕᩪᨶᩉᩣ"}, {"mrā", l = "ᨾᩕᩣ"}, {"kalrāṇa", l = "ᨠᩃᩕᩣᨱ"}, {"srī", l = "ᩈᩕᩦ"}, -- hapax legomen! -- Clusters with initial s	{"slā", l = "ᩈᩖᩣ"}, {"tasmiṃ", l = "ᨲᩈ᩠ᨾᩥᩴ"}, {"sthita", l = "ᩈ᩠ᨳᩥᨲ"}, {"sneho", l = "ᩈ᩠ᨶᩮᩉᩮᩣ"}, {"viddhastā", l = "ᩅᩥᨴ᩠ᨵᩈ᩠ᨲᩣ"}, {"vanaspatī", l = "ᩅᨶᩈ᩠ᨷᨲᩦ"}, -- Clusters with final l	{"kleso", l = "ᨠᩖᩮᩈᩮᩣ"}, {"uklāpo", l = "ᩏᨠᩖᩣᨷᩮᩤ"}, {"gloso", l = "ᨣᩖᩮᩤᩈᩮᩣ", ["l_just"]="Cf. NT ᨣᩖᩤ"}, -- Want to cite reference named MFL {"sabbaglā", l = "ᩈᨻᩛᨣᩖᩤ", ["l_just"]="Cf. NT ᨣᩖᩤ"}, {"nlā", l = "ᨶᩖᩣ"}, {"plavanti", l = "ᨷᩖᩅᨶ᩠ᨲᩥ"}, {"niplavitaṃ", l = "ᨶᩥᨷᩖᩅᩥᨲᩴ"}, {"pallaṅkaṃ", l = "ᨷᩃᩖᩘᨠᩴ"}, -- Conceivable stem variation here! -- Clusters not covered above {"buddhuppāda", l = "ᨻᩩᨴ᩠ᨵᩩᨷ᩠ᨷᩣᨴ", l_just = "Borrowed into NT in this form."}, {"buddhānussati", l = "ᨻᩩᨴ᩠ᨵᩤᨶᩩᩔᨲᩥ", l_just = "Borrowed into NT in this form."}, -- Other special combinations. {"dhātu", l = "ᨵᩤᨲᩩ", l_just = "Loaned into NT as ᨵᩤᨲᩩ"}, -- Sometime inflection issues {"pacanto", l = "ᨷᨧᨶ᩠ᨲᩮᩣ", c = "𑄛𑄌𑄚𑄴𑄖𑄮"}, {"pacant", l = "ᨷᨧᨶ᩠ᨲ᩺", c = "𑄛𑄌𑄚𑄴𑄖𑄴"}, {"⌫⌫nt", l = "⌫⌫ᨶ᩠ᨲ᩺", c = "⌫⌫𑄚𑄴𑄖𑄴"}, {"pāpin", c = "𑄛𑄂𑄛𑄨𑄚𑄴"}, -- Random Chakma tests {"akaraṇaṃ", c = "𑄃𑄇𑄢𑄕𑄁"}, {"bhikkhave", c = "𑄞𑄨𑄇𑄴𑄈𑅇𑄬"}, {"maggassa", c = "𑄟𑄉𑄴𑄉𑄥𑄴𑄥"}, {"ākaṅkhamānena", c = "𑄃𑄂𑄇𑄋𑄴𑄈𑄟𑄂𑄚𑄬𑄚"}, {"pañcamaduke", c = "𑄛𑄐𑄴𑄌𑄟𑄘𑄪𑄇𑄬"}, {"kālaparicchedaṃ", c = "𑄇𑄂𑄣𑄛𑄢𑄨𑄌𑄴𑄍𑄬𑄘𑄁"}, {'vijjatī"ti', c = '𑅇𑄨𑄎𑄴𑄎𑄖𑄩"𑄖𑄨'}, {"chaṭṭhaduke", c = "𑄍𑄑𑄴𑄒𑄘𑄪𑄇𑄬"}, {"taṇhānissayo", c = "𑄖𑄕𑄴𑄦𑄂𑄚𑄨𑄥𑄴𑄥𑄠𑄮"}, {"atthi", c = "𑄃𑄖𑄴𑄗𑄨"}, {"duvidhaṃ", c = "𑄘𑄪𑅇𑄨𑄙𑄁"}, {"ārabbha", c = "𑄃𑄂𑄢𑄝𑄴𑄞"}, {"katvā", c = "𑄇𑄖𑄳𑄤𑄂"}, {'hotī"ti', c = '𑄦𑄮𑄖𑄩"𑄖𑄨'}, {"idaṃ", c = "𑄃𑄨𑄘𑄁"}, {"uttamasamācāro", c = "𑄃𑄪𑄖𑄴𑄖𑄟𑄥𑄟𑄂𑄌𑄂𑄢𑄮"}, }

-- here be the tests function tests:test_Tai_Tham local res; for ia, va in pairs({false, true}) do		va = not not va		for ic, vc in ipairs(cases) do			if va == not not vc.aborts then if vc.l then res = tr(vc[1], "Lana") -- equals(name, actual, expected, options) if res == vc.l then tests:equals(vc[1], res, vc.l)					elseif vc.l_just then tests:equals(vc[1], res, vc.l.." ("..vc.l_just..")") else tests:equals(vc[1], res, vc.l)					end end end end end end

function tests:test_Chakma local res; for ia, va in pairs({false, true}) do		va = not not va		for ic, vc in ipairs(cases) do			if va == not not vc.aborts then if vc.c then res = tr(vc[1], "Cakm") -- equals(name, actual, expected, options) if res == vc.c then tests:equals(vc[1], res, vc.c)					elseif vc.c_just then tests:equals(vc[1], res, vc.c.." ("..vc.c_just..")") else tests:equals(vc[1], res, vc.c)					end end end end end end

return tests