Jump to content

Module:fa-translit/testcases

From Wiktionary, the free dictionary

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

All tests passed. (refresh)

TextExpectedActualDiffers at
test_translit_persian:
Passedگویَا کِهgōyā kiguyâ kegōyā kiguyâ ke
Passedحُقُوقhuqūqhoğuğhuqūqhoğuğ
Passedدَقِیقَهdaqīqadağiğedaqīqadağiğe
Passedخْوَرَاسَانxwarāsānxorâsânxwarāsānxorâsân
Passedخْویشxwēšxišxwēšxiš
Passedروزrōzruzrōzruz
Passedوَلیکِنwalēkinvalikenwalēkinvaliken
Passedشُویْšūyšuyšūyšuy
Passedشویْšōyšuyšōyšuy
Passedشِیرšīrširšīršir
Passedشیرšērširšēršir
Passedشَوْهَرšawharšowharšawharšowhar
Passedکَسیkasēkasikasēkasi
Passedگویِشgōyišguyešgōyišguyeš
Passedبَیْنُ‌المِلَلِیbaynu-l-milalībeyno-l-melalibaynu-l-milalībeyno-l-melali
Passedشَوِیšawīšavišawīšavi
Passedشِوِیšiwīševišiwīševi
Passedشُویšuwēšovišuwēšovi
Passedخْوَدْرَوxwadrawxodrowxwadrawxodrow
Passedحقوق(nil)(nil)N/A
Passedعشق(nil)(nil)N/A
Passedنَمی‌دَانَمنِمی‌دَانَمnamē-dānamnemi-dânamnamē-dānamnemi-dânam
Passedخَانَگِیخَانِگِیxānagīxânegixānagīxânegi
Passedموزمَوْزmōzmowzmōzmowz

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

local full_link = require('Module:links').full_link
local fa = require('Module:languages').getByCode('fa')
local trsp = "<span class=\"Zsym mention\" style=\"font-size:85%;\">/</span>"

local rlm = require("Module:string/char")(0x200F) -- right-to-left mark

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

--TO DO
function tests:do_test_translit(arab, roman)
	self:equals(link(arab), fa_translit.tr(arab, 'fa', 'Persian'), roman)
end

function tests:test_translit_persian()
	local examples = {
		{ 'گویَا کِه', 'gōyā ki' .. trsp .. 'guyâ ke' },
		{ 'حُقُوق', 'huqūq' .. trsp .. 'hoğuğ' },
		{ 'دَقِیقَه', 'daqīqa' .. trsp .. 'dağiğe' },
		{ 'خْوَرَاسَان', 'xwarāsān' .. trsp .. 'xorâsân' },
		{ 'خْویش', 'xwēš' .. trsp .. 'xiš' },
		{ 'روز', 'rōz' .. trsp .. 'ruz' },
		{ 'وَلیکِن', 'walēkin' .. trsp .. 'valiken' },
		{ 'شُویْ', 'šūy' .. trsp .. 'šuy' },
		{ 'شویْ', 'šōy' .. trsp .. 'šuy' },
		{ 'شِیر', 'šīr' .. trsp .. 'šir' },
		{ 'شیر', 'šēr' .. trsp .. 'šir' },
		{ 'شَوْهَر', 'šawhar' .. trsp .. 'šowhar' },
		{ 'کَسی', 'kasē' .. trsp .. 'kasi' },
		{ 'گویِش', 'gōyiš' .. trsp .. 'guyeš' },
		{ 'بَیْنُ‌المِلَلِی', 'baynu-l-milalī' .. trsp .. 'beyno-l-melali' },
		{ 'شَوِی', 'šawī' .. trsp .. 'šavi' },
		{ 'شِوِی', 'šiwī' .. trsp .. 'ševi' },
		{ 'شُوی', 'šuwē' .. trsp .. 'šovi' },
		{ 'خْوَدْرَو', 'xwadraw' .. trsp .. 'xodrow' },
		-- should return nil
		{ 'حقوق', nil },
		{ 'عشق', nil },
		-- tests for vocalization override
		{ 'نَمی‌دَانَم//نِمی‌دَانَم', 'namē-dānam' .. trsp .. 'nemi-dânam' },
		{ 'خَانَگِی//خَانِگِی', 'xānagī' .. trsp .. 'xânegi' },
		{ 'موز//مَوْز', 'mōz' .. trsp .. 'mowz' },
		}
		self:iterate(examples, "do_test_translit")
end	

return tests