local tests = require("Module:UnitTests")
local m_utilities_sandbox = require("Module:grc-utilities/sandbox")
local makeSortKey = m_utilities_sandbox.makeSortKey
local makeEntryName = m_utilities_sandbox.makeEntryName
local normalize = mw.ustring.toNFD
--[=[
-- Compare functions in [[Module:languages]].
local grc = require("Module:languages").getByCode("grc")
local function makeSortKey(text)
return grc:makeSortKey(text)
end
local function makeEntryName(text)
return grc:makeEntryName(text)
end
--]=]
local function tag(text)
return '<span class="polytonic" lang="grc">' .. text .. '</span>'
end
local options = { display = tag }
function tests:check(func)
return function (self, example, expected)
self:equals(tag(example), normalize(func(example)), normalize(expected), options)
end
end
function tests:testMakeEntryName()
local examples = {
{ "ἐᾱ́ν", "ἐάν" },
{ "ᾰ̓́νερ", "ἄνερ" },
{ "Πηληῐ̈ᾰ́δης", "Πηληϊάδης" },
{ "Ᾱ̔́ͅδης", "ᾍδης" },
--[[
{ "", "" },
{ "", "" },
--]]
}
self:iterate(examples, self:check(makeEntryName))
end
function tests:testMakeSortKey()
local examples = {
{ "ἐᾱ́ν", "ΕΑΝ" },
{ "ᾰ̓́νερ", "ΑΝΕΡ" },
{ "Πηληῐ̈ᾰ́δης", "ΠΗΛΗΙΑΔΗΣ" },
{ "Ᾱ̔́ͅδης", "ΑΔΗΣ" },
--[[
{ "", "" },
{ "", "" },
--]]
}
self:iterate(examples, self:check(makeSortKey))
end
return tests