diff options
| author | Roberto I <roberto@inf.puc-rio.br> | 2025-08-09 15:08:53 -0300 |
|---|---|---|
| committer | Roberto I <roberto@inf.puc-rio.br> | 2025-08-09 15:08:53 -0300 |
| commit | 5b179eaf6a78af5f000d76147af94669d04487b2 (patch) | |
| tree | a3466ed22def25294ff1647d1af91cd4ef7fa567 /testes | |
| parent | 8fddca81e7d4137512e92f398ca638d61b935dbd (diff) | |
| download | lua-5b179eaf6a78af5f000d76147af94669d04487b2.tar.gz lua-5b179eaf6a78af5f000d76147af94669d04487b2.tar.bz2 lua-5b179eaf6a78af5f000d76147af94669d04487b2.zip | |
Details
Diffstat (limited to 'testes')
| -rw-r--r-- | testes/gengc.lua | 14 |
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) |
| 177 | end | 177 | end |
| 178 | 178 | ||
| 179 | |||
| 180 | if 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 | ||
| 191 | end | ||
| 192 | |||
| 179 | collectgarbage(oldmode) | 193 | collectgarbage(oldmode) |
| 180 | 194 | ||
| 181 | print('OK') | 195 | print('OK') |
