summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/Test.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/Test.hs b/test/Test.hs
index 3b15d25..bfe9f55 100644
--- a/test/Test.hs
+++ b/test/Test.hs
@@ -21,12 +21,7 @@ import Chess.PGN
import ArbitraryMove
atAnyState :: (Board -> Bool) -> PGN -> Bool
-atAnyState ok pgn = and [ok b | Right b <- seqList [moveSAN m | m <- moves pgn] $ Right defaultBoard]
- where
- seqList :: [r -> Either e r] -> Either e r -> [Either e r]
- seqList (f:fs) (Right io) = f io:seqList fs (f io)
- seqList _ (Left _) = []
- seqList [] _ = []
+atAnyState = atAnyTwoStates . const
atAnyTwoStates :: (Board -> Board -> Bool) -> PGN -> Bool
atAnyTwoStates ok pgn =
@@ -107,5 +102,10 @@ prop_number_of_pieces = atAnyTwoStates (\b1 b2 ->
length (pieceCoords Nothing Nothing b1) - 1 == length (pieceCoords Nothing Nothing b2)
)
+prop_not_in_check_twice :: PGN -> Bool
+prop_not_in_check_twice = atAnyTwoStates (\b1 b2 ->
+ not (check Black b1 && check Black b2) &&
+ not (check White b1 && check White b2))
+
return []
main = $forAllProperties (quickCheckWithResult (stdArgs {maxSuccess=10000}))