| OLD | NEW |
| (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 '') |
| OLD | NEW |