generated from PlexSheep/rs-base
test(naive): test that the naive solver should win it's games
cargo devel CI / cargo CI (push) Failing after 1m55s
Details
cargo devel CI / cargo CI (push) Failing after 1m55s
Details
This commit is contained in:
parent
5f8c92de47
commit
38d484fb5e
|
@ -7,6 +7,8 @@ use wordle_analyzer::wlist::builtin::BuiltinWList;
|
||||||
use wordle_analyzer::wlist::word::{Word, WordData};
|
use wordle_analyzer::wlist::word::{Word, WordData};
|
||||||
use wordle_analyzer::wlist::WordList;
|
use wordle_analyzer::wlist::WordList;
|
||||||
|
|
||||||
|
use rayon::prelude::*;
|
||||||
|
|
||||||
fn wordlist() -> impl WordList {
|
fn wordlist() -> impl WordList {
|
||||||
BuiltinWList::default()
|
BuiltinWList::default()
|
||||||
}
|
}
|
||||||
|
@ -135,3 +137,19 @@ fn test_naive_play_predetermined_game_manually() -> anyhow::Result<()> {
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_naive_win_games() -> anyhow::Result<()> {
|
||||||
|
let wl = wordlist();
|
||||||
|
let sl =
|
||||||
|
AnyBuiltinSolver::Naive(NaiveSolver::build(&wl).expect("could not build naive solver"));
|
||||||
|
let builder = Game::builder(&wl);
|
||||||
|
|
||||||
|
{ 0..50 }.into_par_iter().for_each(|_round| {
|
||||||
|
let mut game = builder.build().expect("could not make game");
|
||||||
|
sl.play(&mut game).expect("could not play game");
|
||||||
|
assert!(game.finished());
|
||||||
|
assert!(game.won());
|
||||||
|
});
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue