Search in sources :

Example 1 with Call

use of org.evosuite.setup.Call in project evosuite by EvoSuite.

the class IBranchSuiteFitness method countGoals.

private void countGoals(List<IBranchTestFitness> branchGoals) {
    int totalGoals = branchGoals.size();
    int goalsInTarget = 0;
    for (IBranchTestFitness g : branchGoals) {
        boolean flag = true;
        for (Call call : g.getContext().getContext()) {
            if (!call.getClassName().equals(Properties.TARGET_CLASS)) {
                flag = false;
                break;
            }
        }
        if (flag)
            goalsInTarget++;
    }
    ClientServices.getInstance().getClientNode().trackOutputVariable(RuntimeVariable.IBranchInitialGoals, totalGoals);
    ClientServices.getInstance().getClientNode().trackOutputVariable(RuntimeVariable.IBranchInitialGoalsInTargetClass, goalsInTarget);
}
Also used : Call(org.evosuite.setup.Call)

Example 2 with Call

use of org.evosuite.setup.Call in project evosuite by EvoSuite.

the class CallGraph method getMethodEntryPoint.

/**
 * computes and returns the call contexts of the specific method
 *
 * @param className
 * @param methodName
 * @return
 */
public Set<CallContext> getMethodEntryPoint(String className, String methodName) {
    Set<CallContext> contexts = new HashSet<>();
    List<Call> cont = new ArrayList<>();
    cont.add(new Call(className, methodName));
    CallContext context = new CallContext(cont);
    if (publicMethods.contains(context)) {
        contexts.add(context);
    } else {
        contexts.add(new CallContext());
    }
    return contexts;
}
Also used : Call(org.evosuite.setup.Call) ArrayList(java.util.ArrayList) CallContext(org.evosuite.setup.CallContext) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Example 3 with Call

use of org.evosuite.setup.Call in project evosuite by EvoSuite.

the class CallGraph method addPublicClassMethod.

private void addPublicClassMethod(String className, String methodName, Set<CallContext> contexts) {
    List<Call> calls = new ArrayList<>();
    Call call = new Call(className, methodName);
    calls.add(call);
    CallContext context = new CallContext(calls);
    if (publicMethods.contains(context) && className.equals(this.className))
        contexts.add(context);
}
Also used : Call(org.evosuite.setup.Call) ArrayList(java.util.ArrayList) CallContext(org.evosuite.setup.CallContext)

Example 4 with Call

use of org.evosuite.setup.Call in project evosuite by EvoSuite.

the class CallGraph method convertIntoCallContext.

private Set<CallContext> convertIntoCallContext(Set<List<CallGraphEntry>> paths) {
    Set<CallContext> contexts = new HashSet<>();
    // return only context that starts from the class under test
    for (List<CallGraphEntry> list : paths) {
        boolean insert = false;
        List<Call> cont = new ArrayList<>();
        for (int i = list.size() - 1; i >= 0; i--) {
            if (!insert && list.get(i).getClassName().equals(className)) {
                insert = true;
            }
            if (insert)
                cont.add(new Call(list.get(i).getClassName(), list.get(i).getMethodName()));
        }
        contexts.add(new CallContext(cont));
    }
    return contexts;
}
Also used : Call(org.evosuite.setup.Call) ArrayList(java.util.ArrayList) CallContext(org.evosuite.setup.CallContext) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Aggregations

Call (org.evosuite.setup.Call)4 ArrayList (java.util.ArrayList)3 CallContext (org.evosuite.setup.CallContext)3 HashSet (java.util.HashSet)2 LinkedHashSet (java.util.LinkedHashSet)2