Module:Ancient Greek/testcases
Appearance
![]() | This is the test cases page for the module Module:Ancient Greek. Results of the test cases. |
--[=[
Modified from [[wikt:Module:grc-translit/testcases]].
]=]
local tests = require('Module:UnitTests')
local translit = require('Module:Ancient Greek')
local decompose = mw.ustring.toNFC
local function tag(text)
return '<span lang="grc">' .. text .. '</span>'
end
function tests:check_output(term, expected, sc)
tests:equals(
tag(term),
decompose(translit.transliterate(term)),
decompose(expected)
)
end
function tests:iterate(examples, func)
for i, example in ipairs(examples) do
self[func](self, unpack(example))
end
end
function tests:test_translit()
local examples = {
{ 'λόγος', '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ē' },
-- 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 ō.' },
}
self:iterate(examples, 'check_output')
end
return tests