This commit is contained in:
Fayez Abu Alia 2018-08-06 13:34:34 +02:00
commit d6364040fa
3 changed files with 18 additions and 17 deletions

View File

@ -1,12 +1,13 @@
package bytecode;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import java.io.File;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import org.junit.BeforeClass;
import org.junit.Test;
import de.dhbwstuttgart.core.JavaTXCompiler;
@ -20,24 +21,21 @@ public class MergeTest {
private static String pathToClassFile;
private static Object instanceOfClass;
// @BeforeClass
// public static void setUpBeforeClass() throws Exception {
// path = System.getProperty("user.dir")+"/test/bytecode/javFiles/Merge.jav";
// fileToTest = new File(path);
// compiler = new JavaTXCompiler(fileToTest);
// compiler.generateBytecode(System.getProperty("user.dir")+"/testBytecode/generatedBC/");
// pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/";
// loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
// classToTest = loader.loadClass("Merge");
// instanceOfClass = classToTest.getDeclaredConstructor().newInstance();
// }
@Test
public void generateBC() throws Exception{
public void generateBC() throws Exception {
path = System.getProperty("user.dir")+"/test/bytecode/javFiles/Merge.jav";
fileToTest = new File(path);
compiler = new JavaTXCompiler(fileToTest);
compiler.generateBytecode(System.getProperty("user.dir")+"/testBytecode/generatedBC/");
}
pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/";
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
classToTest = loader.loadClass("Merge");
//instanceOfClass = classToTest.getDeclaredConstructor().newInstance();
//Method m = classToTest.getDeclaredMethod("m");
//Object result = m.invoke(instanceOfClass);
//assertEquals(result.getClass(), loader.loadClass("Apply"));
}
}

View File

@ -9,9 +9,12 @@ class Merge {
return a;
}
/*
sort(in){
var firstHalf = in.subList(1,2);
var secondHalf = in.subList(1,2);
return merge(sort(firstHalf), sort(secondHalf));
}
*/
}

View File

@ -15,7 +15,7 @@ public class OL {
public class OLMain {
main(x) {
main(java.lang.Integer x) {
var ol;
ol = new OL();
return ol.m(x);