mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-27 16:49:31 +00:00
Fix LuaJIT compatibility
This commit is contained in:
parent
fef498b3d7
commit
16d0bb8d7a
3 changed files with 33 additions and 13 deletions
17
test/run.lua
17
test/run.lua
|
|
@ -144,7 +144,22 @@ else
|
|||
for _, file in ipairs(files) do
|
||||
local filebase = file:match("^(.*)%.ans$")
|
||||
local namespace = filebase:match("([^/]*)$")
|
||||
math.randomseed(0)
|
||||
-- simple random to get the same result across lua versions
|
||||
local prev = 0
|
||||
local function badrandom(a, b)
|
||||
prev = (42424242424242 * prev + 242) % 2^32
|
||||
return a + prev % (b-a+1)
|
||||
end
|
||||
function math.random(a, b)
|
||||
if not a and not b then
|
||||
return badrandom(0, 999) / 1000
|
||||
elseif not b then
|
||||
return badrandom(1, a)
|
||||
else
|
||||
return badrandom(a, b)
|
||||
end
|
||||
end
|
||||
-- load vm
|
||||
local vm = anselme()
|
||||
vm:setaliases("seen", "checkpoint", "reached")
|
||||
vm:loadfunction {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue