Add length test for GA.bestsBy

This commit is contained in:
David Pätzel 2020-01-07 09:17:39 +01:00
parent bbddd62c70
commit 7a48c1278f
2 changed files with 7 additions and 1 deletions

View File

@ -183,6 +183,12 @@ prop_bestsBy_isBestsBy' k pop =
b <- bestsBy' k fitness pop b <- bestsBy' k fitness pop
assert $ NE.toList a == b assert $ NE.toList a == b
prop_bestsBy_lengths k pop =
k > 0 ==> monadicIO $ do
(bests, rest) <- bestsBy k fitness pop
assert
$ length bests == min k (length pop) && length bests + length rest == length pop
{-| {-|
The @k@ worst individuals in the population. The @k@ worst individuals in the population.
-} -}

View File

@ -8,6 +8,6 @@ import qualified Seminar
main :: IO () main :: IO ()
main = do main = do
_ <- Seminar.runTests
_ <- GA.runTests _ <- GA.runTests
_ <- Seminar.runTests
return () return ()