From ff0daa0511b9cf677e84c16cc4acb8861986ee70 Mon Sep 17 00:00:00 2001 From: kaos Date: Sat, 8 Aug 2015 11:47:31 +0200 Subject: [PATCH] add testDoppieRotazioni --- vm/Tests.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/vm/Tests.hs b/vm/Tests.hs index 84c1d8d..cdc80c0 100644 --- a/vm/Tests.hs +++ b/vm/Tests.hs @@ -19,6 +19,17 @@ testTutto = do deepCheck (\pivot cell -> cell == counterRotateCell pivot (rotateCell pivot cell)) deepCheck (\pivot cell -> cell == counterRotateCell2 pivot (rotateCell pivot cell)) +checkForNothing::[Maybe(Cell, Fallimento)] -> Maybe(Cell, Fallimento) +checkForNothing (Nothing:xs) = checkForNothing xs +checkForNothing ((Just v):xs) = Just v +checkForNothing [] = Nothing + +testTutteRotazioni = checkForNothing [ + testDoppieRotazioni (2,3) [(2,0), (4,1), (5,4), (3,6), (0,5), (0,2), (2,0)], + testDoppieRotazioni (2,4) [(2,1), (4,3), (4,6), (1,7), (-1,5), (0,2), (2,1)], + testDoppieRotazioni (1,5) [(1,3), (3,4), (3,6), (1,7), (0,6), (0,4), (1,3)] + ] + testGame = let board = Board 5 10 (Set.fromList []) unit = Unit (Set.fromList [(2, 8)]) (2, 8) game = Game board [unit] (Set.fromList [hash unit])