Fixed mixup between tests of numberutil and mathutil.
This commit is contained in:
parent
32696bad6a
commit
c8badb363d
@ -5,24 +5,13 @@ dofile("./mods/utils/test.lua")
|
|||||||
-- Load the file for testing.
|
-- Load the file for testing.
|
||||||
dofile("./mods/utils/list.lua")
|
dofile("./mods/utils/list.lua")
|
||||||
dofile("./mods/utils/mathutil.lua")
|
dofile("./mods/utils/mathutil.lua")
|
||||||
dofile("./mods/utils/numberutil.lua")
|
|
||||||
dofile("./mods/utils/tableutil.lua")
|
dofile("./mods/utils/tableutil.lua")
|
||||||
|
|
||||||
|
|
||||||
test.start("numberutil")
|
test.start("mathutil")
|
||||||
|
|
||||||
|
|
||||||
test.run("cantor_pairing", function()
|
test.run("cantor_pairing", function()
|
||||||
test.equals(3192, mathutil.cantor_pairing(47, 32))
|
test.equals(3192, mathutil.cantor_pairing(47, 32))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
test.run("format", function()
|
|
||||||
test.equals("12", numberutil.format(12))
|
|
||||||
test.equals("12.74632", numberutil.format(12.74632))
|
|
||||||
test.equals("12,121,212.74", numberutil.format(12121212.74))
|
|
||||||
test.equals("-12,121,212.74", numberutil.format(-12121212.74))
|
|
||||||
|
|
||||||
test.equals("1#123#456#789$588", numberutil.format(1123456789.58823347239, 3, "$", "#"))
|
|
||||||
test.equals("12.00000", numberutil.format(12, 5))
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
24
test/numberutil.lua
Normal file
24
test/numberutil.lua
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
-- Load the test file.
|
||||||
|
dofile("./mods/utils/test.lua")
|
||||||
|
|
||||||
|
-- Load the file for testing.
|
||||||
|
dofile("./mods/utils/list.lua")
|
||||||
|
dofile("./mods/utils/mathutil.lua")
|
||||||
|
dofile("./mods/utils/numberutil.lua")
|
||||||
|
dofile("./mods/utils/tableutil.lua")
|
||||||
|
|
||||||
|
|
||||||
|
test.start("numberutil")
|
||||||
|
|
||||||
|
|
||||||
|
test.run("format", function()
|
||||||
|
test.equals("12", numberutil.format(12))
|
||||||
|
test.equals("12.74632", numberutil.format(12.74632))
|
||||||
|
test.equals("12,121,212.74", numberutil.format(12121212.74))
|
||||||
|
test.equals("-12,121,212.74", numberutil.format(-12121212.74))
|
||||||
|
|
||||||
|
test.equals("1#123#456#789$588", numberutil.format(1123456789.58823347239, 3, "$", "#"))
|
||||||
|
test.equals("12.00000", numberutil.format(12, 5))
|
||||||
|
end)
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user