| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from crash.callstack import StackFrame | 5 from crash.callstack import StackFrame |
| 6 from crash.results import MatchResult | 6 from crash.results import MatchResult |
| 7 from crash.scorers.aggregator import Aggregator | 7 from crash.scorers.aggregator import Aggregator |
| 8 from crash.scorers.min_distance import MinDistance | 8 from crash.scorers.min_distance import MinDistance |
| 9 from crash.scorers.test.scorer_test_suite import ScorerTestSuite | 9 from crash.scorers.test.scorer_test_suite import ScorerTestSuite |
| 10 from crash.scorers.top_frame_index import TopFrameIndex | 10 from crash.scorers.top_frame_index import TopFrameIndex |
| 11 | 11 |
| 12 | 12 |
| 13 class AggregatorTest(ScorerTestSuite): | 13 class AggregatorTest(ScorerTestSuite): |
| 14 | 14 |
| 15 def testScoreAndReason(self): | 15 def testScoreAndReason(self): |
| 16 result = MatchResult(self._GetDummyChangeLog(), 'src/', '') | 16 result = MatchResult(self._GetDummyChangeLog(), 'src/', '') |
| 17 result.file_to_stack_infos = { | 17 result.file_to_stack_infos = { |
| 18 'a.cc': [(StackFrame(0, 'src/', '', 'func', 'a.cc', [7]), 0)] | 18 'a.cc': [(StackFrame(0, 'src/', 'func', 'a.cc', 'src/a.cc', [7]), 0)] |
| 19 } | 19 } |
| 20 result.min_distance = 0 | 20 result.min_distance = 0 |
| 21 | 21 |
| 22 aggregator = Aggregator([TopFrameIndex(), MinDistance()]) | 22 aggregator = Aggregator([TopFrameIndex(), MinDistance()]) |
| 23 aggregator.ScoreAndReason(result) | 23 aggregator.ScoreAndReason(result) |
| 24 | 24 |
| 25 self.assertEqual(result.confidence, 1) | 25 self.assertEqual(result.confidence, 1) |
| 26 self.assertEqual(result.reason, | 26 self.assertEqual(result.reason, |
| 27 ('(1) Modified top crashing frame is #0\n' | 27 ('(1) Modified top crashing frame is #0\n' |
| 28 '(2) Modification distance (LOC) is 0\n\n' | 28 '(2) Modification distance (LOC) is 0\n\n' |
| 29 'Changed file a.cc crashed in func (#0)')) | 29 'Changed file a.cc crashed in func (#0)')) |
| OLD | NEW |