summaryrefslogtreecommitdiff
path: root/protocol/src/simple_bots.rs
diff options
context:
space:
mode:
Diffstat (limited to 'protocol/src/simple_bots.rs')
-rw-r--r--protocol/src/simple_bots.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/protocol/src/simple_bots.rs b/protocol/src/simple_bots.rs
index 45d1a5b..182229f 100644
--- a/protocol/src/simple_bots.rs
+++ b/protocol/src/simple_bots.rs
@@ -46,7 +46,7 @@ impl PlayingBot for RandomPlayingBot {
#[cfg(test)]
mod tests {
use std::str::FromStr;
- use crate::move_result::MoveResult;
+ use crate::{move_result::MoveResult, bridge_engine::SUIT_DISPLAY_ORDER, card::RankOrder};
use super::*;
use crate::{
@@ -159,7 +159,9 @@ mod tests {
async fn play_until_completion() {
crate::tests::test_setup();
let bot = RandomPlayingBot {};
- let mut result = MoveResult::Current(example_play_state());
+ let play_state = example_play_state();
+ let mut deal = play_state.deal.clone();
+ let mut result = MoveResult::Current(play_state);
while let MoveResult::Current(play_state) = result {
info!("Play state: {play_state:#?}");
let player_state = PlayStatePlayerView::from_play_state(
@@ -169,5 +171,13 @@ mod tests {
let card = bot.play(&player_state).await;
result = play_state.play(card).unwrap();
}
+ let play_result = result.next().unwrap();
+
+ // Verify that the deal is intact.
+ deal.sort(&SUIT_DISPLAY_ORDER, RankOrder::Descending);
+ let mut result_deal = play_result.deal().into_owned();
+ result_deal.sort(&SUIT_DISPLAY_ORDER, RankOrder::Descending);
+
+ assert_eq!(result_deal, deal);
}
}