aboutsummaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-06-18 04:12:34 +0200
committerSven Gothel <[email protected]>2023-06-18 04:12:34 +0200
commit7065adb5142911e0b16cbb159150578627712d14 (patch)
treec5dbd9f385def4c7c6034fd54d146f1e540a2258 /src/junit/com/jogamp
parent9dd35877f28f5d3dce5e1817edd33bb8f6dbbe36 (diff)
parent738c15d654f67ec8aeccec2b46f5a0804c793491 (diff)
Merge remote-tracking branch 'remotes/Mathieu_Fery/feature/enable_pragma_once'
Diffstat (limited to 'src/junit/com/jogamp')
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/PCPPTest.java31
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/pcpptest-included.h2
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/pcpptest.h3
3 files changed, 32 insertions, 4 deletions
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/PCPPTest.java b/src/junit/com/jogamp/gluegen/test/junit/generation/PCPPTest.java
index 608a17f..5e06a37 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/PCPPTest.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/PCPPTest.java
@@ -62,13 +62,23 @@ public class PCPPTest extends SingletonJunitCase {
}
@Test
- public void pcppMacroDefinitionTest() throws FileNotFoundException, IOException {
- final PCPP pp = new PCPP(Collections.<String>emptyList(), false, false);
+ public void pcppMacroDefinitionTestWithoutPragmaOnce() throws FileNotFoundException, IOException {
+ pcppMacroDefinitionTest(false);
+ }
+
+ @Test
+ public void pcppMacroDefinitionTestWithPragmaOnce() throws FileNotFoundException, IOException {
+ pcppMacroDefinitionTest(true);
+ }
+
+ public void pcppMacroDefinitionTest(final boolean pragmaOnce) throws FileNotFoundException, IOException {
+ final String folderpath = BuildEnvironment.gluegenRoot + "/src/junit/com/jogamp/gluegen/test/junit/generation";
+ final PCPP pp = new PCPP(Collections.<String>singletonList(folderpath), false, false, pragmaOnce);
final ByteArrayOutputStream output = new ByteArrayOutputStream();
pp.setOut(output);
final String filename = "pcpptest.h";
- final String filepath = BuildEnvironment.gluegenRoot + "/src/junit/com/jogamp/gluegen/test/junit/generation/" + filename ;
+ final String filepath = folderpath + "/" + filename ;
pp.run(new BufferedReader(new FileReader(filepath)), filename);
final String expected = "# 1 \"pcpptest.h\""+
@@ -95,7 +105,20 @@ public class PCPPTest extends SingletonJunitCase {
"#128\"pcpptest.h\""+
"#130\"pcpptest.h\""+
"#134\"pcpptest.h\""+
- "#136\"pcpptest.h\"";
+ "#1\""+folderpath+"/pcpptest-included.h\""+
+ "# define EXAMPLE 42"+
+ "#134\"pcpptest.h\""+
+ (!pragmaOnce ?
+ (
+ "#1\""+folderpath+"/pcpptest-included.h\""+
+ "# define EXAMPLE 42"+
+ "#135\"pcpptest.h\""
+ ):
+ ""
+ )+
+ "#137\"pcpptest.h\""+
+ "#139\"pcpptest.h\""
+ ;
output.flush();
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/pcpptest-included.h b/src/junit/com/jogamp/gluegen/test/junit/generation/pcpptest-included.h
new file mode 100644
index 0000000..8dbe022
--- /dev/null
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/pcpptest-included.h
@@ -0,0 +1,2 @@
+#pragma once
+#define EXAMPLE 42 \ No newline at end of file
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/pcpptest.h b/src/junit/com/jogamp/gluegen/test/junit/generation/pcpptest.h
index e9ba181..31b80c3 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/pcpptest.h
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/pcpptest.h
@@ -131,5 +131,8 @@ int TEST_G_VAL;
}
#endif
+#include <pcpptest-included.h>
+#include <pcpptest-included.h>
+
#endif /* __test_h_ */