Search in sources :

Example 6 with DefUseCoverageTestFitness

use of org.evosuite.coverage.dataflow.DefUseCoverageTestFitness in project evosuite by EvoSuite.

the class AllUsesAnalysis method addNewGoalToFoundPairs.

private void addNewGoalToFoundPairs(CCFGMethodEntryNode investigatedMethod, BytecodeInstruction activeDef, BytecodeInstruction freeUse, DefUsePairType type, Set<DefUseCoverageTestFitness> foundPairs) {
    checkDefinitionSanity(activeDef);
    checkUseSanity(freeUse);
    if (type.equals(DefUsePairType.INTER_METHOD) && !ccfg.isPublicMethod(investigatedMethod))
        return;
    DefUseCoverageTestFitness goal = DefUseCoverageFactory.createGoal(activeDef, freeUse, type);
    if (goal != null) {
        foundPairs.add(goal);
    // System.out.println();
    // System.out.println("  created goal: " + goal.toString());
    }
}
Also used : DefUseCoverageTestFitness(org.evosuite.coverage.dataflow.DefUseCoverageTestFitness)

Example 7 with DefUseCoverageTestFitness

use of org.evosuite.coverage.dataflow.DefUseCoverageTestFitness in project evosuite by EvoSuite.

the class AllUsesAnalysis method createIntraClassPairsForFreeUse.

private Set<DefUseCoverageTestFitness> createIntraClassPairsForFreeUse(BytecodeInstruction freeUse) {
    checkFreeUseSanity(freeUse);
    Set<DefUseCoverageTestFitness> r = new HashSet<DefUseCoverageTestFitness>();
    for (String method : determinedActiveDefs.keySet()) {
        if (!ccfg.isPublicMethod(method)) {
            continue;
        }
        Set<Map<String, BytecodeInstruction>> activeDefss = determinedActiveDefs.get(method);
        for (Map<String, BytecodeInstruction> activeDefs : activeDefss) {
            // checkActiveDefsSanity(activeDefs);
            // if (activeDefs.get(freeUse.getDUVariableName()) == null)
            // continue;
            BytecodeInstruction activeDef = activeDefs.get(freeUse.getVariableName());
            if (activeDef == null)
                continue;
            addNewGoalToFoundPairs(null, activeDef, freeUse, DefUsePairType.INTRA_CLASS, r);
        }
    }
    return r;
}
Also used : DefUseCoverageTestFitness(org.evosuite.coverage.dataflow.DefUseCoverageTestFitness) BytecodeInstruction(org.evosuite.graphs.cfg.BytecodeInstruction) HashMap(java.util.HashMap) Map(java.util.Map) HashSet(java.util.HashSet)

Aggregations

DefUseCoverageTestFitness (org.evosuite.coverage.dataflow.DefUseCoverageTestFitness)7 HashSet (java.util.HashSet)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 CCFGMethodEntryNode (org.evosuite.graphs.ccfg.CCFGMethodEntryNode)2 Constructor (java.lang.reflect.Constructor)1 Method (java.lang.reflect.Method)1 LinkedList (java.util.LinkedList)1 Set (java.util.Set)1 Branch (org.evosuite.coverage.branch.Branch)1 DefUsePairType (org.evosuite.coverage.dataflow.DefUseCoverageTestFitness.DefUsePairType)1 CCFGFieldClassCallNode (org.evosuite.graphs.ccfg.CCFGFieldClassCallNode)1 ClassCallNode (org.evosuite.graphs.ccg.ClassCallNode)1 BytecodeInstruction (org.evosuite.graphs.cfg.BytecodeInstruction)1 ConstructorStatement (org.evosuite.testcase.ConstructorStatement)1 ExecutionResult (org.evosuite.testcase.ExecutionResult)1 ExecutionTrace (org.evosuite.testcase.ExecutionTrace)1 MethodStatement (org.evosuite.testcase.MethodStatement)1 TestCase (org.evosuite.testcase.TestCase)1 TestChromosome (org.evosuite.testcase.TestChromosome)1