Module:User:Vitalik/inflection/units/uz-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 unit_name = 'uz-noun' local lang = require('Module:languages').getByCode('uz')

local n = 0 local average = 0

function tests:check_full_inflection(base, possessive_type, expected, comment) return self:check_inflection(base, possessive_type, expected, comment, true) end

function tests:check_inflection(base, possessive_type, expected, comment, full) n = n + 1

local start = os.clock local forms = inflection.test(unit_name, base, {possessive_type=possessive_type}) local finished = os.clock local delta = finished - start mw.log('time delta = ' .. delta) average = ((average * (n - 1)) + delta) / n	mw.log('time average = ' .. average) local forms_keys if full == nil then forms_keys = { 'nom_sg', 'gen_sg', 'dat_sg', 'acc_sg', 'loc_sg', 'abl_sg', 'nom_pl', 'gen_pl', 'dat_pl', 'acc_pl', 'loc_pl', 'abl_pl', 'nom_sg_possessive_1sg', 'nom_sg_possessive_3sg', }	else forms_keys = { 'nom_sg', 'gen_sg', 'dat_sg', 'acc_sg', 'loc_sg', 'abl_sg', 'nom_pl', 'gen_pl', 'dat_pl', 'acc_pl', 'loc_pl', 'abl_pl', 'nom_sg_possessive_1sg', 'gen_sg_possessive_1sg', 'dat_sg_possessive_1sg', 'acc_sg_possessive_1sg', 'loc_sg_possessive_1sg', 'abl_sg_possessive_1sg', 'nom_sg_possessive_2sg', 'gen_sg_possessive_2sg', 'dat_sg_possessive_2sg', 'acc_sg_possessive_2sg', 'loc_sg_possessive_2sg', 'abl_sg_possessive_2sg', 'nom_sg_possessive_3sg', 'gen_sg_possessive_3sg', 'dat_sg_possessive_3sg', 'acc_sg_possessive_3sg', 'loc_sg_possessive_3sg', 'abl_sg_possessive_3sg', 'nom_sg_possessive_1pl', 'gen_sg_possessive_1pl', 'dat_sg_possessive_1pl', 'acc_sg_possessive_1pl', 'loc_sg_possessive_1pl', 'abl_sg_possessive_1pl', 'nom_sg_possessive_2pl', 'gen_sg_possessive_2pl', 'dat_sg_possessive_2pl', 'acc_sg_possessive_2pl', 'loc_sg_possessive_2pl', 'abl_sg_possessive_2pl', 'nom_sg_possessive_3pl', 'gen_sg_possessive_3pl', 'dat_sg_possessive_3pl', 'acc_sg_possessive_3pl', 'loc_sg_possessive_3pl', 'abl_sg_possessive_3pl', 'nom_pl_possessive_1sg', 'gen_pl_possessive_1sg', 'dat_pl_possessive_1sg', 'acc_pl_possessive_1sg', 'loc_pl_possessive_1sg', 'abl_pl_possessive_1sg', 'nom_pl_possessive_2sg', 'gen_pl_possessive_2sg', 'dat_pl_possessive_2sg', 'acc_pl_possessive_2sg', 'loc_pl_possessive_2sg', 'abl_pl_possessive_2sg', 'nom_pl_possessive_3sg', 'gen_pl_possessive_3sg', 'dat_pl_possessive_3sg', 'acc_pl_possessive_3sg', 'loc_pl_possessive_3sg', 'abl_pl_possessive_3sg', 'nom_pl_possessive_1pl', 'gen_pl_possessive_1pl', 'dat_pl_possessive_1pl', 'acc_pl_possessive_1pl', 'loc_pl_possessive_1pl', 'abl_pl_possessive_1pl', 'nom_pl_possessive_2pl', 'gen_pl_possessive_2pl', 'dat_pl_possessive_2pl', 'acc_pl_possessive_2pl', 'loc_pl_possessive_2pl', 'abl_pl_possessive_2pl', 'nom_pl_possessive_3pl', 'gen_pl_possessive_3pl', 'dat_pl_possessive_3pl', 'acc_pl_possessive_3pl', 'loc_pl_possessive_3pl', 'abl_pl_possessive_3pl', }	end local link = m_links.full_link({term = base, lang = lang, tr = '-' }, nil, true) 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 .. ' (type="' .. (possessive_type or '-') .. '") ' .. form_key .. ''		if comment then			text = text .. " " .. comment .. " "		end		actual = forms[form_key]		expected = expected_list[i]		self:equals(text, actual, expected)	end end

function tests:test_inflection self:check_full_inflection('kitob', '', 		'kitob / kitobning / kitobga / kitobni / kitobda / kitobdan / kitoblar / kitoblarning / kitoblarga / kitoblarni / kitoblarda / kitoblardan / ' ..		'kitobim / kitobimning / kitobimga / kitobimni / kitobimda / kitobimdan / ' ..		'kitobing / kitobingning / kitobingga / kitobingni / kitobingda / kitobingdan / ' ..		'kitobi / kitobining / kitobiga / kitobini / kitobida / kitobidan / ' ..		'kitobimiz / kitobimizning / kitobimizga / kitobimizni / kitobimizda / kitobimizdan / ' ..		'kitobingiz / kitobingizning / kitobingizga / kitobingizni / kitobingizda / kitobingizdan / ' ..		'kitobi / kitobining / kitobiga / kitobini / kitobida / kitobidan / ' ..		'kitoblarim / kitoblarimning / kitoblarimga / kitoblarimni / kitoblarimda / kitoblarimdan / ' ..		'kitoblaring / kitoblaringning / kitoblaringga / kitoblaringni / kitoblaringda / kitoblaringdan / ' ..		'kitoblari / kitoblarining / kitoblariga / kitoblarini / kitoblarida / kitoblaridan / ' .. 'kitoblarimiz / kitoblarimizning / kitoblarimizga / kitoblarimizni / kitoblarimizda / kitoblarimizdan / ' .. 'kitoblaringiz / kitoblaringizning / kitoblaringizga / kitoblaringizni / kitoblaringizda / kitoblaringizdan / ' .. 'kitoblari / kitoblarining / kitoblariga / kitoblarini / kitoblarida / kitoblaridan')	self:check_inflection('mavzu', 'yisi', 'mavzu / mavzuning / mavzuga / mavzuni / mavzuda / mavzudan / mavzular / mavzularning / mavzularga / mavzularni / mavzularda / mavzulardan / mavzuyim / mavzusi')	self:check_inflection('parvo', 'yiyi', 'parvo / parvoning / parvoga / parvoni / parvoda / parvodan / parvolar / parvolarning / parvolarga / parvolarni / parvolarda / parvolardan / parvoyim / parvoyi')	self:check_inflection('ishtirok', 'kq', 'ishtirok / ishtirokning / ishtirokka / ishtirokni / ishtirokda / ishtirokdan / ishtiroklar / ishtiroklarning / ishtiroklarga / ishtiroklarni / ishtiroklarda / ishtiroklardan / ishtirokim / ishtiroki')	self:check_inflection('huquq', 'kq', 'huquq / huquqning / huquqqa / huquqni / huquqda / huquqdan / huquqlar / huquqlarning / huquqlarga / huquqlarni / huquqlarda / huquqlardan / huquqim / huquqi') self:check_inflection('qorin', 'reduced', 'qorin / qorinning / qoringa / qorinni / qorinda / qorindan / qorinlar / qorinlarning / qorinlarga / qorinlarni / qorinlarda / qorinlardan / qornim / qorni') self:check_inflection('metall', '', 'metall / metallning / metallga / metallni / metallda / metalldan / metallar / metallarning / metallarga / metallarni / metallarda / metallardan / metallim / metalli') self:check_inflection('bobo', 'std', 'bobo / boboning / boboga / boboni / boboda / bobodan / bobolar / bobolarning / bobolarga / bobolarni / bobolarda / bobolardan / bobom / bobosi') self:check_inflection('tilak', 'std', 'tilak / tilakning / tilakka / tilakni / tilakda / tilakdan / tilaklar / tilaklarning / tilaklarga / tilaklarni / tilaklarda / tilaklardan / tilagim / tilagi') self:check_inflection('tayoq', 'std', 'tayoq / tayoqning / tayoqqa / tayoqni / tayoqda / tayoqdan / tayoqlar / tayoqlarning / tayoqlarga / tayoqlarni / tayoqlarda / tayoqlardan / tayogʻim / tayogʻi') self:check_inflection('obroʻ', 'yiyi', 'obroʻ / obroʻning / obroʻga / obroʻni / obroʻda / obroʻdan / obroʻlar / obroʻlarning / obroʻlarga / obroʻlarni / obroʻlarda / obroʻlardan / obroʻyim / obroʻyi') self:check_inflection('dohiy', '', 'dohiy / dohiyning / dohiyga / dohiyni / dohiyda / dohiydan / dohiylar / dohiylarning / dohiylarga / dohiylarni / dohiylarda / dohiylardan / dohiyim / dohiysi') end

return tests