Skip to content

Commit 85806d5

Browse files
committed
Add test for matches
1 parent ce5db1f commit 85806d5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/test_player.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
from axelrod_fortran.strategies import all_strategies
22
from axelrod_fortran.player import Player
3+
from axelrod import Alternator, Cooperator, Defector, Match
4+
from axelrod.action import Action
35
from ctypes import c_int, c_float, POINTER
46

57
from hypothesis import given
68
from hypothesis.strategies import integers
79

10+
C, D = Action.C, Action.D
11+
812

913
def test_init():
1014
for strategy in all_strategies:
@@ -33,3 +37,13 @@ def test_original_strategy(
3337
if action not in (0, 1):
3438
print(f'{strategy} returned {action}')
3539
assert action in (0, 1)
40+
41+
42+
def test_matches():
43+
for strategy in all_strategies:
44+
for opponent in (Alternator, Cooperator, Defector):
45+
players = (Player(strategy), opponent())
46+
match = Match(players, 50)
47+
assert all(
48+
action in (C, D) for interaction in match.play()
49+
for action in interaction)

0 commit comments

Comments
 (0)