* Corrected small typos around resistor bands. * Due to failing CI, alterations to the test generator script were needed. The generated vs submitted diff now skips the first three lines of the file so that the generation date is not picked up and flagged as needing regeneration. Sadly, a workaround was also needed to prevent Python difflib from noting the difference anyways and producing an empty "false positive" diff. All templates and test files also needed to be altered to ensure that the first three lines of every test file will always be the autogeneration comment and date. Hopefully, this will now stop the CI failures without creating any subtle additional bugs. * Touch up to bowling template. Added back the error raising utility. * Touch up to two-bucket template to add back in error raising utility. [no important files changed]
51 lines
1.4 KiB
Python
51 lines
1.4 KiB
Python
# These tests are auto-generated with test data from:
|
|
# https://github.com/exercism/problem-specifications/tree/main/exercises/darts/canonical-data.json
|
|
# File last updated on 2023-07-19
|
|
|
|
import unittest
|
|
|
|
from darts import (
|
|
score,
|
|
)
|
|
|
|
|
|
class DartsTest(unittest.TestCase):
|
|
def test_missed_target(self):
|
|
self.assertEqual(score(-9, 9), 0)
|
|
|
|
def test_on_the_outer_circle(self):
|
|
self.assertEqual(score(0, 10), 1)
|
|
|
|
def test_on_the_middle_circle(self):
|
|
self.assertEqual(score(-5, 0), 5)
|
|
|
|
def test_on_the_inner_circle(self):
|
|
self.assertEqual(score(0, -1), 10)
|
|
|
|
def test_exactly_on_center(self):
|
|
self.assertEqual(score(0, 0), 10)
|
|
|
|
def test_near_the_center(self):
|
|
self.assertEqual(score(-0.1, -0.1), 10)
|
|
|
|
def test_just_within_the_inner_circle(self):
|
|
self.assertEqual(score(0.7, 0.7), 10)
|
|
|
|
def test_just_outside_the_inner_circle(self):
|
|
self.assertEqual(score(0.8, -0.8), 5)
|
|
|
|
def test_just_within_the_middle_circle(self):
|
|
self.assertEqual(score(-3.5, 3.5), 5)
|
|
|
|
def test_just_outside_the_middle_circle(self):
|
|
self.assertEqual(score(-3.6, -3.6), 1)
|
|
|
|
def test_just_within_the_outer_circle(self):
|
|
self.assertEqual(score(-7.0, 7.0), 1)
|
|
|
|
def test_just_outside_the_outer_circle(self):
|
|
self.assertEqual(score(7.1, -7.1), 0)
|
|
|
|
def test_asymmetric_position_between_the_inner_and_middle_circles(self):
|
|
self.assertEqual(score(0.5, -4), 5)
|