JavaTXCompilerInJavaTX/test/mycompiler/test/trivial/TestClassMember.java
2014-09-02 10:33:54 +02:00

46 lines
1.4 KiB
Java
Executable File

package mycompiler.test.trivial;
import java.util.Vector;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import mycompiler.test.AbstractInferenceTest;
import mycompiler.test.expectationTypes.ClassExpect;
import mycompiler.test.expectationTypes.Expectation;
import mycompiler.test.expectationTypes.VarExpect;
/**
* 01-04-08
* @author
*
* This test verifies correct detection of a member variable.
*/
public class TestClassMember extends AbstractInferenceTest {
private final static String TESTEDCLASSNAME="TestClassMember";
private final static String JAVPATH="test/mycompiler/test/trivial/";
public TestClassMember(String name) {
super(name,TestClassMember.JAVPATH+TestClassMember.TESTEDCLASSNAME + ".jav");
}
@Override
protected Expectation getExpectations() {
//class--- TestClassMember
ClassExpect testClassMember = new ClassExpect(TestClassMember.TESTEDCLASSNAME);
//member
VarExpect member = new VarExpect("member",new RefType("java.lang.Integer",-1));
Vector<Type> param = new Vector<Type>();
param.add(new RefType("java.lang.String",-1));
RefType member2Type = new RefType("java.util.Vector",param,-1);
VarExpect member2 = new VarExpect("member2",member2Type);
testClassMember.addMember(member);
testClassMember.addMember(member2);
//Expectation
return new Expectation(testClassMember);
}
}