Module:Ethi-common/testcases

From Wiktionary, the free dictionary
Jump to navigation Jump to search

All tests passed. (refresh)

TextExpectedActual
test_components:
Passed{alt=false, base="ጨ", labiovelar=false, order=2, palatalized=false}{alt=false, base="ጨ", labiovelar=false, order=2, palatalized=false}
Passedbase=ጨ, order=2, labiovelar=false, palatalized=false, alt=false"ጩ""ጩ"
Passed{alt=false, base="ዠ", labiovelar=true, order=4, palatalized=false}{alt=false, base="ዠ", labiovelar=true, order=4, palatalized=false}
Passedbase=ዠ, order=4, labiovelar=true, palatalized=false, alt=false"ዧ""ዧ"
Passed{alt=false, base="ኀ", labiovelar=true, order=3, palatalized=false}{alt=false, base="ኀ", labiovelar=true, order=3, palatalized=false}
Passedbase=ኀ, order=3, labiovelar=true, palatalized=false, alt=false"ኊ""ኊ"
Passed{alt=true, base="ከ", labiovelar=true, order=4, palatalized=false}{alt=true, base="ከ", labiovelar=true, order=4, palatalized=false}
Passedbase=ከ, order=4, labiovelar=true, palatalized=false, alt=true"ኯ""ኯ"
Passed{alt=false, base="መ", labiovelar=false, order=1, palatalized=true}{alt=false, base="መ", labiovelar=false, order=1, palatalized=true}
Passedbase=መ, order=1, labiovelar=false, palatalized=true, alt=false"ፙ""ፙ"

local tests = require('Module:UnitTests')
local ethi_common = require('Module:Ethi-common')

function tests:check_components(ethi, expected_components)
    local components = ethi_common.to_components(ethi)
    self:equals_deep(ethi, components, expected_components)
    self:equals_deep("base=" .. components.base .. ", order=" .. components.order .. ", labiovelar=" ..
                         tostring(components.labiovelar) .. ", palatalized=" .. tostring(components.palatalized) ..
                         ", alt=" .. tostring(components.alt), ethi_common.from_components(components), ethi)
end

function tests:test_components()
    local examples = {{"ጩ", {
        base = "ጨ",
        order = 2,
        labiovelar = false,
        palatalized = false,
        alt = false
    }}, {"ዧ", {
        base = "ዠ",
        order = 4,
        labiovelar = true,
        palatalized = false,
        alt = false
    }}, {"ኊ", {
        base = "ኀ",
        order = 3,
        labiovelar = true,
        palatalized = false,
        alt = false
    }}, {"ኯ", {
        base = "ከ",
        order = 4,
        labiovelar = true,
        palatalized = false,
        alt = true
    }}, {"ፙ", {
        base = "መ",
        order = 1,
        labiovelar = false,
        palatalized = true,
        alt = false
    }}}
    self:iterate(examples, "check_components")
end

return tests