Module:gez-nominal/testcases

local tests = require('Module:UnitTests') local gez_nom = require('Module:gez-nominal')

function tests:check_external_plural(base, gender, expected_form) self:equals(base .. ", gender=" .. gender, gez_nom.external_plural(base, gender), expected_form) end

function tests:test_external_plural local examples = {{"ክቡር", "m", "ክቡራን"}, {"ክብርት", "f", "ክብርታት"}} self:iterate(examples, "check_external_plural") end

function tests:check_accusative(base, expected_form) self:equals(base, gez_nom.accusative_form(base), expected_form) end

function tests:test_accusative local examples = {{"ንጉሥ", "ንጉሠ"}, {"ነገሥት", "ነገሥተ"}, {"ንግሥት", "ንግሥተ"}, {"ንግሥታት", "ንግሥታተ"}, {"ሊቅ", "ሊቀ"}, {"ሊቃን", "ሊቃነ"}, {"ዐዘቅት", "ዐዘቅተ"}, {"ዐዘቃት", "ዐዘቃተ"}} self:iterate(examples, "check_accusative") end

function tests:check_construct(base, expected_form) self:equals(base, gez_nom.construct_form(base), expected_form) end

function tests:check_construct_accusative(base, expected_form) self:equals(base, gez_nom.construct_form(gez_nom.accusative_form(base)), expected_form) end

function tests:test_construct local examples = {{"ሊቅ", "ሊቀ"}, {"ሊቃን", "ሊቃነ"}, {"ዐዘቅት", "ዐዘቅተ"}, {"ዐዘቃት", "ዐዘቃተ"}} self:iterate(examples, "check_construct") self:iterate(examples, "check_construct_accusative") end

function tests:check_pronominal_suffix(base, pronoun, base_is_plural, accusative, expected_result) self:equals_deep(base .. ", pronoun=" .. pronoun .. ", plural=" .. tostring(base_is_plural) .. ", accusative=" ..                        tostring(accusative),        gez_nom.with_pronominal_suffix(base, pronoun, base_is_plural, accusative), expected_result) end

function tests:test_pronominal_suffix local examples = {{"ሥጋ", "3ms", false, false, {"ሥጋሁ"}}, {"ሥጋ", "3ms", false, true, {"ሥጋሁ"}}, {"ጸሓፊ", "2ms", false, false, {"ጸሓፊከ"}}, {"ጸሓፊ", "2ms", false, true, {"ጸሓፌከ"}}, {"ጸሓፊ", "3ms", false, false, {"ጸሓፊሁ"}}, {"ጸሓፊ", "3ms", false, true, {"ጸሓፊሁ"}}, {"ንጉሥ", "2ms", false, false, {"ንጉሥከ"}}, {"ንግሥት", "2ms", false, true, {"ንግሥተከ"}}, {"ነገሥት", "1s", true, false, {"ነገሥትየ"}}, {"ነገሥት", "1s", true, true, {"ነገሥትየ"}}, {"ነገሥት", "2fs", true, false, {"ነገሥትኪ", "ነገሥቲኪ"}}, {"ነገሥት", "2fs", true, true, {"ነገሥትኪ", "ነገሥቲኪ"}}, {"ነገሥት", "3mp", true, false, {"ነገሥቲሆሙ"}}, {"ነገሥት", "3mp", true, true, {"ነገሥቲሆሙ"}}, {"እዘን", "3fs", true, false, {"እዘኒሃ"}}, {"እዘን", "3fs", true, true, {"እዘኒሃ"}}, {"እዘን", "1s", true, false, {"እዘንየ"}}, {"እዘን", "1s", true, true, {"እዘንየ"}}, {"ሀገር", "1s", false, false, {"ሀገርየ"}}, {"ሀገር", "1s", false, true, {"ሀገርየ"}}, {"ነቢያት", "3ms", true, false, {"ነቢያቲሁ"}}, {"ነቢያት", "3ms", true, true, {"ነቢያቲሁ"}}, {"ብርሃን", "1s", false, false, {"ብርሃንየ"}}, {"ብርሃን", "1s", false, true, {"ብርሃንየ"}}}

self:iterate(examples, "check_pronominal_suffix") end return tests