forked from JavaTX/JavaCompilerCore
mathStruc.jav hinzugefügt
This commit is contained in:
parent
a41e9804a0
commit
82c0837d1f
38
src/test/java/bytecode/mathStrucTest.java
Normal file
38
src/test/java/bytecode/mathStrucTest.java
Normal file
@ -0,0 +1,38 @@
|
||||
package bytecode;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import de.dhbwstuttgart.core.JavaTXCompiler;
|
||||
|
||||
public class mathStrucTest {
|
||||
|
||||
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 {
|
||||
path = System.getProperty("user.dir")+"/src/test/resources/bytecode/javFiles/mathStruc.jav";
|
||||
fileToTest = new File(path);
|
||||
compiler = new JavaTXCompiler(fileToTest);
|
||||
compiler.generateBytecode(System.getProperty("user.dir")+"/src/test/resources/testBytecode/generatedBC/");
|
||||
pathToClassFile = System.getProperty("user.dir")+"/src/test/resources/testBytecode/generatedBC/";
|
||||
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
|
||||
classToTest = loader.loadClass("mathStruc");
|
||||
instanceOfClass = classToTest.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
|
||||
}
|
@ -3,9 +3,9 @@ import java.lang.Integer;
|
||||
//import java.lang.Short;
|
||||
|
||||
public class Faculty {
|
||||
public fact;
|
||||
Faculty() {
|
||||
fact = (x) -> {
|
||||
//public fact;
|
||||
//Faculty() {
|
||||
public fact = (x) -> {
|
||||
if (x == 1) {
|
||||
return 1;
|
||||
}
|
||||
@ -13,7 +13,7 @@ public class Faculty {
|
||||
return x * (fact.apply(x-1));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
public getFact(x) {
|
||||
|
@ -7,7 +7,8 @@ public class Tph3 {
|
||||
// m2(a,b){
|
||||
// return m(a,b);
|
||||
// }
|
||||
m1(x, y) { m2(x); x = y; }
|
||||
m1(x, y) { m2(x); x = y;
|
||||
}
|
||||
|
||||
m2(y) { m1(y, y); }
|
||||
}
|
||||
|
@ -2,11 +2,11 @@ public class Tph4{
|
||||
m(a,b){
|
||||
var c = m2(b);
|
||||
var d = m2(c);
|
||||
return a;
|
||||
return d;
|
||||
}
|
||||
|
||||
m2(b){
|
||||
return b
|
||||
return b;
|
||||
}
|
||||
|
||||
}
|
11
src/test/resources/bytecode/javFiles/mathStruc.jav
Normal file
11
src/test/resources/bytecode/javFiles/mathStruc.jav
Normal file
@ -0,0 +1,11 @@
|
||||
class mathStruc {
|
||||
model;
|
||||
|
||||
//Fun1*<Fun2*<A,A,A>, Fun1*<MathStruc <A>,MathStruc <A>>>
|
||||
innerOp = (o) -> (ms) -> new mathStruc<>(o.apply(model,ms.model));
|
||||
|
||||
mathStruc(m) {
|
||||
model =m;
|
||||
//innerOp = (o) -> (ms) -> new mathStruc<>(o.apply(this.model,ms.model));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user