Jump to content

Modulus:grc-translit/testcases

E Victionario

Documentation for this module may be created at Modulus:grc-translit/testcases/doc

--[=[
	Unit tests for [[Module:grc-translit]].
]=]

local tests = require('Module:UnitTests')
local translit = require('Module:grc-translit')
local m_util = require('Module:utilities')
local tag = require('Module:grc-utilities').tag

local lang = "grc"

local function check_output(term, expected, sc)
	tests:equals(tag(term), mw.ustring.toNFD(translit.tr(term, lang, sc)), mw.ustring.toNFD(expected))
end

function tests:test_links()
	check_output('λόγος', 'lógos')
	check_output('σφίγξ', 'sphínx')
	check_output('ϝάναξ', 'wánax')
	check_output('οἷαι', 'hoîai')

	-- test u/y
	check_output('ταῦρος', 'taûros')
	check_output('νηῦς', 'nēûs')
	check_output('σῦς', 'sûs')
	check_output('γυῖον', 'guîon')
	check_output('ἀναῡ̈τέω', 'anaṻtéō')
	check_output('δαΐφρων', 'daḯphrōn')

	-- test length
	check_output('τῶν', 'tôn')
	check_output('τοὶ', 'toì')
	check_output('τῷ', 'tôi')
	check_output('τούτῳ', 'toútōi')
	check_output('σοφίᾳ', 'sophíāi')

	-- test h
	check_output('ὁ', 'ho')
	check_output('οἱ', 'hoi')
	check_output('εὕρισκε', 'heúriske')
	check_output('ὑϊκός', 'huïkós')
	check_output('πυρρός', 'purrhós')
	check_output('ῥέω', 'rhéō')
	check_output('σάἁμον', 'sáhamon')
	
	-- test capitals
	check_output('Ὀδυσσεύς', 'Odusseús')
	check_output('Εἵλως', 'Heílōs')
	check_output('ᾍδης', 'Hā́idēs')
	check_output('ἡ Ἑλήνη', 'hē Helḗnē')

	check_output('𐠠𐠒𐠯𐠗', 'pi-lo-ti-mo', "Cprt")
end

return tests