scilab: unsigned ints typemaps behave same as ints (2nd commit: arrays)
This commit is contained in:
parent
e324ad1c6c
commit
8a2472c649
6 changed files with 203 additions and 108 deletions
|
|
@ -2,53 +2,43 @@ exec("swigtest.start", -1);
|
|||
|
||||
// bool
|
||||
a = [%T %F %F %T %F %T %T %T];
|
||||
if arr_bool(a, 8) <> 5 then swigtesterror(); end
|
||||
if typeof(arr_bool(a, 8)) <> "constant" then swigtesterror(); end
|
||||
checkequal(arr_bool(a, 8), 5, "arr_bool");
|
||||
|
||||
// char
|
||||
a = ["charptr"]
|
||||
if arr_char(a, 7) <> 756 then swigtesterror(); end
|
||||
if typeof(arr_char(a, 7)) <> "constant" then swigtesterror(); end
|
||||
checkequal(arr_char(a, 7), 756, "arr_char");
|
||||
|
||||
// signed char
|
||||
a = int8([1, 2, 3, 4]);
|
||||
if arr_schar(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_schar(a, 4)) <> "constant" then swigtesterror(); end
|
||||
checkequal(arr_schar(a, 4), 10, "arr_schar");
|
||||
|
||||
// unsigned char
|
||||
a = uint8([1, 2, 3, 4]);
|
||||
if arr_uchar(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_uchar(a, 4)) <> "constant" then swigtesterror(); end
|
||||
checkequal(arr_uchar(a, 4), 10, "arr_uchar");
|
||||
|
||||
// short
|
||||
a = int16([1, 2, 3, 4]);
|
||||
if arr_short(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_short(a, 4)) <> "constant" then swigtesterror(); end
|
||||
checkequal(arr_short(a, 4), 10, "arr_short");
|
||||
|
||||
// unsigned short
|
||||
a = uint16([1, 2, 3, 4]);
|
||||
if arr_ushort(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_ushort(a, 4)) <> "constant" then swigtesterror(); end
|
||||
checkequal(arr_ushort(a, 4), 10, "arr_ushort");
|
||||
|
||||
// int
|
||||
a = int32([1, 2, 3, 4]);
|
||||
if arr_int(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_int(a, 4)) <> "constant" then swigtesterror(); end
|
||||
checkequal(arr_int(a, 4), 10, "arr_int");
|
||||
|
||||
// unsigned int
|
||||
a = uint32([1, 2, 3, 4]);
|
||||
if arr_uint(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_uint(a, 4)) <> "constant" then swigtesterror(); end
|
||||
checkequal(arr_uint(a, 4), 10, "");
|
||||
|
||||
// long
|
||||
a = [1, 2, 3, 4];
|
||||
if arr_long(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_long(a, 4)) <> "constant" then swigtesterror(); end
|
||||
checkequal(arr_long(a, 4), 10, "arr_long");
|
||||
|
||||
// unsigned long
|
||||
a = [1, 2, 3, 4];
|
||||
if arr_ulong(uint32(a), 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_ulong(uint32(a), 4)) <> "constant" then swigtesterror(); end
|
||||
checkequal(arr_ulong(uint32(a), 4), 10, "arr_ulong");
|
||||
|
||||
// long long
|
||||
// No equivalent in Scilab 5
|
||||
|
|
@ -58,12 +48,10 @@ if typeof(arr_ulong(uint32(a), 4)) <> "constant" then swigtesterror(); end
|
|||
|
||||
// float
|
||||
a = [1, 2, 3, 4];
|
||||
if arr_float(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_float(a, 4)) <> "constant" then swigtesterror(); end
|
||||
checkequal(arr_float(a, 4), 10, "arr_float");
|
||||
|
||||
// double
|
||||
a = [1, 2, 3, 4];
|
||||
if arr_double(a, 4) <> 10 then swigtesterror(); end
|
||||
if typeof(arr_double(a, 4)) <> "constant" then swigtesterror(); end
|
||||
checkequal(arr_double(a, 4), 10, "arr_double");
|
||||
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
|||
|
|
@ -19,37 +19,36 @@ um = [10, 20];
|
|||
testArray("array_c", array_c_set, array_c_get, ['ab'], ['ab']);
|
||||
testArray("array_sc", array_sc_set, array_sc_get, m, m);
|
||||
testArray("array_sc", array_sc_set, array_sc_get, int8(m), m);
|
||||
testArray("array_uc", array_uc_set, array_uc_get, uint8(um), uint8(um));
|
||||
testArray("array_uc", array_uc_set, array_uc_get, uint8(um), um);
|
||||
testArray("array_s", array_s_set, array_s_get, m, m);
|
||||
testArray("array_s", array_s_set, array_s_get, int16(m), m);
|
||||
testArray("array_us", array_us_set, array_us_get, uint16(um), uint16(um));
|
||||
testArray("array_us", array_us_set, array_us_get, uint16(um), um);
|
||||
testArray("array_i", array_i_set, array_i_get, m, m);
|
||||
testArray("array_i", array_i_set, array_i_get, int32(m), m);
|
||||
testArray("array_ui", array_ui_set, array_ui_get, uint32(um), uint32(um));
|
||||
testArray("array_ui", array_ui_set, array_ui_get, uint32(um), um);
|
||||
testArray("array_l", array_l_set, array_l_get, m, m);
|
||||
testArray("array_l", array_l_set, array_l_get, int32(m), m);
|
||||
testArray("array_ul", array_ul_set, array_ul_get, uint32(um), uint32(um));
|
||||
testArray("array_ul", array_ul_set, array_ul_get, uint32(um), um);
|
||||
testArray("array_f", array_f_set, array_f_get, [-2.5, 2.5], [-2.5, 2.5]);
|
||||
testArray("array_d", array_d_set, array_d_get, [-10.5, 20.4], [-10.5, 20.4]);
|
||||
|
||||
if array_const_i_get() <> [10, 20] then swigtesterror(); end
|
||||
checkequal(array_const_i_get(), [10, 20], "array_const_i_get()");
|
||||
|
||||
ierr = execstr('array_i_set([0:10]', 'errcatch');
|
||||
if ierr == 0 then swigtesterror("Overflow error expected"); end
|
||||
|
||||
if BeginString_FIX44a_get() <> "FIX.a.a" then swigtesterror(); end
|
||||
if BeginString_FIX44b_get() <> "FIX.b.b" then swigtesterror(); end
|
||||
if BeginString_FIX44c_get() <> "FIX.c.c" then swigtesterror(); end
|
||||
if BeginString_FIX44d_get() <> "FIX.d.d" then swigtesterror(); end
|
||||
if BeginString_FIX44d_get() <> "FIX.d.d" then swigtesterror(); end
|
||||
checkequal(BeginString_FIX44a_get(), "FIX.a.a", "BeginString_FIX44a_get()");
|
||||
checkequal(BeginString_FIX44b_get(), "FIX.b.b", "BeginString_FIX44b_get()");
|
||||
checkequal(BeginString_FIX44c_get(), "FIX.c.c", "BeginString_FIX44c_get()");
|
||||
checkequal(BeginString_FIX44d_get(), "FIX.d.d", "BeginString_FIX44d_get()");
|
||||
BeginString_FIX44b_set(strcat(["12","\0","45"]));
|
||||
if BeginString_FIX44b_get() <> "12\045" then swigtesterror(); end
|
||||
if BeginString_FIX44d_get() <> "FIX.d.d" then swigtesterror(); end
|
||||
if BeginString_FIX44e_get() <> "FIX.e.e" then swigtesterror(); end
|
||||
if BeginString_FIX44f_get() <> "FIX.f.f" then swigtesterror(); end
|
||||
checkequal(BeginString_FIX44b_get(), "12\045", "BeginString_FIX44b_get()");
|
||||
checkequal(BeginString_FIX44d_get(), "FIX.d.d", "BeginString_FIX44d_get()");
|
||||
checkequal(BeginString_FIX44e_get(), "FIX.e.e", "BeginString_FIX44e_get()");
|
||||
checkequal(BeginString_FIX44f_get(), "FIX.f.f", "BeginString_FIX44f_get()");
|
||||
|
||||
if test_a("hello","hi","chello","chi") <> "hi" then swigtesterror(); end
|
||||
checkequal(test_a("hello","hi","chello","chi"), "hi", "test_a()");
|
||||
|
||||
checkequal(test_b("1234567","hi"), "1234567", "test_b()");
|
||||
|
||||
if test_b("1234567","hi") <> "1234567" then swigtesterror(); end
|
||||
exit
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue