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

67 lines
5.7 KiB
Lua

local v=require("preproc_constants_c")
assert(type(v.CONST_INT1) == "number", "preproc_constants.CONST_INT1 has unexpected type")
assert(type(v.CONST_INT2) == "number", "preproc_constants.CONST_INT2 has unexpected type")
assert(type(v.CONST_UINT1) == "number", "preproc_constants.CONST_UINT1 has unexpected type")
assert(type(v.CONST_UINT2) == "number", "preproc_constants.CONST_UINT2 has unexpected type")
assert(type(v.CONST_UINT3) == "number", "preproc_constants.CONST_UINT3 has unexpected type")
assert(type(v.CONST_UINT4) == "number", "preproc_constants.CONST_UINT4 has unexpected type")
assert(type(v.CONST_LONG1) == "number", "preproc_constants.CONST_LONG1 has unexpected type")
assert(type(v.CONST_LONG2) == "number", "preproc_constants.CONST_LONG2 has unexpected type")
assert(type(v.CONST_LONG3) == "number", "preproc_constants.CONST_LONG3 has unexpected type")
assert(type(v.CONST_LONG4) == "number", "preproc_constants.CONST_LONG4 has unexpected type")
-- long long is converted to string
assert(type(v.CONST_LLONG1) == "string", "preproc_constants.CONST_LLONG1 has unexpected type")
assert(type(v.CONST_LLONG2) == "string", "preproc_constants.CONST_LLONG2 has unexpected type")
assert(type(v.CONST_LLONG3) == "string", "preproc_constants.CONST_LLONG3 has unexpected type")
assert(type(v.CONST_LLONG4) == "string", "preproc_constants.CONST_LLONG4 has unexpected type")
assert(type(v.CONST_ULLONG1) == "string", "preproc_constants.CONST_ULLONG1 has unexpected type")
assert(type(v.CONST_ULLONG2) == "string", "preproc_constants.CONST_ULLONG2 has unexpected type")
assert(type(v.CONST_ULLONG3) == "string", "preproc_constants.CONST_ULLONG3 has unexpected type")
assert(type(v.CONST_ULLONG4) == "string", "preproc_constants.CONST_ULLONG4 has unexpected type")
assert(type(v.CONST_DOUBLE1) == "number", "preproc_constants.CONST_DOUBLE1 has unexpected type")
assert(type(v.CONST_DOUBLE2) == "number", "preproc_constants.CONST_DOUBLE2 has unexpected type")
assert(type(v.CONST_DOUBLE3) == "number", "preproc_constants.CONST_DOUBLE3 has unexpected type")
assert(type(v.CONST_DOUBLE4) == "number", "preproc_constants.CONST_DOUBLE4 has unexpected type")
assert(type(v.CONST_FLOAT1) == "number", "preproc_constants.CONST_FLOAT1 has unexpected type")
assert(type(v.CONST_FLOAT2) == "number", "preproc_constants.CONST_FLOAT2 has unexpected type")
assert(type(v.CONST_BOOL1) == "number", "preproc_constants.CONST_BOOL1 has unexpected type")
assert(type(v.CONST_BOOL2) == "number", "preproc_constants.CONST_BOOL2 has unexpected type")
assert(type(v.CONST_CHAR) == "string", "preproc_constants.CONST_CHAR has unexpected type")
assert(type(v.CONST_STRING1) == "string", "preproc_constants.CONST_STRING1 has unexpected type")
assert(type(v.CONST_STRING2) == "string", "preproc_constants.CONST_STRING2 has unexpected type")
assert(type(v.CONST_STRING3) == "string", "preproc_constants.CONST_STRING3 has unexpected type")
assert(type(v.CONST_STRING4) == "string", "preproc_constants.CONST_STRING4 has unexpected type")
assert(v.CONST_STRING4, "zer\0zer\0")
assert(type(v.INT_AND_BOOL) == "number", "preproc_constants.INT_AND_BOOL has unexpected type")
assert(type(v.INT_AND_CHAR) == "number", "preproc_constants.INT_AND_CHAR has unexpected type")
assert(type(v.INT_AND_INT) == "number", "preproc_constants.INT_AND_INT has unexpected type")
assert(type(v.INT_AND_UINT) == "number", "preproc_constants.INT_AND_UINT has unexpected type")
assert(type(v.INT_AND_LONG) == "number", "preproc_constants.INT_AND_LONG has unexpected type")
assert(type(v.INT_AND_ULONG) == "number", "preproc_constants.INT_AND_ULONG has unexpected type")
-- long long is converted to string
assert(type(v.INT_AND_LLONG) == "string", "preproc_constants.INT_AND_LLONG has unexpected type")
assert(type(v.INT_AND_ULLONG) == "string", "preproc_constants.INT_AND_ULLONG has unexpected type")
assert(type(v.BOOL_AND_BOOL) == "number", "preproc_constants.BOOL_AND_BOOL has unexpected type")
assert(type(v.EXPR_MULTIPLY) == "number", "preproc_constants.EXPR_MULTIPLY has unexpected type")
assert(type(v.EXPR_DIVIDE) == "number", "preproc_constants.EXPR_DIVIDE has unexpected type")
assert(type(v.EXPR_PLUS) == "number", "preproc_constants.EXPR_PLUS has unexpected type")
assert(type(v.EXPR_MINUS) == "number", "preproc_constants.EXPR_MINUS has unexpected type")
assert(type(v.EXPR_LSHIFT) == "number", "preproc_constants.EXPR_LSHIFT has unexpected type")
assert(type(v.EXPR_RSHIFT) == "number", "preproc_constants.EXPR_RSHIFT has unexpected type")
assert(type(v.EXPR_LT) == "number", "preproc_constants.EXPR_LT has unexpected type")
assert(type(v.EXPR_GT) == "number", "preproc_constants.EXPR_GT has unexpected type")
assert(type(v.EXPR_LTE) == "number", "preproc_constants.EXPR_LTE has unexpected type")
assert(type(v.EXPR_GTE) == "number", "preproc_constants.EXPR_GTE has unexpected type")
assert(type(v.EXPR_INEQUALITY) == "number", "preproc_constants.EXPR_INEQUALITY has unexpected type")
assert(type(v.EXPR_EQUALITY) == "number", "preproc_constants.EXPR_EQUALITY has unexpected type")
assert(type(v.EXPR_AND) == "number", "preproc_constants.EXPR_AND has unexpected type")
assert(type(v.EXPR_XOR) == "number", "preproc_constants.EXPR_XOR has unexpected type")
assert(type(v.EXPR_OR) == "number", "preproc_constants.EXPR_OR has unexpected type")
assert(type(v.EXPR_LAND) == "number", "preproc_constants.EXPR_LAND has unexpected type")
assert(type(v.EXPR_LOR) == "number", "preproc_constants.EXPR_LOR has unexpected type")
assert(type(v.EXPR_CONDITIONAL) == "number", "preproc_constants.EXPR_CONDITIONAL has unexpected type")
assert(type(v.EXPR_MIXED1) == "number", "preproc_constants.EXPR_MIXED1 has unexpected type")
assert(type(v.EXPR_WCHAR_MAX) == "number", "preproc_constants.EXPR_WCHAR_MAX has unexpected type")
assert(type(v.EXPR_WCHAR_MIN) == "number", "preproc_constants.EXPR_WCHAR_MIN has unexpected type")