diff options
Diffstat (limited to 'testes')
-rw-r--r-- | testes/sort.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/testes/sort.lua b/testes/sort.lua index 40bb2d8a..45014652 100644 --- a/testes/sort.lua +++ b/testes/sort.lua | |||
@@ -3,6 +3,27 @@ | |||
3 | 3 | ||
4 | print "testing (parts of) table library" | 4 | print "testing (parts of) table library" |
5 | 5 | ||
6 | do print "testing 'table.create'" | ||
7 | collectgarbage() | ||
8 | local m = collectgarbage("count") * 1024 | ||
9 | local t = table.create(10000) | ||
10 | local memdiff = collectgarbage("count") * 1024 - m | ||
11 | assert(memdiff > 10000 * 4) | ||
12 | for i = 1, 20 do | ||
13 | assert(#t == i - 1) | ||
14 | t[i] = 0 | ||
15 | end | ||
16 | assert(not T or T.querytab(t) == 10000) | ||
17 | t = nil | ||
18 | collectgarbage() | ||
19 | m = collectgarbage("count") * 1024 | ||
20 | t = table.create(0, 1024) | ||
21 | memdiff = collectgarbage("count") * 1024 - m | ||
22 | assert(memdiff > 1024 * 12) | ||
23 | assert(not T or select(2, T.querytab(t)) == 1024) | ||
24 | end | ||
25 | |||
26 | |||
6 | print "testing unpack" | 27 | print "testing unpack" |
7 | 28 | ||
8 | local unpack = table.unpack | 29 | local unpack = table.unpack |