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:
parent
2625a29a96
commit
f7d5a8cccc
22 changed files with 273 additions and 125 deletions
|
|
@ -1155,8 +1155,8 @@ SCILAB = @SCILAB@
|
|||
# ----------------------------------------------------------------
|
||||
|
||||
scilab: $(SRCS)
|
||||
$(SWIG) -scilab $(SWIGOPT) $(INTERFACEPATH)
|
||||
if [ -f builder.sce ]; then \
|
||||
@$(SWIG) -scilab $(SWIGOPT) $(INTERFACEPATH)
|
||||
@if [ -f builder.sce ]; then \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -nwni -nb -f builder.sce; \
|
||||
fi
|
||||
|
||||
|
|
@ -1165,8 +1165,8 @@ scilab: $(SRCS)
|
|||
# ----------------------------------------------------------------
|
||||
|
||||
scilab_cpp: $(SRCS)
|
||||
$(SWIG) -scilab -c++ $(SWIGOPT) $(INTERFACEPATH)
|
||||
if [ -f builder.sce ]; then \
|
||||
@$(SWIG) -scilab -c++ $(SWIGOPT) $(INTERFACEPATH)
|
||||
@if [ -f builder.sce ]; then \
|
||||
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -nwni -nb -f builder.sce; \
|
||||
fi
|
||||
|
||||
|
|
@ -1175,7 +1175,7 @@ scilab_cpp: $(SRCS)
|
|||
# -----------------------------------------------------------------
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -15,22 +15,24 @@ include $(srcdir)/../common.mk
|
|||
# none!
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
|
||||
%.cpptest:
|
||||
|
||||
%.ctest:
|
||||
$(setup)
|
||||
cp ../$*.i $*.i
|
||||
if [ -f ../$*.h ]; then (cp ../$*.h $*.h; ) fi;
|
||||
+$(swig_and_compile_c)
|
||||
$(run_testcase)
|
||||
@$(setup)
|
||||
@cp ../$*.i $*.i
|
||||
@if [ -f ../$*.h ]; then (cp ../$*.h $*.h; ) fi;
|
||||
@+$(swig_and_compile_c)
|
||||
@$(run_testcase)
|
||||
|
||||
%.multicpptest:
|
||||
%.multicpptest:
|
||||
|
||||
# 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 "**********************\n* RUNME FILE MISSING *\n**********************") \
|
||||
fi; \
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
exec loader.sce;
|
||||
exec("startswigtest.sce", -1);
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
exec loader.sce;
|
||||
exec("swigtest.start", -1);
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
exec loader.sce;
|
||||
exec("swigtest.start", -1);
|
||||
|
||||
if CHAR_CONSTANT_get() <> 'x' then pause, end
|
||||
if STRING_CONSTANT_get() <> "xyzzy" then pause, end
|
||||
if ESC_CONST_get() <> ascii(1) then pause, end
|
||||
if ia_get() <> ascii('a') then pause, end
|
||||
if ib_get() <> ascii('b') then pause, end
|
||||
if CHAR_CONSTANT_get() <> "x" then swigtesterror(); end
|
||||
if STRING_CONSTANT_get() <> "xyzzy" then swigtesterror(); end
|
||||
if ESC_CONST_get() <> ascii(1) then swigtesterror(); end
|
||||
if ia_get() <> ascii('a') then swigtesterror(); end
|
||||
if ib_get() <> ascii('b') then swigtesterror(); end
|
||||
|
||||
exit
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
bar3(FGHJI_get())
|
||||
bar2(ABCDE_get())
|
||||
bar2(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);
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
exec loader.sce;
|
||||
exec("swigtest.start", -1);
|
||||
|
||||
if add(7, 9) <> 16 then pause, end
|
||||
if do_op(7, 9, funcvar_get()) <> 16 then pause, end
|
||||
if add(7, 9) <> 16 then swigtesterror(); end
|
||||
if do_op(7, 9, funcvar_get()) <> 16 then swigtesterror(); end
|
||||
|
||||
exit
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
exec loader.sce;
|
||||
exec("swigtest.start", -1);
|
||||
|
||||
try
|
||||
a = new_A();
|
||||
catch
|
||||
printf("did not find A\ntherefore, I did not include ""testdir/subdir1/hello.i""\n");
|
||||
swigtesterror();
|
||||
end
|
||||
|
||||
try
|
||||
b = new_B();
|
||||
catch
|
||||
printf("did not find B\ntherefore, I did not include ""testdir/subdir2/hello.i""\n");
|
||||
swigtesterror();
|
||||
end
|
||||
|
||||
if importtest1(5) <> 15 then pause, end
|
||||
if importtest2("black") <> "white" then pause, end
|
||||
|
||||
exit
|
||||
if importtest1(5) <> 15 then swigtesterror(); end
|
||||
if importtest2("black") <> "white" then swigtesterror(); end
|
||||
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
exec loader.sce;
|
||||
exec("swigtest.start", -1);
|
||||
|
||||
x = fmod(M_PI_get(), M_1_PI_get())
|
||||
|
||||
exit
|
||||
try
|
||||
x = fmod(M_PI_get(), M_1_PI_get())
|
||||
catch
|
||||
swigtesterror();
|
||||
end
|
||||
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
@ -1,7 +1,11 @@
|
|||
exec loader.sce;
|
||||
exec("swigtest.start", -1);
|
||||
|
||||
foo_2();
|
||||
if bar_2_get() <> 17 then pause, end
|
||||
if Baz_2_get() <> 47 then pause, end
|
||||
try
|
||||
foo_2();
|
||||
catch
|
||||
swigtesterror();
|
||||
end
|
||||
if bar_2_get() <> 17 then swigtesterror(); end
|
||||
if Baz_2_get() <> 47 then swigtesterror(); end
|
||||
|
||||
exit
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
|||
|
|
@ -1,15 +1,31 @@
|
|||
exec loader.sce;
|
||||
exec("swigtest.start", -1);
|
||||
|
||||
x = makeFoo();
|
||||
if fooCount() <> 1 then pause, end
|
||||
try
|
||||
x = makeFoo();
|
||||
catch
|
||||
swigtesterror();
|
||||
end
|
||||
if fooCount() <> 1 then swigtesterror(); end
|
||||
|
||||
y = makeFoo();
|
||||
if fooCount() <> 2 then pause, end
|
||||
try
|
||||
y = makeFoo();
|
||||
catch
|
||||
swigtesterror();
|
||||
end
|
||||
if fooCount() <> 2 then swigtesterror(); end
|
||||
|
||||
delete_Foo(x);
|
||||
if fooCount() <> 1 then pause, end
|
||||
try
|
||||
delete_Foo(x);
|
||||
catch
|
||||
swigtesterror();
|
||||
end
|
||||
if fooCount() <> 1 then swigtesterror(); end
|
||||
|
||||
delete_Foo(y);
|
||||
if fooCount() <> 0 then pause, end
|
||||
try
|
||||
delete_Foo(y);
|
||||
catch
|
||||
swigtesterror();
|
||||
end
|
||||
if fooCount() <> 0 then swigtesterror(); end
|
||||
|
||||
exit
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
exec loader.sce
|
||||
exec("swigtest.start", -1);
|
||||
|
||||
x = new_Foo();
|
||||
if Foo_test(x) <> 0 then pause, end
|
||||
if Foo_test(x, 1) <> 1 then pause, end
|
||||
if Foo_test(x, 2, 3) <> 5 then pause, end
|
||||
if Foo_test(x, "Hello, swig!") <> 2 then pause, 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
|
||||
|
||||
exit
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
exec loader.sce
|
||||
exec("swigtest.start", -1);
|
||||
|
||||
x = new_Foo();
|
||||
if Foo_test(x, 1) <> 1 then pause, end
|
||||
if Foo_test(x, "Hello swig!") <> 2 then pause, end
|
||||
if Foo_test(x, 2, 3) <> 3 then pause, end
|
||||
if Foo_test(x, x) <> 30 then pause, end
|
||||
if Foo_test(x, x, 4) <> 24 then pause, end
|
||||
if Foo_test(x, x, 4, 5) <> 9 then pause, end
|
||||
try
|
||||
x = new_Foo();
|
||||
catch
|
||||
swigtesterror();
|
||||
end
|
||||
if Foo_test(x, 1) <> 1 then swigtesterror(); 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);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
exec loader.sce;
|
||||
exec("swigtest.start", -1);
|
||||
|
||||
if endif_get() <> 1 then pause, end
|
||||
if define_get() <> 1 then pause, end
|
||||
if defined_get() <> 1 then pause ,end
|
||||
if 2 * one_get() <> two_get() then pause, end
|
||||
|
||||
exit
|
||||
if endif_get() <> 1 then swigtesterror(); end
|
||||
if define_get() <> 1 then swigtesterror(); end
|
||||
if defined_get() <> 1 then swigtesterror(); end
|
||||
if 2 * one_get() <> two_get() then swigtesterror(); end
|
||||
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
|||
13
Examples/test-suite/scilab/ret_by_value_runme.sci
Normal file
13
Examples/test-suite/scilab/ret_by_value_runme.sci
Normal 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);
|
||||
|
|
@ -1,7 +1,12 @@
|
|||
exec loader.sce;
|
||||
exec("swigtest.start", -1);
|
||||
|
||||
initArray();
|
||||
if x_get() <> int32([0,1,2,3,4,5,6,7,8,9]) then pause, end
|
||||
if y_get() <> [0/7,1/7,2/7,3/7,4/7,5/7,6/7] then pause, end
|
||||
try
|
||||
initArray();
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -1,15 +1,31 @@
|
|||
exec loader.sce;
|
||||
exec("swigtest.start", -1);
|
||||
|
||||
x = add(3, 4);
|
||||
if x <> 7 then pause, end
|
||||
try
|
||||
x = add(3, 4);
|
||||
catch
|
||||
swigtesterror();
|
||||
end
|
||||
if x <> 7 then swigtesterror(); end
|
||||
|
||||
y = subtract(3,4);
|
||||
if y <> -1 then pause, end
|
||||
try
|
||||
y = subtract(3,4);
|
||||
catch
|
||||
swigtesterror();
|
||||
end
|
||||
if y <> -1 then swigtesterror(); end
|
||||
|
||||
z = mul(3,4);
|
||||
if z <> 12 then pause, end
|
||||
try
|
||||
z = mul(3,4);
|
||||
catch
|
||||
swigtesterror();
|
||||
end
|
||||
if z <> 12 then swigtesterror(); end
|
||||
|
||||
w = divide(3,4);
|
||||
if w <> 0 then pause, end
|
||||
try
|
||||
w = divide(3,4);
|
||||
catch
|
||||
swigtesterror();
|
||||
end
|
||||
if w <> 0 then swigtesterror(); end
|
||||
|
||||
exit
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
exec loader.sce
|
||||
exec("swigtest.start", -1);
|
||||
|
||||
a = new_Bar();
|
||||
Bar_x_set(a,100);
|
||||
if Bar_x_get(a) <> 100 then pause,end
|
||||
try
|
||||
a = new_Bar();
|
||||
Bar_x_set(a,100);
|
||||
catch
|
||||
swigtesterror();
|
||||
end
|
||||
if Bar_x_get(a) <> 100 then swigtesterror(); end
|
||||
|
||||
exit
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
|||
13
Examples/test-suite/scilab/swigtest.quit
Normal file
13
Examples/test-suite/scilab/swigtest.quit
Normal 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
|
||||
22
Examples/test-suite/scilab/swigtest.start
Normal file
22
Examples/test-suite/scilab/swigtest.start
Normal 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
|
||||
|
|
@ -1,16 +1,29 @@
|
|||
exec loader.sce
|
||||
exec("swigtest.start", -1);
|
||||
|
||||
x = new_LineObj();
|
||||
LineObj_numpoints_set(x, 100);
|
||||
if LineObj_numpoints_get(x) <> 100 then pause, end
|
||||
try
|
||||
x = new_LineObj();
|
||||
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();
|
||||
A_t_a_set(y, 200);
|
||||
if A_t_a_get(y) <> 200 then pause, end
|
||||
A_t_b_set(y, 300);
|
||||
if A_t_b_get(y) <> 300 then pause, end
|
||||
try
|
||||
y = make_a();
|
||||
A_t_a_set(y, 200);
|
||||
catch
|
||||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,23 @@
|
|||
exec loader.sce;
|
||||
exec("swigtest.start", -1);
|
||||
|
||||
small = new_SmallStruct();
|
||||
SmallStruct_jill_set(small, 200);
|
||||
try
|
||||
small = new_SmallStruct();
|
||||
SmallStruct_jill_set(small, 200);
|
||||
|
||||
big = new_BigStruct();
|
||||
BigStruct_jack_set(big, 300);
|
||||
big = new_BigStruct();
|
||||
BigStruct_jack_set(big, 300);
|
||||
|
||||
Jill = SmallStruct_jill_get(small);
|
||||
if Jill <> 200 then pause, end
|
||||
Jill = SmallStruct_jill_get(small);
|
||||
catch
|
||||
swigtesterror();
|
||||
end
|
||||
if Jill <> 200 then swigtesterror(); end
|
||||
|
||||
Jack = BigStruct_jack_get(big);
|
||||
if Jack <> 300 then pause, end
|
||||
try
|
||||
Jack = BigStruct_jack_get(big);
|
||||
catch
|
||||
swigtesterror();
|
||||
end
|
||||
if Jack <> 300 then swigtesterror(); end
|
||||
|
||||
exit
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue