aboutsummaryrefslogtreecommitdiffstats
path: root/src/junit
diff options
context:
space:
mode:
authorMathieu Féry <[email protected]>2023-06-15 19:18:34 +0200
committerMathieu Féry <[email protected]>2023-06-16 10:51:24 +0200
commit738c15d654f67ec8aeccec2b46f5a0804c793491 (patch)
tree259b5149ce3975acdd1e514d0afa291ec4362c69 /src/junit
parent88309192b450e09ba16e9d72adac178c4ce47dc3 (diff)
feat(feature): Enable pragma once management
Diffstat (limited to 'src/junit')
-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_ */