summaryrefslogtreecommitdiffstats
path: root/tests/client_core.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/client_core.rs')
-rw-r--r--tests/client_core.rs23
1 files changed, 12 insertions, 11 deletions
diff --git a/tests/client_core.rs b/tests/client_core.rs
index e75a611..fd88566 100644
--- a/tests/client_core.rs
+++ b/tests/client_core.rs
@@ -135,8 +135,9 @@ fn play_shows_a_ten_line_board_and_fetches_the_balance() {
135 assert_eq!(h.board().len(), 10); 135 assert_eq!(h.board().len(), 10);
136 assert!(h.board()[1].contains("Bet: 50 PLN")); 136 assert!(h.board()[1].contains("Bet: 50 PLN"));
137 assert!(!h.board()[1].contains("Lines:")); 137 assert!(!h.board()[1].contains("Lines:"));
138 assert!(h.board()[5].contains("Pays 3/4/5 x bet:")); 138 assert!(h.board()[5].contains("Pays bet x symbol x shape"));
139 assert!(h.board()[6].contains("G 4/12/40 D 6/18/70 S 9/30/150")); 139 assert!(h.board()[6].contains("Symbol C1 L2 O3 G4 D6 S10"));
140 assert!(h.board()[6].contains("Shape 3:1 4:3 5:14"));
140 assert!(h.sent.contains(&"INFO".to_string())); 141 assert!(h.sent.contains(&"INFO".to_string()));
141 142
142 h.reply("INFO alice 1 1000"); 143 h.reply("INFO alice 1 1000");
@@ -157,15 +158,15 @@ fn spin_replaces_the_board_and_keeps_the_controls_line() {
157 assert!(h.sent.iter().any(|line| line == "PLAY_START slots 50")); 158 assert!(h.sent.iter().any(|line| line == "PLAY_START slots 50"));
158 assert_eq!(h.screen.lines.len(), lines_before_spin); 159 assert_eq!(h.screen.lines.len(), lines_before_spin);
159 160
160 h.reply("GAME_RESULT session-1 100 50 1050 CCCCLLCLODGSDGS win 1 0,3,6"); 161 h.reply("GAME_RESULT session-1 50 50 1000 CCCCLLCLODGSDGS win 1 0,3,6");
161 assert_eq!(h.board().len(), 10); 162 assert_eq!(h.board().len(), 10);
162 assert!(h 163 assert!(h
163 .board() 164 .board()
164 .get(2) 165 .get(2)
165 .is_some_and(|line| line.contains("{ C } { C } { C } [ D ] [ D ]"))); 166 .is_some_and(|line| line.contains("{ C } { C } { C } [ D ] [ D ]")));
166 assert!(h.board()[7].contains("Won 100 PLN")); 167 assert!(h.board()[7].contains("Won 50 PLN"));
167 assert!(h.board()[8].contains("Winning lines: 1")); 168 assert!(h.board()[8].contains("Winning lines: 1 (top)"));
168 assert!(h.board()[1].contains("Balance: 1050 PLN")); 169 assert!(h.board()[1].contains("Balance: 1000 PLN"));
169 assert!(h.board()[9].contains("[Q] Quit")); 170 assert!(h.board()[9].contains("[Q] Quit"));
170 assert_eq!(h.screen.lines.len(), lines_before_spin); 171 assert_eq!(h.screen.lines.len(), lines_before_spin);
171} 172}
@@ -175,7 +176,7 @@ fn changing_the_bet_after_a_spin_does_not_leave_stale_lines() {
175 let mut h = Harness::new(); 176 let mut h = Harness::new();
176 h.enter_slots("50"); 177 h.enter_slots("50");
177 h.key(Key::Char(' ')); 178 h.key(Key::Char(' '));
178 h.reply("GAME_RESULT session-1 100 50 1050 CCCCLLCLODGSDGS win 1 0,3,6"); 179 h.reply("GAME_RESULT session-1 50 50 1000 CCCCLLCLODGSDGS win 1 0,3,6");
179 let lines_before_bet = h.screen.lines.len(); 180 let lines_before_bet = h.screen.lines.len();
180 181
181 h.key(Key::Char('+')); 182 h.key(Key::Char('+'));
@@ -217,11 +218,11 @@ fn a_mega_win_shows_all_winning_lines() {
217 h.enter_slots("10"); 218 h.enter_slots("10");
218 h.key(Key::Char(' ')); 219 h.key(Key::Char(' '));
219 220
220 h.reply(&format!("GAME_RESULT session-1 750 10 1740 {ALL_C} mega 1,2,3,4,5 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14")); 221 h.reply(&format!("GAME_RESULT session-1 700 10 1690 {ALL_C} mega 1,2,3,4,5 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14"));
221 222
222 assert_eq!(h.board().len(), 10); 223 assert_eq!(h.board().len(), 10);
223 assert!(h.board()[7].contains("MEGA WIN! 750 PLN")); 224 assert!(h.board()[7].contains("MEGA WIN! 700 PLN"));
224 assert!(h.board()[8].contains("Winning lines: 1,2,3,4,5")); 225 assert!(h.board()[8].contains("Winning lines: 1 (top), 2 (middle), 3 (bottom), 4 (V), 5 (inverted V)"));
225 assert_eq!(h.board()[2].matches("{ C }").count(), 5); 226 assert_eq!(h.board()[2].matches("{ C }").count(), 5);
226} 227}
227 228
@@ -521,7 +522,7 @@ fn disconnect_clears_connection_state() {
521 522
522#[test] 523#[test]
523fn parses_a_five_by_three_result_with_winning_lines() { 524fn parses_a_five_by_three_result_with_winning_lines() {
524 let response = format!("GAME_RESULT session-1 100 50 1050 {WIN3} win 1 0,3,6"); 525 let response = format!("GAME_RESULT session-1 50 50 1000 {WIN3} win 1 0,3,6");
525 let result = parse_spin_response(&response).expect("valid 5x3 result"); 526 let result = parse_spin_response(&response).expect("valid 5x3 result");
526 527
527 assert_eq!(result.reels.chars().count(), 15); 528 assert_eq!(result.reels.chars().count(), 15);