diff options
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/com/jogamp/gluegen/jcpp/CppReaderTest.java (renamed from src/test/java/org/anarres/cpp/CppReaderTest.java) | 30 | ||||
-rw-r--r-- | src/test/java/com/jogamp/gluegen/jcpp/ErrorTest.java (renamed from src/test/java/org/anarres/cpp/ErrorTest.java) | 4 | ||||
-rw-r--r-- | src/test/java/com/jogamp/gluegen/jcpp/IncludeAbsoluteTest.java | 46 | ||||
-rw-r--r-- | src/test/java/com/jogamp/gluegen/jcpp/JavaFileSystemTest.java (renamed from src/test/java/org/anarres/cpp/JavaFileSystemTest.java) | 2 | ||||
-rw-r--r-- | src/test/java/com/jogamp/gluegen/jcpp/JoinReaderTest.java (renamed from src/test/java/org/anarres/cpp/JoinReaderTest.java) | 2 | ||||
-rw-r--r-- | src/test/java/com/jogamp/gluegen/jcpp/LexerSourceTest.java (renamed from src/test/java/org/anarres/cpp/LexerSourceTest.java) | 25 | ||||
-rw-r--r-- | src/test/java/com/jogamp/gluegen/jcpp/NumericValueTest.java (renamed from src/test/java/org/anarres/cpp/NumericValueTest.java) | 4 | ||||
-rw-r--r-- | src/test/java/com/jogamp/gluegen/jcpp/PreprocessorTest.java (renamed from src/test/java/org/anarres/cpp/PreprocessorTest.java) | 177 | ||||
-rw-r--r-- | src/test/java/com/jogamp/gluegen/jcpp/TokenPastingWhitespaceTest.java (renamed from src/test/java/org/anarres/cpp/TokenPastingWhitespaceTest.java) | 30 | ||||
-rw-r--r-- | src/test/java/org/anarres/cpp/BuildMetadataTest.java | 33 | ||||
-rw-r--r-- | src/test/java/org/anarres/cpp/IncludeAbsoluteTest.java | 35 | ||||
-rw-r--r-- | src/test/java/org/anarres/cpp/MainTest.java | 11 |
12 files changed, 264 insertions, 135 deletions
diff --git a/src/test/java/org/anarres/cpp/CppReaderTest.java b/src/test/java/com/jogamp/gluegen/jcpp/CppReaderTest.java index c901722..e4ef1c5 100644 --- a/src/test/java/org/anarres/cpp/CppReaderTest.java +++ b/src/test/java/com/jogamp/gluegen/jcpp/CppReaderTest.java @@ -1,26 +1,33 @@ -package org.anarres.cpp; +package com.jogamp.gluegen.jcpp; import java.io.BufferedReader; +import java.io.IOException; import java.io.StringReader; import java.util.Collections; + import javax.annotation.Nonnull; + import org.junit.Test; + +import com.jogamp.gluegen.test.junit.generation.BuildEnvironment; + import static org.junit.Assert.assertEquals; public class CppReaderTest { - public static String testCppReader(@Nonnull String in, Feature... f) - throws Exception { + public static String testCppReader(@Nonnull final String in, final Feature... f) throws Exception { + final String inclpath = BuildEnvironment.gluegenRoot + "/jcpp/src/test/resources" ; + System.out.println("Testing " + in); - StringReader r = new StringReader(in); - CppReader p = new CppReader(r); + final StringReader r = new StringReader(in); + final CppReader p = new CppReader(r); p.getPreprocessor().setSystemIncludePath( - Collections.singletonList("src/test/resources") + Collections.singletonList(inclpath) ); p.getPreprocessor().addFeatures(f); - BufferedReader b = new BufferedReader(p); + final BufferedReader b = new BufferedReader(p); - StringBuilder out = new StringBuilder(); + final StringBuilder out = new StringBuilder(); String line; while ((line = b.readLine()) != null) { System.out.println(" >> " + line); @@ -47,7 +54,7 @@ public class CppReaderTest { public void testPragmaOnce() throws Exception { // The newlines are irrelevant, We want exactly one "foo" - String out = testCppReader("#include <once.c>\n", Feature.PRAGMA_ONCE); + final String out = testCppReader("#include <once.c>\n", Feature.PRAGMA_ONCE); assertEquals("foo", out.trim()); } @@ -58,4 +65,9 @@ public class CppReaderTest { testCppReader("#include <once.c>\n", Feature.PRAGMA_ONCE, Feature.LINEMARKERS); } + public static void main(final String args[]) throws IOException { + final String tstname = CppReaderTest.class.getName(); + org.junit.runner.JUnitCore.main(tstname); + } + } diff --git a/src/test/java/org/anarres/cpp/ErrorTest.java b/src/test/java/com/jogamp/gluegen/jcpp/ErrorTest.java index 42240d4..12a5160 100644 --- a/src/test/java/org/anarres/cpp/ErrorTest.java +++ b/src/test/java/com/jogamp/gluegen/jcpp/ErrorTest.java @@ -1,8 +1,8 @@ -package org.anarres.cpp; +package com.jogamp.gluegen.jcpp; import java.io.IOException; import org.junit.Test; -import static org.anarres.cpp.Token.*; +import static com.jogamp.gluegen.jcpp.Token.*; import static org.junit.Assert.*; public class ErrorTest { diff --git a/src/test/java/com/jogamp/gluegen/jcpp/IncludeAbsoluteTest.java b/src/test/java/com/jogamp/gluegen/jcpp/IncludeAbsoluteTest.java new file mode 100644 index 0000000..b44b900 --- /dev/null +++ b/src/test/java/com/jogamp/gluegen/jcpp/IncludeAbsoluteTest.java @@ -0,0 +1,46 @@ +package com.jogamp.gluegen.jcpp; + +import java.io.File; +import java.io.IOException; +import java.io.Reader; + +import org.junit.Test; + +import com.jogamp.common.util.IOUtil; +import com.jogamp.gluegen.Logging; +import com.jogamp.gluegen.Logging.LoggerIf; +import com.jogamp.gluegen.test.junit.generation.BuildEnvironment; + +import static org.junit.Assert.*; + +/** + * + * @author shevek + */ +public class IncludeAbsoluteTest { + + private static final LoggerIf LOG = Logging.getLogger(IncludeAbsoluteTest.class); + + @Test + public void testAbsoluteInclude() throws Exception { + final String filepath = BuildEnvironment.gluegenRoot + "/jcpp/src/test/resources/absolute.h" ; + LOG.info("filepath: " + filepath); + + final File file = new File(filepath); + assertTrue(file.exists()); + + final String input = "#include <" + file.getAbsolutePath() + ">\n"; + LOG.info("Input: " + input); + final Preprocessor pp = new Preprocessor(); + pp.addInput(new StringLexerSource(input, true)); + final Reader r = new CppReader(pp); + final String output = IOUtil.appendCharStream(new StringBuilder(), r).toString(); + r.close(); + LOG.info("Output: " + output); + assertTrue(output.contains("absolute-result")); + } + public static void main(final String args[]) throws IOException { + final String tstname = IncludeAbsoluteTest.class.getName(); + org.junit.runner.JUnitCore.main(tstname); + } +} diff --git a/src/test/java/org/anarres/cpp/JavaFileSystemTest.java b/src/test/java/com/jogamp/gluegen/jcpp/JavaFileSystemTest.java index 6e6f834..d867fb8 100644 --- a/src/test/java/org/anarres/cpp/JavaFileSystemTest.java +++ b/src/test/java/com/jogamp/gluegen/jcpp/JavaFileSystemTest.java @@ -1,4 +1,4 @@ -package org.anarres.cpp; +package com.jogamp.gluegen.jcpp; import java.io.FileNotFoundException; import org.junit.Test; diff --git a/src/test/java/org/anarres/cpp/JoinReaderTest.java b/src/test/java/com/jogamp/gluegen/jcpp/JoinReaderTest.java index bb9cc2d..628a7ec 100644 --- a/src/test/java/org/anarres/cpp/JoinReaderTest.java +++ b/src/test/java/com/jogamp/gluegen/jcpp/JoinReaderTest.java @@ -1,4 +1,4 @@ -package org.anarres.cpp; +package com.jogamp.gluegen.jcpp; import java.io.StringReader; import org.junit.Test; diff --git a/src/test/java/org/anarres/cpp/LexerSourceTest.java b/src/test/java/com/jogamp/gluegen/jcpp/LexerSourceTest.java index 96ec4a3..43ccbe6 100644 --- a/src/test/java/org/anarres/cpp/LexerSourceTest.java +++ b/src/test/java/com/jogamp/gluegen/jcpp/LexerSourceTest.java @@ -1,33 +1,36 @@ -package org.anarres.cpp; +package com.jogamp.gluegen.jcpp; import java.util.Arrays; + import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import static org.anarres.cpp.PreprocessorTest.assertType; -import static org.anarres.cpp.Token.*; + +import com.jogamp.gluegen.Logging; +import com.jogamp.gluegen.Logging.LoggerIf; + +import static com.jogamp.gluegen.jcpp.PreprocessorTest.assertType; +import static com.jogamp.gluegen.jcpp.Token.*; import static org.junit.Assert.*; public class LexerSourceTest { - private static final Logger LOG = LoggerFactory.getLogger(LexerSourceTest.class); + private static final LoggerIf LOG = Logging.getLogger(LexerSourceTest.class); - public static void testLexerSource(String in, boolean textmatch, int... out) + public static void testLexerSource(final String in, final boolean textmatch, final int... out) throws Exception { LOG.info("Testing '" + in + "' => " + Arrays.toString(out)); - StringLexerSource s = new StringLexerSource(in); + final StringLexerSource s = new StringLexerSource(in); - StringBuilder buf = new StringBuilder(); + final StringBuilder buf = new StringBuilder(); for (int i = 0; i < out.length; i++) { - Token tok = s.token(); + final Token tok = s.token(); LOG.info("Token is " + tok); assertType(out[i], tok); // assertEquals(col, tok.getColumn()); buf.append(tok.getText()); } - Token tok = s.token(); + final Token tok = s.token(); LOG.info("Token is " + tok); assertType(EOF, tok); diff --git a/src/test/java/org/anarres/cpp/NumericValueTest.java b/src/test/java/com/jogamp/gluegen/jcpp/NumericValueTest.java index d4ea432..2d612ce 100644 --- a/src/test/java/org/anarres/cpp/NumericValueTest.java +++ b/src/test/java/com/jogamp/gluegen/jcpp/NumericValueTest.java @@ -1,8 +1,8 @@ -package org.anarres.cpp; +package com.jogamp.gluegen.jcpp; import java.io.IOException; import org.junit.Test; -import static org.anarres.cpp.Token.*; +import static com.jogamp.gluegen.jcpp.Token.*; import static org.junit.Assert.*; /** diff --git a/src/test/java/org/anarres/cpp/PreprocessorTest.java b/src/test/java/com/jogamp/gluegen/jcpp/PreprocessorTest.java index 13bd944..651af98 100644 --- a/src/test/java/org/anarres/cpp/PreprocessorTest.java +++ b/src/test/java/com/jogamp/gluegen/jcpp/PreprocessorTest.java @@ -1,29 +1,38 @@ -package org.anarres.cpp; +package com.jogamp.gluegen.jcpp; +import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PipedInputStream; import java.io.PipedOutputStream; +import java.util.List; +import java.util.logging.Level; + +import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import static org.anarres.cpp.Token.*; + +import com.jogamp.gluegen.Logging; +import com.jogamp.gluegen.Logging.LoggerIf; + +import static com.jogamp.gluegen.jcpp.Token.*; import static org.junit.Assert.*; public class PreprocessorTest { - private static final Logger LOG = LoggerFactory.getLogger(PreprocessorTest.class); + private static final LoggerIf LOG = Logging.getLogger(PreprocessorTest.class); private OutputStreamWriter writer; private Preprocessor p; @Before public void setUp() throws Exception { + LOG.setLevel(Level.INFO); final PipedOutputStream po = new PipedOutputStream(); writer = new OutputStreamWriter(po); p = new Preprocessor(); + // p.addFeature(Feature.DEBUG); p.addInput( new LexerSource( new InputStreamReader( @@ -35,10 +44,9 @@ public class PreprocessorTest { } private static class I { - private final String t; - public I(String t) { + public I(final String t) { this.t = t; } @@ -51,10 +59,28 @@ public class PreprocessorTest { return getText(); } } - - private static I I(String t) { + private static I I(final String t) { return new I(t); } + private static class N { + private final String t; + + public N(final String t) { + this.t = t; + } + + public String getText() { + return t; + } + + @Override + public String toString() { + return getText(); + } + } + private static N N(final String t) { + return new N(t); + } /* * When writing tests in this file, remember the preprocessor @@ -63,7 +89,7 @@ public class PreprocessorTest { * the following input line. */ @Test - public void testPreprocessor() throws Exception { + public void test01Preprocessor() throws Exception { /* Magic macros */ testInput("line = __LINE__\n", I("line"), WHITESPACE, '=', WHITESPACE, NUMBER @@ -75,7 +101,11 @@ public class PreprocessorTest { /* Simple definitions */ testInput("#define A a /* a defined */\n", NL); + testInput("A /* a */\n", NL, I("a"), WHITESPACE, CCOMMENT); + testConstMacro("A", true, I("a")); testInput("#define B b /* b defined */\n", NL); + testInput("B /* b */\n", NL, I("b"), WHITESPACE, CCOMMENT); + testConstMacro("B", false, I("b")); testInput("#define C c /* c defined */\n", NL); /* Expansion of arguments */ @@ -107,20 +137,54 @@ public class PreprocessorTest { /* Redefinitions, undefinitions. */ testInput("#define two three\n", NL); + testInput("two /* three */\n", NL, I("three"), WHITESPACE, CCOMMENT); testInput("one /* one */\n", NL, I("one"), WHITESPACE, CCOMMENT); + testConstMacro("two", false, I("three")); + testConstMacro("two", true, I("three")); + testInput("#define one two\n", NL); testInput("one /* three */\n", NL, I("three"), WHITESPACE, CCOMMENT); + testConstMacro("one", false, I("two")); + testConstMacro("one", true, I("three")); + testInput("#undef two\n", NL); + testInput("one /* two */\n", NL, I("two"), WHITESPACE, CCOMMENT); + testConstMacro("one", false, I("two")); + testConstMacro("one", true, I("two")); + testInput("#define two five\n", NL); testInput("one /* five */\n", NL, I("five"), WHITESPACE, CCOMMENT); + testConstMacro("one", false, I("two")); + testConstMacro("one", true, I("five")); + testInput("#undef two\n", NL); testInput("one /* two */\n", NL, I("two"), WHITESPACE, CCOMMENT); + testConstMacro("one", false, I("two")); + testConstMacro("one", true, I("two")); + testInput("#undef one\n", NL); testInput("#define one four\n", NL); testInput("one /* four */\n", NL, I("four"), WHITESPACE, CCOMMENT); + testConstMacro("one", false, I("four")); + testConstMacro("one", true, I("four")); + testInput("#undef one\n", NL); testInput("#define one one\n", NL); testInput("one /* one */\n", NL, I("one"), WHITESPACE, CCOMMENT); + testConstMacro("one", false, I("one")); + testConstMacro("one", true, I("one")); + + testInput("#define NUM1 1\n", NL); + testInput("#define NUM4 ( 1 << ( NUM1 + NUM1 ) )\n", NL); + testInput("NUM4 /* ( 1 << ( 1 + 1 ) ) */\n", NL, + '(', WHITESPACE, N("1"), WHITESPACE, LSH, WHITESPACE, + '(', WHITESPACE, N("1"), WHITESPACE, '+', WHITESPACE, N("1"), WHITESPACE, ')', WHITESPACE, ')', + WHITESPACE, CCOMMENT); + testConstMacro("NUM4", false, '(', WHITESPACE, N("1"), WHITESPACE, LSH, WHITESPACE, + '(', WHITESPACE, I("NUM1"), WHITESPACE, '+', WHITESPACE, I("NUM1"), WHITESPACE, ')', + WHITESPACE, ')'); + testConstMacro("NUM4", true, '(', WHITESPACE, N("1"), WHITESPACE, LSH, WHITESPACE, + '(', WHITESPACE, N("1"), WHITESPACE, '+', WHITESPACE, N("1"), WHITESPACE, ')', WHITESPACE, ')'); /* Variadic macros. */ testInput("#define var(x...) a x __VA_ARGS__ b\n", NL); @@ -186,12 +250,12 @@ public class PreprocessorTest { Token t; do { t = p.token(); - LOG.warn("Remaining token " + t); + LOG.warning("Remaining token " + t); } while (t.getType() != EOF); } @Test - public void testPreprocessorUnterminated() throws Exception { + public void test02PreprocessorUnterminated() throws Exception { testInput("#ifndef X\na\n#else\nb\n"); // Bug #16 writer.close(); @@ -199,32 +263,38 @@ public class PreprocessorTest { Token t; do { t = p.token(); - LOG.warn("Remaining token " + t); + LOG.warning("Remaining token " + t); } while (t.getType() != EOF); } - public static void assertType(int type, Token t) { - String typeExpect = TokenType.getTokenName(type); - String typeActual = TokenType.getTokenName(t.getType()); + public static void assertType(final int type, final Token t) { + final String typeExpect = TokenType.getTokenName(type); + final String typeActual = TokenType.getTokenName(t.getType()); assertEquals("Expected " + typeExpect + " but got " + typeActual, type, t.getType()); } - private void testInput(String in, Object... out) + private void testInput(final String in, final Object... out) throws Exception { LOG.info("Input: " + in); writer.write(in); writer.flush(); - for (Object v : out) { - Token t = p.token(); - LOG.info(String.valueOf(t)); + for (final Object v : out) { + final Token t = p.token(); + LOG.info("READ: "+String.valueOf(t)); if (v instanceof String) { if (t.getType() != STRING) fail("Expected STRING, but got " + t); assertEquals(v, t.getValue()); } else if (v instanceof I) { - if (t.getType() != IDENTIFIER) + if (t.getType() != IDENTIFIER) { fail("Expected IDENTIFIER " + v + ", but got " + t); + } assertEquals(((I) v).getText(), t.getText()); + } else if (v instanceof N) { + if (t.getType() != NUMBER) { + fail("Expected NUMBER " + v + ", but got " + t); + } + assertEquals(((N) v).getText(), t.getText()); } else if (v instanceof Character) { assertType(((Character) v).charValue(), t); } else if (v instanceof Integer) { @@ -234,4 +304,69 @@ public class PreprocessorTest { } } } + // slow .. + private Macro findMacro(final List<Macro> macros, final String macroName) { + final int count = macros.size(); + for(int i=0; i<count; i++) { + final Macro m = macros.get(i); + if( m.getName().equals(macroName) ) { + return m; + } + } + return null; + } + private void dumpMacros(final List<Macro> macros) { + final int count = macros.size(); + System.err.println("Macro count: "+count); + for(int i=0; i<count; i++) { + final Macro m = macros.get(i); + System.err.println(" ["+i+"]: "+m); + } + } + private void testConstMacro(final String macroName, final boolean expandMacro, final Object... out) + throws Exception { + final List<Macro> macros = p.getMacros(expandMacro); + final Macro m = findMacro(macros, macroName); + if( null == m ) { + dumpMacros(macros); + } + Assert.assertNotNull("Macro <"+macroName+"> is missing!", m); + Assert.assertFalse(m.isFunctionLike()); + + final Source s = new MacroTokenSource(m, null); + try { + for (final Object v : out) { + final Token t = s.token(); + LOG.info("READ: "+String.valueOf(t)); + if (v instanceof String) { + if (t.getType() != STRING) { + fail("Expected STRING, but got " + t); + } + assertEquals(v, t.getValue()); + } else if (v instanceof I) { + if (t.getType() != IDENTIFIER) { + fail("Expected IDENTIFIER " + v + ", but got " + t); + } + assertEquals(((I) v).getText(), t.getText()); + } else if (v instanceof N) { + if (t.getType() != NUMBER) { + fail("Expected NUMBER " + v + ", but got " + t); + } + assertEquals(((N) v).getText(), t.getText()); + } else if (v instanceof Character) { + assertType(((Character) v).charValue(), t); + } else if (v instanceof Integer) { + assertType(((Number) v).intValue(), t); + } else { + fail("Bad object " + v.getClass()); + } + } + } finally { + s.close(); + } + } + public static void main(final String args[]) throws IOException { + final String tstname = PreprocessorTest.class.getName(); + org.junit.runner.JUnitCore.main(tstname); + } } diff --git a/src/test/java/org/anarres/cpp/TokenPastingWhitespaceTest.java b/src/test/java/com/jogamp/gluegen/jcpp/TokenPastingWhitespaceTest.java index 2e6a2b5..756425b 100644 --- a/src/test/java/org/anarres/cpp/TokenPastingWhitespaceTest.java +++ b/src/test/java/com/jogamp/gluegen/jcpp/TokenPastingWhitespaceTest.java @@ -1,11 +1,15 @@ -package org.anarres.cpp; +package com.jogamp.gluegen.jcpp; + +import com.jogamp.common.util.IOUtil; -import com.google.common.io.CharStreams; import java.io.IOException; import java.io.Reader; + import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; + +import com.jogamp.gluegen.Logging; +import com.jogamp.gluegen.Logging.LoggerIf; + import static org.junit.Assert.*; /** @@ -15,11 +19,14 @@ import static org.junit.Assert.*; */ public class TokenPastingWhitespaceTest { - private static final Logger LOG = LoggerFactory.getLogger(TokenPastingWhitespaceTest.class); + private static final LoggerIf LOG = Logging.getLogger(TokenPastingWhitespaceTest.class); @Test - public void testWhitespacePasting() throws IOException { - Preprocessor pp = new Preprocessor(); + public void test01WhitespacePasting() throws IOException { + final Preprocessor pp = new Preprocessor(); + testWhitespacePastingImpl(pp); + } + void testWhitespacePastingImpl(final Preprocessor pp) throws IOException { pp.addInput(new StringLexerSource( "#define ONE(arg) one_##arg\n" + "#define TWO(arg) ONE(two_##arg)\n" @@ -31,8 +38,8 @@ public class TokenPastingWhitespaceTest { + "ONE(good)\n" + "ONE( /* evil newline */\n" + " bad)\n", true)); - Reader r = new CppReader(pp); - String text = CharStreams.toString(r).trim(); + final Reader r = new CppReader(pp); + final String text = IOUtil.appendCharStream(new StringBuilder(), r).toString().trim(); LOG.info("Output is:\n" + text); assertEquals("one_two_good\n" + "one_two_bad\n" @@ -40,4 +47,9 @@ public class TokenPastingWhitespaceTest { + "one_good\n" + "one_bad", text); } + + public static void main(final String args[]) throws IOException { + final String tstname = TokenPastingWhitespaceTest.class.getName(); + org.junit.runner.JUnitCore.main(tstname); + } } diff --git a/src/test/java/org/anarres/cpp/BuildMetadataTest.java b/src/test/java/org/anarres/cpp/BuildMetadataTest.java deleted file mode 100644 index 42dc071..0000000 --- a/src/test/java/org/anarres/cpp/BuildMetadataTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.anarres.cpp; - -import com.google.common.base.Charsets; -import com.google.common.io.Resources; -import java.net.URL; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author shevek - */ -public class BuildMetadataTest { - - private static final Logger LOG = LoggerFactory.getLogger(BuildMetadataTest.class); - - @Test - public void testProperties() throws Exception { - URL url = Resources.getResource("META-INF/jcpp.properties"); - String text = Resources.asCharSource(url, Charsets.ISO_8859_1).read(); - LOG.info("Metadata is " + text); - } - - @Test - public void testMetadata() throws Exception { - BuildMetadata metadata = BuildMetadata.getInstance(); - LOG.info("Version is " + metadata.getVersion()); - LOG.info("BuildDate is " + metadata.getBuildDate()); - LOG.info("ChangeId is " + metadata.getChangeId()); - } - -} diff --git a/src/test/java/org/anarres/cpp/IncludeAbsoluteTest.java b/src/test/java/org/anarres/cpp/IncludeAbsoluteTest.java deleted file mode 100644 index df7ffb7..0000000 --- a/src/test/java/org/anarres/cpp/IncludeAbsoluteTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.anarres.cpp; - -import com.google.common.io.CharStreams; -import java.io.BufferedReader; -import java.io.File; -import java.io.Reader; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import static org.junit.Assert.*; - -/** - * - * @author shevek - */ -public class IncludeAbsoluteTest { - - private static final Logger LOG = LoggerFactory.getLogger(IncludeAbsoluteTest.class); - - @Test - public void testAbsoluteInclude() throws Exception { - File file = new File("build/resources/test/absolute.h"); - assertTrue(file.exists()); - - String input = "#include <" + file.getAbsolutePath() + ">\n"; - LOG.info("Input: " + input); - Preprocessor pp = new Preprocessor(); - pp.addInput(new StringLexerSource(input, true)); - Reader r = new CppReader(pp); - String output = CharStreams.toString(r); - r.close(); - LOG.info("Output: " + output); - assertTrue(output.contains("absolute-result")); - } -} diff --git a/src/test/java/org/anarres/cpp/MainTest.java b/src/test/java/org/anarres/cpp/MainTest.java deleted file mode 100644 index 5ff7350..0000000 --- a/src/test/java/org/anarres/cpp/MainTest.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.anarres.cpp; - -import org.junit.Test; - -public class MainTest { - - @Test - public void testMain() throws Exception { - Main.main(new String[]{"--version"}); - } -} |