scilab: remove constants tests from example
This commit is contained in:
parent
d8135e7387
commit
4aa870c318
2 changed files with 9 additions and 35 deletions
|
|
@ -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) */
|
||||
%scilabconst(1);
|
||||
|
||||
#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
|
||||
#define EXPR ICONST + 3*FCONST
|
||||
|
||||
// SWIG also offers to define constants
|
||||
%constant int iconst = 37;
|
||||
%constant double fconst = 3.14;
|
||||
|
||||
|
||||
%constant double fconst = 42.2;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
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
|
||||
printf("fconst = %3.2f (should be 42.20)\n", fconst);
|
||||
|
||||
exit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue