diff options
Diffstat (limited to 'testes/code.lua')
-rw-r--r-- | testes/code.lua | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/testes/code.lua b/testes/code.lua index 57923b14..3b768f33 100644 --- a/testes/code.lua +++ b/testes/code.lua | |||
@@ -8,22 +8,22 @@ end | |||
8 | print "testing code generation and optimizations" | 8 | print "testing code generation and optimizations" |
9 | 9 | ||
10 | -- to test constant propagation | 10 | -- to test constant propagation |
11 | local <const> k0aux = 0 | 11 | local k0aux <const> = 0 |
12 | local <const> k0 = k0aux | 12 | local k0 <const> = k0aux |
13 | local <const> k1 = 1 | 13 | local k1 <const> = 1 |
14 | local <const> k3 = 3 | 14 | local k3 <const> = 3 |
15 | local <const> k6 = k3 + (k3 << k0) | 15 | local k6 <const> = k3 + (k3 << k0) |
16 | local <const> kFF0 = 0xFF0 | 16 | local kFF0 <const> = 0xFF0 |
17 | local <const> k3_78 = 3.78 | 17 | local k3_78 <const> = 3.78 |
18 | local <const> x, <const> k3_78_4 = 10, k3_78 / 4 | 18 | local x, k3_78_4 <const> = 10, k3_78 / 4 |
19 | assert(x == 10) | 19 | assert(x == 10) |
20 | 20 | ||
21 | local <const> kx = "x" | 21 | local kx <const> = "x" |
22 | 22 | ||
23 | local <const> kTrue = true | 23 | local kTrue <const> = true |
24 | local <const> kFalse = false | 24 | local kFalse <const> = false |
25 | 25 | ||
26 | local <const> kNil = nil | 26 | local kNil <const> = nil |
27 | 27 | ||
28 | -- this code gave an error for the code checker | 28 | -- this code gave an error for the code checker |
29 | do | 29 | do |
@@ -105,7 +105,7 @@ end, 'CLOSURE', 'NEWTABLE', 'EXTRAARG', 'GETTABUP', 'CALL', | |||
105 | 105 | ||
106 | -- sequence of LOADNILs | 106 | -- sequence of LOADNILs |
107 | check(function () | 107 | check(function () |
108 | local <const> kNil = nil | 108 | local kNil <const> = nil |
109 | local a,b,c | 109 | local a,b,c |
110 | local d; local e; | 110 | local d; local e; |
111 | local f,g,h; | 111 | local f,g,h; |
@@ -173,7 +173,7 @@ end, | |||
173 | 173 | ||
174 | -- "get/set table" with numeric indices | 174 | -- "get/set table" with numeric indices |
175 | check(function (a) | 175 | check(function (a) |
176 | local <const> k255 = 255 | 176 | local k255 <const> = 255 |
177 | a[1] = a[100] | 177 | a[1] = a[100] |
178 | a[k255] = a[256] | 178 | a[k255] = a[256] |
179 | a[256] = 5 | 179 | a[256] = 5 |
@@ -276,14 +276,14 @@ checkI(function () return ((100 << k6) << -4) >> 2 end, 100) | |||
276 | 276 | ||
277 | -- borders around MAXARG_sBx ((((1 << 17) - 1) >> 1) == 65535) | 277 | -- borders around MAXARG_sBx ((((1 << 17) - 1) >> 1) == 65535) |
278 | local a = 17; local sbx = ((1 << a) - 1) >> 1 -- avoid folding | 278 | local a = 17; local sbx = ((1 << a) - 1) >> 1 -- avoid folding |
279 | local <const> border = 65535 | 279 | local border <const> = 65535 |
280 | checkI(function () return border end, sbx) | 280 | checkI(function () return border end, sbx) |
281 | checkI(function () return -border end, -sbx) | 281 | checkI(function () return -border end, -sbx) |
282 | checkI(function () return border + 1 end, sbx + 1) | 282 | checkI(function () return border + 1 end, sbx + 1) |
283 | checkK(function () return border + 2 end, sbx + 2) | 283 | checkK(function () return border + 2 end, sbx + 2) |
284 | checkK(function () return -(border + 1) end, -(sbx + 1)) | 284 | checkK(function () return -(border + 1) end, -(sbx + 1)) |
285 | 285 | ||
286 | local <const> border = 65535.0 | 286 | local border <const> = 65535.0 |
287 | checkF(function () return border end, sbx + 0.0) | 287 | checkF(function () return border end, sbx + 0.0) |
288 | checkF(function () return -border end, -sbx + 0.0) | 288 | checkF(function () return -border end, -sbx + 0.0) |
289 | checkF(function () return border + 1 end, (sbx + 1.0)) | 289 | checkF(function () return border + 1 end, (sbx + 1.0)) |
@@ -411,9 +411,9 @@ checkequal(function () return 6 and true or nil end, | |||
411 | 411 | ||
412 | 412 | ||
413 | do -- string constants | 413 | do -- string constants |
414 | local <const> k0 = "00000000000000000000000000000000000000000000000000" | 414 | local k0 <const> = "00000000000000000000000000000000000000000000000000" |
415 | local function f1 () | 415 | local function f1 () |
416 | local <const> k = k0 | 416 | local k <const> = k0 |
417 | return function () | 417 | return function () |
418 | return function () return k end | 418 | return function () return k end |
419 | end | 419 | end |