70 lines
2.2 KiB
Java
70 lines
2.2 KiB
Java
package bytecode;
|
|
|
|
import static org.junit.Assert.*;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.lang.reflect.Method;
|
|
import java.net.URL;
|
|
import java.net.URLClassLoader;
|
|
import java.util.Vector;
|
|
|
|
import org.junit.BeforeClass;
|
|
import org.junit.Test;
|
|
|
|
import de.dhbwstuttgart.core.JavaTXCompiler;
|
|
|
|
public class MatrixTest {
|
|
private static String path;
|
|
private static File fileToTest;
|
|
private static JavaTXCompiler compiler;
|
|
private static ClassLoader loader;
|
|
private static Class<?> classToTest;
|
|
private static String pathToClassFile;
|
|
private static Object instanceOfClass;
|
|
|
|
// @BeforeClass
|
|
// public static void setUpBeforeClass() throws Exception {
|
|
// path = System.getProperty("user.dir")+"/test/bytecode/javFiles/Matrix.jav";
|
|
// fileToTest = new File(path);
|
|
// compiler = new JavaTXCompiler(fileToTest);
|
|
// pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/";
|
|
// compiler.generateBytecode(pathToClassFile);
|
|
// loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
|
|
// classToTest = loader.loadClass("Matrix");
|
|
// instanceOfClass = classToTest.getDeclaredConstructor().newInstance();
|
|
// }
|
|
|
|
@Test
|
|
public void test() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException, IOException {
|
|
// Vector<Vector<Integer>> m1 = new Vector<>();
|
|
// Vector<Integer> r1 = new Vector<>();
|
|
// r1.addElement(1);
|
|
// r1.addElement(0);
|
|
// m1.addElement(r1);
|
|
// Vector<Integer> r2 = new Vector<>();
|
|
// r2.addElement(0);
|
|
// r2.addElement(1);
|
|
// m1.add(r2);
|
|
//
|
|
// Vector<Vector<Integer>> m2 = new Vector<>();
|
|
// Vector<Integer> mr1 = new Vector<>();
|
|
// mr1.addElement(1);
|
|
// mr1.addElement(2);
|
|
// m2.add(mr1);
|
|
// Vector<Integer> mr2 = new Vector<>();
|
|
// mr2.addElement(3);
|
|
// mr2.addElement(4);
|
|
// m2.add(mr2);
|
|
|
|
path = System.getProperty("user.dir")+"/test/bytecode/javFiles/Matrix.jav";
|
|
fileToTest = new File(path);
|
|
compiler = new JavaTXCompiler(fileToTest);
|
|
pathToClassFile = System.getProperty("user.dir")+"/testBytecode/generatedBC/";
|
|
compiler.generateBytecode(pathToClassFile);
|
|
|
|
}
|
|
|
|
}
|