Permalink
Browse files

Passed testGetBlackPieces

  • Loading branch information...
1 parent 8881b7b commit dbf1eb39a3f67a4571fdbf1f759172c1ce6438df Kestutis-Z committed Nov 5, 2012
@@ -116,4 +116,11 @@ protected static int getConsequtiveDuplicateCharsInArrayUpToIndex(
return count;
}
+ /** @return list of Black pieces for this tablebase */
+ public List<Piece> getBlackPieces() {
+ char[] blackPiecesAsChars = getPiecesAsCharsFromTablebase(PieceColour.BLACK);
+ List<Piece> blackPieces = new ArrayList<Piece>();
+ blackPieces = convertCharsToPieces(blackPiecesAsChars, PieceColour.BLACK);
+ return blackPieces;
+ }
}
@@ -70,7 +70,16 @@ public void testGetWhitePieces() {
Tablebase tablebase1 = Tablebase.KRPKR;
Piece[] expectedPieces = new Piece[] { Piece.WHITE_KING,
Piece.WHITE_ROOK, Piece.WHITE_PAWN };
- Piece[] actualPieces = (Piece[]) tablebase1.getWhitePieces().toArray(new Piece[0]);
+ Piece[] actualPieces = tablebase1.getWhitePieces().toArray(new Piece[0]);
+
+ assertArrayEquals(expectedPieces, actualPieces);
+ }
+
+ @Test
+ public void testGetBlackPieces() {
+ Tablebase tablebase1 = Tablebase.KRPKR;
+ Piece[] expectedPieces = new Piece[] { Piece.BLACK_KING, Piece.BLACK_ROOK };
+ Piece[] actualPieces = tablebase1.getBlackPieces().toArray(new Piece[0]);
assertArrayEquals(expectedPieces, actualPieces);
}
Binary file not shown.

0 comments on commit dbf1eb3

Please sign in to comment.