Add length test for GA.bestsBy
This commit is contained in:
parent
bbddd62c70
commit
7a48c1278f
|
@ -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.
|
||||||
-}
|
-}
|
||||||
|
|
|
@ -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 ()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user