diff options
Diffstat (limited to 'test/Main.hs')
-rw-r--r-- | test/Main.hs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/Main.hs b/test/Main.hs index aade6a5..86b6011 100644 --- a/test/Main.hs +++ b/test/Main.hs @@ -1,13 +1,26 @@ {-# LANGUAGE TypeApplications #-} module Main where +import qualified Data.Vector as V +import Hedgehog import Test.Tasty +import Test.Tasty.Hedgehog import Test.Tasty.HUnit import Numeric.ADDual +import Numeric.ADDual.Examples main :: IO () main = defaultMain $ testGroup "Tests" [testCase "product [1..5]" $ - gradient' @Double product [1..5] 1 @?= (120, [120, 60, 40, 30, 24])] + gradient' @Double product [1..5] 1 @?= (120, [120, 60, 40, 30, 24]) + ,testCase "neural one" $ + let problem = FNeural + [(V.replicate 6 0.0, V.replicate 6 0.0), (V.replicate 24 0.0, V.replicate 4 0.0)] + (V.replicate 1 0.0) + in fst (gradient' @Double fneural problem 1) @?= 0.0 + ,testProperty "neural run" $ property $ do + input <- forAll genNeuralInput + let (res, _grad) = gradient' fneural input 1 + res === fneural input] |