forked from JavaTX/JavaCompilerCore
new file: ../../AllgemeinTest/VectorConstAdd.jav
modified: ../../bytecode/javFiles/VectorAdd.jav new file: ../../../src/test/java/AllgemeinTest.java wieder hergestellt.
This commit is contained in:
parent
f8c8e2c805
commit
291fee12db
15
resources/AllgemeinTest/VectorConstAdd.jav
Normal file
15
resources/AllgemeinTest/VectorConstAdd.jav
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import java.util.Vector;
|
||||||
|
import java.lang.Integer;
|
||||||
|
|
||||||
|
|
||||||
|
public class VectorConstAdd {
|
||||||
|
vectorAdd(v1) {
|
||||||
|
var i = 0;
|
||||||
|
var erg = new Vector<>();
|
||||||
|
while (i < v1.size()) {
|
||||||
|
erg.addElement(v1.elementAt(i) + 1);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return erg;
|
||||||
|
}
|
||||||
|
}
|
@ -1,26 +1,6 @@
|
|||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.lang.Integer;
|
import java.lang.Integer;
|
||||||
import java.lang.String;
|
|
||||||
import java.lang.Byte;
|
|
||||||
import java.lang.Boolean;
|
|
||||||
//import java.util.Vector;
|
|
||||||
//import java.util.Collection;
|
|
||||||
/*
|
|
||||||
public class VectorAdd {
|
|
||||||
|
|
||||||
add(v1, v2) {
|
|
||||||
var ret = new Vector();
|
|
||||||
var i = 0;
|
|
||||||
var erg;
|
|
||||||
while(i < v1.size()) {
|
|
||||||
erg = v1.elementAt(i) + v2.elementAt(i);
|
|
||||||
ret.addElement(erg);
|
|
||||||
}
|
|
||||||
v1.addAll
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class VectorAdd {
|
public class VectorAdd {
|
||||||
vectorAdd(v1, v2) {
|
vectorAdd(v1, v2) {
|
||||||
@ -32,11 +12,4 @@ public class VectorAdd {
|
|||||||
}
|
}
|
||||||
return erg;
|
return erg;
|
||||||
}
|
}
|
||||||
|
|
||||||
//addEle(z) {
|
|
||||||
// var x;
|
|
||||||
// var y;
|
|
||||||
// x.add(y);
|
|
||||||
// z = x;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
72
src/test/java/AllgemeinTest.java
Normal file
72
src/test/java/AllgemeinTest.java
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLClassLoader;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
import de.dhbwstuttgart.core.JavaTXCompiler;
|
||||||
|
|
||||||
|
public class AllgemeinTest {
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test() throws Exception {
|
||||||
|
//String className = "GenTest";
|
||||||
|
//String className = "Overloading_Generics";
|
||||||
|
//String className = "Generics";
|
||||||
|
//String className = "OverloadingMain";
|
||||||
|
//String className = "OverrideMain";
|
||||||
|
//String className = "OverrideMainRet";
|
||||||
|
//String className = "FCTest1";
|
||||||
|
//String className = "FCTest2";
|
||||||
|
//String className = "Pair";
|
||||||
|
//String className = "FCTest3";
|
||||||
|
//String className = "Var";
|
||||||
|
//String className = "Put";
|
||||||
|
//String className = "Twice";
|
||||||
|
//String className = "TestSubTypless";
|
||||||
|
//String className = "addList";
|
||||||
|
//String className = "M";
|
||||||
|
//String className = "Wildcard_Andi";
|
||||||
|
//String className = "Box";
|
||||||
|
//String className = "Box_Main";
|
||||||
|
//String className = "wildcardPair";
|
||||||
|
String className = "VectorConstAdd";
|
||||||
|
//PL 2019-10-24: genutzt fuer unterschiedliche Tests
|
||||||
|
path = System.getProperty("user.dir")+"/resources/AllgemeinTest/" + className + ".jav";
|
||||||
|
//path = System.getProperty("user.dir")+"/src/test/resources/AllgemeinTest/Overloading_Generics.jav";
|
||||||
|
//path = System.getProperty("user.dir")+"/src/test/resources/bytecode/javFiles/mathStrucInteger.jav";
|
||||||
|
//compiler = new JavaTXCompiler(Lists.newArrayList(new File(System.getProperty("user.dir")+"/src/test/resources/AllgemeinTest/Overloading_Generics.jav")));
|
||||||
|
///*
|
||||||
|
compiler = new JavaTXCompiler(
|
||||||
|
Lists.newArrayList(new File(path)),
|
||||||
|
Lists.newArrayList(new File(System.getProperty("user.dir")+"/resources/testBytecode/generatedBC/")));
|
||||||
|
//*/
|
||||||
|
compiler.generateBytecode(System.getProperty("user.dir")+"/resources/testBytecode/generatedBC/");
|
||||||
|
pathToClassFile = System.getProperty("user.dir")+"/resources/testBytecode/generatedBC/";
|
||||||
|
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
|
||||||
|
classToTest = loader.loadClass(className);
|
||||||
|
//classToTest = loader.loadClass("Overloading_Generics");
|
||||||
|
//instanceOfClass = classToTest.getDeclaredConstructor().newInstance("A");
|
||||||
|
//classToTest = loader.loadClass("Overloading_Generics1");
|
||||||
|
//instanceOfClass = classToTest.getDeclaredConstructor(Object.class).newInstance("B");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user