lua-users home
lua-l archive

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


We're looking at Roberto's struct library. When running it on the Mac,
it fails an assertion on line 170:


```lua

a, b, c, d = lib.unpack(">lBxxH", lib.pack(">lBxxH", -20, 10, 250))
assert(a == -20 and b == 10 and c == 250 and d == 10)
```

So, I changed the assert to:

`assert(a == -20 and b == 10 and c == 250 and d == lib.size(">lBxxH") + 1)`

I'm merely evaluating things now, so I'm not comfortable in my
understanding about how everything works. Here, I assume that the test
made an assumption about data sizes or alignment that wasn't correct
on the Mac.

I think my questions are:

1: Am I correct that struct doesn't seem to be broken and that the
test is to blame, in this case?

2: Is my edit to the test sane, not amounting to checking an error
with something that might actually be buggy code?


Thanks!

-Andrew