Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

scilab: remove constants tests from example

  • Loading branch information...
commit 4aa870c318747364d048fa8b0d70f7305fecf12c 1 parent d8135e7
@smarchetto smarchetto authored
28 Examples/scilab/constants/example.i
@@ -1,29 +1,17 @@
/* File : example.i */
%module example
-/* Forces to wrap constants as Scilab variables (instead of functions) */
+/* Wraps constants as Scilab variables (instead of getter functions) */
-#define ICONST 42
-#define FCONST 2.1828
-#define CCONST 'x'
-#define CCONST2 '\n'
-#define SCONST "Hello World"
-#define SCONST2 "\"Hello World\""
+#define ICONST 42
+#define FCONST 2.1828
+#define SCONST "Hello World"
-/* This should work just fine */
-#define EXPR ICONST + 3*(FCONST)
-/* This shouldn't do anything */
-#define EXTERN extern
-/* Neither should this (BAR isn't defined) */
-#define FOO (ICONST + BAR)
-/* The following directives also produce constants */
+// Constants expressions are also accepted
+// SWIG also offers to define constants
%constant int iconst = 37;
-%constant double fconst = 3.14;
+%constant double fconst = 42.2;
16 Examples/scilab/constants/runme.sci
@@ -6,23 +6,9 @@ example_Init();
printf("\nConstants are wrapped by functions:\n");
printf("ICONST = %i (should be 42)\n", ICONST);
printf("FCONST = %5.4f (should be 2.1828)\n", FCONST);
-printf("CCONST = ''%c'' (should be ''x'')\n", CCONST);
-printf("CCONST2 = %s (this should be on a new line)\n", CCONST2);
printf("SCONST = ''%s'' (should be ''Hello World'')\n", SCONST);
-printf("SCONST2 = ''%s'' (should be "'""Hello World"""')\n", SCONST2);
printf("EXPR = %5.4f (should be 48.5484)\n", EXPR);
printf("iconst = %i (should be 37)\n", iconst);
-printf("fconst = %3.2f (should be 3.14)\n", fconst);
- printf("EXTERN = %s (Arg! This should not printf(anything)\n", EXTERN);
- printf("EXTERN is not defined (good)\n");
- printf("FOO = %i (Arg! This should not printf(anything)\n", FOO);
- printf("FOO is not defined (good)\n");
+printf("fconst = %3.2f (should be 42.20)\n", fconst);
Please sign in to comment.
Something went wrong with that request. Please try again.