From 68aa4272209a6a7e86208bdd7d2fcfca7dca4d73 Mon Sep 17 00:00:00 2001 From: "Schubert, Julia (WWI2012D)" Date: Mon, 22 Jun 2015 16:26:18 +0200 Subject: [PATCH] =?UTF-8?q?BCEL=20Test=20f=C3=BCr=20BoolLit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .classpath | 24 ++++----- bin/log4j.xml | 70 +++++++++++++------------- bin/log4jTesting.xml | 48 +++++++++--------- bin/parser/BoundedParameter.jav | 6 +-- bin/parser/FieldInitializationTest.jav | 4 +- bin/parser/GenericFieldVarTest.jav | 6 +-- bin/parser/ImportTest.jav | 6 +-- test/bytecode/BoolLit.jav | 7 +++ test/bytecode/BoolLitTest.java | 45 +++++++++++++++++ 9 files changed, 134 insertions(+), 82 deletions(-) create mode 100644 test/bytecode/BoolLit.jav create mode 100644 test/bytecode/BoolLitTest.java diff --git a/.classpath b/.classpath index 1a1e4004..8448ba69 100755 --- a/.classpath +++ b/.classpath @@ -1,12 +1,12 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/bin/log4j.xml b/bin/log4j.xml index 64e7c5db..f36fb342 100755 --- a/bin/log4j.xml +++ b/bin/log4j.xml @@ -1,35 +1,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/log4jTesting.xml b/bin/log4jTesting.xml index dc30c245..ef849218 100755 --- a/bin/log4jTesting.xml +++ b/bin/log4jTesting.xml @@ -1,24 +1,24 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/parser/BoundedParameter.jav b/bin/parser/BoundedParameter.jav index 6d7518a9..0cb21f77 100644 --- a/bin/parser/BoundedParameter.jav +++ b/bin/parser/BoundedParameter.jav @@ -1,3 +1,3 @@ -class Matrix{ - String op = "String"; -} +class Matrix{ + String op = "String"; +} diff --git a/bin/parser/FieldInitializationTest.jav b/bin/parser/FieldInitializationTest.jav index 302667b9..35b56df8 100644 --- a/bin/parser/FieldInitializationTest.jav +++ b/bin/parser/FieldInitializationTest.jav @@ -1,3 +1,3 @@ -class FieldInitializationTest{ - String var = "hallo"; +class FieldInitializationTest{ + String var = "hallo"; } \ No newline at end of file diff --git a/bin/parser/GenericFieldVarTest.jav b/bin/parser/GenericFieldVarTest.jav index a47b41eb..214c3f94 100644 --- a/bin/parser/GenericFieldVarTest.jav +++ b/bin/parser/GenericFieldVarTest.jav @@ -1,3 +1,3 @@ -class Test{ - A var; -} +class Test{ + A var; +} diff --git a/bin/parser/ImportTest.jav b/bin/parser/ImportTest.jav index 2de55cee..bec195d8 100644 --- a/bin/parser/ImportTest.jav +++ b/bin/parser/ImportTest.jav @@ -1,4 +1,4 @@ -import java.util.*; - -class ImportTest{ +import java.util.*; + +class ImportTest{ } \ No newline at end of file diff --git a/test/bytecode/BoolLit.jav b/test/bytecode/BoolLit.jav new file mode 100644 index 00000000..3e295c93 --- /dev/null +++ b/test/bytecode/BoolLit.jav @@ -0,0 +1,7 @@ +class BoolLit{ + + + + + +} \ No newline at end of file diff --git a/test/bytecode/BoolLitTest.java b/test/bytecode/BoolLitTest.java new file mode 100644 index 00000000..ef7b0fc3 --- /dev/null +++ b/test/bytecode/BoolLitTest.java @@ -0,0 +1,45 @@ +package bytecode; + +import static org.junit.Assert.*; + +import java.io.File; +import java.io.IOException; + +import junit.framework.TestCase; + +import org.junit.Test; + +import plugindevelopment.TypeInsertTester; +import de.dhbwstuttgart.core.MyCompiler; +import de.dhbwstuttgart.core.MyCompilerAPI; +import de.dhbwstuttgart.logger.LoggerConfiguration; +import de.dhbwstuttgart.logger.Section; +import de.dhbwstuttgart.parser.JavaParser.yyException; +import de.dhbwstuttgart.typeinference.ByteCodeResult; +import de.dhbwstuttgart.typeinference.Menge; +import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; +import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; + +public class BoolLitTest { + + public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + public final static String testFile = "BoolLit.jav"; + public final static String outputFile = "BoolLit.class"; + + @Test + public void test() { + LoggerConfiguration logConfig = new LoggerConfiguration().setOutput(Section.PARSER, System.out); + MyCompilerAPI compiler = MyCompiler.getAPI(logConfig); + try { + compiler.parse(new File(rootDirectory + testFile)); + compiler.typeReconstruction(); + ByteCodeResult bytecode = compiler.generateBytecode(); + System.out.println(bytecode); + bytecode.getByteCode().getJavaClass().dump(new File(rootDirectory + outputFile)); + } catch (IOException | yyException e) { + e.printStackTrace(); + TestCase.fail(); + } + } + +}