-
Notifications
You must be signed in to change notification settings - Fork 0
/
avalon_test.py
51 lines (41 loc) · 1.41 KB
/
avalon_test.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
47
48
49
50
import unittest
import avalon
from game import AvalonGame
import time
class TestAvalonGame(unittest.TestCase):
def test_game_setup(self):
game = avalon.start_game()
for player in game.players_by_id:
print(player.name, player.id, player.role)
def test_instructions(self):
avalon.instructions()
def test_role_assignments(self):
test_game = AvalonGame(5)
for i in range(5):
id = i
name = "test_player_"+str(i)
test_game.add_player(id, name)
test_game.run_player_assignment()
def test_game_object(self):
game = AvalonGame(5)
roles = game.get_roles()
assert len(roles) == game.num_players
random_roles = game.randomly_assign_roles()
assert len(random_roles) == game.num_players
def test_voting(self):
test_game = AvalonGame(5)
for i in range(5):
id = i
name = "test_player_"+str(i)
test_game.add_player(id, name)
test_game.run_team_proposal(1)
def test_quest_run(self):
test_game = AvalonGame(5)
for i in range(5):
id = i
name = "test_player_"+str(i)
test_game.add_player(id, name)
test_team = [test_game.players_by_id[0], test_game.players_by_id[1]]
print(test_game.run_quest(test_team, 1))
if __name__ == "__main__":
unittest.main()