beholder tests
This commit is contained in:
parent
a8506c5881
commit
b1e80b5f4f
|
|
@ -57,6 +57,7 @@ pub trait ActionPromptTitleExt {
|
||||||
fn direwolf(&self);
|
fn direwolf(&self);
|
||||||
fn masons_wake(&self);
|
fn masons_wake(&self);
|
||||||
fn masons_leader_recruit(&self);
|
fn masons_leader_recruit(&self);
|
||||||
|
fn beholder(&self);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActionPromptTitleExt for ActionPromptTitle {
|
impl ActionPromptTitleExt for ActionPromptTitle {
|
||||||
|
|
@ -111,6 +112,9 @@ impl ActionPromptTitleExt for ActionPromptTitle {
|
||||||
fn masons_leader_recruit(&self) {
|
fn masons_leader_recruit(&self) {
|
||||||
assert_eq!(*self, ActionPromptTitle::MasonLeaderRecruit)
|
assert_eq!(*self, ActionPromptTitle::MasonLeaderRecruit)
|
||||||
}
|
}
|
||||||
|
fn beholder(&self) {
|
||||||
|
assert_eq!(*self, ActionPromptTitle::Beholder)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ActionResultExt {
|
pub trait ActionResultExt {
|
||||||
|
|
@ -136,6 +140,21 @@ impl ActionResultExt for ActionResult {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub trait AlignmentExt {
|
||||||
|
fn village(&self);
|
||||||
|
fn wolves(&self);
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AlignmentExt for Alignment {
|
||||||
|
fn village(&self) {
|
||||||
|
assert_eq!(*self, Alignment::Village)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn wolves(&self) {
|
||||||
|
assert_eq!(*self, Alignment::Wolves)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub trait ServerToHostMessageExt {
|
pub trait ServerToHostMessageExt {
|
||||||
fn prompt(self) -> ActionPrompt;
|
fn prompt(self) -> ActionPrompt;
|
||||||
fn result(self) -> ActionResult;
|
fn result(self) -> ActionResult;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
use core::num::NonZeroU8;
|
||||||
|
#[allow(unused)]
|
||||||
|
use pretty_assertions::{assert_eq, assert_ne, assert_str_eq};
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
game::{Game, GameSettings, SetupRole},
|
||||||
|
game_test::{
|
||||||
|
ActionPromptTitleExt, ActionResultExt, AlignmentExt, GameExt, SettingsExt, gen_players,
|
||||||
|
},
|
||||||
|
message::night::{ActionPrompt, ActionPromptTitle},
|
||||||
|
};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn beholding_seer() {
|
||||||
|
let players = gen_players(1..10);
|
||||||
|
let seer_player_id = players[0].player_id;
|
||||||
|
let wolf_player_id = players[1].player_id;
|
||||||
|
let beholder_player_id = players[2].player_id;
|
||||||
|
let mut settings = GameSettings::empty();
|
||||||
|
settings.add_and_assign(SetupRole::Seer, seer_player_id);
|
||||||
|
settings.add_and_assign(SetupRole::Werewolf, wolf_player_id);
|
||||||
|
settings.add_and_assign(SetupRole::Beholder, beholder_player_id);
|
||||||
|
settings.fill_remaining_slots_with_villagers(9);
|
||||||
|
let mut game = Game::new(&players, settings).unwrap();
|
||||||
|
game.r#continue().r#continue();
|
||||||
|
assert_eq!(game.next().title(), ActionPromptTitle::WolvesIntro);
|
||||||
|
game.r#continue().sleep();
|
||||||
|
|
||||||
|
game.next().title().seer();
|
||||||
|
game.mark(game.character_by_player_id(wolf_player_id).character_id());
|
||||||
|
game.r#continue().seer().wolves();
|
||||||
|
|
||||||
|
game.next().title().beholder();
|
||||||
|
game.mark(game.character_by_player_id(seer_player_id).character_id());
|
||||||
|
game.r#continue().seer().wolves();
|
||||||
|
|
||||||
|
game.next_expect_day();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn beholding_wolf() {
|
||||||
|
let players = gen_players(1..10);
|
||||||
|
let wolf_player_id = players[1].player_id;
|
||||||
|
let beholder_player_id = players[2].player_id;
|
||||||
|
let mut settings = GameSettings::empty();
|
||||||
|
settings.add_and_assign(SetupRole::Werewolf, wolf_player_id);
|
||||||
|
settings.add_and_assign(SetupRole::Beholder, beholder_player_id);
|
||||||
|
settings.fill_remaining_slots_with_villagers(9);
|
||||||
|
let mut game = Game::new(&players, settings).unwrap();
|
||||||
|
game.r#continue().r#continue();
|
||||||
|
assert_eq!(game.next().title(), ActionPromptTitle::WolvesIntro);
|
||||||
|
game.r#continue().sleep();
|
||||||
|
|
||||||
|
game.next().title().beholder();
|
||||||
|
game.mark(game.character_by_player_id(wolf_player_id).character_id());
|
||||||
|
game.r#continue().sleep();
|
||||||
|
|
||||||
|
game.next_expect_day();
|
||||||
|
game.execute().title().wolf_pack_kill();
|
||||||
|
game.mark(game.living_villager_excl(beholder_player_id).character_id());
|
||||||
|
game.r#continue().sleep();
|
||||||
|
|
||||||
|
game.next().title().beholder();
|
||||||
|
game.mark(game.character_by_player_id(wolf_player_id).character_id());
|
||||||
|
game.r#continue().sleep();
|
||||||
|
|
||||||
|
game.next_expect_day();
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
mod beholder;
|
||||||
mod elder;
|
mod elder;
|
||||||
mod mason;
|
mod mason;
|
||||||
mod scapegoat;
|
mod scapegoat;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue