@@ -45,10 +45,10 @@ mod move_stats {
4545 fn returns_the_best_move ( ) {
4646 let moves = vec ! [ Play ( Black , 1 , 1 ) , Play ( Black , 2 , 2 ) ] ;
4747 let mut stats = MoveStats :: new ( & moves, Black ) ;
48- stats. record_win ( & Play ( Black , 1 , 1 ) ) ;
49- stats. record_loss ( & Play ( Black , 1 , 1 ) ) ;
50- stats. record_win ( & Play ( Black , 2 , 2 ) ) ;
51- stats. record_win ( & Play ( Black , 2 , 2 ) ) ;
48+ stats. record_win ( Play ( Black , 1 , 1 ) ) ;
49+ stats. record_loss ( Play ( Black , 1 , 1 ) ) ;
50+ stats. record_win ( Play ( Black , 2 , 2 ) ) ;
51+ stats. record_win ( Play ( Black , 2 , 2 ) ) ;
5252 let ( m, ms) = stats. best ( ) ;
5353 assert_eq ! ( Play ( Black , 2 , 2 ) , m) ;
5454 assert_eq ! ( ms. plays, 2 ) ;
@@ -59,58 +59,58 @@ mod move_stats {
5959 fn all_wins_returns_true_when_no_losses_were_recorded ( ) {
6060 let moves = vec ! [ Play ( Black , 1 , 1 ) , Play ( Black , 2 , 2 ) ] ;
6161 let mut stats = MoveStats :: new ( & moves, Black ) ;
62- stats. record_win ( & Play ( Black , 1 , 1 ) ) ;
63- stats. record_win ( & Play ( Black , 2 , 2 ) ) ;
62+ stats. record_win ( Play ( Black , 1 , 1 ) ) ;
63+ stats. record_win ( Play ( Black , 2 , 2 ) ) ;
6464 assert ! ( stats. all_wins( ) ) ;
6565 }
6666
6767 #[ test]
6868 fn all_wins_returns_false_when_a_loss_was_recorded ( ) {
6969 let moves = vec ! [ Play ( Black , 1 , 1 ) , Play ( Black , 2 , 2 ) ] ;
7070 let mut stats = MoveStats :: new ( & moves, Black ) ;
71- stats. record_loss ( & Play ( Black , 1 , 1 ) ) ;
71+ stats. record_loss ( Play ( Black , 1 , 1 ) ) ;
7272 assert ! ( !stats. all_wins( ) ) ;
7373 }
7474
7575 #[ test]
7676 fn all_losses_returns_true_when_no_wins_were_recorded ( ) {
7777 let moves = vec ! [ Play ( Black , 1 , 1 ) , Play ( Black , 2 , 2 ) ] ;
7878 let mut stats = MoveStats :: new ( & moves, Black ) ;
79- stats. record_loss ( & Play ( Black , 1 , 1 ) ) ;
80- stats. record_loss ( & Play ( Black , 2 , 2 ) ) ;
79+ stats. record_loss ( Play ( Black , 1 , 1 ) ) ;
80+ stats. record_loss ( Play ( Black , 2 , 2 ) ) ;
8181 assert ! ( stats. all_losses( ) ) ;
8282 }
8383
8484 #[ test]
8585 fn all_losses_returns_false_when_a_win_was_recorded ( ) {
8686 let moves = vec ! [ Play ( Black , 1 , 1 ) , Play ( Black , 2 , 2 ) ] ;
8787 let mut stats = MoveStats :: new ( & moves, Black ) ;
88- stats. record_win ( & Play ( Black , 1 , 1 ) ) ;
88+ stats. record_win ( Play ( Black , 1 , 1 ) ) ;
8989 assert ! ( !stats. all_losses( ) ) ;
9090 }
9191
9292 #[ test]
9393 fn record_win_does_nothing_for_untracked_moves ( ) {
9494 let moves = vec ! ( ) ;
9595 let mut stats = MoveStats :: new ( & moves, Black ) ;
96- stats. record_win ( & Play ( Black , 1 , 1 ) ) ;
96+ stats. record_win ( Play ( Black , 1 , 1 ) ) ;
9797 }
9898
9999 #[ test]
100100 fn record_loss_does_nothing_for_untracked_moves ( ) {
101101 let moves = vec ! ( ) ;
102102 let mut stats = MoveStats :: new ( & moves, Black ) ;
103- stats. record_loss ( & Play ( Black , 1 , 1 ) ) ;
103+ stats. record_loss ( Play ( Black , 1 , 1 ) ) ;
104104 }
105105
106106 #[ test]
107107 fn merge_merges_stats_existing_in_both ( ) {
108108 let m = Play ( Black , 1 , 1 ) ;
109109 let moves = vec ! ( m) ;
110110 let mut stats = MoveStats :: new ( & moves, Black ) ;
111- stats. record_win ( & m) ;
111+ stats. record_win ( m) ;
112112 let mut other = MoveStats :: new ( & moves, Black ) ;
113- other. record_loss ( & m) ;
113+ other. record_loss ( m) ;
114114 stats. merge ( & other) ;
115115 let ms = stats. stats . get ( & m) . unwrap ( ) ;
116116 assert_eq ! ( ms. wins, 1 ) ;
@@ -124,7 +124,7 @@ mod move_stats {
124124 let mut stats = MoveStats :: new ( & moves, Black ) ;
125125 let moves2 = vec ! ( m) ;
126126 let mut other = MoveStats :: new ( & moves2, Black ) ;
127- other. record_loss ( & m) ;
127+ other. record_loss ( m) ;
128128 stats. merge ( & other) ;
129129 assert ! ( !stats. stats. get( & m) . is_some( ) ) ;
130130 }
0 commit comments