File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -488,6 +488,31 @@ pub fn fake_pgn_parser(moves: &str) -> Game {
488488 } )
489489}
490490
491+ #[ test]
492+ fn test_fen_string ( ) {
493+ use crate :: square:: Square ;
494+ let mut game = Game :: new ( ) ;
495+ assert_eq ! (
496+ "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" ,
497+ format!( "{}" , game)
498+ ) ;
499+ game. make_move ( ChessMove :: new ( Square :: E2 , Square :: E4 , None ) ) ;
500+ assert_eq ! (
501+ "rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1" ,
502+ format!( "{}" , game)
503+ ) ;
504+ game. make_move ( ChessMove :: new ( Square :: C7 , Square :: C5 , None ) ) ;
505+ assert_eq ! (
506+ "rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq c6 0 2" ,
507+ format!( "{}" , game)
508+ ) ;
509+ game. make_move ( ChessMove :: new ( Square :: G1 , Square :: F3 , None ) ) ;
510+ assert_eq ! (
511+ "rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2" ,
512+ format!( "{}" , game)
513+ ) ;
514+ }
515+
491516#[ test]
492517pub fn test_can_declare_draw ( ) {
493518 let game = fake_pgn_parser (
You can’t perform that action at this time.
0 commit comments