scilab: unsigned ints typemaps behave same as ints (2nd commit: arrays)

This commit is contained in:
Simon Marchetto 2014-06-16 16:25:49 +02:00
commit 8a2472c649
6 changed files with 203 additions and 108 deletions

View file

@ -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);