wip: misc
This commit is contained in:
parent
9ac271f276
commit
42ccddc12b
2 changed files with 46 additions and 21 deletions
|
|
@ -2,6 +2,7 @@ use eschac::board::*;
|
|||
use eschac::position::*;
|
||||
use eschac::san::*;
|
||||
use eschac::setup::*;
|
||||
use eschac::uci::*;
|
||||
|
||||
static P1: &'static str = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq -";
|
||||
static P2: &'static str = "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq -";
|
||||
|
|
@ -319,6 +320,38 @@ fn san() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn uci_move() {
|
||||
let position = Setup::from_text_record("3qk3/2P5/8/8/8/8/8/B3K2R w K -")
|
||||
.unwrap()
|
||||
.into_position()
|
||||
.unwrap();
|
||||
for uci in ["a1a1", "a1a2", "c7b8q", "c7c8", "c7d8"].map(|s| s.parse::<UciMove>().unwrap()) {
|
||||
assert!(uci.to_move(&position).is_err(), "{uci}");
|
||||
}
|
||||
for uci in ["c7c8q", "c7d8n", "e1g1"].map(|s| s.parse::<UciMove>().unwrap()) {
|
||||
assert!(uci.to_move(&position).is_ok(), "{uci}");
|
||||
}
|
||||
assert_eq!(
|
||||
"h1h8"
|
||||
.parse::<UciMove>()
|
||||
.unwrap()
|
||||
.to_move(&position)
|
||||
.unwrap()
|
||||
.role(),
|
||||
Role::Rook,
|
||||
);
|
||||
assert_eq!(
|
||||
"a1h8"
|
||||
.parse::<UciMove>()
|
||||
.unwrap()
|
||||
.to_move(&position)
|
||||
.unwrap()
|
||||
.role(),
|
||||
Role::Bishop,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn max_legal_moves() {
|
||||
let position = Setup::from_text_record("R6R/3Q4/1Q4Q1/4Q3/2Q4Q/Q4Q2/pp1Q4/kBNN1KB1 w - -")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue