summaryrefslogtreecommitdiffstats
path: root/tests/016/arith.tl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/016/arith.tl')
-rw-r--r--tests/016/arith.tl24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/016/arith.tl b/tests/016/arith.tl
index 43efb6bb..52e8667b 100644
--- a/tests/016/arith.tl
+++ b/tests/016/arith.tl
@@ -142,3 +142,27 @@
(test (ffi-get (ffi-put #x-8000000000000000 (ffi int64)) (ffi int64))
#x-8000000000000000)
+
+(mtest
+ (sum #()) 0
+ (sum #(1)) 1
+ (sum #(1 2)) 3
+ (sum #(1 2 3)) 6
+ (sum #() (op * 10)) 0
+ (sum #(1) (op * 10)) 10
+ (sum #(1 2) (op * 10)) 30
+ (sum #(1 2 3) (op * 10)) 60
+ (sum 1..10) 45
+ (sum 2..10) 44)
+
+(mtest
+ (prod #()) 1
+ (prod #(1)) 1
+ (prod #(1 2)) 2
+ (prod #(1 2 3)) 6
+ (prod #() (op * 10)) 1
+ (prod #(1) (op * 10)) 10
+ (prod #(1 2) (op * 10)) 200
+ (prod #(1 2 3) (op * 10)) 6000
+ (prod 2..8) 5040
+ (prod 3..8) 2520)