Duplicate tests that are run twice as both C and C++ tests to fix parallel make: li_carrays
This commit is contained in:
parent
78b113558f
commit
9600c95234
11 changed files with 320 additions and 1 deletions
29
Examples/test-suite/lua/li_carrays_cpp_runme.lua
Normal file
29
Examples/test-suite/lua/li_carrays_cpp_runme.lua
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
require("import") -- the import fn
|
||||
import("li_carrays_cpp") -- import code
|
||||
lc = li_carrays_cpp
|
||||
|
||||
-- catch "undefined" global variables
|
||||
local env = _ENV -- Lua 5.2
|
||||
if not env then env = getfenv () end -- Lua 5.1
|
||||
setmetatable(env, {__index=function (t,i) error("undefined global variable `"..i.."'",2) end})
|
||||
|
||||
-- Testing for %array_functions(int,intArray)
|
||||
ary = lc.new_intArray(2)
|
||||
lc.intArray_setitem(ary, 0, 0)
|
||||
lc.intArray_setitem(ary, 1, 1)
|
||||
assert(lc.intArray_getitem(ary, 0)==0)
|
||||
assert(lc.intArray_getitem(ary, 1)==1)
|
||||
lc.delete_intArray(ary)
|
||||
|
||||
-- Testing for %array_class(double, doubleArray)
|
||||
d = lc.doubleArray(10)
|
||||
d[0] = 7
|
||||
d[5] = d[0] + 3
|
||||
assert(d[5] + d[0] == 17)
|
||||
--print(d[5] + d[0])
|
||||
|
||||
ptr = d:cast() -- to ptr
|
||||
d2 = lc.doubleArray_frompointer(ptr) -- and back to array
|
||||
assert(d2[5] + d2[0] == 17)
|
||||
--print(d2[5] + d2[0])
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue