aseprite/tests/scripts/math.lua
David Capello 7ce9f85b39 [lua] Fix bug comparing integers and floating points (fix #4516)
This bug was introduced in:

  db8284f5fc

We've removed the patch in our updated Lua v5.4.6 branch.
2024-06-03 11:39:16 -03:00

17 lines
506 B
Lua

-- Copyright (C) 2018 David Capello
--
-- This file is released under the terms of the MIT license.
-- Read LICENSE.txt for more information.
assert(100 == math.abs(-100))
assert(100 == math.min(100, 200, 300))
assert(300 == math.max(100, 200, 300))
assert(50 == math.fmod(250, 100))
assert(3141 == math.floor(1000*math.pi))
-- Add tests for integer <-> number comparisons
assert(math.floor(0.5) == 0)
assert(math.floor(0.5) == 0.0)
assert(math.floor(0.5) ~= 0.5)
assert(math.floor(0.5)+0.1-0.1 ~= 0.5)