Module:lzz-dec-noun/testcases

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

local tester = require('Module:UnitTests') -- [[Module:UnitTests]]
local mod = require('Module:lzz-dec-noun') -- [[Module:lzz-dec-noun]]

function tester:tests_main()
	local testcases = {
		["კოლი"] = {tests = {{"abs2", "კოლეფე"}}},
		
		["ტრამვაი"] = {args = {[1] = ""}, 
					  tests = {{"gen1", "ტაბაღიშ(ი))"}, {"dat2", "ტაბაღეფეში"}}},
		
		["საღანი"] = {args = {[1] = ""}, 
					tests = {{"loc1", "საღანის"}, {"ins1", "საღანითენ"}}},
		
		["ალი"] = {args = {[1] = "given name"}, 
					tests = {{"gen1", "ალიშ"}}},
		
		["მამედი"] = {args = {[1] = "მამედი", [2] = "given name"}, 
					tests = {{"lat1", "მამედიშე"}, {"abl1", "მამედიშენ"}}},
					
		["დავითი"] = {args = {[1] = "given name"}, 
					tests = {{"adv1", "დავითად"}, {"dat1", "დავითს"}}},
	}
	
	for inflTerm, testcase in pairs(testcases) do
		local tests = testcase.tests;
		local term = testcase.term or inflTerm;
		local args = testcase.args or {}
		args[1] = term
		
		for _, test in pairs(tests) do
			local form, shouldbe = unpack(test)
			local testname = form .. ". of " .. term
			self:equals(testname, mod.test(args, form), shouldbe, {nowiki = true})
		end
	end
end

return tester