[lua] bugfix 1938142 (bool& and bool* support)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10527 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
32617f7804
commit
de6d6ccaa8
4 changed files with 67 additions and 2 deletions
40
Examples/test-suite/lua/li_typemaps_runme.lua
Normal file
40
Examples/test-suite/lua/li_typemaps_runme.lua
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
require("import") -- the import fn
|
||||
import("li_typemaps") -- import code
|
||||
|
||||
-- catch "undefined" global variables
|
||||
setmetatable(getfenv(),{__index=function (t,i) error("undefined global variable `"..i.."'",2) end})
|
||||
|
||||
-- Check double INPUT typemaps
|
||||
assert(li_typemaps.in_double(22.22) == 22.22)
|
||||
assert(li_typemaps.inr_double(22.22) == 22.22)
|
||||
|
||||
-- Check double OUTPUT typemaps
|
||||
assert(li_typemaps.out_double(22.22) == 22.22)
|
||||
assert(li_typemaps.outr_double(22.22) == 22.22)
|
||||
|
||||
-- Check double INOUT typemaps
|
||||
assert(li_typemaps.inout_double(22.22) == 22.22)
|
||||
assert(li_typemaps.inoutr_double(22.22) == 22.22)
|
||||
|
||||
-- check long long
|
||||
assert(li_typemaps.in_ulonglong(20)==20)
|
||||
assert(li_typemaps.inr_ulonglong(20)==20)
|
||||
assert(li_typemaps.out_ulonglong(20)==20)
|
||||
assert(li_typemaps.outr_ulonglong(20)==20)
|
||||
assert(li_typemaps.inout_ulonglong(20)==20)
|
||||
assert(li_typemaps.inoutr_ulonglong(20)==20)
|
||||
|
||||
-- check bools
|
||||
assert(li_typemaps.in_bool(true)==true)
|
||||
assert(li_typemaps.inr_bool(false)==false)
|
||||
assert(li_typemaps.out_bool(true)==true)
|
||||
assert(li_typemaps.outr_bool(false)==false)
|
||||
assert(li_typemaps.inout_bool(true)==true)
|
||||
assert(li_typemaps.inoutr_bool(false)==false)
|
||||
|
||||
-- the others
|
||||
a,b=li_typemaps.inoutr_int2(1,2)
|
||||
assert(a==1 and b==2)
|
||||
|
||||
f,i=li_typemaps.out_foo(10)
|
||||
assert(f.a==10 and i==20)
|
||||
Loading…
Add table
Add a link
Reference in a new issue