Modul:Wikidata/Formatters/round/testcases
Vzhled
local myModule = require 'Modul:Wikidata/Formatters/round'
local ScribuntoUnit = require 'Modul:ScribuntoUnit'
local suite = ScribuntoUnit:new()
function suite:testFormatNumber()
local provider = {
[123] = '123',
[1234] = '1 234',
[12345] = '12 345',
[123456] = '123 456',
[1234567] = '1,2 mil.',
[-1234567] = '−1,2 mil.',
[12345678] = '12,3 mil.',
[-12345678] = '−12,3 mil.',
[123456789] = '123,5 mil.',
[-123456789] = '−123,5 mil.',
[1234567890] = '1,2 mld.',
[12345678901] = '12,3 mld.',
[123456789012] = '123,5 mld.',
[1234567890123] = '1,2 bil.',
}
for num, expected in pairs(provider) do
self:assertEquals(expected, myModule.formatNumber(num))
end
end
return suite