OL Test eingefügt

This commit is contained in:
Fayez Abu Alia 2018-04-11 13:55:32 +02:00
parent 32ab198f9e
commit 52a96d7253
3 changed files with 24 additions and 15 deletions

View File

@ -11,7 +11,7 @@ import org.junit.Test;
import de.dhbwstuttgart.core.JavaTXCompiler; import de.dhbwstuttgart.core.JavaTXCompiler;
public class Op2Test { public class OLTest {
private static String path; private static String path;
private static File fileToTest; private static File fileToTest;
private static JavaTXCompiler compiler; private static JavaTXCompiler compiler;
@ -22,13 +22,13 @@ public class Op2Test {
@BeforeClass @BeforeClass
public static void setUpBeforeClass() throws Exception { public static void setUpBeforeClass() throws Exception {
path = System.getProperty("user.dir")+"/test/bytecode/javFiles/Op2.jav"; path = System.getProperty("user.dir")+"/test/bytecode/javFiles/OL.jav";
fileToTest = new File(path); fileToTest = new File(path);
compiler = new JavaTXCompiler(fileToTest); compiler = new JavaTXCompiler(fileToTest);
compiler.generateBytecode(); compiler.generateBytecode();
pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/"; pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/";
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
classToTest = loader.loadClass("Op2"); classToTest = loader.loadClass("OL");
instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); instanceOfClass = classToTest.getDeclaredConstructor().newInstance();
} }
@Test @Test

View File

@ -0,0 +1,9 @@
import java.lang.Integer;
import java.lang.Boolean;
class OL {
m(Integer x) { return x + x; }
m(Boolean x) {return x || x; }
}

View File

@ -32,18 +32,18 @@ public class Op {
// return c; // return c;
// } // }
// subInt(Integer a, Integer b) { subInt(Integer a, Integer b) {
// Integer c = a-b; Integer c = a-b;
// return c; return c;
// } }
// subLong(Long a, Long b) { subLong(Long a, Long b) {
// Long c = a-b; Long c = a-b;
// return c; return c;
// } }
// subFloat(Float a, Float b) { subFloat(Float a, Float b) {
// Float c = a-b; Float c = a-b;
// return c; return c;
// } }
// subDouble(Double a, Double b) { // subDouble(Double a, Double b) {
// Double c = a-b; // Double c = a-b;
// return c; // return c;