Setup QuickCheck testing

This commit is contained in:
David Pätzel 2019-10-18 23:20:19 +02:00
parent e0b5de5a7f
commit c8af014976
4 changed files with 30 additions and 12 deletions

View File

@ -1,7 +1,6 @@
{ mkDerivation, base, Cabal, cabal-test-quickcheck, extra { mkDerivation, base, Cabal, extra, monad-loops, MonadRandom, pipes
, monad-loops, MonadRandom, pipes, protolude, QuickCheck , protolude, QuickCheck, quickcheck-instances, random, random-fu
, quickcheck-instances, random, random-fu, random-shuffle, stdenv , random-shuffle, stdenv, text
, text
}: }:
mkDerivation { mkDerivation {
pname = "ga"; pname = "ga";
@ -14,13 +13,8 @@ mkDerivation {
quickcheck-instances random random-fu random-shuffle text quickcheck-instances random random-fu random-shuffle text
]; ];
executableHaskellDepends = [ executableHaskellDepends = [
base extra monad-loops MonadRandom pipes protolude QuickCheck base Cabal extra monad-loops MonadRandom pipes protolude QuickCheck
quickcheck-instances random random-fu random-shuffle text quickcheck-instances random random-fu random-shuffle text
]; ];
testHaskellDepends = [
base Cabal cabal-test-quickcheck extra monad-loops MonadRandom
pipes protolude QuickCheck quickcheck-instances random random-fu
random-shuffle text
];
license = stdenv.lib.licenses.gpl3; license = stdenv.lib.licenses.gpl3;
} }

View File

@ -56,16 +56,25 @@ executable ga
, SS19 , SS19
, WS19 , WS19
executable ga-tests
build-depends: base ^>=4.12.0.0
, Cabal
, extra
, MonadRandom
, monad-loops
, pipes , pipes
, protolude , protolude
, QuickCheck , QuickCheck
, quickcheck-instances , quickcheck-instances
, random
, random-fu
, random-shuffle
, text , text
default-language: Haskell2010 default-language: Haskell2010
hs-source-dirs: src hs-source-dirs: src
main-is: Main.hs main-is: Test.hs
other-modules: GA other-modules: GA
, Seminar , Seminar
, Pretty , Pretty
, SS19 , SS19
, WS19 , WS19

View File

@ -1,5 +1,6 @@
{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module Seminar where module Seminar where
@ -161,3 +162,6 @@ valid :: Assignment -> Bool
valid a = valid a =
length a == length (nub $ fst <$> a) length a == length (nub $ fst <$> a)
&& length a == length (nub $ snd <$> a) && length a == length (nub $ snd <$> a)
return []
runTests = $quickCheckAll

11
src/Test.hs Normal file
View File

@ -0,0 +1,11 @@
{-# LANGUAGE NoImplicitPrelude #-}
module Main where
import Protolude
import qualified Seminar
main :: IO ()
main = do
_ <- Seminar.runTests
return ()