summaryrefslogtreecommitdiff
path: root/modules/call_scilab/tests
diff options
context:
space:
mode:
Diffstat (limited to 'modules/call_scilab/tests')
-rwxr-xr-xmodules/call_scilab/tests/nonreg_tests/bug_7601.tst36
-rwxr-xr-xmodules/call_scilab/tests/nonreg_tests/bug_7602.tst50
-rwxr-xr-xmodules/call_scilab/tests/nonreg_tests/bug_8115.tst88
-rwxr-xr-xmodules/call_scilab/tests/nonreg_tests/bug_8830.tst51
4 files changed, 225 insertions, 0 deletions
diff --git a/modules/call_scilab/tests/nonreg_tests/bug_7601.tst b/modules/call_scilab/tests/nonreg_tests/bug_7601.tst
new file mode 100755
index 000000000..78ec20fe1
--- /dev/null
+++ b/modules/call_scilab/tests/nonreg_tests/bug_7601.tst
@@ -0,0 +1,36 @@
+// =============================================================================
+// 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 -->
+//
+// <-- INTERACTIVE TEST -->
+//
+// <-- Non-regression test for bug 7601 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=7601
+//
+// <-- Short Description -->
+// call_scilab C functions did not check if engine is started.
+
+// Create a C code to use call_scilab:
+
+int main(void)
+{
+#ifdef _MSC_VER
+ StartScilab(NULL, NULL, NULL);
+#else
+ StartScilab(getenv("SCI"), NULL, NULL);
+#endif
+
+ SendScilabJob("disp([2,3]+[-44,39]);"); // Will display - 42. 42.
+ TerminateScilab(NULL);
+ return SendScilabJob("disp([2,3]+[-44,39]);")
+
+}
+
+default value returned by main will be -1 \ No newline at end of file
diff --git a/modules/call_scilab/tests/nonreg_tests/bug_7602.tst b/modules/call_scilab/tests/nonreg_tests/bug_7602.tst
new file mode 100755
index 000000000..3959e5b5d
--- /dev/null
+++ b/modules/call_scilab/tests/nonreg_tests/bug_7602.tst
@@ -0,0 +1,50 @@
+// =============================================================================
+// 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 -->
+//
+// <-- INTERACTIVE TEST -->
+//
+// <-- Non-regression test for bug 7602 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=7602
+//
+// <-- Short Description -->
+// it was not possible to start/close a Scilab engine at anytime.
+
+// Create a C code to use call_scilab:
+
+int main(void)
+{
+ #define NB_LOOPS 10
+ int i = 0;
+ for (i = 0; i < NB_LOOPS; i++)
+ {
+ DisableInteractiveMode();
+#ifdef _MSC_VER
+ StartScilab(NULL, NULL, NULL);
+#else
+ StartScilab(getenv("SCI"), NULL, NULL);
+#endif
+
+ TerminateScilab(NULL);
+
+ DisableInteractiveMode();
+#ifdef _MSC_VER
+ StartScilab(NULL, NULL, NULL);
+#else
+ StartScilab(getenv("SCI"), NULL, NULL);
+#endif
+ SendScilabJob("disp([2,3]+[-44,39]);"); // Will display - 42. 42.
+
+ TerminateScilab(NULL);
+ }
+ return 0;
+}
+
+// you must have 10 display of - 42. 42. \ No newline at end of file
diff --git a/modules/call_scilab/tests/nonreg_tests/bug_8115.tst b/modules/call_scilab/tests/nonreg_tests/bug_8115.tst
new file mode 100755
index 000000000..b2313dd4b
--- /dev/null
+++ b/modules/call_scilab/tests/nonreg_tests/bug_8115.tst
@@ -0,0 +1,88 @@
+// =============================================================================
+// 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 -->
+//
+// <-- INTERACTIVE TEST -->
+//
+// <-- Non-regression test for bug 8115 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=8115
+//
+// <-- Short Description -->
+// DisableInteractiveMode did not work
+
+// Create a C code to use call_scilab:
+
+#ifdef _MSC_VER
+#pragma comment(lib, "call_scilab.lib")
+#pragma comment(lib, "libscilab.lib")
+#endif
+/*--------------------------------------------------------------------------*/
+#include <stdio.h>
+#include <stdlib.h>
+#include "call_scilab.h"
+#include "scilabmode.h"
+/*--------------------------------------------------------------------------*/
+int main(void)
+{
+ int iErr = 0;
+ if (getScilabMode() != SCILAB_API)
+ {
+ fprintf(stderr, "BUG 8115 NOT FIXED.\n");
+ iErr = 1;
+ }
+
+ DisableInteractiveMode();
+#ifdef _MSC_VER
+ StartScilab(NULL, NULL, 0);
+#else
+ StartScilab(getenv("SCI"), NULL, 0);
+#endif
+
+ /* check that it is NWNI mode */
+ if (getScilabMode() != SCILAB_NWNI)
+ {
+ fprintf(stderr, "BUG 8115 NOT FIXED.\n");
+ iErr = 1;
+ }
+
+ TerminateScilab(NULL);
+
+ /* check that we returns to default mode */
+ if (getScilabMode() != SCILAB_API)
+ {
+ fprintf(stderr, "BUG 8115 NOT FIXED.\n");
+ iErr = 1;
+ }
+
+#ifdef _MSC_VER
+ StartScilab(NULL, NULL, 0);
+#else
+ StartScilab(getenv("SCI"), NULL, 0);
+#endif
+
+ /* check that it is API mode */
+ if (getScilabMode() != SCILAB_API)
+ {
+ fprintf(stderr, "BUG 8115 NOT FIXED.\n");
+ iErr = 1;
+ }
+
+ TerminateScilab(NULL);
+
+ /* check that we returns to default mode */
+ if (getScilabMode() != SCILAB_API)
+ {
+ fprintf(stderr, "BUG 8115 NOT FIXED.\n");
+ iErr = 1;
+ }
+
+ return iErr;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/modules/call_scilab/tests/nonreg_tests/bug_8830.tst b/modules/call_scilab/tests/nonreg_tests/bug_8830.tst
new file mode 100755
index 000000000..dc7e2971a
--- /dev/null
+++ b/modules/call_scilab/tests/nonreg_tests/bug_8830.tst
@@ -0,0 +1,51 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2011 - DIGITEO - Sylvestre LEDRU
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- INTERACTIVE TEST -->
+//
+// <-- Non-regression test for bug 8830 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=8830
+//
+// <-- Short Description -->
+// In call_scilab, TerminateScilab did not clear the last error.
+
+// Create a C code to use call_scilab:
+
+#include <stdio.h>
+#include <string.h>
+
+#include "stack-c.h" /* Provide functions to access to the memory of Scilab */
+#include "call_scilab.h" /* Provide functions to call Scilab engine */
+
+/*------------------------------------------------------------*/
+int main(void)
+{
+#ifdef _MSC_VER
+ if ( StartScilab(NULL,NULL,NULL) == FALSE )
+#else
+ if ( StartScilab(getenv("SCI"),NULL,NULL) == FALSE )
+#endif
+ {
+ fprintf(stderr,"Error while calling StartScilab\n");
+ return -1;
+ }
+
+
+ int code=SendScilabJob("failedMyCurrentJob=%pi*3/0");
+
+ if ( TerminateScilab(NULL) == FALSE ) {
+ fprintf(stderr,"Error while calling TerminateScilab\n");
+ return -2;
+ }
+ printf("getLastErrorValue %d\n",getLastErrorValue());
+ return 0;
+}
+/*------------------------------------------------------------*/