diff options
author | rupak | 2019-09-30 17:10:09 +0530 |
---|---|---|
committer | rupak | 2019-09-30 17:10:09 +0530 |
commit | bf4c25d175c03e090a04ecddf7b914eee0406ed5 (patch) | |
tree | f0abd869ed910bdffd549e7ab127f37c43860ea0 | |
parent | 001e7cad0046525aec259f7f68668cf223157e12 (diff) | |
download | fossee-scilab-octave-toolbox-bf4c25d175c03e090a04ecddf7b914eee0406ed5.tar.gz fossee-scilab-octave-toolbox-bf4c25d175c03e090a04ecddf7b914eee0406ed5.tar.bz2 fossee-scilab-octave-toolbox-bf4c25d175c03e090a04ecddf7b914eee0406ed5.zip |
adding CI
-rw-r--r-- | macros/scilab_error.bin | bin | 1951 -> 1951 bytes | |||
-rw-r--r-- | macros/scilab_sum.bin | bin | 913 -> 913 bytes | |||
-rwxr-xr-x | sci_gateway/cpp/libscilab_toolbox.so | bin | 17024 -> 17024 bytes | |||
-rw-r--r-- | sci_gateway/cpp/sci_matrix.cpp | 1 | ||||
-rw-r--r-- | tests/oct-setup.m | 4 | ||||
-rw-r--r-- | tests/test.sce | 264 | ||||
-rw-r--r-- | tests/unit_tests/c_sum.dia.ref | 5 | ||||
-rw-r--r-- | tests/unit_tests/c_sum.tst | 5 | ||||
-rw-r--r-- | tests/unit_tests/fortran_sum.dia.ref | 4 | ||||
-rw-r--r-- | tests/unit_tests/fortran_sum.tst | 4 | ||||
-rw-r--r-- | tests/unit_tests/java_sum.dia.ref | 5 | ||||
-rw-r--r-- | tests/unit_tests/java_sum.tst | 5 | ||||
-rw-r--r-- | tests/unit_tests/scilab_sum.dia.ref | 4 | ||||
-rw-r--r-- | tests/unit_tests/scilab_sum.tst | 4 |
14 files changed, 269 insertions, 36 deletions
diff --git a/macros/scilab_error.bin b/macros/scilab_error.bin Binary files differindex 41c22ca..d05471b 100644 --- a/macros/scilab_error.bin +++ b/macros/scilab_error.bin diff --git a/macros/scilab_sum.bin b/macros/scilab_sum.bin Binary files differindex 925a0fc..b55867c 100644 --- a/macros/scilab_sum.bin +++ b/macros/scilab_sum.bin diff --git a/sci_gateway/cpp/libscilab_toolbox.so b/sci_gateway/cpp/libscilab_toolbox.so Binary files differindex 48ffccd..5d957ed 100755 --- a/sci_gateway/cpp/libscilab_toolbox.so +++ b/sci_gateway/cpp/libscilab_toolbox.so diff --git a/sci_gateway/cpp/sci_matrix.cpp b/sci_gateway/cpp/sci_matrix.cpp index 26fd7dd..7153903 100644 --- a/sci_gateway/cpp/sci_matrix.cpp +++ b/sci_gateway/cpp/sci_matrix.cpp @@ -104,6 +104,7 @@ int sci_octave_fun(scilabEnv env, int nin, scilabVar* in, int nopt, scilabOpt* o //printf("in scilab ouput args are: %d\n", funcall.n_out_arguments); if(status_fun==1) { + Scierror(999, "\nOctave unable to process!\nCorrect usage:\n octave_fun(\"octave_function\",input1,input2,...)\n octave_fun(\"octave_function\",input1,input2,...,optional_input1,optional_input2,...)\n octave_fun(\"octave_function\",\"octave_package\",input1,input2,...)\n octave_fun(\"octave_function\",\"octave_package\",input1,input2,...,optional_input1,optional_input2,...)\n"); return 1; } else if(funcall.n_out_user <= funcall.n_out_arguments) diff --git a/tests/oct-setup.m b/tests/oct-setup.m new file mode 100644 index 0000000..22b1e73 --- /dev/null +++ b/tests/oct-setup.m @@ -0,0 +1,4 @@ +pkg install -forge control +pkg install -forge signal + + diff --git a/tests/test.sce b/tests/test.sce new file mode 100644 index 0000000..e6a4463 --- /dev/null +++ b/tests/test.sce @@ -0,0 +1,264 @@ +test_pass=[] +res=[] + +test1=0 +exec loader.sce +/////////Test case for 2) arburg ////////// + +a = octave_fun("arburg","signal", [1,2,3,4,5],2); +a = round(a*10000)/10000; + +if(a == [1. -1.8639 0.9571]) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("arburg test failed") +end + +/////////Test case for 4) aryule ////////// + +a = octave_fun("aryule","signal", [1,2,3,4,5],2); +a = round(a*10000)/10000; + +if(a == [1. -0.814 0.1193]) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("aryule test failed") +end + +/////////Test case for 38)levinson ////////// + +a = [1 0.1 -0.8]; +v = 0.4; +rand("seed", 0); +w = sqrt(v)*rand(15000,1); +x=octave_fun("filter","signal",1,a,w); + +r=octave_fun("xcorr","signal",x); + +ar=octave_fun("levinson","signal",r,length(a)-1); + +ar = round(ar*10000)/10000; + +if(ar ~= 0) + test_pass=[test_pass,1] + else + test_pass=[test_pass,0] + disp("levinson Test failed") +end + +/////////Test case for **)sigmoid_train ////////// + +s = octave_fun("sigmoid_train",0.1,[1:3],[4]); +s = round(s*10000)/10000 + +if(s == 0.2737) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("sigmoid_train Test failed") +end + +/////////Test case for **)circshift ///////// + + M = [1 2 3 4]; + R = octave_fun("circshift",M,[0 1]); + +if(R == [4 1 2 3]) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("circshift failed") +end + +///////////////////////////////////////////// +/////////Test case for **)kaiser ////////// + +win = octave_fun("kaiser",6,[0.2]) ; +win = round(win*10000)/10000; + +if(win == [ 0.9901; 0.9964; 0.9996; 0.9996; 0.9964; 0.9901 ]) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("kaiser Test failed") +end + +///////////////////////////////////////////// + +///////////////////////////////////////////// + + +/////////Test case for autoreg_matrix ////////// +m = octave_fun("autoreg_matrix",[1 2 3],[2]); + +if(m == [1 0 0; 1 1 0; 1 2 1]) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("autoreg_matrix test failed") +end + +///////////////////////////////////////////// +/////////Test case for arch_rnd ////////// + +a = [1 2 3 4 5]; +b = [7 8 9 10]; +t = 5 ; +rand("seed", 0) +m = octave_fun("arch_rnd",a,b,t); +m = round(m*1000)/1000 + +if(m ~=0 ) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("arch_rnd Test failed") +end + +///////////////////////////////////////////// + +/////////Test case for postpad ////////// + +y = octave_fun("postpad",[1 2 3],6); + +if(y == [1 2 3 0 0 0 ] ) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("postpad Test failed") +end + + +/////////Test case for wconv ////////// +a = [1 2 3 4 5]; +b = [7 8 9 10]; +y = octave_fun("wconv",[1],a,b); + +if(y == [7. 22. 46. 80. 114. 106. 85. 50.]) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("wconv Test failed") +end +/////////Test case for dctmtx ////////// +T = octave_fun("dctmtx",[3]); +T = round(T*10000)/10000; +if(T == [0.5774 0.5774 0.5774; 0.7071 0 -0.7071; 0.4082 -0.8165 0.4082]) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("dctmtx Test failed") +end + +/////////Test case for 40) medfilt1 ////////// + + +fs = 100; +t = 0:1/fs:1; +x = sin(2*%pi*t*3)+0.25*sin(2*%pi*t*40); + +y = octave_fun("medfilt1","signal",x,10); +y = round(y*10000)/10000 ; +y = y' + +if(length(y) ~= 0) + test_pass=[test_pass,1] + else + test_pass=[test_pass,0] + disp("medfilt1 Test failed") +end + +///////////////////////////////////////////// +/////////Test case for arma_rnd ////////// + +a = [1 2 3 4 5]; +b = [7; 8; 9; 10; 11]; +t = 5 ; +v = 10 ; +n = 100 ; +rand("seed", 0) +m = octave_fun("arma_rnd","signal",a, b, v, t, n); +m = round(m) ; + +if(m ~= 0) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("arma_rnd Test failed") +end + +/////////Test case for ncauer ////////// + +[z p g] = octave_fun("ncauer","signal",3, 10, 4); +g = round(g*10000)/10000; + +if(g == 0.32400) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("ncauer Test failed") +end + +/////////Test case for ellipap ////////// + +[z p g] = octave_fun("ellipap","signal",4, 3, 10); +g = round(g*10000)/10000; + +if(g == 0.324) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("ellipap Test failed") +end + +[z p g] = octave_fun("besselap","signal",5); +g = round(g*10000)/10000; +p = round(p*10000)/10000; + +if(g == 1) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("besselap Test failed") +end + +/////////Test case for zp2tf ////////// + +[num, den] = octave_fun("zp2tf","signal",[1 2 3], [4 5 6], 5); +num = round(num*10000)/10000; +den = round(den*10000)/10000; + +if(num == [5 -30 55 -30] & den == [1. -15. 74. -120]) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("zp2tf Test failed") +end + +/////////Test case for tf2zp ////////// + +[z p k] = octave_fun("tf2zp","signal",[1 2 3], [4 5 6]); +k = round(k*10000)/10000; +p = round(p*10000)/10000; +z = round(z*10000)/10000; + +if(k == 0.25) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("tf2zp Test failed") +end +///////////////////////////////////////////// +res=find(test_pass==0) + +if(res~=[]) + disp("One or more tests failed in test1") + disp(length(test_pass),"Total functions tested:") + exit(1) +else +disp(length(test_pass),"Total functions tested:") +disp("ALL OK") +exit() +end diff --git a/tests/unit_tests/c_sum.dia.ref b/tests/unit_tests/c_sum.dia.ref deleted file mode 100644 index 023d2d4..0000000 --- a/tests/unit_tests/c_sum.dia.ref +++ /dev/null @@ -1,5 +0,0 @@ -// This file is released under the 3-clause BSD license. See COPYING-BSD. -//================================= -assert_checkequal(c_sum(3,5), 8); -assert_checkequal(c_sum6(3,5), 8); -//================================= diff --git a/tests/unit_tests/c_sum.tst b/tests/unit_tests/c_sum.tst deleted file mode 100644 index 023d2d4..0000000 --- a/tests/unit_tests/c_sum.tst +++ /dev/null @@ -1,5 +0,0 @@ -// This file is released under the 3-clause BSD license. See COPYING-BSD. -//================================= -assert_checkequal(c_sum(3,5), 8); -assert_checkequal(c_sum6(3,5), 8); -//================================= diff --git a/tests/unit_tests/fortran_sum.dia.ref b/tests/unit_tests/fortran_sum.dia.ref deleted file mode 100644 index d244f1f..0000000 --- a/tests/unit_tests/fortran_sum.dia.ref +++ /dev/null @@ -1,4 +0,0 @@ -// This file is released under the 3-clause BSD license. See COPYING-BSD. -//================================= -assert_checkequal(fortran_sum(3,5), 8); -//================================= diff --git a/tests/unit_tests/fortran_sum.tst b/tests/unit_tests/fortran_sum.tst deleted file mode 100644 index d244f1f..0000000 --- a/tests/unit_tests/fortran_sum.tst +++ /dev/null @@ -1,4 +0,0 @@ -// This file is released under the 3-clause BSD license. See COPYING-BSD. -//================================= -assert_checkequal(fortran_sum(3,5), 8); -//================================= diff --git a/tests/unit_tests/java_sum.dia.ref b/tests/unit_tests/java_sum.dia.ref deleted file mode 100644 index fac83d2..0000000 --- a/tests/unit_tests/java_sum.dia.ref +++ /dev/null @@ -1,5 +0,0 @@ -// This file is released under the 3-clause BSD license. See COPYING-BSD. -//================================= -jimport org.scilab.contrib.toolboxskeleton.Sum; -assert_checkequal(Sum.sum(7.0, 5.0), 12.0); -//================================= diff --git a/tests/unit_tests/java_sum.tst b/tests/unit_tests/java_sum.tst deleted file mode 100644 index fac83d2..0000000 --- a/tests/unit_tests/java_sum.tst +++ /dev/null @@ -1,5 +0,0 @@ -// This file is released under the 3-clause BSD license. See COPYING-BSD. -//================================= -jimport org.scilab.contrib.toolboxskeleton.Sum; -assert_checkequal(Sum.sum(7.0, 5.0), 12.0); -//================================= diff --git a/tests/unit_tests/scilab_sum.dia.ref b/tests/unit_tests/scilab_sum.dia.ref deleted file mode 100644 index 17e7e40..0000000 --- a/tests/unit_tests/scilab_sum.dia.ref +++ /dev/null @@ -1,4 +0,0 @@ -// This file is released under the 3-clause BSD license. See COPYING-BSD. -//================================= -assert_checkequal(scilab_sum(3,5), 8); -//================================= diff --git a/tests/unit_tests/scilab_sum.tst b/tests/unit_tests/scilab_sum.tst deleted file mode 100644 index 17e7e40..0000000 --- a/tests/unit_tests/scilab_sum.tst +++ /dev/null @@ -1,4 +0,0 @@ -// This file is released under the 3-clause BSD license. See COPYING-BSD. -//================================= -assert_checkequal(scilab_sum(3,5), 8); -//================================= |