local nl = ffi.new("size_t [1]")
local nb = ffi.C.rspamd_decode_base32(bs, #bs, nl, how)
- assert_equal(tonumber(nl[0]), l,
- string.format("invalid size reported: %d reported vs %d expected", tonumber(nl[0]), l))
+ local reported_len = tonumber(nl[0]) or 0
+ assert_equal(reported_len, l,
+ string.format("invalid size reported: %s reported vs %s expected", tostring(reported_len), tostring(l)))
local cmp = ffi.C.memcmp(b, nb, l)
ffi.C.g_free(ben)
ffi.C.g_free(nb)
assert_not_nil(expr, "Cannot parse " .. c[1] .. '; error: ' .. (err or 'wut??'))
res = expr:process(atoms)
- assert_equal(res, c[2], string.format("Processed expr '%s'{%s} returned '%d', expected: '%d'",
- expr:to_string(), c[1], res, c[2]))
+ assert_equal(res, c[2], string.format("Processed expr '%s'{%s} returned '%s', expected: '%s'",
+ expr:to_string(), c[1], tostring(res), tostring(c[2])))
end)
end
end)
context("Fpconv printf functions", function()
local ok, ffi = pcall(require, "ffi")
+ local is_luajit_ffi = ok
if not ok then
ffi = require("cffi")
end
+
+ -- cffi-lua doesn't support variadic functions properly, skip these tests
+ if not is_luajit_ffi then
+ test("Skipped: cffi-lua does not support variadic functions", function()
+ -- This test suite requires LuaJIT FFI for variadic function support
+ end)
+ return
+ end
local niter_fuzz = 100000
local function small_double()
return math.random()