diff options
| author | salmonik <salmonik@tuta.io> | 2026-10-28 23:19:52 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-10-28 23:19:52 +0100 |
| commit | 2915d826f744612e0d975282f5bddf13270b9f3f (patch) | |
| tree | a2864bfaef91070ac3b4e13b8b731e539a757cc8 /tests/client_core.rs | |
| parent | v1.0.0: replace slots with 5x3 reels and five paylines (diff) | |
| download | zagan-bet-2915d826f744612e0d975282f5bddf13270b9f3f.tar.gz zagan-bet-2915d826f744612e0d975282f5bddf13270b9f3f.zip | |
v1.1.0: highlight winning symbols on the slots board
Diffstat (limited to 'tests/client_core.rs')
| -rw-r--r-- | tests/client_core.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/client_core.rs b/tests/client_core.rs index 80ec587..91ddcab 100644 --- a/tests/client_core.rs +++ b/tests/client_core.rs | |||
| @@ -155,12 +155,12 @@ fn spin_replaces_the_board_and_keeps_the_controls_line() { | |||
| 155 | assert!(h.sent.iter().any(|line| line == "PLAY_START slots 50")); | 155 | assert!(h.sent.iter().any(|line| line == "PLAY_START slots 50")); |
| 156 | assert_eq!(h.screen.lines.len(), lines_before_spin); | 156 | assert_eq!(h.screen.lines.len(), lines_before_spin); |
| 157 | 157 | ||
| 158 | h.reply("GAME_RESULT session-1 100 50 1050 CCCCLLCLODGSDGS win 1"); | 158 | h.reply("GAME_RESULT session-1 100 50 1050 CCCCLLCLODGSDGS win 1 0,3,6"); |
| 159 | assert_eq!(h.board().len(), 9); | 159 | assert_eq!(h.board().len(), 9); |
| 160 | assert!(h | 160 | assert!(h |
| 161 | .board() | 161 | .board() |
| 162 | .get(2) | 162 | .get(2) |
| 163 | .is_some_and(|line| line.contains("[ C ] [ C ] [ C ] [ D ] [ D ]"))); | 163 | .is_some_and(|line| line.contains("{ C } { C } { C } [ D ] [ D ]"))); |
| 164 | assert!(h.board()[6].contains("Won 100 PLN")); | 164 | assert!(h.board()[6].contains("Won 100 PLN")); |
| 165 | assert!(h.board()[7].contains("Winning lines: 1")); | 165 | assert!(h.board()[7].contains("Winning lines: 1")); |
| 166 | assert!(h.board()[1].contains("Balance: 1050 PLN")); | 166 | assert!(h.board()[1].contains("Balance: 1050 PLN")); |
| @@ -173,7 +173,7 @@ fn changing_the_bet_after_a_spin_does_not_leave_stale_lines() { | |||
| 173 | let mut h = Harness::new(); | 173 | let mut h = Harness::new(); |
| 174 | h.enter_slots("50"); | 174 | h.enter_slots("50"); |
| 175 | h.key(Key::Char(' ')); | 175 | h.key(Key::Char(' ')); |
| 176 | h.reply("GAME_RESULT session-1 100 50 1050 CCCCLLCLODGSDGS win 1"); | 176 | h.reply("GAME_RESULT session-1 100 50 1050 CCCCLLCLODGSDGS win 1 0,3,6"); |
| 177 | let lines_before_bet = h.screen.lines.len(); | 177 | let lines_before_bet = h.screen.lines.len(); |
| 178 | 178 | ||
| 179 | h.key(Key::Char('+')); | 179 | h.key(Key::Char('+')); |
| @@ -183,7 +183,7 @@ fn changing_the_bet_after_a_spin_does_not_leave_stale_lines() { | |||
| 183 | assert!(h | 183 | assert!(h |
| 184 | .board() | 184 | .board() |
| 185 | .get(2) | 185 | .get(2) |
| 186 | .is_some_and(|line| line.contains("[ C ] [ C ] [ C ] [ D ] [ D ]"))); | 186 | .is_some_and(|line| line.contains("{ C } { C } { C } [ D ] [ D ]"))); |
| 187 | assert_eq!(h.screen.lines.len(), lines_before_bet); | 187 | assert_eq!(h.screen.lines.len(), lines_before_bet); |
| 188 | assert_eq!( | 188 | assert_eq!( |
| 189 | h.screen | 189 | h.screen |
| @@ -206,6 +206,7 @@ fn a_losing_spin_shows_no_win_and_no_winning_lines() { | |||
| 206 | assert_eq!(h.board().len(), 9); | 206 | assert_eq!(h.board().len(), 9); |
| 207 | assert!(h.board()[6].contains("No win.")); | 207 | assert!(h.board()[6].contains("No win.")); |
| 208 | assert_eq!(h.board()[7], ""); | 208 | assert_eq!(h.board()[7], ""); |
| 209 | assert!(!h.board()[2].contains('{')); | ||
| 209 | } | 210 | } |
| 210 | 211 | ||
| 211 | #[test] | 212 | #[test] |
| @@ -214,11 +215,12 @@ fn a_mega_win_shows_all_winning_lines() { | |||
| 214 | h.enter_slots("10"); | 215 | h.enter_slots("10"); |
| 215 | h.key(Key::Char(' ')); | 216 | h.key(Key::Char(' ')); |
| 216 | 217 | ||
| 217 | h.reply(&format!("GAME_RESULT session-1 750 10 1740 {ALL_C} mega 1,2,3,4,5")); | 218 | 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")); |
| 218 | 219 | ||
| 219 | assert_eq!(h.board().len(), 9); | 220 | assert_eq!(h.board().len(), 9); |
| 220 | assert!(h.board()[6].contains("MEGA WIN! 750 PLN")); | 221 | assert!(h.board()[6].contains("MEGA WIN! 750 PLN")); |
| 221 | assert!(h.board()[7].contains("Winning lines: 1,2,3,4,5")); | 222 | assert!(h.board()[7].contains("Winning lines: 1,2,3,4,5")); |
| 223 | assert_eq!(h.board()[2].matches("{ C }").count(), 5); | ||
| 222 | } | 224 | } |
| 223 | 225 | ||
| 224 | #[test] | 226 | #[test] |
| @@ -517,12 +519,13 @@ fn disconnect_clears_connection_state() { | |||
| 517 | 519 | ||
| 518 | #[test] | 520 | #[test] |
| 519 | fn parses_a_five_by_three_result_with_winning_lines() { | 521 | fn parses_a_five_by_three_result_with_winning_lines() { |
| 520 | let response = format!("GAME_RESULT session-1 100 50 1050 {WIN3} win 1"); | 522 | let response = format!("GAME_RESULT session-1 100 50 1050 {WIN3} win 1 0,3,6"); |
| 521 | let result = parse_spin_response(&response).expect("valid 5x3 result"); | 523 | let result = parse_spin_response(&response).expect("valid 5x3 result"); |
| 522 | 524 | ||
| 523 | assert_eq!(result.reels.chars().count(), 15); | 525 | assert_eq!(result.reels.chars().count(), 15); |
| 524 | assert_eq!(result.win_type, "win"); | 526 | assert_eq!(result.win_type, "win"); |
| 525 | assert_eq!(result.win_lines, vec![1]); | 527 | assert_eq!(result.win_lines, vec![1]); |
| 528 | assert_eq!(result.win_cells, vec![0, 3, 6]); | ||
| 526 | } | 529 | } |
| 527 | 530 | ||
| 528 | #[test] | 531 | #[test] |
| @@ -533,6 +536,7 @@ fn accepts_a_legacy_three_symbol_result() { | |||
| 533 | assert_eq!(result.reels, "OSS"); | 536 | assert_eq!(result.reels, "OSS"); |
| 534 | assert_eq!(result.win_type, "two"); | 537 | assert_eq!(result.win_type, "two"); |
| 535 | assert!(result.win_lines.is_empty()); | 538 | assert!(result.win_lines.is_empty()); |
| 539 | assert!(result.win_cells.is_empty()); | ||
| 536 | } | 540 | } |
| 537 | 541 | ||
| 538 | #[test] | 542 | #[test] |
