Optimize some tests

This commit is contained in:
Pierre HUBERT 2022-09-24 12:14:39 +02:00
parent dfdf6d9952
commit 625cc88950

View File

@ -107,7 +107,7 @@ async fn first_player_win() {
let res = bot_client::BotClient::new(TestPort::InviteModeFirstPlayerWin.as_url()) let res = bot_client::BotClient::new(TestPort::InviteModeFirstPlayerWin.as_url())
.with_run_mode(RunMode::CreateInvite) .with_run_mode(RunMode::CreateInvite)
.with_play_as_bot_type(BotType::Smart) .with_play_as_bot_type(BotType::Smart)
.with_number_plays(10) .with_number_plays(3)
.with_server_msg_callback(move |msg| { .with_server_msg_callback(move |msg| {
if let ServerMessage::SetInviteCode { code } = msg { if let ServerMessage::SetInviteCode { code } = msg {
task::spawn_local(run_other_invite_side( task::spawn_local(run_other_invite_side(
@ -115,7 +115,7 @@ async fn first_player_win() {
TestPort::InviteModeFirstPlayerWin, TestPort::InviteModeFirstPlayerWin,
code.clone(), code.clone(),
BotType::Linear, BotType::Linear,
10, 3,
)); ));
} }
}) })
@ -143,7 +143,7 @@ async fn first_player_win() {
assert_eq!(d1, v2); assert_eq!(d1, v2);
assert_eq!(v1, d2); assert_eq!(v1, d2);
assert!(v1 > 6); assert!(v1 > 1);
} }
(_, _) => unreachable!(), (_, _) => unreachable!(),
@ -169,7 +169,7 @@ async fn second_player_win() {
let res = bot_client::BotClient::new(TestPort::InviteModeSecondPlayerWin.as_url()) let res = bot_client::BotClient::new(TestPort::InviteModeSecondPlayerWin.as_url())
.with_run_mode(RunMode::CreateInvite) .with_run_mode(RunMode::CreateInvite)
.with_play_as_bot_type(BotType::Linear) .with_play_as_bot_type(BotType::Linear)
.with_number_plays(10) .with_number_plays(3)
.with_server_msg_callback(move |msg| { .with_server_msg_callback(move |msg| {
if let ServerMessage::SetInviteCode { code } = msg { if let ServerMessage::SetInviteCode { code } = msg {
task::spawn_local(run_other_invite_side( task::spawn_local(run_other_invite_side(
@ -177,7 +177,7 @@ async fn second_player_win() {
TestPort::InviteModeSecondPlayerWin, TestPort::InviteModeSecondPlayerWin,
code.clone(), code.clone(),
BotType::Smart, BotType::Smart,
10, 3,
)); ));
} }
}) })
@ -205,7 +205,7 @@ async fn second_player_win() {
assert_eq!(d1, v2); assert_eq!(d1, v2);
assert_eq!(v1, d2); assert_eq!(v1, d2);
assert!(v2 > 6); assert!(v2 > 1);
} }
(_, _) => unreachable!(), (_, _) => unreachable!(),