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])