This repository has been archived by the owner on May 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.py
46 lines (31 loc) · 1.49 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
42
43
44
45
46
import unittest
import pd_main
class TestMethods(unittest.TestCase):
def test_bust(self):
self.assertEqual(pd_main.dice_rules(hand=[5, 6, 3, 1, 4]), (['Bust'], 0))
def test_pair(self):
self.assertEqual(pd_main.dice_rules(hand=[5, 6, 3, 1, 1]), (['Pair'], 1))
def test_two_pair(self):
self.assertEqual(pd_main.dice_rules(hand=[5, 3, 3, 1, 1]), (['Two Pair'], 2))
def test_three_kind(self):
self.assertEqual(pd_main.dice_rules(hand=[5, 6, 1, 1, 1]), (['Three of a Kind'], 1))
def test_straight(self):
self.assertEqual(pd_main.dice_rules(hand=[1, 2, 3, 4, 5]), (['Straight'], 4))
def test_full_house(self):
self.assertEqual(pd_main.dice_rules(hand=[3, 3, 3, 6, 6]), (['Full House'], 5))
def test_four_kind(self):
self.assertEqual(pd_main.dice_rules(hand=[4, 4, 4, 4, 1]), (['Four of a Kind'], 1))
def test_five_kind(self):
self.assertEqual(pd_main.dice_rules(hand=[1, 1, 1, 1, 1]), (['Five of a kind'], 7))
def test_die(self):
dice = pd_main.Dice()
self.assertAlmostEqual(dice(), 3, delta=3)
def test_game_dice_generation(self):
game = pd_main.PokeDiceGame()
self.assertEqual(all(type(die) is pd_main.Dice for die in game.current_hand), True)
def test_game(self):
game = pd_main.PokeDiceGame()
game.roll_hand()
self.assertEqual(all(type(die) is int for die in game.current_hand), True)
if __name__ == '__main__':
unittest.main()