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: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 = '<span style="color:silver;font-family:Courier New,monospace;">|</span>'
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 = '<small>' .. n .. '.' .. zero .. i .. ')</small> '
text = text .. '<span style="border:1px gray solid;padding:3px;">{{<small style="color:gray">ru-delc-noun-z</small>'.. divider .. link .. divider .. gender_animacy .. divider .. stress_type .. specific .. '}}</span>, '
text = text .. " <small style='color: gray;'>stem type is '''" .. forms['stem_type'] .. "'''</small>, "
text = text .. '<b>' .. form_key .. '</b> →'
if comment then
text = text .. "<br/><small>comment: <span style='color:gray;'> " .. comment .. "</span></small>"
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