diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/junit/com/jogamp/gluegen/PCPPTest.java | 29 | ||||
-rw-r--r-- | test/junit/com/jogamp/gluegen/pcpptest.h | 37 |
2 files changed, 60 insertions, 6 deletions
diff --git a/test/junit/com/jogamp/gluegen/PCPPTest.java b/test/junit/com/jogamp/gluegen/PCPPTest.java index c1f12ab..fc59f9a 100644 --- a/test/junit/com/jogamp/gluegen/PCPPTest.java +++ b/test/junit/com/jogamp/gluegen/PCPPTest.java @@ -47,7 +47,7 @@ public class PCPPTest { @Test public void pcppMacroDefinitionTest() throws FileNotFoundException, IOException { - PCPP pp = new PCPP(Collections.<String>emptyList()); + PCPP pp = new PCPP(Collections.<String>emptyList(), false); ByteArrayOutputStream output = new ByteArrayOutputStream(); pp.setOut(output); @@ -58,12 +58,30 @@ public class PCPPTest { String expected = "# 1 \"pcpptest.h\""+ "# define CL_SCHAR_MIN (-127-1)"+ - " cl_char __attribute__(( aligned(2))) s[ 2];"+ - "# 7 \"pcpptest.h\""; + "# define __YES__ 1"+ + "# 16 \"pcpptest.h\""+ + "# 26 \"pcpptest.h\""+ + "# 36 \"pcpptest.h\""+ + " cl_char GOOD_A;"+ + " int GOOD_B;"+ + " int GOOD_C;"+ + "# 40 \"pcpptest.h\""; + output.flush(); String result = output.toString(); output.close(); + System.err.println("Expected: "); + System.err.println("-------------------------------"); + System.err.println(killWhitespace(expected)); + System.err.println("-------------------------------"); + System.err.println(); + System.err.println("Result: "); + System.err.println("-------------------------------"); + System.err.println(killWhitespace(result)); + System.err.println("-------------------------------"); + System.err.println(); + assertEquals(killWhitespace(expected), killWhitespace(result)); } @@ -72,5 +90,8 @@ public class PCPPTest { return a.replaceAll("\\p{javaWhitespace}+", ""); } - + public static void main(String args[]) throws IOException { + String tstname = PCPPTest.class.getName(); + org.junit.runner.JUnitCore.main(tstname); + } } diff --git a/test/junit/com/jogamp/gluegen/pcpptest.h b/test/junit/com/jogamp/gluegen/pcpptest.h index 58b8935..5009d04 100644 --- a/test/junit/com/jogamp/gluegen/pcpptest.h +++ b/test/junit/com/jogamp/gluegen/pcpptest.h @@ -1,6 +1,39 @@ #define CL_SCHAR_MIN (-127-1) -#define CL_ALIGNED(_x) __attribute__ ((aligned(_x))) -cl_char CL_ALIGNED(2) s[2]; +#define __YES__ 1 + +#if defined( __YES__ ) + #define TEST_A(_x) GOOD_A +#elif defined( _WIN32) && (_MSC_VER) + #define TEST_A(_x) ERR_A_1 +#elif defined( __unix__) || ( __sun__ ) + #define TEST_A(_x) ERR_A_2 +#else + #define TEST_A(_x) ERR_A_3 +#endif + +#if defined( __NO__ ) + #define TEST_B ERR_B_1 +#elif defined( __YES__) + #define TEST_B GOOD_B +#elif defined( __unix__) || ( __sun__ ) + #define TEST_B ERR_B_2 +#else + #define TEST_B ERR_B_3 +#endif + +#if defined( __NO__ ) + #define TEST_C ERR_C_1 +#elif defined( __NO__ ) + #define TEST_C ERR_C_2 +#elif defined( __unix__) || ( __sun__ ) + #define TEST_C ERR_C_3 +#else + #define TEST_C GOOD_C +#endif + +cl_char TEST_A(2); +int TEST_B; +int TEST_C; |