diff --git a/Pioneers.cabal b/Pioneers.cabal index 4aad55e..633c0c5 100644 --- a/Pioneers.cabal +++ b/Pioneers.cabal @@ -12,6 +12,8 @@ executable Pioneers ghc-options: -Wall -Odph -rtsopts -threaded -fno-liberate-case -funfolding-use-threshold1000 -funfolding-keeness-factor1000 -optlo-O3 -fllvm } other-modules: + Map.Map, + Map.Combinators, Map.Types, Map.Graphics, Map.Creation, @@ -49,3 +51,32 @@ executable Pioneers attoparsec-binary >= 0.1 Default-Language: Haskell2010 +test-suite QuickCheckTests + type: exitcode-stdio-1.0 + hs-source-dirs: tests, src + main-is: MainTestSuite.hs + build-depends: base, + OpenGL >=2.9, + bytestring >=0.10, + OpenGLRaw >=1.4, + text >=0.11, + array >=0.4, + random >=1.0.1, + transformers >=0.3.0, + unordered-containers >= 0.2.1, + hashable >= 1.0.1.1, + mtl >=2.1.2, + stm >=2.4.2, + vector >=0.10.9 && <0.11, + distributive >=0.3.2, + linear >=1.3.1, + lens >=4.0, + SDL2 >= 0.1.0, + time >=1.4.0, + GLUtil >= 0.7, + attoparsec >= 0.11.2, + attoparsec-binary >= 0.1, + QuickCheck, + test-framework, + test-framework-quickcheck2 + Default-Language: Haskell2010 diff --git a/src/Map/Map.hs b/src/Map/Map.hs index e358cee..ba697c0 100644 --- a/src/Map/Map.hs +++ b/src/Map/Map.hs @@ -40,5 +40,5 @@ giveNeighbourhood mp n (a,b) = let ns = giveNeighbours mp (a,b) in remdups :: Ord a => [a] -> [a] remdups = map head . group . sort -prop_rd_idempot :: Ord a => [a] -> Bool +prop_rd_idempot :: [Int] -> Bool prop_rd_idempot xs = remdups xs == (remdups . remdups) xs diff --git a/tests/MainTestSuite.hs b/tests/MainTestSuite.hs new file mode 100644 index 0000000..9c46a05 --- /dev/null +++ b/tests/MainTestSuite.hs @@ -0,0 +1,20 @@ +module Main where + +import Test.Framework +import Test.Framework.Providers.QuickCheck2 + +import Map.Map + +main :: IO () +main = defaultMain tests + +tests :: [Test] +tests = + [ + testGroup "Map.Map" + [ + testProperty "remdups idempotency" prop_rd_idempot + ] + ] + +