Difference between revisions of "Module:ConvertNumeric/testcases"
Jump to navigation
Jump to search
blackwiki>Dcoetzee |
blackwiki>Dcoetzee (lk tests, more scientific notation tests) |
||
Line 16: | Line 16: | ||
{'123 | sp=us', 'one hundred twenty-three'}, | {'123 | sp=us', 'one hundred twenty-three'}, | ||
{'123 | adj=on', 'one-hundred-and-twenty-three'}, | {'123 | adj=on', 'one-hundred-and-twenty-three'}, | ||
+ | {'0.25', 'zero point two five'}, | ||
+ | {'.25', 'zero point two five'}, | ||
{'0 | ord=on', 'zeroth'}, | {'0 | ord=on', 'zeroth'}, | ||
{'33 | ord=on', 'thirty-third'}, | {'33 | ord=on', 'thirty-third'}, | ||
Line 23: | Line 25: | ||
{'1000000000000000000000000000001', 'one nonillion and one'}, | {'1000000000000000000000000000001', 'one nonillion and one'}, | ||
{'1.23E3', 'one thousand two hundred and thirty'}, | {'1.23E3', 'one thousand two hundred and thirty'}, | ||
+ | {'123E-4', 'zero point zero one two three'}, | ||
+ | {'100010001001001000 | lk=on', 'one [[Orders_of_magnitude_(numbers)#1012|quadrillion]] one [[Orders_of_magnitude_(numbers)#1012|trillion]] one [[Orders_of_magnitude_(numbers)#109|billion]] one million one thousand'}, | ||
+ | {'100010001001001000 | lk=billion,quadrillion', 'one [[Orders_of_magnitude_(numbers)#1012|quadrillion]] one trillion one [[Orders_of_magnitude_(numbers)#109|billion]] one million one thousand'}, | ||
{'5E30', 'five nonillion'}, | {'5E30', 'five nonillion'}, | ||
− | {'-123456789.25 ', 'negative one hundred twenty-three million four hundred fifty-six thousand seven hundred and eighty-nine point two five'}, | + | {'-123456789.25', 'negative one hundred twenty-three million four hundred fifty-six thousand seven hundred and eighty-nine point two five'}, |
} | } | ||
for i, case in ipairs(cases) do | for i, case in ipairs(cases) do |
Revision as of 01:42, 25 February 2013
Documentation for this module may be created at Module:ConvertNumeric/testcases/doc
-- Unit tests for [[Module:ConvertNumeric]]. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_numeral_to_english()
local cases = {
{'0', 'zero'},
{'1', 'one'},
{' 1 ', 'one'}, -- test whitespace around number
{'1 | case=u', 'One'},
{'1 | case=U', 'One'},
{'-1', 'negative one'},
{'-1 | negative=minus', 'minus one'},
{'70', 'seventy'},
{'42', 'forty-two'},
{'123', 'one hundred and twenty-three'},
{'123 | sp=us', 'one hundred twenty-three'},
{'123 | adj=on', 'one-hundred-and-twenty-three'},
{'0.25', 'zero point two five'},
{'.25', 'zero point two five'},
{'0 | ord=on', 'zeroth'},
{'33 | ord=on', 'thirty-third'},
{'40 | ord=on', 'fortieth'},
{'5000000000 | ord=on', 'five billionth'},
{'76 | pl=on', 'seventy-sixes'},
{'1000000000000000000000000000001', 'one nonillion and one'},
{'1.23E3', 'one thousand two hundred and thirty'},
{'123E-4', 'zero point zero one two three'},
{'100010001001001000 | lk=on', 'one [[Orders_of_magnitude_(numbers)#1012|quadrillion]] one [[Orders_of_magnitude_(numbers)#1012|trillion]] one [[Orders_of_magnitude_(numbers)#109|billion]] one million one thousand'},
{'100010001001001000 | lk=billion,quadrillion', 'one [[Orders_of_magnitude_(numbers)#1012|quadrillion]] one trillion one [[Orders_of_magnitude_(numbers)#109|billion]] one million one thousand'},
{'5E30', 'five nonillion'},
{'-123456789.25', 'negative one hundred twenty-three million four hundred fifty-six thousand seven hundred and eighty-nine point two five'},
}
for i, case in ipairs(cases) do
self:preprocess_equals('{{#invoke:ConvertNumeric | numeral_to_english |' .. case[1] .. '}}', case[2])
end
end
return p