aboutsummaryrefslogtreecommitdiff
path: root/testes/verybig.lua
diff options
context:
space:
mode:
Diffstat (limited to 'testes/verybig.lua')
-rw-r--r--testes/verybig.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/testes/verybig.lua b/testes/verybig.lua
index 8fb7b13e..250ea795 100644
--- a/testes/verybig.lua
+++ b/testes/verybig.lua
@@ -52,7 +52,7 @@ if _soft then return 10 end
52print "testing large programs (>64k)" 52print "testing large programs (>64k)"
53 53
54-- template to create a very big test file 54-- template to create a very big test file
55prog = [[$ 55local prog = [[$
56 56
57local a,b 57local a,b
58 58
@@ -85,7 +85,7 @@ function b:xxx (a,b) return a+b end
85assert(b:xxx(10, 12) == 22) -- pushself with non-constant index 85assert(b:xxx(10, 12) == 22) -- pushself with non-constant index
86b["xxx"] = undef 86b["xxx"] = undef
87 87
88s = 0; n=0 88local s = 0; local n=0
89for a,b in pairs(b) do s=s+b; n=n+1 end 89for a,b in pairs(b) do s=s+b; n=n+1 end
90-- with 32-bit floats, exact value of 's' depends on summation order 90-- with 32-bit floats, exact value of 's' depends on summation order
91assert(81800000.0 < s and s < 81860000 and n == 70001) 91assert(81800000.0 < s and s < 81860000 and n == 70001)
@@ -93,7 +93,7 @@ assert(81800000.0 < s and s < 81860000 and n == 70001)
93a = nil; b = nil 93a = nil; b = nil
94print'+' 94print'+'
95 95
96function f(x) b=x end 96local function f(x) b=x end
97 97
98a = f{$3$} or 10 98a = f{$3$} or 10
99 99
@@ -118,7 +118,7 @@ local function sig (x)
118 return (x % 2 == 0) and '' or '-' 118 return (x % 2 == 0) and '' or '-'
119end 119end
120 120
121F = { 121local F = {
122function () -- $1$ 122function () -- $1$
123 for i=10,50009 do 123 for i=10,50009 do
124 io.write('a', i, ' = ', sig(i), 5+((i-10)/2), ',\n') 124 io.write('a', i, ' = ', sig(i), 5+((i-10)/2), ',\n')
@@ -138,14 +138,14 @@ function () -- $3$
138end, 138end,
139} 139}
140 140
141file = os.tmpname() 141local file = os.tmpname()
142io.output(file) 142io.output(file)
143for s in string.gmatch(prog, "$([^$]+)") do 143for s in string.gmatch(prog, "$([^$]+)") do
144 local n = tonumber(s) 144 local n = tonumber(s)
145 if not n then io.write(s) else F[n]() end 145 if not n then io.write(s) else F[n]() end
146end 146end
147io.close() 147io.close()
148result = dofile(file) 148local result = dofile(file)
149assert(os.remove(file)) 149assert(os.remove(file))
150print'OK' 150print'OK'
151return result 151return result