public void testPseudoLegalMoves() throws ChessParseError {
  String fen="8/3k4/8/2n2pP1/1P6/1NB5/2QP4/R3K2R w KQ f6 0 2";
  Position pos=TextIO.readFEN(fen);
  assertEquals(fen,TextIO.toFEN(pos));
  List<String> strMoves=getMoveList(pos,false);
  assertTrue(strMoves.contains("Ra1-d1"));
  assertTrue(!strMoves.contains("Ra1-e1"));
  assertTrue(!strMoves.contains("Ra1-f1"));
  assertTrue(strMoves.contains("Ra1-a7+"));
  assertTrue(strMoves.contains("Ke1-f2"));
  assertTrue(!strMoves.contains("Ke1-g3"));
  assertTrue(strMoves.contains("Bc3-f6"));
  assertTrue(!strMoves.contains("Nb3xd2"));
  assertTrue(strMoves.contains("O-O"));
  assertTrue(strMoves.contains("O-O-O"));
  assertEquals(49,strMoves.size());
  pos.setPiece(Position.getSquare(4,3),Piece.BROOK);
  strMoves=getMoveList(pos,false);
  assertTrue(!strMoves.contains("O-O"));
  assertTrue(!strMoves.contains("O-O-O"));
  pos.setPiece(Position.getSquare(4,3),Piece.EMPTY);
  pos.setPiece(Position.getSquare(5,3),Piece.BROOK);
  strMoves=getMoveList(pos,false);
  assertTrue(!strMoves.contains("O-O"));
  assertTrue(strMoves.contains("O-O-O"));
  pos.setPiece(Position.getSquare(5,3),Piece.EMPTY);
  pos.setPiece(Position.getSquare(6,3),Piece.BBISHOP);
  strMoves=getMoveList(pos,false);
  assertTrue(strMoves.contains("O-O"));
  assertTrue(!strMoves.contains("O-O-O"));
  pos.setPiece(Position.getSquare(6,3),Piece.EMPTY);
  pos.setCastleMask(1 << Position.A1_CASTLE);
  strMoves=getMoveList(pos,false);
  assertTrue(!strMoves.contains("O-O"));
  assertTrue(strMoves.contains("O-O-O"));
}

public void testPseudoLegalMoves ( ) throws ChessParseError { String fen = "8/3k4/8/2n2pP1/1P6/1NB5/2QP4/R3K2R w KQ f6 0 2" ; Position pos = TextIO . readFEN ( fen ) ; assertEquals ( fen , TextIO . toFEN ( pos ) ) ; List < String > strMoves = getMoveList ( pos , false ) ; assertTrue ( strMoves . contains ( "Ra1-d1" ) ) ; assertTrue ( ! strMoves . contains ( "Ra1-e1" ) ) ; assertTrue ( ! strMoves . contains ( "Ra1-f1" ) ) ; assertTrue ( strMoves . contains ( "Ra1-a7+" ) ) ; assertTrue ( strMoves . contains ( "Ke1-f2" ) ) ; assertTrue ( ! strMoves . contains ( "Ke1-g3" ) ) ; assertTrue ( strMoves . contains ( "Bc3-f6" ) ) ; assertTrue ( ! strMoves . contains ( "Nb3xd2" ) ) ; assertTrue ( strMoves . contains ( "O-O" ) ) ; assertTrue ( strMoves . contains ( "O-O-O" ) ) ; assertEquals ( 49 , strMoves . size ( ) ) ; pos . setPiece ( Position . getSquare ( 4 , 3 ) , Piece . BROOK ) ; strMoves = getMoveList ( pos , false ) ; assertTrue ( ! strMoves . contains ( "O-O" ) ) ; assertTrue ( ! strMoves . contains ( "O-O-O" ) ) ; pos . setPiece ( Position . getSquare ( 4 , 3 ) , Piece . EMPTY ) ; pos . setPiece ( Position . getSquare ( 5 , 3 ) , Piece . BROOK ) ; strMoves = getMoveList ( pos , false ) ; assertTrue ( ! strMoves . contains ( "O-O" ) ) ; assertTrue ( strMoves . contains ( "O-O-O" ) ) ; pos . setPiece ( Position . getSquare ( 5 , 3 ) , Piece . EMPTY ) ; pos . setPiece ( Position . getSquare ( 6 , 3 ) , Piece . BBISHOP ) ; strMoves = getMoveList ( pos , false ) ; assertTrue ( strMoves . contains ( "O-O" ) ) ; assertTrue ( ! strMoves . contains ( "O-O-O" ) ) ; pos . setPiece ( Position . getSquare ( 6 , 3 ) , Piece . EMPTY ) ; pos . setCastleMask ( 1 << Position . A1_CASTLE ) ; strMoves = getMoveList ( pos , false ) ; assertTrue ( ! strMoves . contains ( "O-O" ) ) ; assertTrue ( strMoves . contains ( "O-O-O" ) ) ; }
test of pseudolegalmoves method , of class movegen .
