Module:User:Vitalik/inflection/units/ru-noun/testcases

local dev_prefix = '' dev_prefix = 'User:Vitalik/' -- comment this on active version

local tests = require('Module:UnitTests') local inflection = require('Module:' .. dev_prefix .. 'inflection') local m_links = require('Module:links')

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

local n = 1

function tests:check_inflection(word_stressed, gender_animacy, stress_type, specific, expected, comment) local title = word_stressed local link = m_links.full_link({lang = lang, term = title, tr = '-'}, nil, true) local base = mw.ustring.gsub(word_stressed, '́', '') local forms = inflection.test(data_name, base, {word_stressed=word_stressed, gender_animacy=gender_animacy, stress_type=stress_type, specific=specific}) 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, ' / ') local divider = '&#124; ' if specific ~= '' then specific = divider .. specific end for i, form_key in pairs(forms_keys) do		local zero = i < 10 and '0' or '' local text = ' ' .. n .. '.' .. zero .. i .. ') '		text = text .. ', '		text = text .. " stem type is " .. forms['stem_type'] .. " , "		text = text .. '' .. form_key .. ' →'		if comment then			text = text .. " comment: " .. comment .. " "		end		actual = forms[form_key]		expected = expected_list[i]		if expected ~= '-' then			self:equals(text, actual, expected)		end	end	n = n + 1 end

return tests