Skip to content

Commit bc57d68

Browse files
Grociucmccandless
authored andcommitted
darts: update tests to canonical data 2.2.0 (#1847)
* darts-update-to-220
1 parent d610158 commit bc57d68

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

exercises/darts/darts_test.py

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,47 @@
22
from darts import score
33

44

5-
# Tests adapted from `problem-specifications//canonical-data.json` @ v2.0.0
5+
# Tests adapted from `problem-specifications//canonical-data.json` @ v2.2.0
66

77
class darts_test(unittest.TestCase):
8-
def test_dart_lands_outside_target(self):
8+
def test_missed_target(self):
99
self.assertEqual(score(-9, 9), 0)
1010

11-
def test_dart_lands_just_in_border_of_target(self):
11+
def test_on_the_outer_circle(self):
1212
self.assertEqual(score(0, 10), 1)
1313

14-
def test_dart_lands_outer_circle(self):
15-
self.assertEqual(score(4, 4), 1)
14+
def test_on_the_middle_circle(self):
15+
self.assertEqual(score(-5, 0), 5)
1616

17-
def test_dart_lands_border_between_outside_middle(self):
18-
self.assertEqual(score(5, 0), 5)
17+
def test_on_the_inner_circle(self):
18+
self.assertEqual(score(0, -1), 10)
19+
20+
def test_exactly_on_centre(self):
21+
self.assertEqual(score(0, 0), 10)
22+
23+
def test_near_the_centre(self):
24+
self.assertEqual(score(-0.1, -0.1), 10)
1925

20-
def test_dart_lands_in_middle_circle(self):
26+
def test_just_within_the_inner_circle(self):
27+
self.assertEqual(score(0.7, 0.7), 10)
28+
29+
def test_just_outside_the_inner_circle(self):
2130
self.assertEqual(score(0.8, -0.8), 5)
2231

23-
def test_dart_lands_border_betweeen_middle_inner(self):
24-
self.assertEqual(score(0, -1), 10)
32+
def test_just_within_the_middle_circle(self):
33+
self.assertAlmostEqual(score(-3.5, 3.5), 5)
2534

26-
def test_dart_lands_inner_circle(self):
27-
self.assertEqual(score(-0.1, -0.1), 10)
35+
def test_just_outside_the_middle_circle(self):
36+
self.assertAlmostEqual(score(-3.6, -3.6), 1)
2837

29-
def test_dart_coord_sum_more_than_1_radius_less_than_1_is_in_inner(self):
30-
self.assertEqual(score(0.4, 0.8), 10)
38+
def test_just_within_the_outer_circle(self):
39+
self.assertAlmostEqual(score(-7.0, 7.0), 1)
3140

32-
def test_dart_coord_sum_more_than_5_radius_less_than_5_is_in_middle(self):
33-
self.assertEqual(score(2, 4), 5)
41+
def test_just_outside_the_outer_circle(self):
42+
self.assertAlmostEqual(score(7.1, -7.1), 0)
3443

35-
def test_dart_coord_sum_more_than_10_radius_less_than_10_is_in_outer(self):
36-
self.assertEqual(score(4, 8), 1)
44+
def test_asymmetric_position_between_the_inner_and_middle_circles(self):
45+
self.assertAlmostEqual(score(0.5, -4), 5)
3746

3847

3948
if __name__ == '__main__':

0 commit comments

Comments
 (0)