* New version for Scilab module using fragments

* A C and CPP tests generate and compile except tests using vectors (to be done)



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@12698 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Vincent Couvert 2011-05-20 08:34:46 +00:00
commit a8b8b6c5d4
41 changed files with 2679 additions and 2557 deletions

View file

@ -9,34 +9,51 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
include $(srcdir)/../common.mk
# Overridden variables here
# none!
# None!
# - constructor_copy (Vectors/C++)
# - dynamic_cast (Vectors/C++)
# - li_boost_shared_ptr_bits (Vectors/C++)
# - member_funcptr_galore (Vectors/C++)
# - member_pointer (Vectors/C++)
# - minherit (Vectors/C++)
# - typemap_variables (weird error/C++)
# - director_string (Vectors/C++)
# - ignore_template_constructor (Vectors/C++)
# - li_std_combinations (std_pair.i/C++)
# - li_std_deque (std_deque.i/C++)
# - li_std_except (This version of std_except.i should not be used/C++)
# - li_std_map (std_pair.i/std_map.i/C++)
# - li_std_pair (std_pair.i/C++)
# - li_std_vector (Vectors/C++)
# - smart_pointer_inherit (Vectors/C++)
# - template_typedef_fnc (Vectors/C++)
# - template_type_namespace (Vectors/C++)
# - template_opaque (Vectors/C++)
include $(srcdir)/../common.mk
# Rules for the different types of tests
%.cpptest:
@$(setup)
+$(swig_and_compile_cpp) > scilab.log
@+$(swig_and_compile_cpp) #> scilab.log
@$(run_testcase)
%.ctest:
@$(setup)
@+$(swig_and_compile_c) > scilab.log
@+$(swig_and_compile_c) #> scilab.log
@$(run_testcase)
%.multicpptest:
@$(setup)
@+$(swig_and_compile_multi_cpp) > scilab.log
@+$(swig_and_compile_multi_cpp) > #scilab.log
@$(run_testcase)
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.sci appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) -nwni -nb -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ; ) \
else \
(echo "*** RUNME FILE NOT FOUND: $(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ***") \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) -nwni -nb -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ; ) \
fi; \

View file

@ -1,16 +1,16 @@
exec("swigtest.start", -1);
if UP_get()<>int32(1) then swigtesterror(); end
if typeof(UP_get())<>"int32" then swigtesterror(); end
if UP_get()<>1 then swigtesterror(); end
if typeof(UP_get())<>"constant" then pause; end
if DOWN_get()<>int32(2) then swigtesterror(); end
if typeof(DOWN_get())<>"int32" then swigtesterror(); end
if DOWN_get()<>2 then swigtesterror(); end
if typeof(DOWN_get())<>"constant" then pause; end
if LEFT_get()<>int32(3) then swigtesterror(); end
if typeof(LEFT_get())<>"int32" then swigtesterror(); end
if LEFT_get()<>3 then swigtesterror(); end
if typeof(LEFT_get())<>"constant" then pause; end
if RIGHT_get()<>int32(4) then swigtesterror(); end
if typeof(RIGHT_get())<>"int32" then swigtesterror(); end
if RIGHT_get()<>4 then swigtesterror(); end
if typeof(RIGHT_get())<>"constant" then pause; end
// TODO: move is a Scilab function...
//result = move(UP_get());

View file

@ -36,7 +36,7 @@ end
if Foo_y_get(foo)<>5 then swigtesterror(); end
try
Foo_f_set(foo, 5);
Foo_f_set(foo, uint32(5));
catch
swigtesterror();
end
@ -50,7 +50,7 @@ end
if Foo_z_get(foo)<>13 then swigtesterror(); end
try
Foo_seq_set(foo, 3);
Foo_seq_set(foo, uint32(3));
catch
swigtesterror();
end

View file

@ -1,6 +1,6 @@
exec("swigtest.start", -1);
smallnum = -127;
smallnum = int8(-127);
if CharValFunction(smallnum) <> smallnum then swigtesterror(); end
if CCharValFunction(smallnum) <> smallnum then swigtesterror(); end
if CCharRefFunction(smallnum) <> smallnum then swigtesterror(); end

View file

@ -1,6 +1,70 @@
exec("swigtest.start", -1);
a = [1, 2, 3, 4]
if arr_double(a, 4) <> 10 then swigtesterror(); end
// 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
// char
a = ["charptr"]
if arr_char(a, 7) <> 756 then swigtesterror(); end
if typeof(arr_char(a, 7)) <> "constant" then swigtesterror(); end
// 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
// 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
// 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
// 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
// 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
// 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
// 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
// unsigned long
a = [1, 2, 3, 4];
if arr_ulong(a, 4) <> 10 then swigtesterror(); end
if typeof(arr_ulong(a, 4)) <> "constant" then swigtesterror(); end
// long long
// No equivalent in Scilab 5
// unsigned long long
// No equivalent in Scilab 5
// 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
// 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
exit
exec("swigtest.quit", -1);

View file

@ -16,5 +16,5 @@ if BeginString_FIX44f_get() <> "FIX.f.f" then swigtesterror(); end
if test_a("hello","hi","chello","chi") <> "hi" then swigtesterror(); end
if test_b("1234567","hi") <> "1234567" then swigtesterror(); end
exit
exec("swigtest.quit", -1);

View file

@ -2,11 +2,11 @@ exec("swigtest.start", -1);
a = [1, 2, 3, 4; 5, 6, 7, 8;]
try
array_d_set(a);
catch
swigtesterror();
end
if array_d_get() <> a then swigtesterror(); end
//try
// array_d_set(a);
//catch
// swigtesterror();
//end
//if array_d_get() <> a then swigtesterror(); end
exec("swigtest.start", -1);
exec("swigtest.quit", -1);

View file

@ -1,5 +0,0 @@
exec("swigtest.start", -1);
// Do nothing
exec("swigtest.quit", -1);

View file

@ -1,13 +1,13 @@
exec("swigtest.start", -1);
try
x = new_Foo();
catch
swigtesterror();
end
if Foo_test(x) <> 0 then swigtesterror(); end
if Foo_test(x, 1) <> 1 then swigtesterror(); end
if Foo_test(x, 2, 3) <> 5 then swigtesterror(); end
if Foo_test(x, "Hello, swig!") <> 2 then swigtesterror(); end
//try
// x = new_Foo();
//catch
// swigtesterror();
//end
//if Foo_test(x) <> 0 then swigtesterror(); end
//if Foo_test(x, 1) <> 1 then swigtesterror(); end
//if Foo_test(x, 2, 3) <> 5 then swigtesterror(); end
//if Foo_test(x, "Hello, swig!") <> 2 then swigtesterror(); end
exec("swigtest.quit", -1);