scilab: remove constants tests from example

This commit is contained in:
Simon Marchetto 2014-02-17 16:29:11 +01:00
commit 4aa870c318
2 changed files with 9 additions and 35 deletions

View file

@ -1,29 +1,17 @@
/* File : example.i */ /* File : example.i */
%module example %module example
/* Forces to wrap constants as Scilab variables (instead of functions) */ /* Wraps constants as Scilab variables (instead of getter functions) */
%scilabconst(1); %scilabconst(1);
#define ICONST 42 #define ICONST 42
#define FCONST 2.1828 #define FCONST 2.1828
#define CCONST 'x' #define SCONST "Hello World"
#define CCONST2 '\n'
#define SCONST "Hello World"
#define SCONST2 "\"Hello World\""
/* This should work just fine */ // Constants expressions are also accepted
#define EXPR ICONST + 3*(FCONST) #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 */
// SWIG also offers to define constants
%constant int iconst = 37; %constant int iconst = 37;
%constant double fconst = 3.14; %constant double fconst = 42.2;

View file

@ -6,23 +6,9 @@ example_Init();
printf("\nConstants are wrapped by functions:\n"); printf("\nConstants are wrapped by functions:\n");
printf("ICONST = %i (should be 42)\n", ICONST); printf("ICONST = %i (should be 42)\n", ICONST);
printf("FCONST = %5.4f (should be 2.1828)\n", FCONST); 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("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("EXPR = %5.4f (should be 48.5484)\n", EXPR);
printf("iconst = %i (should be 37)\n", iconst); printf("iconst = %i (should be 37)\n", iconst);
printf("fconst = %3.2f (should be 3.14)\n", fconst); printf("fconst = %3.2f (should be 42.20)\n", fconst);
try
printf("EXTERN = %s (Arg! This should not printf(anything)\n", EXTERN);
catch
printf("EXTERN is not defined (good)\n");
end
try
printf("FOO = %i (Arg! This should not printf(anything)\n", FOO);
catch
printf("FOO is not defined (good)\n");
end
exit exit