Improve Scilab test suite with start/quit scripts + remove useless display.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@12266 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Vincent Couvert 2010-10-14 09:15:59 +00:00
commit f7d5a8cccc
22 changed files with 273 additions and 125 deletions

View file

@ -1155,8 +1155,8 @@ SCILAB = @SCILAB@
# ---------------------------------------------------------------- # ----------------------------------------------------------------
scilab: $(SRCS) scilab: $(SRCS)
$(SWIG) -scilab $(SWIGOPT) $(INTERFACEPATH) @$(SWIG) -scilab $(SWIGOPT) $(INTERFACEPATH)
if [ -f builder.sce ]; then \ @if [ -f builder.sce ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -nwni -nb -f builder.sce; \ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -nwni -nb -f builder.sce; \
fi fi
@ -1165,8 +1165,8 @@ scilab: $(SRCS)
# ---------------------------------------------------------------- # ----------------------------------------------------------------
scilab_cpp: $(SRCS) scilab_cpp: $(SRCS)
$(SWIG) -scilab -c++ $(SWIGOPT) $(INTERFACEPATH) @$(SWIG) -scilab -c++ $(SWIGOPT) $(INTERFACEPATH)
if [ -f builder.sce ]; then \ @if [ -f builder.sce ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -nwni -nb -f builder.sce; \ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -nwni -nb -f builder.sce; \
fi fi
@ -1175,7 +1175,7 @@ scilab_cpp: $(SRCS)
# ----------------------------------------------------------------- # -----------------------------------------------------------------
scilab_run: scilab_run:
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -nwni -nb -f runme.sci @env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -nwni -nb -f runme.sci
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# Cleaning the scilab examples # Cleaning the scilab examples

View file

@ -18,11 +18,11 @@ include $(srcdir)/../common.mk
%.cpptest: %.cpptest:
%.ctest: %.ctest:
$(setup) @$(setup)
cp ../$*.i $*.i @cp ../$*.i $*.i
if [ -f ../$*.h ]; then (cp ../$*.h $*.h; ) fi; @if [ -f ../$*.h ]; then (cp ../$*.h $*.h; ) fi;
+$(swig_and_compile_c) @+$(swig_and_compile_c)
$(run_testcase) @$(run_testcase)
%.multicpptest: %.multicpptest:
@ -31,6 +31,8 @@ include $(srcdir)/../common.mk
run_testcase = \ run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \ if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) -nwni -nb -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ; ) \ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) -nwni -nb -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ; ) \
else \
(echo "**********************\n* RUNME FILE MISSING *\n**********************") \
fi; \ fi; \

View file

@ -1,6 +1,6 @@
exec loader.sce; exec("startswigtest.sce", -1);
a = [1, 2, 3, 4] a = [1, 2, 3, 4]
if arr_double(a, 4) <> 10 then pause, end if arr_double(a, 4) <> 10 then swigtesterror(); end
exit exec("quitswigtest.sce", -1);

View file

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

View file

@ -1,9 +1,9 @@
exec loader.sce; exec("swigtest.start", -1);
if CHAR_CONSTANT_get() <> 'x' then pause, end if CHAR_CONSTANT_get() <> "x" then swigtesterror(); end
if STRING_CONSTANT_get() <> "xyzzy" then pause, end if STRING_CONSTANT_get() <> "xyzzy" then swigtesterror(); end
if ESC_CONST_get() <> ascii(1) then pause, end if ESC_CONST_get() <> ascii(1) then swigtesterror(); end
if ia_get() <> ascii('a') then pause, end if ia_get() <> ascii('a') then swigtesterror(); end
if ib_get() <> ascii('b') then pause, end if ib_get() <> ascii('b') then swigtesterror(); end
exit exec("swigtest.quit", -1);

View file

@ -1,9 +1,24 @@
lines(0); exec("swigtest.start", -1);
exec loader.sce try
bar1(CSP_ITERATION_FWD_get())
bar1(CSP_ITERATION_BWD_get())
bar1(int32(1))
bar1(CSP_ITERATION_BWD_get()) bar2(ABCDE_get())
bar2(ABCDE_get()) bar2(FGHJI_get())
bar3(FGHJI_get()) bar2(int32(1))
exit bar3(ABCDE_get())
bar3(FGHJI_get())
bar3(int32(1))
catch
swigtesterror()
end
if enumInstance_get() <> int32(2) then swigtesterror(); end
if Slap_get() <> int32(10) then swigtesterror(); end
if My_get() <> int32(11) then swigtesterror(); end
if Thigh_get() <> int32(12) then swigtesterror(); end
exec("swigtest.quit", -1);

View file

@ -1,6 +1,6 @@
exec loader.sce; exec("swigtest.start", -1);
if add(7, 9) <> 16 then pause, end if add(7, 9) <> 16 then swigtesterror(); end
if do_op(7, 9, funcvar_get()) <> 16 then pause, end if do_op(7, 9, funcvar_get()) <> 16 then swigtesterror(); end
exit exec("swigtest.quit", -1);

View file

@ -1,19 +1,20 @@
exec loader.sce; exec("swigtest.start", -1);
try try
a = new_A(); a = new_A();
catch catch
printf("did not find A\ntherefore, I did not include ""testdir/subdir1/hello.i""\n"); printf("did not find A\ntherefore, I did not include ""testdir/subdir1/hello.i""\n");
swigtesterror();
end end
try try
b = new_B(); b = new_B();
catch catch
printf("did not find B\ntherefore, I did not include ""testdir/subdir2/hello.i""\n"); printf("did not find B\ntherefore, I did not include ""testdir/subdir2/hello.i""\n");
swigtesterror();
end end
if importtest1(5) <> 15 then pause, end if importtest1(5) <> 15 then swigtesterror(); end
if importtest2("black") <> "white" then pause, end if importtest2("black") <> "white" then swigtesterror(); end
exit
exec("swigtest.quit", -1);

View file

@ -1,6 +1,9 @@
exec loader.sce; exec("swigtest.start", -1);
x = fmod(M_PI_get(), M_1_PI_get()) try
x = fmod(M_PI_get(), M_1_PI_get())
exit catch
swigtesterror();
end
exec("swigtest.quit", -1);

View file

@ -1,7 +1,11 @@
exec loader.sce; exec("swigtest.start", -1);
foo_2(); try
if bar_2_get() <> 17 then pause, end foo_2();
if Baz_2_get() <> 47 then pause, end catch
swigtesterror();
end
if bar_2_get() <> 17 then swigtesterror(); end
if Baz_2_get() <> 47 then swigtesterror(); end
exit exec("swigtest.quit", -1);

View file

@ -1,15 +1,31 @@
exec loader.sce; exec("swigtest.start", -1);
x = makeFoo(); try
if fooCount() <> 1 then pause, end x = makeFoo();
catch
swigtesterror();
end
if fooCount() <> 1 then swigtesterror(); end
y = makeFoo(); try
if fooCount() <> 2 then pause, end y = makeFoo();
catch
swigtesterror();
end
if fooCount() <> 2 then swigtesterror(); end
delete_Foo(x); try
if fooCount() <> 1 then pause, end delete_Foo(x);
catch
swigtesterror();
end
if fooCount() <> 1 then swigtesterror(); end
delete_Foo(y); try
if fooCount() <> 0 then pause, end delete_Foo(y);
catch
swigtesterror();
end
if fooCount() <> 0 then swigtesterror(); end
exit exec("swigtest.quit", -1);

View file

@ -1,9 +1,13 @@
exec loader.sce exec("swigtest.start", -1);
x = new_Foo(); try
if Foo_test(x) <> 0 then pause, end x = new_Foo();
if Foo_test(x, 1) <> 1 then pause, end catch
if Foo_test(x, 2, 3) <> 5 then pause, end swigtesterror();
if Foo_test(x, "Hello, swig!") <> 2 then pause, end 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
exit exec("swigtest.quit", -1);

View file

@ -1,11 +1,15 @@
exec loader.sce exec("swigtest.start", -1);
x = new_Foo(); try
if Foo_test(x, 1) <> 1 then pause, end x = new_Foo();
if Foo_test(x, "Hello swig!") <> 2 then pause, end catch
if Foo_test(x, 2, 3) <> 3 then pause, end swigtesterror();
if Foo_test(x, x) <> 30 then pause, end end
if Foo_test(x, x, 4) <> 24 then pause, end if Foo_test(x, 1) <> 1 then swigtesterror(); end
if Foo_test(x, x, 4, 5) <> 9 then pause, end if Foo_test(x, "Hello swig!") <> 2 then swigtesterror(); end
if Foo_test(x, 2, 3) <> 3 then swigtesterror(); end
if Foo_test(x, x) <> 30 then swigtesterror(); end
if Foo_test(x, x, 4) <> 24 then swigtesterror(); end
if Foo_test(x, x, 4, 5) <> 9 then swigtesterror(); end
exit exec("swigtest.quit", -1);

View file

@ -1,8 +1,8 @@
exec loader.sce; exec("swigtest.start", -1);
if endif_get() <> 1 then pause, end if endif_get() <> 1 then swigtesterror(); end
if define_get() <> 1 then pause, end if define_get() <> 1 then swigtesterror(); end
if defined_get() <> 1 then pause ,end if defined_get() <> 1 then swigtesterror(); end
if 2 * one_get() <> two_get() then pause, end if 2 * one_get() <> two_get() then swigtesterror(); end
exit exec("swigtest.quit", -1);

View file

@ -0,0 +1,13 @@
exec("swigtest.start", -1);
try
a = get_test();
catch
swigtesterror();
end
if test_myInt_get(a) <> 100 then swigtesterror(); end
if test_myShort_get(a) != 200 then swigtesterror(); end
exec("swigtest.quit", -1);

View file

@ -1,7 +1,12 @@
exec loader.sce; exec("swigtest.start", -1);
initArray(); try
if x_get() <> int32([0,1,2,3,4,5,6,7,8,9]) then pause, end initArray();
if y_get() <> [0/7,1/7,2/7,3/7,4/7,5/7,6/7] then pause, end catch
swigtesterror();
end
exit if x_get() <> int32([0,1,2,3,4,5,6,7,8,9]) then swigtesterror(); end
if y_get() <> [0/7,1/7,2/7,3/7,4/7,5/7,6/7] then swigtesterror(); end
exec("swigtest.quit", -1);

View file

@ -1,15 +1,31 @@
exec loader.sce; exec("swigtest.start", -1);
x = add(3, 4); try
if x <> 7 then pause, end x = add(3, 4);
catch
swigtesterror();
end
if x <> 7 then swigtesterror(); end
y = subtract(3,4); try
if y <> -1 then pause, end y = subtract(3,4);
catch
swigtesterror();
end
if y <> -1 then swigtesterror(); end
z = mul(3,4); try
if z <> 12 then pause, end z = mul(3,4);
catch
swigtesterror();
end
if z <> 12 then swigtesterror(); end
w = divide(3,4); try
if w <> 0 then pause, end w = divide(3,4);
catch
swigtesterror();
end
if w <> 0 then swigtesterror(); end
exit exec("swigtest.quit", -1);

View file

@ -1,7 +1,11 @@
exec loader.sce exec("swigtest.start", -1);
a = new_Bar(); try
Bar_x_set(a,100); a = new_Bar();
if Bar_x_get(a) <> 100 then pause,end Bar_x_set(a,100);
catch
swigtesterror();
end
if Bar_x_get(a) <> 100 then swigtesterror(); end
exit exec("swigtest.quit", -1);

View file

@ -0,0 +1,13 @@
// Clean files
exec("cleaner.sce", -1);
mdelete("builder.sce");
mdelete("cleaner.sce");
mdelete(swigtestname + "_wrap.c");
mdelete(swigtestname + ".i");
//mprintf("******************\n")
//mprintf("* TEST SUCCEEDED *\n")
//mprintf("******************\n")
// Exit from Scilab
exit

View file

@ -0,0 +1,22 @@
lines(0);
// Get test name (used in swigtest.quit file)
[units, typ, names] = file(1);
swigtestname = strsubst(fileparts(names, "fname"), "_runme", "");
// Load library
try
exec("loader.sce", -1);
catch
mprintf("***************************\n")
mprintf("* LOADER EXECUTION FAILED *\n");
mprintf("***************************\n")
end
// Error management function
function swigtesterror()
mprintf("***************\n")
mprintf("* TEST FAILED *\n")
mprintf("***************\n")
exit
endfunction

View file

@ -1,16 +1,29 @@
exec loader.sce exec("swigtest.start", -1);
x = new_LineObj(); try
LineObj_numpoints_set(x, 100); x = new_LineObj();
if LineObj_numpoints_get(x) <> 100 then pause, end LineObj_numpoints_set(x, 100);
catch
swigtesterror();
end
if LineObj_numpoints_get(x) <> 100 then swigtesterror(); end
if MS_NOOVERRIDE_get() <> -1111 then pause, end if MS_NOOVERRIDE_get() <> -1111 then swigtesterror(); end
y = make_a(); try
A_t_a_set(y, 200); y = make_a();
if A_t_a_get(y) <> 200 then pause, end A_t_a_set(y, 200);
A_t_b_set(y, 300); catch
if A_t_b_get(y) <> 300 then pause, end swigtesterror();
end
if A_t_a_get(y) <> 200 then swigtesterror(); end
exit try
A_t_b_set(y, 300);
catch
swigtesterror();
end
if A_t_b_get(y) <> 300 then swigtesterror(); end
exec("swigtest.quit", -1);

View file

@ -1,15 +1,23 @@
exec loader.sce; exec("swigtest.start", -1);
small = new_SmallStruct(); try
SmallStruct_jill_set(small, 200); small = new_SmallStruct();
SmallStruct_jill_set(small, 200);
big = new_BigStruct(); big = new_BigStruct();
BigStruct_jack_set(big, 300); BigStruct_jack_set(big, 300);
Jill = SmallStruct_jill_get(small); Jill = SmallStruct_jill_get(small);
if Jill <> 200 then pause, end catch
swigtesterror();
end
if Jill <> 200 then swigtesterror(); end
Jack = BigStruct_jack_get(big); try
if Jack <> 300 then pause, end Jack = BigStruct_jack_get(big);
catch
swigtesterror();
end
if Jack <> 300 then swigtesterror(); end
exit exec("swigtest.quit", -1);