mirror of
https://github.com/gvx/bitser.git
synced 2024-11-24 06:54:20 +00:00
either i don't understand luaspec
or i'm losing my mind
This commit is contained in:
parent
772f090413
commit
776b056d69
@ -302,21 +302,25 @@ describe("bitser", function()
|
|||||||
it("can read and write simple cdata", function()
|
it("can read and write simple cdata", function()
|
||||||
test_serdeser(ffi.new('double', 42.5))
|
test_serdeser(ffi.new('double', 42.5))
|
||||||
end)
|
end)
|
||||||
before = function ()
|
it("can read and write cdata with a registered ctype", function()
|
||||||
ffi.cdef[[
|
pcall(ffi.cdef,[[
|
||||||
struct some_struct {
|
struct some_struct {
|
||||||
int a;
|
int a;
|
||||||
double b;
|
double b;
|
||||||
};
|
};
|
||||||
]]
|
]])
|
||||||
end
|
|
||||||
it("can read and write cdata with a registered ctype", function()
|
|
||||||
local value = ffi.new('struct some_struct', 42, 1.25)
|
local value = ffi.new('struct some_struct', 42, 1.25)
|
||||||
bitser.register('struct_type', ffi.typeof(value))
|
bitser.register('struct_type', ffi.typeof(value))
|
||||||
test_serdeser(value)
|
test_serdeser(value)
|
||||||
bitser.unregister('struct_type')
|
bitser.unregister('struct_type')
|
||||||
end)
|
end)
|
||||||
it("can read and write cdata without registering its ctype", function()
|
it("can read and write cdata without registering its ctype", function()
|
||||||
|
pcall(ffi.cdef,[[
|
||||||
|
struct some_struct {
|
||||||
|
int a;
|
||||||
|
double b;
|
||||||
|
};
|
||||||
|
]])
|
||||||
local value = ffi.new('struct some_struct', 42, 1.25)
|
local value = ffi.new('struct some_struct', 42, 1.25)
|
||||||
test_serdeser(value)
|
test_serdeser(value)
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user