Module:grc-form of/testcases

local tests = require("Module:UnitTests")

local _process = require("Module:grc-form of").process

local error_messages = {} local function process(...) local success, result = pcall(_process, ...) if success then return result else error_messages[...] = result return "error" end end

local function display(labels, POS) return table.concat(labels, ", ") .. " (" .. POS .. ")" end

function tests:check_processing(labels, POS, expected) local actual = process(labels, POS) -- so that error message is logged when equals_deep is called self:equals_deep(display(labels, POS), actual, expected, { comment = error_messages[labels] }) end

function tests:test_processing local examples = { { { "p", "nom", "masc" }, "adjective", { "masculine", "nominative", "plural" } }, { { "plural", "nominative", "masculine" }, "adjective", { "masculine", "nominative", "plural" } }, { { "plural", "subjunctive" }, "noun", "error" }, { { "masculine", "feminine", "plural" }, "noun", "error" }, { { "3", "s", "aor", "subj", "act" }, "verb", { "third person", "singular", "aorist", "subjunctive", "active" } }, { { "pres", "inf", "act" }, "verb", { "present", "active", "infinitive" } }, { { "3", "s", "inf", "act" }, "verb", "error" }, { { "pres", "inf", "act" }, "varb", "error" }, { { "m", "nom", "p", "part", "act" }, "verb", { "masculine", "nominative", "plural", "active", "participle" } }, { { "m", "nom", "p", "part", "subj", "act" }, "verb", "error" }, }	self:iterate(examples, "check_processing") end

return tests