Module:grc-form of/testcases
Jump to navigation
Jump to search
- The following documentation is located at Module:grc-form of/testcases/documentation. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • tested module • sandbox
All tests passed. (refresh)
Text | Expected | Actual | Comments | |
---|---|---|---|---|
p, nom, masc (adjective) | {"masculine", "nominative", "plural"} | {"masculine", "nominative", "plural"} | ||
plural, nominative, masculine (adjective) | {"masculine", "nominative", "plural"} | {"masculine", "nominative", "plural"} | ||
plural, subjunctive (noun) | "error" | "error" | Module:grc-form_of:89: The category “mood” is not used by the part of speech “noun”. | |
masculine, feminine, plural (noun) | "error" | "error" | Module:grc-form_of:16: There were multiple labels belonging to the same category: “gender”: “masculine”, “feminine”. | |
3, s, aor, subj, act (verb) | {"third person", "singular", "aorist", "subjunctive", "active"} | {"third person", "singular", "aorist", "subjunctive", "active"} | ||
pres, inf, act (verb) | {"present", "active", "infinitive"} | {"present", "active", "infinitive"} | ||
3, s, inf, act (verb) | "error" | "error" | Module:grc-form_of:89: The categories “number”, “person” are not used by the part of speech “infinitive”. | |
pres, inf, act (varb) | "error" | "error" | Module:grc-form_of:78: The part of speech “varb” does not have a set of valid inflectional categories. | |
m, nom, p, part, act (verb) | {"masculine", "nominative", "plural", "active", "participle"} | {"masculine", "nominative", "plural", "active", "participle"} | ||
m, nom, p, part, subj, act (verb) | "error" | "error" | Module:grc-form_of:89: The category “mood” is not used by the part of speech “participle”. |
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