Module:ug-translit/testcases

From Linguifex
Jump to navigation Jump to search

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

-- 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