Modul:ar-translit/testcases

A Wikiszótárból, a nyitott szótárból
Ugrás a navigációhoz Ugrás a kereséshez

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

2 teszt sikertelen. (frissítés)

Szöveg Várt Tényleges Első eltérés
test_translit_arabic:
Sikeres اَلْعَرَبِيَّة‏ al-ʿarabiyya al-ʿarabiyya
Sikeres اَلْعَرَبِيَّة. al-ʿarabiyya. al-ʿarabiyya.
Sikeres لِلْكِتَاب lilkitāb lilkitāb
Sikeres لِلتَّأْكِيد (nil) (nil) N/A
Sikeres لِلَّبَنِ lillabani lillabani
Sikeres لِللَّبَنِ (nil) (nil) N/A
Sikeres شْنِيتْزَل šnītzal šnītzal
Sikeres عُظْمَى ʿuẓmā ʿuẓmā
Sikeres إِحْدَى ʾiḥdā ʾiḥdā
Sikeres بِٱلتَّأْكِيد bi-t-taʾkīd bi-t-taʾkīd
Sikeres بِالتَّأْكِيد bi-t-taʾkīd bi-t-taʾkīd
Sikeres بِالتَأْكِيد bi-t-taʾkīd bi-t-taʾkīd
Sikeres بِالكِتَاب bi-l-kitāb bi-l-kitāb
Sikeres بِالْكِتَاب bi-l-kitāb bi-l-kitāb
Sikeres اَللُّغَةُ ٱلْعَرَبِيَّةُ al-luḡatu l-ʿarabiyyatu al-luḡatu l-ʿarabiyyatu
Sikeres اَللُّغَةُ الْعَرَبِيَّةُ al-luḡatu l-ʿarabiyyatu al-luḡatu l-ʿarabiyyatu
Sikeres نَسُوا nasū nasū
Sikeres رَمَوْا ramaw ramaw
Sikeres عَصًا ʿaṣan ʿaṣan
Sikeres هُدًى hudan hudan
Sikeres عَصاً ʿaṣan ʿaṣan
Sikeres هُذىً huḏan huḏan
Sikeres كاتِب kātib kātib
Sikeres كُتّاب kuttāb kuttāb
Sikeres إلاه ʾilāh ʾilāh
Sikeres كاتب (nil) (nil) N/A
Sikeres رَبّ rabb rabb
Sikeres نَوَاةٌ nawātun nawātun
Sikeres اَلشَّدَّة aš-šadda aš-šadda
Sikeres شَدَّة الشَكْل šadda(t) aš-šakl šadda(t) aš-šakl
Sikeres مُعَادَاة muʿādāh muʿādāh
Sikeres مِرْآة mirʾāh mirʾāh
Sikeres صلاح (nil) (nil) N/A
Sikeres اِيبَ ība ība
Sikeres دِيُون diyūn diyūn
Sikeres دُوِين duwīn duwīn
Sikeres الَّذِي allaḏī allaḏī
Sikertelen رَأَيْتُ ابْنَهُ raʾaytu bnahu (nil) N/A
Sikeres رَأَيْتُ ٱبْنَهُ raʾaytu bnahu raʾaytu bnahu
Sikeres ڪُفُوًا kufuwan kufuwan
Sikertelen أَحَدٌ ٱللّٰهُ ٱلصَّمَدُ ʾaḥaduni llāhu ṣ-ṣamadu ʾaḥadun llāhu ṣ-ṣamadu 8

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

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

local rlm = mw.ustring.char(0x200F) -- right-to-left mark

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

--TO DO
function tests:do_test_translit(arab, roman)
	self:equals(link(arab), ar_translit.tr(arab, 'ar', 'Arab'), roman)
end

function tests:test_translit_arabic()
	local examples = {
		{ "اَلْعَرَبِيَّة" .. rlm, "al-ʿarabiyya" }, -- right-to-left mark is removed
		{ "اَلْعَرَبِيَّة.", "al-ʿarabiyya." },
		{ 'لِلْكِتَاب', 'lilkitāb' }, -- ideally 'li-l-kitāb'
		{ 'لِلتَّأْكِيد', nil }, -- ideally 'li-t-taʾḵīd'
		{ 'لِلَّبَنِ', 'lillabani' }, -- ideally 'li-l-labani'; correct spelling
		{ 'لِللَّبَنِ', nil }, -- ideally 'li-l-labani; spelling sometimes used
		{ 'شْنِيتْزَل', "šnītzal" },
		{ 'عُظْمَى', "ʿuẓmā" },
		{ 'إِحْدَى', "ʾiḥdā" },
		-- cases with bi- prefix plus definite article
		{ 'بِٱلتَّأْكِيد', "bi-t-taʾkīd" },
		{ 'بِالتَّأْكِيد', "bi-t-taʾkīd" },
		{ 'بِالتَأْكِيد', "bi-t-taʾkīd" },
		{ 'بِالكِتَاب', "bi-l-kitāb" },
		{ 'بِالْكِتَاب', "bi-l-kitāb" },
		-- check handling of ʾiʿrāb, hamzatu l-waṣl w/al-, al- w/sun and moon letters
		{ 'اَللُّغَةُ ٱلْعَرَبِيَّةُ', "al-luḡatu l-ʿarabiyyatu" },
		-- check elision of al- after a vowel
		{ 'اَللُّغَةُ الْعَرَبِيَّةُ', "al-luḡatu l-ʿarabiyyatu" },
	
		-- check two kinds of otiose alif in 3rd-masc-plural endings	
		{ 'نَسُوا', "nasū" },
		{ 'رَمَوْا', "ramaw" },
		-- check otiose alif and alif maqṣūra after fatḥatan
		{ 'عَصًا', "ʿaṣan" },
		{ 'هُدًى', "hudan" },
		-- same where fatḥatan wrongly placed over alif or alif maqṣūra
		{ 'عَصاً', "ʿaṣan" },
		{ 'هُذىً', "huḏan" },
		-- infer fatḥa on alif between consonants
		{ 'كاتِب', "kātib" },
		-- infer fatḥa on alif between consonants when first is marked with shadda
		{ 'كُتّاب', "kuttāb" },
		-- infer kasra after hamza-under-alif
		{ 'إلاه', "ʾilāh" },
		-- missing diacritic on t
		{ 'كاتب', nil },
		-- final shadda on unvocalized consonant
		{ 'رَبّ', "rabb" },
		-- tā' marbūṭa preceded by alif; don't infer fatḥa
		{ 'نَوَاةٌ', "nawātun" },
		-- alif-lam w/unvocalized lam + shadda over sun letter; final tāʾ marbūṭa
		{ 'اَلشَّدَّة', "aš-šadda" },
		-- medial tāʾ marbūṭa
		{ 'شَدَّة الشَكْل', "šadda(t) aš-šakl" },
		-- alif + tāʾ marbūṭa --> āh
		{ 'مُعَادَاة', "muʿādāh" },
		-- alif madda + tāʾ marbūṭa --> āh
		{ 'مِرْآة', "mirʾāh" },
	    -- test of h for the constant
		{ 'صلاح', nil },
		-- initial unhamzated alif + ī
		{ 'اِيبَ', "ība" },
		-- iyū sequence
		{ 'دِيُون', "diyūn" },
		-- uwī sequence
		{ 'دُوِين', "duwīn" },
		-- allaḏī, with al + shadda
		{ 'الَّذِي', "allaḏī" },
		-- alif al-wasl
		{ 'رَأَيْتُ ابْنَهُ', "raʾaytu bnahu" },
		{ 'رَأَيْتُ ٱبْنَهُ', "raʾaytu bnahu" },
		-- "swash kaf"
		{ 'ڪُفُوًا', "kufuwan" },
		{ 'أَحَدٌ ٱللّٰهُ ٱلصَّمَدُ', "ʾaḥaduni llāhu ṣ-ṣamadu" },
	}
	
	self:iterate(examples, "do_test_translit")
end
 
return tests