Module:User:Vitalik/inflection-new/testcases

Hello, you have come here looking for the meaning of the word Module:User:Vitalik/inflection-new/testcases. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:User:Vitalik/inflection-new/testcases, but we will also tell you about its etymology, its characteristics and you will know how to say Module:User:Vitalik/inflection-new/testcases in singular and plural. Everything you need to know about the word Module:User:Vitalik/inflection-new/testcases you have here. The definition of the word Module:User:Vitalik/inflection-new/testcases will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:User:Vitalik/inflection-new/testcases, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.


local tests = require('Module:UnitTests')
local inflection = require('Module:User:Vitalik/inflection-new')
local m_links = require('Module:links')

local data_name = 'ru-noun'
local lang = require('Module:languages').getByCode('ru')

local n = 1

function tests:check_inflection(base_stressed, gender_class, stress, expected, comment)
	local title = base_stressed
	local link = m_links.full_link({lang = lang, term = title, tr = '-'}, nil, true)
	local base = mw.ustring.gsub(base_stressed, '́', '')
	local forms = inflection.main(data_name, base, {base_stressed=base_stressed, gender_class=gender_class, stress=stress})
	local forms_keys = {'nom_sg', 'gen_sg', 'dat_sg', 'acc_sg', 'ins_sg', 'prp_sg', 'nom_pl', 'gen_pl', 'dat_pl', 'acc_pl', 'ins_pl', 'prp_pl'}
	local expected_list = mw.text.split(expected, ' / ')
	for i, form_key in pairs(forms_keys) do
		local zero = i < 10 and '0' or ''
		local text = n .. '.' .. zero .. i .. ') ' .. link .. ' (' .. gender_class .. ', ' .. stress .. ') <b>' .. form_key .. '</b>'
		text = text .. " <small style='color: gray;'>stem type is " .. forms .. "</small>"
		if comment then
			text = text .. " <small style='color: gray;'>" .. comment .. "</small>"
		end
		actual = forms
		expected = expected_list
		self:equals(text, actual, expected)
	end
	n = n + 1
end

return tests