Exemple #1
0
def test_analyze_traces_has_exception(has_ex):
    results = []
    result = MagicMock(ExecutionResult)
    result.has_test_exceptions.return_value = has_ex
    results.append(result)
    has_exception, trace = BranchDistanceSuiteFitnessFunction.analyze_traces(
        results)
    assert has_ex == has_exception
Exemple #2
0
def test_analyze_traces_merge(trace_mock):
    results = []
    result = MagicMock(ExecutionResult)
    result.has_test_exceptions.return_value = False
    trace_mock.true_distances[0] = 1
    trace_mock.true_distances[1] = 2
    trace_mock.executed_predicates[0] = 1
    trace_mock.executed_code_objects.add(0)
    result.execution_trace = trace_mock
    results.append(result)
    has_exception, trace = BranchDistanceSuiteFitnessFunction.analyze_traces(
        results)
    assert not has_exception
    assert trace == trace_mock
Exemple #3
0
def test_analyze_traces_empty():
    results = []
    has_exception, trace = BranchDistanceSuiteFitnessFunction.analyze_traces(
        results)
    assert not has_exception
    assert trace == ExecutionTrace()