Skip to content

Commit 1ab9d37

Browse files
authored
Merge branch 'master' into minor-assertion-tweak
2 parents bd4700a + 85806d5 commit 1ab9d37

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:
@@ -31,3 +35,13 @@ def test_original_strategy(
3135
their_last_move, move_number, my_score, their_score, 0,
3236
my_last_move)
3337
assert action in (0, 1), print(f'{strategy} returned {action}')
38+
39+
40+
def test_matches():
41+
for strategy in all_strategies:
42+
for opponent in (Alternator, Cooperator, Defector):
43+
players = (Player(strategy), opponent())
44+
match = Match(players, 50)
45+
assert all(
46+
action in (C, D) for interaction in match.play()
47+
for action in interaction)

0 commit comments

Comments
 (0)