@@ -20,6 +20,16 @@ def test_init():
20
20
assert player .original_function .restype == c_int
21
21
22
22
23
+ def test_matches ():
24
+ for strategy in all_strategies :
25
+ for opponent in (Alternator , Cooperator , Defector ):
26
+ players = (Player (strategy ), opponent ())
27
+ match = Match (players , 50 )
28
+ assert all (
29
+ action in (C , D ) for interaction in match .play ()
30
+ for action in interaction )
31
+
32
+
23
33
@given (
24
34
their_last_move = integers (min_value = 0 , max_value = 1 ),
25
35
move_number = integers (min_value = 1 , max_value = 200 ),
@@ -35,13 +45,3 @@ def test_original_strategy(
35
45
their_last_move , move_number , my_score , their_score , 0 ,
36
46
my_last_move )
37
47
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