summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLua Team <team@lua.org>2010-01-08 12:00:00 +0000
committerrepogen <>2010-01-08 12:00:00 +0000
commit22912c77c80f8de8f7accd3319c726f7c5349fd3 (patch)
treecaf064ecca31cd2ef1c919c585ee6b3d5e6d25d6 /test
parent300cd56eb905be061aa75bb665549b3b85109bbe (diff)
downloadlua-github-5.2.0-work1.tar.gz
Lua 5.2.0-work15.2.0-work1
Diffstat (limited to 'test')
-rw-r--r--test/ALL.lua26
-rw-r--r--test/sieve.lua2
-rw-r--r--test/xd.lua7
3 files changed, 31 insertions, 4 deletions
diff --git a/test/ALL.lua b/test/ALL.lua
new file mode 100644
index 00000000..0045fc36
--- /dev/null
+++ b/test/ALL.lua
@@ -0,0 +1,26 @@
+function run(x)
+ print("\n-------------------------------------------------------------")
+ print(x)
+ os.execute("../src/lua "..x)
+ print("DONE",x)
+end
+
+run"bisect.lua"
+run"cf.lua"
+run"echo.lua jan feb mar apr may jun jul aug sep oct nov dec"
+run"env.lua"
+run"factorial.lua"
+run"fib.lua"
+run"fibfor.lua"
+--run"globals.lua"
+run"hello.lua"
+run"luac.lua"
+run"printf.lua"
+run"readonly.lua"
+run"sieve.lua"
+run"sort.lua"
+run"table.lua"
+run"trace-calls.lua"
+run"trace-globals.lua"
+run"xd.lua < hello.lua"
+run"life.lua"
diff --git a/test/sieve.lua b/test/sieve.lua
index 0871bb21..e27c1a20 100644
--- a/test/sieve.lua
+++ b/test/sieve.lua
@@ -14,7 +14,7 @@ function filter (p, g)
while 1 do
local n = g()
if n == nil then return end
- if math.mod(n, p) ~= 0 then coroutine.yield(n) end
+ if n % p ~= 0 then coroutine.yield(n) end
end
end)
end
diff --git a/test/xd.lua b/test/xd.lua
index ebc3effc..8b420394 100644
--- a/test/xd.lua
+++ b/test/xd.lua
@@ -1,14 +1,15 @@
-- hex dump
-- usage: lua xd.lua < file
+local N=16
local offset=0
while true do
- local s=io.read(16)
+ local s=io.read(N)
if s==nil then return end
io.write(string.format("%08X ",offset))
string.gsub(s,"(.)",
function (c) io.write(string.format("%02X ",string.byte(c))) end)
- io.write(string.rep(" ",3*(16-string.len(s))))
+ io.write(string.rep(" ",3*(N-string.len(s))))
io.write(" ",string.gsub(s,"%c","."),"\n")
- offset=offset+16
+ offset=offset+N
end