From 7d0aa2d61de043373796dd07a4d8467e1463ef95 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Mon, 17 Jul 2023 13:31:05 -0700 Subject: [PATCH 1/1] Test with multiple players --- src/lib.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c73c146..59a47a9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -490,8 +490,15 @@ mod tests { #[test] fn test_game() { - let mut game = Game::default(); - game.add_player(); - assert!(play(game, vec![Player(Box::new(random_player))]).is_ok()); + for num_players in 1..10 { + let players: Vec<_> = std::iter::from_fn(|| Some(Player(Box::new(random_player)))) + .take(num_players) + .collect(); + let mut game = Game::default(); + for _ in 0..num_players { + game.add_player(); + } + assert!(play(game, players).is_ok()); + } } } -- 2.44.1