lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 23/10/2014 13:13, Luiz Henrique de Figueiredo wrote:
> Lua 5.3.0 (beta) is now available for testing at

> A test suite is available at
> All feedback welcome. Thanks.
> --lhf
I've got some issues with the test suite and I'm not sure if they depend
on my side (some assertion failures, one with "permission denied" error
[1]). When I've got some more time I'll report back.

Browsing through the tests' source I found something puzzling (I've not
followed last Lua iteration development, so I may be well missing
something). The problem lies in `tpack.lua` test file [lines 9-21]:

local sizeshort = #pack("h", 0)
local sizeint = #pack("i", 0)
local sizelong = #pack("l", 0)
local sizesize_t = #pack("T", 0)
local sizeLI = #pack("j", 0)
local sizefloat = #pack("f", 0)
local sizedouble = #pack("d", 0)
local sizenumber = #pack("n", 0)
local little = (pack("h", 1) == "\1\0")
local align = #pack("!xXi16")

assert(1 <= sizeshort and sizeshort <= sizeint and sizeint <= sizelong
and  sizefloat <= sizedouble)

The test for endianness seems brittle to me: it assumes that a short is
two bytes long, which is common, but not guaranteed by C standard,
as the following assertion also aknowledge (IIUC).

In particular, if a short is 1 byte pack("h",1) will return "\1" on both
big endian and little endian machines.

Is that a bug in the test suite or just a conscious tradeoff to avoid
more complex testing on exotic platforms?


-- Lorenzo

[1] Lua 5.3.0 beta on Windows 7 (64 bit); compiled with TDM-GCC 4.8.1
(32 bit - yes, not 64 bit).

()  ascii ribbon campaign - against html e-mail
/\   - against proprietary attachments