From 80d9aa13251f7f5c3d3eeaa877bc79dac4435341 Mon Sep 17 00:00:00 2001 From: salmonik Date: Thu, 29 Oct 2026 23:08:25 +0100 Subject: PLN changed to Kromer --- tests/client_core.rs | 199 +++++++++++++++++++++++++++------------------------ tests/crash.rs | 8 +-- 2 files changed, 109 insertions(+), 98 deletions(-) (limited to 'tests') diff --git a/tests/client_core.rs b/tests/client_core.rs index a7c5716..bb8772e 100644 --- a/tests/client_core.rs +++ b/tests/client_core.rs @@ -173,7 +173,7 @@ fn play_shows_a_ten_line_board_and_fetches_the_balance() { h.line("play slots 50"); assert_eq!(h.board().len(), 10); - assert!(h.board()[1].contains("Bet: 50 PLN")); + assert!(h.board()[1].contains("Bet: 50 Kr")); assert!(!h.board()[1].contains("Lines:")); assert!(h.board()[5].contains("Pays bet x symbol x shape")); assert!(h.board()[6].contains("Symbol C1 L2 O3 G4 D6 S10")); @@ -182,7 +182,7 @@ fn play_shows_a_ten_line_board_and_fetches_the_balance() { h.reply("INFO alice 1 1000"); assert_eq!(h.board().len(), 10); - assert!(h.board()[1].contains("Balance: 1000 PLN")); + assert!(h.board()[1].contains("Balance: 1000 Kr")); } #[test] @@ -200,13 +200,14 @@ fn spin_replaces_the_board_and_keeps_the_controls_line() { h.reply("GAME_RESULT session-1 50 50 1000 CCCCLLCLODGSDGS win 1 0,3,6"); assert_eq!(h.board().len(), 10); - assert!(h - .board() - .get(2) - .is_some_and(|line| line.contains("{ C } { C } { C } [ D ] [ D ]"))); - assert!(h.board()[7].contains("Won 50 PLN")); + assert!( + h.board() + .get(2) + .is_some_and(|line| line.contains("{ C } { C } { C } [ D ] [ D ]")) + ); + assert!(h.board()[7].contains("Won 50 Kr")); assert!(h.board()[8].contains("Winning lines: 1 (top)")); - assert!(h.board()[1].contains("Balance: 1000 PLN")); + assert!(h.board()[1].contains("Balance: 1000 Kr")); assert!(h.board()[9].contains("[Q] Quit")); assert_eq!(h.screen.lines.len(), lines_before_spin); } @@ -219,7 +220,7 @@ fn equals_increases_the_bet_like_plus() { h.key(Key::Char('=')); assert_eq!(h.board().len(), 10); - assert!(h.board()[1].contains("Bet: 20 PLN")); + assert!(h.board()[1].contains("Bet: 20 Kr")); } #[test] @@ -233,11 +234,12 @@ fn changing_the_bet_after_a_spin_does_not_leave_stale_lines() { h.key(Key::Char('+')); assert_eq!(h.board().len(), 10); - assert!(h.board()[1].contains("Bet: 60 PLN")); - assert!(h - .board() - .get(2) - .is_some_and(|line| line.contains("{ C } { C } { C } [ D ] [ D ]"))); + assert!(h.board()[1].contains("Bet: 60 Kr")); + assert!( + h.board() + .get(2) + .is_some_and(|line| line.contains("{ C } { C } { C } [ D ] [ D ]")) + ); assert_eq!(h.screen.lines.len(), lines_before_bet); assert_eq!( h.screen @@ -272,9 +274,11 @@ fn a_mega_win_shows_all_winning_lines() { 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")); assert_eq!(h.board().len(), 10); - assert!(h.board()[7].contains("MEGA WIN! 700 PLN")); - assert!(h.board()[8] - .contains("Winning lines: 1 (top), 2 (middle), 3 (bottom), 4 (V), 5 (inverted V)")); + assert!(h.board()[7].contains("MEGA WIN! 700 Kr")); + assert!( + h.board()[8] + .contains("Winning lines: 1 (top), 2 (middle), 3 (bottom), 4 (V), 5 (inverted V)") + ); assert_eq!(h.board()[2].matches("{ C }").count(), 5); } @@ -371,11 +375,12 @@ fn tab_completion_list_wraps() { h.key(Key::Tab); - assert!(h - .screen - .lines - .iter() - .any(|line| line == "Possible completions:")); + assert!( + h.screen + .lines + .iter() + .any(|line| line == "Possible completions:") + ); for line in h .screen .lines @@ -398,7 +403,7 @@ fn play_without_a_bet_uses_the_default() { h.line("play slots"); assert_eq!(h.board().len(), 10); - assert!(h.board()[1].contains("Bet: 10 PLN")); + assert!(h.board()[1].contains("Bet: 10 Kr")); } #[test] @@ -407,11 +412,12 @@ fn an_invalid_bet_does_not_start_a_game() { h.line("play slots 5"); assert!(h.board().is_empty()); - assert!(h - .screen - .lines - .iter() - .any(|line| line.contains("Bet must be at least 10 PLN"))); + assert!( + h.screen + .lines + .iter() + .any(|line| line.contains("Bet must be at least 10 Kr")) + ); } #[test] @@ -438,20 +444,22 @@ fn play_requires_a_connection_and_a_login() { let mut h = Harness::new(); h.core.set_connected(false); h.line("play slots"); - assert!(h - .screen - .lines - .iter() - .any(|line| line.contains("Not connected"))); + assert!( + h.screen + .lines + .iter() + .any(|line| line.contains("Not connected")) + ); let mut h = Harness::new(); h.core.set_logged_in(None); h.line("play slots"); - assert!(h - .screen - .lines - .iter() - .any(|line| line.contains("Not logged in"))); + assert!( + h.screen + .lines + .iter() + .any(|line| line.contains("Not logged in")) + ); } #[test] @@ -489,26 +497,24 @@ fn info_shows_the_host_and_the_server_fields() { ); h.line("info"); - assert!(h - .screen - .lines - .iter() - .any(|line| line.contains("Connected to: 127.0.0.1:11525"))); - assert!(h - .screen - .lines - .iter() - .any(|line| line.contains("Fingerprint: deadbeef"))); + assert!( + h.screen + .lines + .iter() + .any(|line| line.contains("Connected to: 127.0.0.1:11525")) + ); + assert!( + h.screen + .lines + .iter() + .any(|line| line.contains("Fingerprint: deadbeef")) + ); h.reply("INFO alice 42 1234"); assert!(h.screen.lines.iter().any(|line| line == "User: alice")); assert!(h.screen.lines.iter().any(|line| line == "Account: 42")); - assert!(h - .screen - .lines - .iter() - .any(|line| line == "Balance: 1234 PLN")); + assert!(h.screen.lines.iter().any(|line| line == "Balance: 1234 Kr")); } #[test] @@ -518,11 +524,12 @@ fn info_without_a_connection_does_not_send() { h.line("info"); - assert!(h - .screen - .lines - .iter() - .any(|line| line.contains("Not connected to any host"))); + assert!( + h.screen + .lines + .iter() + .any(|line| line.contains("Not connected to any host")) + ); assert!(h.sent.is_empty()); } @@ -554,11 +561,12 @@ fn disconnect_clears_connection_state() { assert!(h.screen.lines.iter().any(|line| line == "Disconnected")); h.line("play slots"); - assert!(h - .screen - .lines - .iter() - .any(|line| line.contains("Not connected"))); + assert!( + h.screen + .lines + .iter() + .any(|line| line.contains("Not connected")) + ); } #[test] @@ -597,8 +605,8 @@ fn roulette_cursor_places_bets_and_spins() { assert_eq!(h.board().len(), 12); assert_eq!(h.board()[0], "=== ROULETTE ==="); - assert!(h.board()[1].contains("Balance: 1000 PLN")); - assert!(h.board()[1].contains("Chip: 10 PLN")); + assert!(h.board()[1].contains("Balance: 1000 Kr")); + assert!(h.board()[1].contains("Chip: 10 Kr")); assert!(h.board()[9].contains("Bets: (none)")); // The cursor starts on number 1, the bottom-left corner. assert!(h.board()[5].contains("[ 1 ]")); @@ -611,14 +619,14 @@ fn roulette_cursor_places_bets_and_spins() { h.key(Key::Enter); assert!(h.board()[9].contains("2/3 10")); - assert!(h.board()[9].contains("Total: 10 PLN")); + assert!(h.board()[9].contains("Total: 10 Kr")); // Back down to number 1 and place a straight. h.key(Key::Down); h.key(Key::Down); h.key(Key::Enter); assert!(h.board()[9].contains("1 10")); - assert!(h.board()[9].contains("Total: 20 PLN")); + assert!(h.board()[9].contains("Total: 20 Kr")); h.key(Key::Char(' ')); let request = h @@ -637,8 +645,8 @@ fn roulette_cursor_places_bets_and_spins() { )); assert_eq!(h.board().len(), 12); - assert!(h.board()[1].contains("Balance: 1160 PLN")); - assert!(h.board()[10].contains("Won 180 PLN at 3 RED ODD")); + assert!(h.board()[1].contains("Balance: 1160 Kr")); + assert!(h.board()[10].contains("Won 180 Kr at 3 RED ODD")); assert!(h.board()[10].contains("+160")); } @@ -672,16 +680,17 @@ fn roulette_rejects_an_empty_spin_and_accepts_the_equals_chip_key() { h.key(Key::Char(' ')); assert!(h.board()[10].contains("ERROR: Place at least one bet")); - assert!(!h - .sent - .iter() - .any(|line| line.starts_with("PLAY_START roulette"))); + assert!( + !h.sent + .iter() + .any(|line| line.starts_with("PLAY_START roulette")) + ); h.key(Key::Char('=')); - assert!(h.board()[1].contains("Chip: 20 PLN")); + assert!(h.board()[1].contains("Chip: 20 Kr")); h.key(Key::Enter); assert!(h.board()[9].contains("1 20")); - assert!(h.board()[9].contains("Total: 20 PLN")); + assert!(h.board()[9].contains("Total: 20 Kr")); } fn bj_state( @@ -776,7 +785,7 @@ fn blackjack_deals_hits_and_settles() { serde_json::to_string(&done).unwrap() )); - assert!(h.board()[4].contains("Win! Won 20 PLN")); + assert!(h.board()[4].contains("Win! Won 20 Kr")); assert!(h.board()[5].contains("[SPACE] New hand")); h.key(Key::Char('q')); @@ -835,11 +844,12 @@ fn blackjack_forfeit_is_sent_when_leaving_an_active_hand() { )); assert!(h.board().is_empty()); - assert!(h - .screen - .lines - .iter() - .any(|line| line.contains("forfeited (10 PLN lost)"))); + assert!( + h.screen + .lines + .iter() + .any(|line| line.contains("forfeited (10 Kr lost)")) + ); } #[test] @@ -848,7 +858,7 @@ fn blackjack_ready_board_can_change_the_next_bet() { h.enter_blackjack(); h.key(Key::Char('=')); - assert!(h.board()[1].contains("Bet: 20 PLN")); + assert!(h.board()[1].contains("Bet: 20 Kr")); h.key(Key::Char(' ')); assert!(h.sent.iter().any(|line| line == "PLAY_START blackjack 20")); @@ -917,14 +927,14 @@ fn crash_starts_a_round_and_draws_the_multiplier_locally() { assert_eq!(h.board().len(), 6); assert!(h.board()[2].contains("Multiplier: 1.00x")); - assert!(h.board()[3].contains("Potential: 10 PLN")); + assert!(h.board()[3].contains("Potential: 10 Kr")); assert!(h.board()[4].contains("Rising")); assert!(h.board()[5].contains("[C] Cash out")); // The multiplier is drawn from the local clock, with no server round trip. h.tick(Duration::from_secs(5)); assert!(h.board()[2].contains("Multiplier: 2.00x")); - assert!(h.board()[3].contains("Potential: 20 PLN")); + assert!(h.board()[3].contains("Potential: 20 Kr")); h.key(Key::Char('c')); assert_eq!(h.sent.last().map(String::as_str), Some("CRASH_CASHOUT cr1")); @@ -932,9 +942,9 @@ fn crash_starts_a_round_and_draws_the_multiplier_locally() { let cashed = crash_state("cashed", 2.0, Some(3.0), 20, 1010); h.reply(&crash_line("CRASH_STATE", &cashed)); - assert!(h.board()[4].contains("Cashed out at 2.00x Won 20 PLN")); + assert!(h.board()[4].contains("Cashed out at 2.00x Won 20 Kr")); assert!(h.board()[5].contains("[SPACE] Play")); - assert_eq!(h.board()[1], "Balance: 1010 PLN Bet: 10 PLN"); + assert_eq!(h.board()[1], "Balance: 1010 Kr Bet: 10 Kr"); } #[test] @@ -977,11 +987,12 @@ fn crash_q_forfeits_an_active_round() { h.reply(&crash_line("CRASH_STATE", &forfeited)); assert!(h.board().is_empty()); - assert!(h - .screen - .lines - .iter() - .any(|line| line.contains("Round forfeited (10 PLN lost)"))); + assert!( + h.screen + .lines + .iter() + .any(|line| line.contains("Round forfeited (10 Kr lost)")) + ); } #[test] @@ -990,8 +1001,8 @@ fn crash_ready_board_changes_the_next_bet() { h.enter_crash(); h.key(Key::Char('=')); - assert!(h.board()[1].contains("Bet: 20 PLN")); - assert!(h.board()[3].contains("Potential: 20 PLN")); + assert!(h.board()[1].contains("Bet: 20 Kr")); + assert!(h.board()[3].contains("Potential: 20 Kr")); h.key(Key::Char(' ')); assert!(h.sent.iter().any(|line| line == "PLAY_START crash 20")); @@ -1058,7 +1069,7 @@ fn a_forfeit_that_arrives_after_the_bust_still_leaves_cleanly() { assert!(h.board().is_empty()); assert!(h.screen.lines.iter().any(|line| line == "Game exited.")); - assert!(!h.screen.lines.iter().any(|line| line.contains("PLN lost"))); + assert!(!h.screen.lines.iter().any(|line| line.contains("Kr lost"))); } #[test] diff --git a/tests/crash.rs b/tests/crash.rs index 49eaf89..c985ebe 100644 --- a/tests/crash.rs +++ b/tests/crash.rs @@ -2,8 +2,8 @@ use std::time::Duration; use zagan_bet::crash::{ - crash_point_from_uniform, multiplier_at, multiplier_at_secs, payout, time_for_multiplier, - HOUSE_EDGE, MAX_MULTIPLIER, + HOUSE_EDGE, MAX_MULTIPLIER, crash_point_from_uniform, multiplier_at, multiplier_at_secs, + payout, time_for_multiplier, }; fn close(a: f64, b: f64, tolerance: f64) { @@ -38,9 +38,9 @@ fn the_time_for_a_multiplier_is_the_inverse_of_the_curve() { } #[test] -fn cashout_value_is_floored_to_whole_pln() { +fn cashout_value_is_floored_to_whole_Kr() { assert_eq!(payout(10, 1.0), 10); - assert_eq!(payout(10, 1.05), 10, "half a PLN is not paid out"); + assert_eq!(payout(10, 1.05), 10, "half a Kr is not paid out"); assert_eq!(payout(10, 1.10), 11); assert_eq!(payout(10, 2.47), 24); assert_eq!(payout(7, 3.0), 21); -- cgit v1.2.3