Use noDupsList generator for more tests

This commit is contained in:
David Pätzel 2019-10-19 15:57:55 +02:00
parent 36999532c2
commit 2a9459f226

View File

@ -182,20 +182,22 @@ unique xs = length xs == (length . nub) xs
prop_valid_empty = valid [] prop_valid_empty = valid []
prop_valid_dupNoT ss = unique ss ==> valid (ss `zip` repeat NoT) prop_valid_dupNoT =
forAll noDupsList $ \ss ->
valid (ss `zip` repeat NoT)
prop_valid_dupT ss ts = prop_valid_dupT =
unique ss forAll noDupsList $ \ss ->
&& unique ts forAll noDupsList $ \ts' ->
&& length ss > length ts let ts = filter (/= NoT) ts'
&& not (null ts) in length ss > length ts && not (null ts)
&& NoT `notElem` ts ==> not . valid
==> not . valid $ ss `zip` cycle ts $ ss `zip` cycle ts
prop_valid_noDups = prop_valid_noDups =
forAll noDupsList $ \ss -> forAll noDupsList $ \ss ->
forAll noDupsList $ \ts -> forAll noDupsList $ \ts ->
valid $ ss `zip` ts valid $ ss `zip` ts
{-| {-|
Generator for lists fulfilling 'unique', that is, only containing unique Generator for lists fulfilling 'unique', that is, only containing unique