From 47c2b787133b42ec48a4c794708a626165069e1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Thu, 12 May 2016 21:14:57 +0200 Subject: [PATCH] =?UTF-8?q?Testfall=20f=C3=BCr=20Bug=2048:=20Uninizierte?= =?UTF-8?q?=20Variablen=20erstellt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/bytecode/UninitializedVariable.jav | 15 ++++++++ test/bytecode/UninitializedVariableTest.java | 39 ++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 test/bytecode/UninitializedVariable.jav create mode 100644 test/bytecode/UninitializedVariableTest.java diff --git a/test/bytecode/UninitializedVariable.jav b/test/bytecode/UninitializedVariable.jav new file mode 100644 index 00000000..0854d0a9 --- /dev/null +++ b/test/bytecode/UninitializedVariable.jav @@ -0,0 +1,15 @@ +import java.util.Vector; + +class UninitializedVariable{ + + Integer method(Integer v) { + return v; + } + + public static void main(String[] args) { + UninitializedVariable ol; + ol = new UninitializedVariable(); + Integer v; + ol.method(v); + } +} \ No newline at end of file diff --git a/test/bytecode/UninitializedVariableTest.java b/test/bytecode/UninitializedVariableTest.java new file mode 100644 index 00000000..838d9708 --- /dev/null +++ b/test/bytecode/UninitializedVariableTest.java @@ -0,0 +1,39 @@ +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 UninitializedVariableTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "UninitializedVariable"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } + + @Test + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } +}