summaryrefslogtreecommitdiff
path: root/test/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'test/Main.hs')
-rw-r--r--test/Main.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/Main.hs b/test/Main.hs
index d90d9cd..f779352 100644
--- a/test/Main.hs
+++ b/test/Main.hs
@@ -229,8 +229,18 @@ tests :: IO Bool
tests = checkParallel $ Group "AD"
[("id", adTest $ fromNamed $ lambda #x $ body $ #x)
+ ,("idx0", adTest $ fromNamed $ lambda #x $ body $ idx0 #x)
+
,("sum-vec", adTest $ fromNamed $ lambda #x $ body $ idx0 (sum1i #x))
+ ,("sum-replicate", adTest $ fromNamed $ lambda #x $ body $
+ idx0 $ sum1i $ replicate1i 10 #x)
+
+ ,("pairs", adTest $ fromNamed $ lambda #x $ lambda #y $ body $
+ let_ #p (pair #x #y) $
+ let_ #q (pair (snd_ #p * fst_ #p + #y) #x) $
+ fst_ #q * #x + snd_ #q * fst_ #p)
+
,("build0", adTest $ fromNamed $ lambda @(TArr N0 _) #x $ body $
idx0 $
build SZ (shape #x) $ #idx :-> #x ! #idx)