Jump to content

Module:I18n/ordinal/testcases

Wikibooks වෙතින්
local p = require('Module:UnitTests')
local i18n = require('Module:I18n/ordinal')

function p:test_I18n_ordinal()
	self:equals_deep('SchemeFromLang["en"]', i18n.SchemeFromLang["en"], 'en-scheme')
	self:equals_deep('SchemeFromLang["de"]', i18n.SchemeFromLang["de"], 'period-scheme')
	self:equals_deep('SchemeFromLang["fr"]', i18n.SchemeFromLang["fr"], 'fr-scheme')
	self:equals_deep('SchemeFromLang["it"]', i18n.SchemeFromLang["it"], 'romance-scheme')
	self:equals_deep('SchemeFromLang["pl"]', i18n.SchemeFromLang["pl"], 'pl-scheme')
	
	self:equals_deep('Scheme["null-scheme"]', i18n.Scheme["null-scheme"], 
		{})
	self:equals_deep('Scheme["period-scheme"]', i18n.Scheme["period-scheme"], 
		{rules = 'suffix', suffix = '.'})
	self:equals_deep('Scheme["en-scheme"]', i18n.Scheme["en-scheme"], 
		{rules = 'skip-tens', superscript = true, suffix = 'th', suffix_1 = 'st', suffix_2 = 'nd', suffix_3 = 'rd'})
	self:equals_deep('Scheme["zh-scheme"]', i18n.Scheme["zh-scheme"], 
		{rules = 'prefix', prefix = '第'})
		
	self:equals('languages > 20', tablelength(i18n.SchemeFromLang) > 20, true) 
	self:equals('schemes > 20', tablelength(i18n.Scheme) > 20, true) 
end

function tablelength(T) 
	local count = 0 
	for _ in pairs(T) do count = count + 1 end
  	return count
end
 
return p
"https://si.wikibooks.org/w/index.php?title=Module:I18n/ordinal/testcases&oldid=24470" වෙතින් සම්ප්‍රවේශනය කෙරිණි