11from axelrod_fortran .strategies import all_strategies
22from axelrod_fortran .player import Player
3- from ctypes import c_int
3+ from ctypes import c_int , c_float , POINTER
44
55from hypothesis import given
66from hypothesis .strategies import integers
@@ -10,14 +10,26 @@ def test_init():
1010 for strategy in all_strategies :
1111 player = Player (strategy )
1212 assert player .original_name == strategy
13+ assert player .original_function .argtypes == (
14+ POINTER (c_int ), POINTER (c_int ), POINTER (c_int ), POINTER (c_int ),
15+ POINTER (c_float ))
1316 assert player .original_function .restype == c_int
1417
1518
16- @given (last_move = integers (min_value = 0 , max_value = 1 ),
17- score = integers (min_value = 0 , max_value = 200 ))
18- def test_strategy (last_move , score ):
19- print (last_move , score )
19+ @given (
20+ their_last_move = integers (min_value = 0 , max_value = 1 ),
21+ move_number = integers (min_value = 1 , max_value = 200 ),
22+ my_score = integers (min_value = 0 , max_value = 200 ),
23+ their_score = integers (min_value = 0 , max_value = 200 ),
24+ my_last_move = integers (min_value = 0 , max_value = 1 ))
25+ def test_original_strategy (
26+ their_last_move , move_number , my_score , their_score , my_last_move
27+ ):
2028 for strategy in all_strategies :
2129 player = Player (strategy )
22-
23-
30+ action = player .original_strategy (
31+ their_last_move , move_number , my_score , their_score , 0 ,
32+ my_last_move )
33+ if action not in (0 , 1 ):
34+ print (f'{ strategy } returned { action } ' )
35+ assert action in (0 , 1 )
0 commit comments