diff --git a/test/mathutil.lua b/test/mathutil.lua index 84cd8d3..e8e1aa2 100644 --- a/test/mathutil.lua +++ b/test/mathutil.lua @@ -5,24 +5,13 @@ 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.start("mathutil") test.run("cantor_pairing", function() test.equals(3192, mathutil.cantor_pairing(47, 32)) 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) - diff --git a/test/numberutil.lua b/test/numberutil.lua new file mode 100644 index 0000000..fa13dfa --- /dev/null +++ b/test/numberutil.lua @@ -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) +