Module:gez-nominal/testcases

All tests passed. (refresh)

TextExpectedActual
test_accusative:
Passedንጉሥንጉሠንጉሠ
Passedነገሥትነገሥተነገሥተ
Passedንግሥትንግሥተንግሥተ
Passedንግሥታትንግሥታተንግሥታተ
Passedሊቅሊቀሊቀ
Passedሊቃንሊቃነሊቃነ
Passedዐዘቅትዐዘቅተዐዘቅተ
Passedዐዘቃትዐዘቃተዐዘቃተ
TextExpectedActual
test_construct:
Passedሊቅሊቀሊቀ
Passedሊቃንሊቃነሊቃነ
Passedዐዘቅትዐዘቅተዐዘቅተ
Passedዐዘቃትዐዘቃተዐዘቃተ
Passedሊቅሊቀሊቀ
Passedሊቃንሊቃነሊቃነ
Passedዐዘቅትዐዘቅተዐዘቅተ
Passedዐዘቃትዐዘቃተዐዘቃተ
TextExpectedActual
test_external_plural:
Passedክቡር, gender=mክቡራንክቡራን
Passedክብርት, gender=fክብርታትክብርታት
TextExpectedActual
test_pronominal_suffix:
Passedሥጋ, pronoun=3ms, plural=false, accusative=false{"ሥጋሁ"}{"ሥጋሁ"}
Passedሥጋ, pronoun=3ms, plural=false, accusative=true{"ሥጋሁ"}{"ሥጋሁ"}
Passedጸሓፊ, pronoun=2ms, plural=false, accusative=false{"ጸሓፊከ"}{"ጸሓፊከ"}
Passedጸሓፊ, pronoun=2ms, plural=false, accusative=true{"ጸሓፌከ"}{"ጸሓፌከ"}
Passedጸሓፊ, pronoun=3ms, plural=false, accusative=false{"ጸሓፊሁ"}{"ጸሓፊሁ"}
Passedጸሓፊ, pronoun=3ms, plural=false, accusative=true{"ጸሓፊሁ"}{"ጸሓፊሁ"}
Passedንጉሥ, pronoun=2ms, plural=false, accusative=false{"ንጉሥከ"}{"ንጉሥከ"}
Passedንግሥት, pronoun=2ms, plural=false, accusative=true{"ንግሥተከ"}{"ንግሥተከ"}
Passedነገሥት, pronoun=1s, plural=true, accusative=false{"ነገሥትየ"}{"ነገሥትየ"}
Passedነገሥት, pronoun=1s, plural=true, accusative=true{"ነገሥትየ"}{"ነገሥትየ"}
Passedነገሥት, pronoun=2fs, plural=true, accusative=false{"ነገሥትኪ", "ነገሥቲኪ"}{"ነገሥትኪ", "ነገሥቲኪ"}
Passedነገሥት, pronoun=2fs, plural=true, accusative=true{"ነገሥትኪ", "ነገሥቲኪ"}{"ነገሥትኪ", "ነገሥቲኪ"}
Passedነገሥት, pronoun=3mp, plural=true, accusative=false{"ነገሥቲሆሙ"}{"ነገሥቲሆሙ"}
Passedነገሥት, pronoun=3mp, plural=true, accusative=true{"ነገሥቲሆሙ"}{"ነገሥቲሆሙ"}
Passedእዘን, pronoun=3fs, plural=true, accusative=false{"እዘኒሃ"}{"እዘኒሃ"}
Passedእዘን, pronoun=3fs, plural=true, accusative=true{"እዘኒሃ"}{"እዘኒሃ"}
Passedእዘን, pronoun=1s, plural=true, accusative=false{"እዘንየ"}{"እዘንየ"}
Passedእዘን, pronoun=1s, plural=true, accusative=true{"እዘንየ"}{"እዘንየ"}
Passedሀገር, pronoun=1s, plural=false, accusative=false{"ሀገርየ"}{"ሀገርየ"}
Passedሀገር, pronoun=1s, plural=false, accusative=true{"ሀገርየ"}{"ሀገርየ"}
Passedነቢያት, pronoun=3ms, plural=true, accusative=false{"ነቢያቲሁ"}{"ነቢያቲሁ"}
Passedነቢያት, pronoun=3ms, plural=true, accusative=true{"ነቢያቲሁ"}{"ነቢያቲሁ"}
Passedብርሃን, pronoun=1s, plural=false, accusative=false{"ብርሃንየ"}{"ብርሃንየ"}
Passedብርሃን, pronoun=1s, plural=false, accusative=true{"ብርሃንየ"}{"ብርሃንየ"}

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