Module:User:Erutuon/grc/Latin to Greek/testcases

local tests = require("Module:UnitTests") local tag = mw.text.tag local decompose = mw.ustring.toNFD

local Latin_to_Greek = require("Module:User:Erutuon/grc/Latin to Greek")

--[=[ -- To compare speed of the function in Module:typing-aids. local old_replace = require("Module:typing-aids").replace function Latin_to_Greek(Latin) return old_replace{ "grc", Latin } end --]=]

local function tag_Greek(text) return tag("span", { class = "polytonic", lang = "grc" }, text) end

local function code(text) return tag("code", nil, text) end

local options = { display = tag_Greek, show_difference = true } function tests:check(example, expected) self:equals(code(example),		decompose(Latin_to_Greek(example)),		decompose(expected),		options) end

function tests:test local examples = { { "a__i", "ᾱͅ" }, { "a)lhqh/s", "ἀληθής" },		{ "a)lhqhs*", "ἀληθησ" }, { "a)lhqhs-", "ἀληθησ-" },		{ "a^)nh/r", "ᾰ̓νήρ" }, { "Phlhi+a/dhs", "Πηληϊάδης" }, { "Phlhi^+a^/dhs", "Πηληῐ̈ᾰ́δης" }, { "Πηληϊ^ά^δης", "Πηληῐ̈ᾰ́δης" }, { "e)a_/n", "ἐᾱ́ν" },		{ "ἐά_ν", "ἐᾱ́ν" },		{ "pa=sa^", "πᾶσᾰ" },		{ "u_(mei=s", "ῡ̔μεῖς" }, { "a/)^ner", "ᾰ̓́νερ" },		{ "a/^)ner", "ᾰ̓́νερ" }, { "a)/^ner", "ᾰ̓́νερ" },		{ "a)^/ner", "ᾰ̓́νερ" }, { "dai+/frwn", "δαΐφρων" }, { "dai/+frwn", "δαΐφρων" }, }	tests:iterate(examples, "check") end

return tests