Module:ug-translit/testcases

From Wiktionary, the free dictionary
Jump to navigation Jump to search

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

All tests passed. (refresh)

TextExpectedActualDiffers at
test_translit_uyghur:
Passedئادەم (adem)ademadem
Passedب د ت (b d t)b d tb d t
Passedبوغۇم (boghum)boghumboghum
Passedئائىلە (a'ile)a'ilea'ile
Passedئىنئام (in'am)in'amin'am
Passedچاڭئەن (chang'en)chang'enchang'en
Passedدېڭىز (dë'ngiz)dë'ngizdë'ngiz
Passedتەنگە (ten'ge)ten'geten'ge
Passedۋىجدانغا (wijdan'gha)wijdan'ghawijdan'gha
Passedمەزھەپ (mez'hep)mez'hepmez'hep

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

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

function tests:do_test_translit(Uyghur, roman, xlit)
	self:equals(link(Uyghur), ug_translit.tr(Uyghur, 'ug', 'ug-Arab'), roman)
end

function tests:test_translit_uyghur()
	local examples = {
		{ "ئادەم", "adem" },
		{ "ب د ت", "b d t" },
		{ "بوغۇم", "boghum" },
		{ "ئائىلە", "a'ile" },
		{ "ئىنئام", "in'am" },
		{ "چاڭئەن", "chang'en" },
		{ "دېڭىز", "dë'ngiz" },
		{ "تەنگە", "ten'ge" },
		{ "ۋىجدانغا", "wijdan'gha" },
		{ "مەزھەپ", "mez'hep" },
	}
	self:iterate(examples, "do_test_translit")
end	

return tests