Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: appengine/findit/crash/scorers/test/min_distance_test.py

Issue 1861373003: [Findit] Initial code of findit for crash. Add scorers to apply heuristic rules. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fix nits and rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 from crash.results import Result, MatchResult
6 from crash.scorers.min_distance import MinDistance
7 from crash.scorers.test.scorer_test_suite import ScorerTestSuite
8
9
10 class MinDistanceTest(ScorerTestSuite):
11
12 def testGetMetric(self):
13 dummy_changelog = self._GetDummyChangeLog()
14 match_result = MatchResult(dummy_changelog, 'src/', '')
15 match_result.min_distance = 0
16
17 self.assertEqual(MinDistance().GetMetric(match_result), 0)
18
19 result = Result(dummy_changelog, 'src/', '')
20 self.assertEqual(MinDistance().GetMetric(result), None)
21
22 def testScore(self):
23 self.assertEqual(MinDistance().Score(0), 1)
24 self.assertEqual(MinDistance().Score(30), 0.8)
25 self.assertEqual(MinDistance().Score(60), 0)
26
27 def testReason(self):
28 self.assertEqual(MinDistance().Reason(0, 1),
29 'Minimum distance to crashed line is 0')
30 self.assertEqual(MinDistance().Reason(60, 0),
31 '')
OLDNEW
« no previous file with comments | « appengine/findit/crash/scorers/test/aggregator_test.py ('k') | appengine/findit/crash/scorers/test/scorer_test_suite.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698