Search in sources :

Example 6 with ABSData

use of apet.testCases.ABSData in project abstools by abstools.

the class MethodTestCaseBuilder method makePreviousCalls.

@Override
List<Exp> makePreviousCalls(String testName, Set<String> heapNames, List<PreviousCall> calls) {
    // task interleaving
    List<Exp> expressions = new ArrayList<Exp>();
    for (PreviousCall call : calls) {
        // test execution
        List<ABSData> callInputArguments = getCallArgs(call);
        String methodName = removeClassName(getMethodName(call));
        expressions.add(makeMethodCall(testName, heapNames, methodName, callInputArguments, false));
    }
    return expressions;
}
Also used : ArrayList(java.util.ArrayList) ABSData(apet.testCases.ABSData) PureExp(abs.frontend.ast.PureExp) Exp(abs.frontend.ast.Exp) PreviousCall(apet.testCases.PreviousCall)

Example 7 with ABSData

use of apet.testCases.ABSData in project abstools by abstools.

the class MethodTestCaseBuilder method makeMethodCall.

private Call makeMethodCall(String testName, Set<String> heapNames, String methodName, List<ABSData> inArgs, boolean sync) {
    if (inArgs.size() == 0) {
        throw new IllegalStateException("Inputs for a method must at least have a reference");
    }
    ABSData r = inArgs.get(0);
    if (!(r instanceof ABSRef)) {
        throw new IllegalStateException("Inputs for a method must at least have a reference");
    }
    PureExp[] ps = new PureExp[inArgs.size() - 1];
    for (int i = 1; i < inArgs.size(); i++) {
        ABSData d = inArgs.get(i);
        PureExp exp = pureExpBuilder.createPureExpression(testName, heapNames, d);
        ps[i - 1] = exp;
    }
    String rn = getABSDataValue(r);
    VarUse var = new VarUse(heapRefBuilder.heapReferenceForTest(testName, rn));
    Call call = getCall(var, methodName, sync, ps);
    return call;
}
Also used : Call(abs.frontend.ast.Call) PreviousCall(apet.testCases.PreviousCall) AbsASTBuilderUtil.getCall(abs.backend.tests.AbsASTBuilderUtil.getCall) ABSRef(apet.testCases.ABSRef) ABSData(apet.testCases.ABSData) PureExp(abs.frontend.ast.PureExp) VarUse(abs.frontend.ast.VarUse)

Example 8 with ABSData

use of apet.testCases.ABSData in project abstools by abstools.

the class PureExpressionBuilder method parseValue.

DataConstructorExp parseValue(String currentHeapReference, List<String> initialisationsOrders, String testName, Set<String> heap, ABSTerm term) {
    final DataConstructorExp result = new DataConstructorExp();
    String fn = getABSTermFunctor(term);
    result.setConstructor(fn);
    result.setParamList(new abs.frontend.ast.List<PureExp>());
    List<ABSData> vs = getABSTermArgs(term);
    for (int i = 0; i < vs.size(); i++) {
        result.setParam(createPureExpression(currentHeapReference, initialisationsOrders, testName, heap, vs.get(i)), i);
    }
    return result;
}
Also used : DataConstructorExp(abs.frontend.ast.DataConstructorExp) ABSData(apet.testCases.ABSData) PureExp(abs.frontend.ast.PureExp)

Aggregations

ABSData (apet.testCases.ABSData)8 PureExp (abs.frontend.ast.PureExp)6 VarUse (abs.frontend.ast.VarUse)4 PreviousCall (apet.testCases.PreviousCall)4 ABSRef (apet.testCases.ABSRef)3 ArrayList (java.util.ArrayList)3 AbsASTBuilderUtil.getCall (abs.backend.tests.AbsASTBuilderUtil.getCall)2 Call (abs.frontend.ast.Call)2 ClassDecl (abs.frontend.ast.ClassDecl)2 Exp (abs.frontend.ast.Exp)2 InterfaceTypeUse (abs.frontend.ast.InterfaceTypeUse)2 HashMap (java.util.HashMap)2 List (java.util.List)2 DeclNamePredicate (abs.backend.tests.AbsASTBuilderUtil.DeclNamePredicate)1 AbsASTBuilderUtil.getExpStmt (abs.backend.tests.AbsASTBuilderUtil.getExpStmt)1 Block (abs.frontend.ast.Block)1 DataConstructorExp (abs.frontend.ast.DataConstructorExp)1 DataTypeUse (abs.frontend.ast.DataTypeUse)1 EqExp (abs.frontend.ast.EqExp)1 FieldDecl (abs.frontend.ast.FieldDecl)1