mirror of https://github.com/swig/swig.git
34 lines
1.6 KiB
Lua
34 lines
1.6 KiB
Lua
local v=require 'reference_global_vars'
|
|
|
|
-- primitive reference variables
|
|
v.var_bool = v.createref_bool(true)
|
|
assert(v.value_bool(v.var_bool), "test 1")
|
|
v.var_bool = v.createref_bool(false)
|
|
assert(not v.value_bool(v.var_bool), "test 2")
|
|
v.var_char = v.createref_char('w')
|
|
assert(v.value_char(v.var_char) == 'w', "test 3")
|
|
v.var_unsigned_char = v.createref_unsigned_char(10)
|
|
assert(v.value_unsigned_char(v.var_unsigned_char) == 10, "test 4")
|
|
v.var_signed_char = v.createref_signed_char(10)
|
|
assert(v.value_signed_char(v.var_signed_char) == 10, "test 5")
|
|
v.var_short = v.createref_short(10)
|
|
assert(v.value_short(v.var_short) == 10, "test 6")
|
|
v.var_unsigned_short = v.createref_unsigned_short(10)
|
|
assert(v.value_unsigned_short(v.var_unsigned_short) == 10, "test 7")
|
|
v.var_int = v.createref_int(10)
|
|
assert(v.value_int(v.var_int) == 10, "test 8")
|
|
v.var_unsigned_int = v.createref_unsigned_int(10)
|
|
assert(v.value_unsigned_int(v.var_unsigned_int) == 10, "test 9")
|
|
v.var_long = v.createref_long(10)
|
|
assert(v.value_long(v.var_long) == 10, "test 10")
|
|
v.var_unsigned_long = v.createref_unsigned_long(10)
|
|
assert(v.value_unsigned_long(v.var_unsigned_long) == 10, "test 11")
|
|
v.var_long_long = v.createref_long_long(10)
|
|
assert(v.value_long_long(v.var_long_long) == 10, "test 12")
|
|
v.var_unsigned_long_long = v.createref_unsigned_long_long(10)
|
|
assert(v.value_unsigned_long_long(v.var_unsigned_long_long) == 10, "test 13")
|
|
v.var_float = v.createref_float(10.5)
|
|
assert(v.value_float(v.var_float) == 10.5, "test 14")
|
|
v.var_double = v.createref_double(10.5)
|
|
assert(v.value_double(v.var_double) == 10.5, "test 15")
|