diff options
author | Camil Staps | 2017-11-20 13:50:01 +0100 |
---|---|---|
committer | Camil Staps | 2017-11-20 13:50:01 +0100 |
commit | 2d069198f6c4ce5bc39f73f0a31271c9d806c16b (patch) | |
tree | bf9643e43f7ea619e5f53b2df6f87f6dced7645c | |
parent | Add pieceCoords (diff) |
Add prop_no_pawns_on_1_and_8
-rw-r--r-- | test/Test.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/Test.hs b/test/Test.hs index 4aa3197..9cf10b4 100644 --- a/test/Test.hs +++ b/test/Test.hs @@ -71,7 +71,7 @@ makePGN event site date round white black result moves = -- From Chess.hs, with adaptations pieceCoords :: Maybe Color -> Maybe PieceType -> Board -> [((Int,Int),Piece)] -pieceCoords clr piece brd = [(i,pc) | (i,Just pc) <- (assocs $ board brd), match pc] +pieceCoords clr piece brd = [(i,pc) | (i,Just pc) <- assocs $ board brd, match pc] where match :: Piece -> Bool match (Piece clr' piece') = @@ -83,5 +83,11 @@ prop_only_2_kings = atAnyState (\b -> length (pieceCoords (Just Black) (Just King) b) == 1 && length (pieceCoords (Just White) (Just King) b) == 1) +prop_no_pawns_on_1_and_8 :: PGN -> Bool +prop_no_pawns_on_1_and_8 = atAnyState $ all notOnAorH . pieceCoords Nothing (Just Pawn) + where + notOnAorH :: ((Int,Int),a) -> Bool + notOnAorH ((_,r),_) = r /= 0 && r /= 7 + return [] main = $forAllProperties (quickCheckWithResult (stdArgs {maxSuccess=10000})) |