diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/GenomeTest.hs | 20 | 
1 files changed, 13 insertions, 7 deletions
diff --git a/test/GenomeTest.hs b/test/GenomeTest.hs index 0a27a94..a09e742 100644 --- a/test/GenomeTest.hs +++ b/test/GenomeTest.hs @@ -62,11 +62,17 @@ mutationTests = testGroup "mutations" $          )          ([], rand)          (replicate 3 sourceGene) -    in -      mutatedGenes @?= -      [ Gene { source = M.Input 0, sink = M.Output 1, weight = 7.572357} -      , Gene { source = M.Input 0, sink = M.Output 1, weight = -1.4116564 } -      , Gene { source = M.Input 0, sink = M.Internal 1, weight = -7.2413177  } -      ] - +      expected = +      	[ Gene { source = M.Input 0, sink = M.Output 1, weight = 7.572357} +      	, Gene { source = M.Input 0, sink = M.Output 1, weight = -1.4116564 } +      	, Gene { source = M.Input 0, sink = M.Output 1, weight = -7.2413177  } +      	] +      approxEqual a b = abs (a-b) < 0.0001 +    in do +      (map source mutatedGenes) @?= (map source expected) +      (map sink mutatedGenes) @?= (map sink expected) +      True @?= foldl (&&) True (zipWith approxEqual +      	(map weight mutatedGenes) +      	(map weight expected) +      	)    ]  | 
