viriformat/
lib.rs

1pub mod chess;
2pub mod dataformat;
3mod lookups;
4mod makemove;
5mod rng;
6
7#[cfg(test)]
8mod tests {
9    use std::io::BufReader;
10
11    use crate::{chess::{board::Board, chessmove::{Move, MoveFlags}, types::Square}, dataformat::Game};
12
13    #[test]
14    fn from_ep_startpos_roundtrip() {
15        const FEN: &str = "r1bqkbnr/pppp1pp1/2n5/4p3/4P1Pp/2N2N2/PPPP1P1P/R1BQKBR1 b Qkq g3 0 5";
16        let board = Board::from_fen(FEN).unwrap();
17        let mut game = Game::new(&board);
18        game.add_move(Move::new_with_flags(Square::H4, Square::G3, MoveFlags::EnPassant), 1337);
19        let mut memory = Vec::new();
20        game.serialise_into(&mut memory).unwrap();
21        let game2 = Game::deserialise_from(&mut BufReader::new(&*memory), Vec::new()).unwrap();
22        assert_eq!(game, game2);
23    }
24}