aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
Diffstat (limited to 'testes')
-rw-r--r--testes/math.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/testes/math.lua b/testes/math.lua
index 66998460..e5c9d8ec 100644
--- a/testes/math.lua
+++ b/testes/math.lua
@@ -1,4 +1,4 @@
1-- $Id: math.lua,v 1.86 2018/05/09 14:55:52 roberto Exp $ 1-- $Id: math.lua,v 1.86 2018/05/09 14:55:52 roberto Exp roberto $
2-- See Copyright Notice in file all.lua 2-- See Copyright Notice in file all.lua
3 3
4print("testing numbers and math lib") 4print("testing numbers and math lib")
@@ -139,6 +139,17 @@ assert(-1 // 0.0 == -1/0)
139assert(eqT(3.5 // 1.5, 2.0)) 139assert(eqT(3.5 // 1.5, 2.0))
140assert(eqT(3.5 // -1.5, -3.0)) 140assert(eqT(3.5 // -1.5, -3.0))
141 141
142do -- tests for different kinds of opcodes
143 local x, y
144 x = 1; assert(x // 0.0 == 1/0)
145 x = 1.0; assert(x // 0 == 1/0)
146 x = 3.5; assert(eqT(x // 1, 3.0))
147 assert(eqT(x // -1, -4.0))
148
149 x = 3.5; y = 1.5; assert(eqT(x // y, 2.0))
150 x = 3.5; y = -1.5; assert(eqT(x // y, -3.0))
151end
152
142assert(maxint // maxint == 1) 153assert(maxint // maxint == 1)
143assert(maxint // 1 == maxint) 154assert(maxint // 1 == maxint)
144assert((maxint - 1) // maxint == 0) 155assert((maxint - 1) // maxint == 0)