local t = require("Module:UnitTests")
local mut = require("Module:h3")
function t:test1_get_long_sing()
self:equals('h3.getLongSing("subst")', mut.getLongSing("subst"), "substantiv")
self:equals('h3.getLongSing("prep")', mut.getLongSing("prep"), "preposition")
self:equals('h3.getLongSing("Preposition")', mut.getLongSing("Preposition"), "preposition")
self:equals('h3.getLongSing("Prepositioner")', mut.getLongSing("Prepositioner"), "preposition")
self:equals('h3.getLongSing("Prepositionen")', mut.getLongSing("Prepositionen"), "preposition")
end
function t:test2_get_long_sing_ucfirst()
self:equals('h3.getLongSingUCFirst("subst")', mut.getLongSingUCFirst("subst"), "Substantiv")
self:equals('h3.getLongSingUCFirst("prep")', mut.getLongSingUCFirst("prep"), "Preposition")
self:equals('h3.getLongSingUCFirst("preposition")', mut.getLongSingUCFirst("preposition"), "Preposition")
end
function t:test3_get_long_plur()
self:equals('h3.getLongPlur("subst")', mut.getLongPlur("subst"), "substantiv")
self:equals('h3.getLongPlur("prep")', mut.getLongPlur("prep"), "prepositioner")
self:equals('h3.getLongPlur("Preposition")', mut.getLongPlur("Preposition"), "prepositioner")
end
function t:test4_get_long_plur_ucfirst()
self:equals('h3.getLongPlurUCFirst("subst")', mut.getLongPlurUCFirst("subst"), "Substantiv")
self:equals('h3.getLongPlurUCFirst("prep")', mut.getLongPlurUCFirst("prep"), "Prepositioner")
self:equals('h3.getLongPlurUCFirst("preposition")', mut.getLongPlurUCFirst("preposition"), "Prepositioner")
end
function t:test5_get_short()
self:equals('h3.getShort("subst")', mut.getShort("subst"), "subst")
self:equals('h3.getShort("prep")', mut.getShort("prep"), "prep")
self:equals('h3.getShort("preposition")', mut.getShort("preposition"), "prep")
self:equals('h3.getShort("Preposition")', mut.getShort("Preposition"), "prep")
end
function t:test6_get_long_det_sing()
self:equals('h3.getLongDetSing("subst")', mut.getLongDetSing("subst"), "substantivet")
self:equals('h3.getLongDetSing("prep")', mut.getLongDetSing("prep"), "prepositionen")
self:equals('h3.getLongDetSing("Preposition")', mut.getLongDetSing("Preposition"), "prepositionen")
end
function t:test7_get_long_det_sing_ucfirst()
self:equals('h3.getLongDetSingUCFirst("subst")', mut.getLongDetSingUCFirst("subst"), "Substantivet")
self:equals('h3.getLongDetSingUCFirst("prep")', mut.getLongDetSingUCFirst("prep"), "Prepositionen")
self:equals('h3.getLongDetSingUCFirst("preposition")', mut.getLongDetSingUCFirst("preposition"), "Prepositionen")
end
function t:test8_has_h3()
self:equals('h3.hasH3("subst")', mut.hasH3("subst"), true)
self:equals('h3.hasH3("Substantiv")', mut.hasH3("Substantiv"), true)
self:equals('h3.hasH3("xyz")', mut.hasH3("xyz"), false)
end
function t:test9_return_default()
self:equals('h3.getShort("wrongh3short")', mut.getShort("wrongh3short"), "")
self:equals('h3.getLongSing("wrongh3long")', mut.getLongDetSing("wrongh3long"), "")
self:equals('h3.getLongPlur("wrongh3long")', mut.getLongDetSing("wrongh3long"), "")
self:equals('h3.getLongDetSing("wrongh3long")', mut.getLongDetSing("wrongh3long"), "")
end
return t