diff options
author | chai <chaifix@163.com> | 2021-11-08 01:17:11 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-11-08 01:17:11 +0800 |
commit | efce5b6bd5c9d4f8214a71e0f7a7c35751710a4c (patch) | |
tree | 0789475ded5c377667165a3ddb047ca6703bcf33 /ThirdParty/tolua_runtime/luajit-2.1/src/x64/test/unit | |
parent | ed78df90944bbe6b7de7308bda2bf3a7f1bc3de6 (diff) |
+ tolua
+ lpeg
Diffstat (limited to 'ThirdParty/tolua_runtime/luajit-2.1/src/x64/test/unit')
4 files changed, 59 insertions, 0 deletions
diff --git a/ThirdParty/tolua_runtime/luajit-2.1/src/x64/test/unit/ffi/test_abi.lua b/ThirdParty/tolua_runtime/luajit-2.1/src/x64/test/unit/ffi/test_abi.lua new file mode 100644 index 0000000..9fafcf5 --- /dev/null +++ b/ThirdParty/tolua_runtime/luajit-2.1/src/x64/test/unit/ffi/test_abi.lua @@ -0,0 +1,10 @@ +local ffi = require "ffi" + +-- TODO: test "gc64" and "win" parameters +assert((ffi.abi("32bit") or ffi.abi("64bit")) + and ffi.abi("le") + and not ffi.abi("be") + and ffi.abi("fpu") + and not ffi.abi("softfp") + and ffi.abi("hardfp") + and not ffi.abi("eabi")) diff --git a/ThirdParty/tolua_runtime/luajit-2.1/src/x64/test/unit/ffi/test_line_directive.lua b/ThirdParty/tolua_runtime/luajit-2.1/src/x64/test/unit/ffi/test_line_directive.lua new file mode 100644 index 0000000..a8b0403 --- /dev/null +++ b/ThirdParty/tolua_runtime/luajit-2.1/src/x64/test/unit/ffi/test_line_directive.lua @@ -0,0 +1,15 @@ +local x = [=[ +local ffi = require "ffi" + +ffi.cdef [[ + #line 100 + typedef Int xxx +]] +]=] + +local function foo() + loadstring(x)() +end + +local r, e = pcall(foo) +assert(string.find(e, "declaration specifier expected near 'Int' at line 100") ~= nil) diff --git a/ThirdParty/tolua_runtime/luajit-2.1/src/x64/test/unit/ffi/test_pragma_pack_pushpop.lua b/ThirdParty/tolua_runtime/luajit-2.1/src/x64/test/unit/ffi/test_pragma_pack_pushpop.lua new file mode 100644 index 0000000..5f1bdd3 --- /dev/null +++ b/ThirdParty/tolua_runtime/luajit-2.1/src/x64/test/unit/ffi/test_pragma_pack_pushpop.lua @@ -0,0 +1,12 @@ +local ffi = require "ffi" + +ffi.cdef[[ +#pragma pack(push, 1) +typedef struct { + char x; + double y; +} foo; +#pragma pack(pop) +]] + +assert(ffi.sizeof("foo") == 9) diff --git a/ThirdParty/tolua_runtime/luajit-2.1/src/x64/test/unit/ffi/test_var_attribute.lua b/ThirdParty/tolua_runtime/luajit-2.1/src/x64/test/unit/ffi/test_var_attribute.lua new file mode 100644 index 0000000..11252bb --- /dev/null +++ b/ThirdParty/tolua_runtime/luajit-2.1/src/x64/test/unit/ffi/test_var_attribute.lua @@ -0,0 +1,22 @@ +local ffi = require "ffi" + +ffi.cdef[[ +typedef struct { int a; char b; } __attribute__((packed)) myty1; +typedef struct { int a; char b; } __attribute__((__packed__)) myty1_a; + +typedef struct { int a; char b; } __attribute__((aligned(16))) myty2_a; +typedef struct { int a; char b; } __attribute__((__aligned__(16))) myty2; + +typedef int __attribute__ ((vector_size (32))) myty3; +typedef int __attribute__ ((__vector_size__ (32))) myty3_a; + +typedef int __attribute__ ((mode(DI))) myty4; +]] + +assert(ffi.sizeof("myty1") == 5 and + ffi.sizeof("myty1_a") == 5 and + ffi.alignof("myty2") == 16 and + ffi.alignof("myty2_a") == 16 and + ffi.sizeof("myty3") == 32 and + ffi.sizeof("myty3_a") == 32 and + ffi.sizeof("myty4") == 8) |