new test
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4296 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
dbabaa7fa8
commit
43c45a7c51
3 changed files with 33 additions and 0 deletions
|
|
@ -247,6 +247,7 @@ C_TEST_CASES += \
|
|||
preproc_2 \
|
||||
preproc_3 \
|
||||
preproc_4 \
|
||||
preproc_5 \
|
||||
ret_by_value \
|
||||
sizeof_pointer \
|
||||
sneaky1 \
|
||||
|
|
|
|||
|
|
@ -37,3 +37,4 @@ ARITH_RTYPE(double,int) hello1();
|
|||
// ARITH_RTYPE(double,int) hello2();
|
||||
//
|
||||
HELLO_TYPE(double,int) hello2();
|
||||
|
||||
|
|
|
|||
31
Examples/test-suite/preproc_5.i
Normal file
31
Examples/test-suite/preproc_5.i
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
%module preproc_5
|
||||
|
||||
// Various preprocessor bits of nastiness.
|
||||
|
||||
|
||||
/* Test argument name substitution */
|
||||
#define foo(x,xx) #x #xx
|
||||
#define bar(x,xx) x + xx
|
||||
|
||||
%constant char *a = foo(hello,world);
|
||||
%constant int b = bar(3,4);
|
||||
|
||||
// Wrap your brain around this one ;-)
|
||||
|
||||
%{
|
||||
#define cat(x,y) x ## y
|
||||
%}
|
||||
|
||||
#define cat(x,y) x ## y
|
||||
|
||||
/* This should expand to cat(1,2);
|
||||
See K&R, p. 231 */
|
||||
|
||||
%constant int c = cat(cat(1,2),;)
|
||||
|
||||
#define xcat(x,y) cat(x,y)
|
||||
|
||||
/* This expands to 123. See K&R, p. 231 */
|
||||
%constant int d = xcat(xcat(1,2),3);
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue