-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.py
41 lines (30 loc) · 1.05 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from main import Bowling
import unittest
class TestMain(unittest.TestCase):
def setUp(self):
self.jeu = Bowling()
def test_deux_lances_a_zero_equal_zero(self):
score = self.jeu.tour(0, 0)
self.assertEqual(score, 0)
def test_deux_lancers_a_trois_equal_six(self):
score = self.jeu.tour(3, 3)
self.assertEqual(score, 6)
def test_jouer_deux_tours_additionne_les_scores(self):
self.jeu.tour(5, 4)
score = self.jeu.tour(3, 0)
self.assertEqual(score, 12)
def test_jouer_un_spare_puis_3_equal_16(self):
self.jeu.tour(5,5)
score = self.jeu.tour(3,0)
self.assertEqual(score, 16)
def test_jouer_un_strike_puis_2_3_equal_22(self):
self.jeu.tour(10, 0)
score = self.jeu.tour(3, 3)
self.assertEqual(score, 22)
def test_jouer_2_strikes_puis_2_3_equal_45(self):
self.jeu.tour(10, 0)
self.jeu.tour(10, 0)
score = self.jeu.tour(3, 3)
self.assertEqual(score, 45)
if __name__ == '__main__':
unittest.main()