Module:grc-translit/sandbox/testcases

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

local tests = require('Module:UnitTests') local transliterate = require('Module:grc-translit/sandbox').tr local m_util = require('Module:utilities') local tag = require('Module:grc-utilities').tag local compose = mw.ustring.toNFC

local lang = "grc"

local function check_output(term, expected, sc) tests:equals(		tag(term),		compose(transliterate(term, lang, sc)),		compose(expected)	) end

local function iterate(list) for i, example in pairs(list) do		check_output(example[1], example[2], example[3]) end end

function tests:test_links local examples = { -- all-caps { 'ΛΌΓΟΣ', 'LÓGOS' }, { 'ΟἿΑΙ', 'HOÎAI' }, { 'ῬΉΤΩΡ', 'RHḖTŌR' }, { 'λόγος', 'lógos' }, { 'σφίγξ', 'sphínx' }, { 'ϝάναξ', 'wánax' }, { 'οἷαι', 'hoîai' }, -- test u/y { 'ταῦρος', 'taûros' }, { 'νηῦς', 'nēûs' }, { 'σῦς', 'sûs' }, { 'ὗς', 'hûs' }, { 'γυῖον', 'guîon' }, { 'ἀναῡ̈τέω', 'anaṻtéō' }, { 'δαΐφρων', 'daḯphrōn' }, -- test length { 'τῶν', 'tôn' }, { 'τοὶ', 'toì' }, { 'τῷ', 'tôi' }, { 'τούτῳ', 'toútōi' }, { 'σοφίᾳ', 'sophíāi' }, { 'μᾱ̆νός', 'mānós' }, -- should perhaps be mā̆nos -- test h		{ 'ὁ', 'ho' }, { 'οἱ', 'hoi' }, { 'εὕρισκε', 'heúriske' }, { 'ὑϊκός', 'huïkós' }, { 'πυρρός', 'purrhós' }, { 'ῥέω', 'rhéō' }, { 'σάἁμον', 'sáhamon' }, -- test capitals { 'Ὀδυσσεύς', 'Odusseús' }, { 'Εἵλως', 'Heílōs' }, { 'ᾍδης', 'Hā́idēs' }, { 'ἡ Ἑλήνη', 'hē Helḗnē' }, { '𐠠𐠒𐠯𐠗', 'pi-lo-ti-mo', "Cprt" }, -- punctuation { 'ἔχεις μοι εἰπεῖν, ὦ Σώκρατες, ἆρα διδακτὸν ἡ ἀρετή;', 'ékheis moi eipeîn, ô Sṓkrates, âra didaktòn hē aretḗ?'}, { 'τί τηνικάδε ἀφῖξαι, ὦ Κρίτων; ἢ οὐ πρῲ ἔτι ἐστίν;', 'tí tēnikáde aphîxai, ô Krítōn? ḕ ou prṑi éti estín?' }, -- This ought to be colon, but sadly that cannot be. { 'τούτων φωνήεντα μέν ἐστιν ἑπτά· α ε η ι ο υ ω.', 'toútōn phōnḗenta mén estin heptá; a e ē i o u ō.' }, }	iterate(examples) end

return tests