use sashite_feen::Feen;
fn round_trip(s: &str) {
let feen = Feen::parse(s).expect("valid");
assert_eq!(feen.to_string(), s, "round-trip mismatch");
}
#[test]
fn round_trips() {
round_trip("8/8/8/8/8/8/8/8 / W/w");
round_trip("-rnbqk^bn-r/+p+p+p+p+p+p+p+p/8/8/8/8/+P+P+P+P+P+P+P+P/-RNBQK^BN-R / W/w");
round_trip("lnsgk^gsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGK^GSNL / J/j");
round_trip("rheag^aehr/9/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/9/RHEAG^AEHR / C/c");
round_trip("k^+p4+PK^ / C/c");
round_trip("ab/cd//AB/CD / G/g");
round_trip("8/8/8/8/8/8/8/8 3P2B/3p2b W/w");
round_trip("8/8/8/8/8/8/8/8 / c/C"); round_trip("k^ / J/j");
}
#[test]
fn write_into_sink() {
use core::fmt::Write;
let feen = Feen::parse("k^+p4+PK^ / C/c").unwrap();
let mut buf = String::new();
write!(buf, "{feen}").unwrap();
assert_eq!(buf, "k^+p4+PK^ / C/c");
}