swig/Examples/test-suite/lua/extend_template_method_runm...

27 lines
1.2 KiB
Lua

local v=require("extend_template_method")
local em = v.ExtendMe()
local ret_double = em:do_stuff_double(1, 1.1)
assert(ret_double == 1.1, "double failed " .. ret_double)
local ret_string = em:do_stuff_string(1, "hello there")
assert(ret_string == "hello there", "string failed " .. ret_string)
ret_double = em:do_overloaded_stuff(1.1)
assert(ret_double == 1.1, "double failed " .. ret_double)
ret_string = em:do_overloaded_stuff("hello there")
assert(ret_string == "hello there", "string failed " .. ret_string)
assert(v.ExtendMe.static_method(123) == 123, "static_method failed")
local em2 = v.ExtendMe(123)
local em = v.TemplateExtend()
ret_double = em:do_template_stuff_double(1, 1.1)
assert(ret_double == 1.1, "double failed " .. ret_double)
ret_string = em:do_template_stuff_string(1, "hello there")
assert(ret_string == "hello there", "string failed " .. ret_string)
ret_double = em:do_template_overloaded_stuff(1.1)
assert(ret_double == 1.1, "double failed " .. ret_double)
ret_string = em:do_template_overloaded_stuff("hello there")
assert(ret_string == "hello there", "string failed " .. ret_string)
assert(v.TemplateExtend.static_template_method(123) == 123, "static_template_method failed")
local em2 = v.TemplateExtend(123)