Sun, 21 Nov 2010 21:36:26 +0000
New (passing) test, arithmetic.lua
tests/pass/arithmetic.lua | file | annotate | diff | comparison | revisions |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/pass/arithmetic.lua Sun Nov 21 21:36:26 2010 +0000 @@ -0,0 +1,21 @@ +local _ = 0; -- To prevent constant folding +assert((_ + 0) + 0 == 0) +assert((_ + 0) + 1 == 1) +assert((_ + 1) + 0 == 1) +assert((_ + 1) + 1 == 2) + +assert((_ + 0) - 0 == 0) +assert((_ + 0) - 1 == -1) +assert((_ + 0) - 0 == 0) +assert((_ + 1) - 1 == 0) + +assert((_ + 0) * 0 == 0) +assert((_ + 0) * 1 == 0) +assert((_ + 1) * 0 == 0) +assert((_ + 1) * 1 == 1) + +assert((0 / 1) == 0) +assert((1 / 1) == 1) +assert((1 / 2) == 0.5) +assert((2 / 1) == 2) +