diff --git a/src/GA.hs b/src/GA.hs index 7ff5702..69c3aed 100644 --- a/src/GA.hs +++ b/src/GA.hs @@ -183,6 +183,12 @@ prop_bestsBy_isBestsBy' k pop = b <- bestsBy' k fitness pop 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. -} diff --git a/src/Test.hs b/src/Test.hs index e0a921d..a7fbe27 100644 --- a/src/Test.hs +++ b/src/Test.hs @@ -8,6 +8,6 @@ import qualified Seminar main :: IO () main = do - _ <- Seminar.runTests _ <- GA.runTests + _ <- Seminar.runTests return ()