mirror of https://github.com/swig/swig.git
80 lines
2.8 KiB
Lua
80 lines
2.8 KiB
Lua
local v=require ("default_args")
|
|
|
|
local ec = v.EnumClass()
|
|
assert(ec:blah(), "EnumClass::blah() default arguments don't work")
|
|
|
|
local de = v.DerivedEnumClass()
|
|
de:accelerate()
|
|
de:accelerate(v.EnumClass.SLOW)
|
|
|
|
assert(v.Statics.staticmethod() == 60)
|
|
assert(v.cfunc1(1) == 2)
|
|
assert(v.cfunc2(1) == 3)
|
|
assert(v.cfunc3(1) == 4)
|
|
|
|
local f = v.Foo()
|
|
f:newname()
|
|
f:newname(1)
|
|
f:defaulted1()
|
|
f:defaulted2()
|
|
assert(f:double_if_void_ptr_is_null(2, nil) == 4)
|
|
assert(f:double_if_void_ptr_is_null(3) == 6)
|
|
assert(f:double_if_handle_is_null(4, nil) == 8)
|
|
assert(f:double_if_handle_is_null(5) == 10)
|
|
assert(f:double_if_dbl_ptr_is_null(6, nil) == 12)
|
|
assert(f:double_if_dbl_ptr_is_null(7) == 14)
|
|
|
|
assert(not pcall(function() v.Foo(1) end), "Foo::Foo ignore is not working")
|
|
assert(not pcall(function() v.Foo(1, 2) end), "Foo::Foo ignore is not working")
|
|
assert(not pcall(function() v.Foo(1, 2, 3) end), "Foo::Foo ignore is not working")
|
|
assert(not pcall(function() f.meth(1) end), "Foo::meth ignore is not working")
|
|
assert(not pcall(function() f.meth(1, 2) end), "Foo::meth ignore is not working")
|
|
assert(not pcall(function() f.meth(1, 2, 3) end), "Foo::meth ignore is not working")
|
|
|
|
local Klass_inc = v.Klass.inc
|
|
assert(Klass_inc(100, v.Klass(22)).val == 122, "Klass::inc failed")
|
|
assert(Klass_inc(100).val == 99, "Klass::inc failed")
|
|
assert(Klass_inc().val == 0, "Klass::inc failed")
|
|
|
|
local tricky = v.TrickyInPython()
|
|
assert(tricky:value_m1(10) == -1, "trickyvalue_m1 failed")
|
|
assert(tricky:value_m1(10, 10) == 10, "trickyvalue_m1 failed")
|
|
assert(tricky:value_0xabcdef(10) == 0xabcdef, "trickyvalue_0xabcdef failed")
|
|
assert(tricky:value_0644(10) == 420, "trickyvalue_0644 failed")
|
|
assert(tricky:value_perm(10) == 420, "trickyvalue_perm failed")
|
|
assert(tricky:value_m01(10) == -1, "trickyvalue_m01 failed")
|
|
assert(tricky:booltest2(), "booltest2 failed")
|
|
assert(tricky:max_32bit_int1() == 0x7FFFFFFF, "max_32bit_int1 failed")
|
|
assert(tricky:min_32bit_int1() == -2147483648, "min_32bit_int1 failed")
|
|
assert(tricky:max_32bit_int2() == 0x7FFFFFFF, "max_32bit_int2 failed")
|
|
tricky:too_big_32bit_int1()
|
|
tricky:too_small_32bit_int1()
|
|
tricky:too_big_32bit_int2()
|
|
tricky:too_small_32bit_int2()
|
|
|
|
v.seek()
|
|
v.seek(10)
|
|
|
|
assert(v.booltest(), "booltest failed")
|
|
assert(v.slightly_off_square(10) == 102)
|
|
assert(v.slightly_off_square() == 291)
|
|
assert(v.Q.slightly_off_square_static(10) == 102)
|
|
assert(v.Q.slightly_off_square_static() == 291)
|
|
|
|
local q = v.Q()
|
|
assert(q:slightly_off_square(10) == 102)
|
|
assert(q:slightly_off_square() == 291)
|
|
|
|
local cda = v.CDA()
|
|
assert(v.CDA():cdefaultargs_test1() == 1)
|
|
assert(v.CDA():cdefaultargs_test2() == 1)
|
|
assert(cda:cdefaultargs_test1() == 1)
|
|
assert(cda:cdefaultargs_test2() == 1)
|
|
|
|
assert(v.chartest1() == "x")
|
|
assert(v.chartest2() == "\0")
|
|
assert(v.chartest3() == "\1")
|
|
assert(v.chartest4() == "\n")
|
|
assert(v.chartest5() == "B")
|
|
assert(v.chartest6() == "C")
|