def test_single_step(self): trace = [MacroStep(0, steps=[ MicroStep(entered_states=['a', 'b', 'c'], transition=Transition('x')), MicroStep(entered_states=['a', 'b'], transition=Transition('x')), MicroStep(entered_states=['a']), MicroStep(entered_states=[]) ])] self.assertEqual(coverage_from_trace(trace), (Counter(a=3, b=2, c=1), Counter({Transition('x'): 2})))
def test_multiple_steps(self): trace = [MacroStep(0, steps=[ MicroStep(entered_states=['a', 'b', 'c'], transition=Transition('x')), MicroStep(entered_states=['a', 'b'], transition=Transition('x')), MicroStep(entered_states=['a']), MicroStep(entered_states=[]) ])] trace.extend(trace) self.assertEqual(coverage_from_trace(trace), (Counter(a=6, b=4, c=2), Counter({Transition('x'): 4})))
def test_single_step(self): trace = [ MacroStep(0, steps=[ MicroStep(entered_states=['a', 'b', 'c'], transition=Transition('x')), MicroStep(entered_states=['a', 'b'], transition=Transition('x')), MicroStep(entered_states=['a']), MicroStep(entered_states=[]) ]) ] self.assertEqual( coverage_from_trace(trace), (Counter(a=3, b=2, c=1), Counter({Transition('x'): 2})))
def test_multiple_steps(self): trace = [ MacroStep(0, steps=[ MicroStep(entered_states=['a', 'b', 'c'], transition=Transition('x')), MicroStep(entered_states=['a', 'b'], transition=Transition('x')), MicroStep(entered_states=['a']), MicroStep(entered_states=[]) ]) ] trace.extend(trace) self.assertEqual( coverage_from_trace(trace), (Counter(a=6, b=4, c=2), Counter({Transition('x'): 4})))
def test_empty_trace(self): self.assertEqual(coverage_from_trace([]), (Counter(), Counter()))