require("li_typemaps")
catch_undef_globs() -- catch "undefined" global variables

-- 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))
assert(not li_typemaps.inr_bool(false))
assert(li_typemaps.out_bool(true))
assert(not li_typemaps.outr_bool(false))
assert(li_typemaps.inout_bool(true))
assert(not li_typemaps.inoutr_bool(false))

-- the others
a,b=li_typemaps.inoutr_int2(1,2)
assert(a==1 and b==2)

f,i,i2=li_typemaps.out_foo(10)
assert(f.a==10 and i==20 and i2==30)
