scilab: replace test scilab_typemaps by generic test primitive_types
This commit is contained in:
parent
cfc9f1398e
commit
65621c988b
4 changed files with 62 additions and 98 deletions
|
|
@ -11,7 +11,7 @@ top_srcdir = $(abspath @top_srcdir@)
|
|||
top_builddir = $(abspath @top_builddir@)
|
||||
|
||||
CPP_STD_TEST_CASES += \
|
||||
scilab_typemaps \
|
||||
primitive_types \
|
||||
|
||||
TEST_DIR = $*.dir
|
||||
RUNME_SCRIPT = $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)
|
||||
|
|
|
|||
61
Examples/test-suite/scilab/primitive_types_runme.sci
Normal file
61
Examples/test-suite/scilab/primitive_types_runme.sci
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
exec("swigtest.start", -1);
|
||||
|
||||
// Check passing by value
|
||||
if (val_char('a') <> 'a') then swigtesterror(); end
|
||||
if (val_schar(42) <> 42) then swigtesterror(); end
|
||||
if (val_schar(int8(42)) <> 42) then swigtesterror(); end
|
||||
if (val_uchar(uint8(42)) <> uint8(42)) then swigtesterror(); end
|
||||
|
||||
if (val_short(42) <> 42) then swigtesterror(); end
|
||||
if (val_short(int16(42)) <> 42) then swigtesterror(); end
|
||||
if (val_ushort(uint16(42)) <> uint16(42)) then swigtesterror(); end
|
||||
|
||||
if (val_int(42) <> 42) then swigtesterror(); end
|
||||
if (val_int(int32(42)) <> 42) then swigtesterror(); end
|
||||
if (val_uint(uint32(42)) <> uint32(42)) then swigtesterror(); end
|
||||
|
||||
if (val_long(42) <> 42) then swigtesterror(); end
|
||||
if (val_long(int32(42)) <> 42) then swigtesterror(); end
|
||||
if (val_ulong(uint32(42)) <> uint32(42)) then swigtesterror(); end
|
||||
|
||||
//if (val_llong(42) <> 42) then swigtesterror(); end
|
||||
//if (val_llong(int64(42)) <> 42) then swigtesterror(); end
|
||||
//if (val_ullong(uint64(42)) <> uint64(42)) then swigtesterror(); end
|
||||
|
||||
if (val_float(42) <> 42) then swigtesterror(); end
|
||||
if (val_double(42) <> 42) then swigtesterror(); end
|
||||
|
||||
if (val_bool(%t) <> %t) then swigtesterror(); end
|
||||
//if (val_bool(1) <> %t) then swigtesterror(); end
|
||||
|
||||
|
||||
// Check passing by reference
|
||||
if (ref_char('a') <> 'a') then swigtesterror(); end
|
||||
if (ref_schar(42) <> 42) then swigtesterror(); end
|
||||
if (ref_schar(int8(42)) <> 42) then swigtesterror(); end
|
||||
if (ref_uchar(uint8(42)) <> uint8(42)) then swigtesterror(); end
|
||||
|
||||
if (ref_short(42) <> 42) then swigtesterror(); end
|
||||
if (ref_short(int16(42)) <> 42) then swigtesterror(); end
|
||||
if (ref_ushort(uint16(42)) <> uint16(42)) then swigtesterror(); end
|
||||
|
||||
if (ref_int(42) <> 42) then swigtesterror(); end
|
||||
if (ref_int(int32(42)) <> 42) then swigtesterror(); end
|
||||
if (ref_uint(uint32(42)) <> uint32(42)) then swigtesterror(); end
|
||||
|
||||
if (ref_long(42) <> 42) then swigtesterror(); end
|
||||
if (ref_long(int32(42)) <> 42) then swigtesterror(); end
|
||||
if (ref_ulong(uint32(42)) <> uint32(42)) then swigtesterror(); end
|
||||
|
||||
//if (ref_llong(42) <> 42) then swigtesterror(); end
|
||||
//if (ref_llong(int64(42)) <> 42) then swigtesterror(); end
|
||||
//if (ref_ullong(42) <> 42) then swigtesterror(); end
|
||||
//if (ref_ullong(uint64(42)) <> uint64(42)) then swigtesterror(); end
|
||||
|
||||
//if (ref_float(42) <> 42) then swigtesterror(); end
|
||||
//if (ref_double(42) <> 42) then swigtesterror(); end
|
||||
|
||||
if (ref_bool(%t) <> %t) then swigtesterror(); end
|
||||
//if (ref_bool(1) <> %t) then swigtesterror(); end
|
||||
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
exec("swigtest.start", -1);
|
||||
|
||||
// Char
|
||||
if typeof(returnChar()) <> "string" then swigtesterror(); end
|
||||
if returnChar() <> "a" then swigtesterror(); end
|
||||
if typeof(returnSignedChar()) <> "int8" then swigtesterror(); end
|
||||
if returnSignedChar() <> int8(42) then swigtesterror(); end
|
||||
if typeof(returnUnsignedChar()) <> "uint8" then swigtesterror(); end
|
||||
if returnUnsignedChar() <> uint8(42) then swigtesterror(); end
|
||||
|
||||
// Short
|
||||
if typeof(returnShort()) <> "constant" then swigtesterror(); end
|
||||
if returnShort() <> 42 then swigtesterror(); end
|
||||
if typeof(returnUnsignedShort()) <> "uint16" then swigtesterror(); end
|
||||
if returnUnsignedShort() <> uint16(42) then swigtesterror(); end
|
||||
|
||||
// Int
|
||||
if typeof(returnInt()) <> "constant" then swigtesterror(); end
|
||||
if returnInt() <> 42 then swigtesterror(); end
|
||||
if typeof(returnUnsignedInt()) <> "uint32" then swigtesterror(); end
|
||||
if returnUnsignedInt() <> uint32(42) then swigtesterror(); end
|
||||
|
||||
// Long
|
||||
if typeof(returnLong()) <> "constant" then swigtesterror(); end
|
||||
if returnLong() <> 42 then swigtesterror(); end
|
||||
if typeof(returnUnsignedLong()) <> "uint32" then swigtesterror(); end
|
||||
if returnUnsignedLong() <> uint32(42) then swigtesterror(); end
|
||||
|
||||
// Double & float
|
||||
if typeof(returnDouble()) <> "constant" then swigtesterror(); end
|
||||
if returnDouble() <> 42.42 then swigtesterror(); end
|
||||
if typeof(returnFloat()) <> "constant" then swigtesterror(); end
|
||||
if returnFloat() <> 42 then swigtesterror(); end
|
||||
|
||||
|
||||
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
%module scilab_typemaps
|
||||
|
||||
%inline %{
|
||||
// Char
|
||||
char returnChar()
|
||||
{
|
||||
return 'a';
|
||||
}
|
||||
signed char returnSignedChar()
|
||||
{
|
||||
return (signed char)42;
|
||||
}
|
||||
unsigned char returnUnsignedChar()
|
||||
{
|
||||
return (unsigned char) 42;
|
||||
}
|
||||
|
||||
// Short
|
||||
short returnShort()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
unsigned short returnUnsignedShort()
|
||||
{
|
||||
return (unsigned short) 42;
|
||||
}
|
||||
|
||||
// Int
|
||||
int returnInt()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
|
||||
unsigned int returnUnsignedInt()
|
||||
{
|
||||
return (unsigned int) 42;
|
||||
}
|
||||
|
||||
// Long
|
||||
long returnLong()
|
||||
{
|
||||
return (long) 42;
|
||||
}
|
||||
unsigned long returnUnsignedLong()
|
||||
{
|
||||
return (unsigned long) 42;
|
||||
}
|
||||
|
||||
|
||||
// Double & float
|
||||
double returnDouble()
|
||||
{
|
||||
return 42.42;
|
||||
}
|
||||
float returnFloat()
|
||||
{
|
||||
return (float) 42;
|
||||
}
|
||||
%}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue