aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
authorRoberto I <roberto@inf.puc-rio.br>2025-08-09 15:08:53 -0300
committerRoberto I <roberto@inf.puc-rio.br>2025-08-09 15:08:53 -0300
commit5b179eaf6a78af5f000d76147af94669d04487b2 (patch)
treea3466ed22def25294ff1647d1af91cd4ef7fa567 /testes
parent8fddca81e7d4137512e92f398ca638d61b935dbd (diff)
downloadlua-5b179eaf6a78af5f000d76147af94669d04487b2.tar.gz
lua-5b179eaf6a78af5f000d76147af94669d04487b2.tar.bz2
lua-5b179eaf6a78af5f000d76147af94669d04487b2.zip
Details
Diffstat (limited to 'testes')
-rw-r--r--testes/gengc.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/testes/gengc.lua b/testes/gengc.lua
index ea99bdc4..6509e39d 100644
--- a/testes/gengc.lua
+++ b/testes/gengc.lua
@@ -176,6 +176,20 @@ do print"testing stop-the-world collection"
176 assert(collectgarbage("param", "stepsize") == step) 176 assert(collectgarbage("param", "stepsize") == step)
177end 177end
178 178
179
180if T then -- test GC parameter codification
181 for _, percentage in ipairs{5, 10, 12, 20, 50, 100, 200, 500} do
182 local param = T.codeparam(percentage) -- codify percentage
183 for _, value in ipairs{1, 2, 10, 100, 257, 1023, 6500, 100000} do
184 local exact = value*percentage // 100
185 local aprox = T.applyparam(param, value) -- apply percentage
186 -- difference is at most 10% (+1 compensates difference due to
187 -- rounding to integers)
188 assert(math.abs(aprox - exact) <= exact/10 + 1)
189 end
190 end
191end
192
179collectgarbage(oldmode) 193collectgarbage(oldmode)
180 194
181print('OK') 195print('OK')