modified: resources/bytecode/javFiles/Matrix.jav

modified:   src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java
	modified:   src/test/java/targetast/TestComplete.java
This commit is contained in:
pl@gohorb.ba-horb.de 2023-04-04 15:54:03 +02:00
parent 02c8dd9804
commit 86d229cac9
3 changed files with 29 additions and 3 deletions

View File

@ -1,6 +1,6 @@
import java.util.Vector;
import java.lang.Integer;
import java.lang.Float;
//import java.lang.Float;
//import java.lang.Byte;
//import java.lang.Boolean;

View File

@ -610,8 +610,8 @@ public class TYPEStmt implements StatementVisitor{
//Fuer Bytecodegenerierung PL 2020-03-09 wird derzeit nicht benutzt ENDE
methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.EQUALSDOT));
extendsMethodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.EQUALSDOT));
methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.SMALLERDOT));
extendsMethodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.SMALLERDOT));
Set<Pair> parameterContraints = generateParameterConstraints(forMethod, assumption, info, resolver);

View File

@ -279,6 +279,32 @@ public class TestComplete {
assertEquals(result, instanceOfClass_m3);
}
@Test
public void scalarTest() throws Exception {
var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Scalar.jav");
var scalar = classFiles.get("Scalar");
Vector<Vector<Integer>> vv = new Vector<>();
Vector<Integer> v1 = new Vector<> ();
v1.addElement(2);
v1.addElement(2);
var instanceOfClass_s1 = scalar.getDeclaredConstructor(Vector.class).newInstance(v1);
Vector<Integer> v2 = new Vector<> ();
v2.addElement(2);
v2.addElement(2);
var instanceOfClass_s2 = scalar.getDeclaredConstructor(Vector.class).newInstance(v2);
var mul = scalar.getDeclaredMethod("mul", Vector.class);
var result = mul.invoke(instanceOfClass_s1, instanceOfClass_s2);
System.out.println(instanceOfClass_s1.toString() + " * " + instanceOfClass_s2.toString() + " = " + result.toString());
assertEquals(result, 8);
}
@Test
public void mergeTest() throws Exception {
var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Merge.jav");