diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-18 15:31:22 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-18 15:31:22 -0300 |
| commit | 3c1d415bd3fef686b27f853bdf3eaf1f0a9bb0be (patch) | |
| tree | e12a3f99a83e6a298f46f4bdaedebd0755543181 /testes/gc.lua | |
| parent | d36a31e6739bcd39c84f637344227af87cfd0ee5 (diff) | |
| download | lua-3c1d415bd3fef686b27f853bdf3eaf1f0a9bb0be.tar.gz lua-3c1d415bd3fef686b27f853bdf3eaf1f0a9bb0be.tar.bz2 lua-3c1d415bd3fef686b27f853bdf3eaf1f0a9bb0be.zip | |
Details
- Macro 'checkliveness' (for debug) always uses 'L', to avoid warnings.
- Some old 'while' changed to 'for' in 'testes/gc.lua'.
- In 'testes/libs/makefile', do not make files depend on 'ltests.h',
which may not even exist.
Diffstat (limited to 'testes/gc.lua')
| -rw-r--r-- | testes/gc.lua | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/testes/gc.lua b/testes/gc.lua index 6d24e0d8..9ea054c1 100644 --- a/testes/gc.lua +++ b/testes/gc.lua | |||
| @@ -99,35 +99,28 @@ local function GC() GC1(); GC2() end | |||
| 99 | do | 99 | do |
| 100 | print("creating many objects") | 100 | print("creating many objects") |
| 101 | 101 | ||
| 102 | local contCreate = 0 | ||
| 103 | |||
| 104 | local limit = 5000 | 102 | local limit = 5000 |
| 105 | 103 | ||
| 106 | while contCreate <= limit do | 104 | for i = 1, limit do |
| 107 | local a = {}; a = nil | 105 | local a = {}; a = nil |
| 108 | contCreate = contCreate+1 | ||
| 109 | end | 106 | end |
| 110 | 107 | ||
| 111 | local a = "a" | 108 | local a = "a" |
| 112 | 109 | ||
| 113 | contCreate = 0 | 110 | for i = 1, limit do |
| 114 | while contCreate <= limit do | 111 | a = i .. "b"; |
| 115 | a = contCreate .. "b"; | ||
| 116 | a = string.gsub(a, '(%d%d*)', "%1 %1") | 112 | a = string.gsub(a, '(%d%d*)', "%1 %1") |
| 117 | a = "a" | 113 | a = "a" |
| 118 | contCreate = contCreate+1 | ||
| 119 | end | 114 | end |
| 120 | 115 | ||
| 121 | 116 | ||
| 122 | contCreate = 0 | ||
| 123 | 117 | ||
| 124 | a = {} | 118 | a = {} |
| 125 | 119 | ||
| 126 | function a:test () | 120 | function a:test () |
| 127 | while contCreate <= limit do | 121 | for i = 1, limit do |
| 128 | load(string.format("function temp(a) return 'a%d' end", contCreate), "")() | 122 | load(string.format("function temp(a) return 'a%d' end", i), "")() |
| 129 | assert(temp() == string.format('a%d', contCreate)) | 123 | assert(temp() == string.format('a%d', i)) |
| 130 | contCreate = contCreate+1 | ||
| 131 | end | 124 | end |
| 132 | end | 125 | end |
| 133 | 126 | ||
| @@ -166,9 +159,8 @@ print('long strings') | |||
| 166 | x = "01234567890123456789012345678901234567890123456789012345678901234567890123456789" | 159 | x = "01234567890123456789012345678901234567890123456789012345678901234567890123456789" |
| 167 | assert(string.len(x)==80) | 160 | assert(string.len(x)==80) |
| 168 | s = '' | 161 | s = '' |
| 169 | n = 0 | ||
| 170 | k = math.min(300, (math.maxinteger // 80) // 2) | 162 | k = math.min(300, (math.maxinteger // 80) // 2) |
| 171 | while n < k do s = s..x; n=n+1; j=tostring(n) end | 163 | for n = 1, k do s = s..x; j=tostring(n) end |
| 172 | assert(string.len(s) == k*80) | 164 | assert(string.len(s) == k*80) |
| 173 | s = string.sub(s, 1, 10000) | 165 | s = string.sub(s, 1, 10000) |
| 174 | s, i = string.gsub(s, '(%d%d%d%d)', '') | 166 | s, i = string.gsub(s, '(%d%d%d%d)', '') |
