diff options
author | sanine <sanine.not@pm.me> | 2023-11-21 11:34:48 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-11-21 11:34:48 -0600 |
commit | 23e8acfc1eaa1702e55f47239e4b4dfbe9d35fca (patch) | |
tree | 8a96478dfba28e9ac275c9a93e49375f7deebcbd /test | |
parent | 6ab486c73d4d5764ac7b63c46e04c361c776385b (diff) |
add connectNeurons
Diffstat (limited to 'test')
-rw-r--r-- | test/MindTest.hs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/MindTest.hs b/test/MindTest.hs index 5eb1734..65d5a84 100644 --- a/test/MindTest.hs +++ b/test/MindTest.hs @@ -21,4 +21,40 @@ networkTests :: TestTree networkTests = testGroup "network tests" $ [ testCase "create empty network" $ (createEmptyNetwork 3 2 1) @?= Network 3 [[], []] [[]] + , testCase "output network connection" $ + let network = Network 3 [[], []] [[]] + in (connectNeurons network (Input 0) (Output 0) (negate 1.0)) + @?= (Just $ Network 3 [[], []] [[Edge (Input 0, (negate 1.0))]]) + , testCase "internal network connection" $ + let network = Network 3 [[], []] [[]] + in (connectNeurons network (Internal 0) (Internal 1) (negate 1.0)) + @?= (Just $ Network 3 [[], [Edge (Internal 0, negate 1.0)]] [[]]) + , testCase "internal self-connection" $ + let network = Network 3 [[], []] [[]] + in (connectNeurons network (Internal 0) (Internal 0) (negate 1.0)) + @?= (Just $ Network 3 [[Edge (Internal 0, negate 1.0)], []] [[]]) + , testCase "internal source out of range" $ + let network = Network 3 [[], []] [[]] + in (connectNeurons network (Internal 5) (Internal 0) (negate 1.0)) + @?= Nothing + , testCase "internal sink out of range" $ + let network = Network 3 [[], []] [[]] + in (connectNeurons network (Internal 1) (Internal (negate 1)) (negate 1.0)) + @?= Nothing + , testCase "input source out of range" $ + let network = Network 3 [[], []] [[]] + in (connectNeurons network (Input (negate 1)) (Internal 0) (negate 1.0)) + @?= Nothing + , testCase "input sink" $ + let network = Network 3 [[], []] [[]] + in (connectNeurons network (Input 0) (Input 0) (negate 1.0)) + @?= Nothing + , testCase "output source" $ + let network = Network 3 [[], []] [[]] + in (connectNeurons network (Output 0) (Output 0) (negate 1.0)) + @?= Nothing + , testCase "output sink out of range" $ + let network = Network 3 [[], []] [[]] + in (connectNeurons network (Input 0) (Output 4) (negate 1.0)) + @?= Nothing ] |