summaryrefslogtreecommitdiff
path: root/modules/intersci/tests
diff options
context:
space:
mode:
authorShashank2017-05-29 12:40:26 +0530
committerShashank2017-05-29 12:40:26 +0530
commit0345245e860375a32c9a437c4a9d9cae807134e9 (patch)
treead51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/intersci/tests
downloadscilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip
CMSCOPE changed
Diffstat (limited to 'modules/intersci/tests')
-rwxr-xr-xmodules/intersci/tests/nonreg_tests/bug7603.desc13
-rwxr-xr-xmodules/intersci/tests/nonreg_tests/bug7603function.c25
-rwxr-xr-xmodules/intersci/tests/nonreg_tests/bug_1957.dia.ref58
-rwxr-xr-xmodules/intersci/tests/nonreg_tests/bug_1957.tst66
-rwxr-xr-xmodules/intersci/tests/nonreg_tests/bug_4625.c25
-rwxr-xr-xmodules/intersci/tests/nonreg_tests/bug_4625.desc13
-rwxr-xr-xmodules/intersci/tests/nonreg_tests/bug_4625.dia.ref23
-rwxr-xr-xmodules/intersci/tests/nonreg_tests/bug_4625.tst25
-rwxr-xr-xmodules/intersci/tests/nonreg_tests/bug_7599.c25
-rwxr-xr-xmodules/intersci/tests/nonreg_tests/bug_7599.desc13
-rwxr-xr-xmodules/intersci/tests/nonreg_tests/bug_7599.dia.ref26
-rwxr-xr-xmodules/intersci/tests/nonreg_tests/bug_7599.tst27
-rwxr-xr-xmodules/intersci/tests/nonreg_tests/bug_7603.dia.ref32
-rwxr-xr-xmodules/intersci/tests/nonreg_tests/bug_7603.tst39
14 files changed, 410 insertions, 0 deletions
diff --git a/modules/intersci/tests/nonreg_tests/bug7603.desc b/modules/intersci/tests/nonreg_tests/bug7603.desc
new file mode 100755
index 000000000..5768a554b
--- /dev/null
+++ b/modules/intersci/tests/nonreg_tests/bug7603.desc
@@ -0,0 +1,13 @@
+ext1c a b
+a vector m
+b vector m
+c vector m
+
+ext1c m a b c
+m integer
+a double
+b double
+c double
+
+out sequence c
+***********************
diff --git a/modules/intersci/tests/nonreg_tests/bug7603function.c b/modules/intersci/tests/nonreg_tests/bug7603function.c
new file mode 100755
index 000000000..8be855195
--- /dev/null
+++ b/modules/intersci/tests/nonreg_tests/bug7603function.c
@@ -0,0 +1,25 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2010 - DIGITEO - Allan CORNET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+
+
+#include "machine.h"
+
+int F2C(ext1c)(int *n, double *a, double *b, double *c)
+{
+ int k = 0;
+ for (k = 0; k < *n; ++k)
+ {
+ c[k] = a[k] + b[k];
+ }
+ return(0);
+}
+
diff --git a/modules/intersci/tests/nonreg_tests/bug_1957.dia.ref b/modules/intersci/tests/nonreg_tests/bug_1957.dia.ref
new file mode 100755
index 000000000..1bcbedc13
--- /dev/null
+++ b/modules/intersci/tests/nonreg_tests/bug_1957.dia.ref
@@ -0,0 +1,58 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2006-2008 - INRIA - Serge STEER <serge.steer@inria.fr>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- Non-regression test for bug 1957 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=1957
+//
+// <-- Short Description -->
+// Non fonctionnement de intersci pour les variables optionnelles (au
+// moins scalaires)
+tab = ascii(9);
+path = TMPDIR;
+ilib_verbose(0);
+desc=['foo'+tab+'x'+tab+'y'+tab+'[ITMAX 2000]'+tab+'[eps 0.001]'
+ 'x'+tab+'scalar'
+ 'y'+tab+'scalar'
+ 'ITMAX'+tab+'scalar'
+ 'eps '+tab+'scalar'
+ 'r'+tab+'vector 4'
+ ''
+ 'foo'+tab+'x'+tab+'y'+tab+' ITMAX'+tab+'eps'+tab+'r'
+ 'x'+tab+'double'
+ 'y'+tab+'double'
+ 'ITMAX'+tab+'integer'
+ 'eps'+tab+'double'
+ 'r'+tab+'double'
+ ''
+ 'out sequence'+tab+'r'
+ '*******************'];
+mputl(desc,path+'/intsfoo.desc')
+ ans =
+
+ T
+foo_code=['#include ""stack-c.h""'
+ 'void C2F(foo)(double *x,double *y,int *ITMAX,double *eps,double *r)'
+ ' {'
+ ' r[0]=*x; r[1]=*y; r[2]=*ITMAX; r[3]=*eps;'
+ ' }'];
+mputl(foo_code,path+'/foo.c');
+intersci=getshortpathname(SCI+'/modules/intersci/bin/intersci-n');
+curpath=pwd();
+chdir(path);
+try
+ unix_s(intersci+' intsfoo');
+ ilib_build('buglib',['bug1957','intsfoo'],['foo.o','intsfoo.o'],[])
+ exec loader.sce;
+catch
+ if %T then bugmes();quit;end
+ return
+end
+chdir(curpath);
+res=bug1957(1.2,-2.3);
+VAL = 2000;
+if norm(res-[1.2,-2.3,VAL,0.001]) >= 2d-1 then bugmes();quit;end
diff --git a/modules/intersci/tests/nonreg_tests/bug_1957.tst b/modules/intersci/tests/nonreg_tests/bug_1957.tst
new file mode 100755
index 000000000..fa6a53aea
--- /dev/null
+++ b/modules/intersci/tests/nonreg_tests/bug_1957.tst
@@ -0,0 +1,66 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2006-2008 - INRIA - Serge STEER <serge.steer@inria.fr>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- NOT FIXED -->
+// <-- Non-regression test for bug 1957 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=1957
+//
+// <-- Short Description -->
+// Non fonctionnement de intersci pour les variables optionnelles (au
+// moins scalaires)
+
+tab = ascii(9);
+path = TMPDIR;
+ilib_verbose(0);
+
+desc=['foo'+tab+'x'+tab+'y'+tab+'[ITMAX 2000]'+tab+'[eps 0.001]'
+ 'x'+tab+'scalar'
+ 'y'+tab+'scalar'
+ 'ITMAX'+tab+'scalar'
+ 'eps '+tab+'scalar'
+ 'r'+tab+'vector 4'
+ ''
+ 'foo'+tab+'x'+tab+'y'+tab+' ITMAX'+tab+'eps'+tab+'r'
+ 'x'+tab+'double'
+ 'y'+tab+'double'
+ 'ITMAX'+tab+'integer'
+ 'eps'+tab+'double'
+ 'r'+tab+'double'
+ ''
+ 'out sequence'+tab+'r'
+ '*******************'];
+
+mputl(desc,path+'/intsfoo.desc')
+
+foo_code=['#include ""stack-c.h""'
+ 'void C2F(foo)(double *x,double *y,int *ITMAX,double *eps,double *r)'
+ ' {'
+ ' r[0]=*x; r[1]=*y; r[2]=*ITMAX; r[3]=*eps;'
+ ' }'];
+
+mputl(foo_code,path+'/foo.c');
+
+intersci=getshortpathname(SCI+'/modules/intersci/bin/intersci-n');
+
+curpath=pwd();
+chdir(path);
+
+try
+ unix_s(intersci+' intsfoo');
+ ilib_build('buglib',['bug1957','intsfoo'],['foo.o','intsfoo.o'],[])
+ exec loader.sce;
+catch
+ if %T then pause,end
+ return
+end
+
+chdir(curpath);
+
+res=bug1957(1.2,-2.3);
+VAL = 2000;
+if norm(res-[1.2,-2.3,VAL,0.001]) >= 2d-1 then pause,end
diff --git a/modules/intersci/tests/nonreg_tests/bug_4625.c b/modules/intersci/tests/nonreg_tests/bug_4625.c
new file mode 100755
index 000000000..d5987618b
--- /dev/null
+++ b/modules/intersci/tests/nonreg_tests/bug_4625.c
@@ -0,0 +1,25 @@
+#include "stack-c.h"
+/******************************************
+ * SCILAB function : ext1c, fin = 1
+ ******************************************/
+
+int intsext1c(char *fname)
+{
+ int m1,n1,l1,mn1,m2,n2,l2,mn2,un=1,mn3,l3;
+ CheckRhs(2,2);
+ CheckLhs(1,1);
+ /* checking variable a */
+ GetRhsVar(1,"d",&m1,&n1,&l1);
+ CheckVector(1,m1,n1);
+ mn1=m1*n1;
+ /* checking variable b */
+ GetRhsVar(2,"d",&m2,&n2,&l2);
+ CheckVector(2,m2,n2);
+ mn2=m2*n2;
+ /* cross variable size checking */
+ CheckDimProp(1,2,m1*n1 != m2*n2);
+ CreateVar(3,"d",(un=1,&un),(mn3=mn1,&mn3),&l3);/* named: c */
+ C2F(ext1c)(&mn1,stk(l1),stk(l2),stk(l3));
+ LhsVar(1)= 3;
+ return 0;
+}
diff --git a/modules/intersci/tests/nonreg_tests/bug_4625.desc b/modules/intersci/tests/nonreg_tests/bug_4625.desc
new file mode 100755
index 000000000..5768a554b
--- /dev/null
+++ b/modules/intersci/tests/nonreg_tests/bug_4625.desc
@@ -0,0 +1,13 @@
+ext1c a b
+a vector m
+b vector m
+c vector m
+
+ext1c m a b c
+m integer
+a double
+b double
+c double
+
+out sequence c
+***********************
diff --git a/modules/intersci/tests/nonreg_tests/bug_4625.dia.ref b/modules/intersci/tests/nonreg_tests/bug_4625.dia.ref
new file mode 100755
index 000000000..14ad7e9c3
--- /dev/null
+++ b/modules/intersci/tests/nonreg_tests/bug_4625.dia.ref
@@ -0,0 +1,23 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- Non-regression test for bug 4625 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=4625
+//
+// <-- Short Description -->
+// intersci-n was broken on Windows.
+//
+if getos() == 'Windows' then
+ copyfile(SCI+"/modules/intersci/tests/nonreg_tests/bug_4625.desc", TMPDIR+"/bug_4625.desc");
+ cd(TMPDIR);
+ s = dos(SCI+'/modules/intersci/bin/intersci-n.exe bug_4625');
+ if s <> %t then bugmes();quit;end
+ r = mgetl(TMPDIR + '/bug_4625.c');
+ ref = mgetl(SCI+"/modules/intersci/tests/nonreg_tests/bug_4625.c");
+ if ~and(r == ref) then bugmes();quit;end
+end
diff --git a/modules/intersci/tests/nonreg_tests/bug_4625.tst b/modules/intersci/tests/nonreg_tests/bug_4625.tst
new file mode 100755
index 000000000..07b320827
--- /dev/null
+++ b/modules/intersci/tests/nonreg_tests/bug_4625.tst
@@ -0,0 +1,25 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- Non-regression test for bug 4625 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=4625
+//
+// <-- Short Description -->
+// intersci-n was broken on Windows.
+//
+
+if getos() == 'Windows' then
+ copyfile(SCI+"/modules/intersci/tests/nonreg_tests/bug_4625.desc", TMPDIR+"/bug_4625.desc");
+ cd(TMPDIR);
+ s = dos(SCI+'/modules/intersci/bin/intersci-n.exe bug_4625');
+ if s <> %t then pause, end
+ r = mgetl(TMPDIR + '/bug_4625.c');
+ ref = mgetl(SCI+"/modules/intersci/tests/nonreg_tests/bug_4625.c");
+ if ~and(r == ref) then pause, end
+end
diff --git a/modules/intersci/tests/nonreg_tests/bug_7599.c b/modules/intersci/tests/nonreg_tests/bug_7599.c
new file mode 100755
index 000000000..d5987618b
--- /dev/null
+++ b/modules/intersci/tests/nonreg_tests/bug_7599.c
@@ -0,0 +1,25 @@
+#include "stack-c.h"
+/******************************************
+ * SCILAB function : ext1c, fin = 1
+ ******************************************/
+
+int intsext1c(char *fname)
+{
+ int m1,n1,l1,mn1,m2,n2,l2,mn2,un=1,mn3,l3;
+ CheckRhs(2,2);
+ CheckLhs(1,1);
+ /* checking variable a */
+ GetRhsVar(1,"d",&m1,&n1,&l1);
+ CheckVector(1,m1,n1);
+ mn1=m1*n1;
+ /* checking variable b */
+ GetRhsVar(2,"d",&m2,&n2,&l2);
+ CheckVector(2,m2,n2);
+ mn2=m2*n2;
+ /* cross variable size checking */
+ CheckDimProp(1,2,m1*n1 != m2*n2);
+ CreateVar(3,"d",(un=1,&un),(mn3=mn1,&mn3),&l3);/* named: c */
+ C2F(ext1c)(&mn1,stk(l1),stk(l2),stk(l3));
+ LhsVar(1)= 3;
+ return 0;
+}
diff --git a/modules/intersci/tests/nonreg_tests/bug_7599.desc b/modules/intersci/tests/nonreg_tests/bug_7599.desc
new file mode 100755
index 000000000..9cf0ccfb1
--- /dev/null
+++ b/modules/intersci/tests/nonreg_tests/bug_7599.desc
@@ -0,0 +1,13 @@
+ext1c a b
+a vector m
+b vector m
+c vector m
+
+ext1c m a b c
+m integer
+a double
+b double
+c double
+
+out sequence c
+*********************** \ No newline at end of file
diff --git a/modules/intersci/tests/nonreg_tests/bug_7599.dia.ref b/modules/intersci/tests/nonreg_tests/bug_7599.dia.ref
new file mode 100755
index 000000000..95bf102ae
--- /dev/null
+++ b/modules/intersci/tests/nonreg_tests/bug_7599.dia.ref
@@ -0,0 +1,26 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 7599 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=7599
+//
+// <-- Short Description -->
+// Intersci-n and intersci did not create code from a .desc file if it was not ended by an empty line.
+//
+if getos() == 'Windows' then
+ copyfile(SCI+"/modules/intersci/tests/nonreg_tests/bug_7599.desc", TMPDIR+"/bug_7599.desc");
+ cd(TMPDIR);
+ s = dos(SCI+'/modules/intersci/bin/intersci-n.exe bug_7599');
+ if s <> %t then bugmes();quit;end
+ r = mgetl(TMPDIR + '/bug_7599.c');
+ ref = mgetl(SCI+"/modules/intersci/tests/nonreg_tests/bug_7599.c");
+ if ~and(r == ref) then bugmes();quit;end
+end
diff --git a/modules/intersci/tests/nonreg_tests/bug_7599.tst b/modules/intersci/tests/nonreg_tests/bug_7599.tst
new file mode 100755
index 000000000..d1ceae922
--- /dev/null
+++ b/modules/intersci/tests/nonreg_tests/bug_7599.tst
@@ -0,0 +1,27 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 7599 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=7599
+//
+// <-- Short Description -->
+// Intersci-n and intersci did not create code from a .desc file if it was not ended by an empty line.
+//
+
+if getos() == 'Windows' then
+ copyfile(SCI+"/modules/intersci/tests/nonreg_tests/bug_7599.desc", TMPDIR+"/bug_7599.desc");
+ cd(TMPDIR);
+ s = dos(SCI+'/modules/intersci/bin/intersci-n.exe bug_7599');
+ if s <> %t then pause, end
+ r = mgetl(TMPDIR + '/bug_7599.c');
+ ref = mgetl(SCI+"/modules/intersci/tests/nonreg_tests/bug_7599.c");
+ if ~and(r == ref) then pause, end
+end
diff --git a/modules/intersci/tests/nonreg_tests/bug_7603.dia.ref b/modules/intersci/tests/nonreg_tests/bug_7603.dia.ref
new file mode 100755
index 000000000..2a05f17f1
--- /dev/null
+++ b/modules/intersci/tests/nonreg_tests/bug_7603.dia.ref
@@ -0,0 +1,32 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- Non-regression test for bug 7603 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=7603
+//
+// <-- Short Description -->
+// Fortran code generated by intersci did not build with a fortran or F2C compiler on Windows.
+//
+if getos() == 'Windows' then
+ copyfile(SCI+"/modules/intersci/tests/nonreg_tests/bug7603.desc", TMPDIR+"/bug7603.desc");
+ copyfile(SCI+"/modules/intersci/tests/nonreg_tests/bug7603function.c", TMPDIR+"/bug7603function.c");
+ cd(TMPDIR);
+ // check intersci generation
+ s1 = dos(SCI + '/modules/intersci/bin/intersci.exe bug7603');
+ if s1 <> %t then bugmes();quit;end
+ // check f2c conversion works
+ s2 = dos(SCI + "/bin/f2c.exe -I" + SCI + "/modules/core/includes " + "bug7603.f");
+ if s2 <> %t then bugmes();quit;end
+ if isfile("bug7603.c") then
+ mdelete("bug7603.c");
+ end
+ // check build
+ ilib_verbose(0);
+ ierr = execstr("ilib_build(""gw_bug7603"", [""bug7603"", ""bug7603_""], [""bug7603.f"", ""bug7603function.c""], []);", "errcatch");
+ if ierr <> 0 then bugmes();quit;end
+end
diff --git a/modules/intersci/tests/nonreg_tests/bug_7603.tst b/modules/intersci/tests/nonreg_tests/bug_7603.tst
new file mode 100755
index 000000000..009e22308
--- /dev/null
+++ b/modules/intersci/tests/nonreg_tests/bug_7603.tst
@@ -0,0 +1,39 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- Non-regression test for bug 7603 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=7603
+//
+// <-- Short Description -->
+// Fortran code generated by intersci did not build with a fortran or F2C compiler on Windows.
+//
+
+if getos() == 'Windows' then
+
+ copyfile(SCI+"/modules/intersci/tests/nonreg_tests/bug7603.desc", TMPDIR+"/bug7603.desc");
+ copyfile(SCI+"/modules/intersci/tests/nonreg_tests/bug7603function.c", TMPDIR+"/bug7603function.c");
+ cd(TMPDIR);
+
+ // check intersci generation
+ s1 = dos(SCI + '/modules/intersci/bin/intersci.exe bug7603');
+ if s1 <> %t then pause, end
+
+ // check f2c conversion works
+ s2 = dos(SCI + "/bin/f2c.exe -I" + SCI + "/modules/core/includes " + "bug7603.f");
+ if s2 <> %t then pause, end
+ if isfile("bug7603.c") then
+ mdelete("bug7603.c");
+ end
+
+ // check build
+ ilib_verbose(0);
+ ierr = execstr("ilib_build(""gw_bug7603"", [""bug7603"", ""bug7603_""], [""bug7603.f"", ""bug7603function.c""], []);", "errcatch");
+ if ierr <> 0 then pause,end
+
+end