| Index: appengine/findit/crash/scorers/test/aggregator_test.py
|
| diff --git a/appengine/findit/crash/scorers/test/aggregator_test.py b/appengine/findit/crash/scorers/test/aggregator_test.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..27749ff7a98393c834ded8e7df21c834527d81ec
|
| --- /dev/null
|
| +++ b/appengine/findit/crash/scorers/test/aggregator_test.py
|
| @@ -0,0 +1,54 @@
|
| +# Copyright 2016 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +from testing_utils import testing
|
| +
|
| +from common.change_log import ChangeLog
|
| +from crash.callstack import StackFrame
|
| +from crash.results import MatchResult
|
| +from crash.scorers.aggregator import Aggregator
|
| +from crash.scorers.min_distance import MinDistance
|
| +from crash.scorers.top_frame_index import TopFrameIndex
|
| +
|
| +DUMMY_CHANGELOG = ChangeLog.FromDict({
|
| + 'author_name': 'r@chromium.org',
|
| + 'message': 'dummy',
|
| + 'committer_email': 'r@chromium.org',
|
| + 'commit_position': 175900,
|
| + 'author_email': 'r@chromium.org',
|
| + 'touched_files': [
|
| + {
|
| + 'change_type': 'add',
|
| + 'new_path': 'a.cc',
|
| + 'old_path': None,
|
| + },
|
| + ],
|
| + 'author_time': 'Thu Mar 31 21:24:43 2016',
|
| + 'committer_time': 'Thu Mar 31 21:28:39 2016',
|
| + 'commit_url':
|
| + 'https://repo.test/+/1',
|
| + 'code_review_url': 'https://codereview.chromium.org/3281',
|
| + 'committer_name': 'example@chromium.org',
|
| + 'revision': '1',
|
| + 'reverted_revision': None
|
| +})
|
| +
|
| +
|
| +class AggregatorTest(testing.AppengineTestCase):
|
| +
|
| + def testScoreAndReason(self):
|
| + result = MatchResult(DUMMY_CHANGELOG, 'src/', '')
|
| + result.file_to_stack_infos = {
|
| + 'a.cc': [(StackFrame(0, 'src/', '', 'func', 'a.cc', [7]), 0)]
|
| + }
|
| + result.min_distance = 0
|
| +
|
| + aggregator = Aggregator([TopFrameIndex(), MinDistance()])
|
| + aggregator.ScoreAndReason(result)
|
| +
|
| + self.assertEqual(result.confidence, 1)
|
| + self.assertEqual(result.reason,
|
| + ('1. Top frame changed is frame #0 (score: 1)\n'
|
| + '2. Minimum distance to crashed line is 0 (score: 1)\n'
|
| + '\nChanged file a.cc which crashed in func (#0)'))
|
|
|