summaryrefslogtreecommitdiff
path: root/test-suite/tests/srfi-1.test
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2005-03-17 23:16:31 +0000
committerKevin Ryde <user42@zip.com.au>2005-03-17 23:16:31 +0000
commitcfa1ef52a2939e3303069de65f6f54bc32bc2e52 (patch)
tree40a607f7344bb1bc9b3ed01b0cf2321ad09a6d35 /test-suite/tests/srfi-1.test
parentc16359466bcc3f2ebf6d750c069f787f629fc625 (diff)
downloadguile-cfa1ef52a2939e3303069de65f6f54bc32bc2e52.tar.gz
(filter-map): More tests.
Diffstat (limited to 'test-suite/tests/srfi-1.test')
-rw-r--r--test-suite/tests/srfi-1.test59
1 files changed, 57 insertions, 2 deletions
diff --git a/test-suite/tests/srfi-1.test b/test-suite/tests/srfi-1.test
index 93d7329fe..b8713b12e 100644
--- a/test-suite/tests/srfi-1.test
+++ b/test-suite/tests/srfi-1.test
@@ -717,6 +717,12 @@
(with-test-prefix "filter-map"
(with-test-prefix "one list"
+ (pass-if-exception "'x" exception:wrong-type-arg
+ (filter-map noop 'x))
+
+ (pass-if-exception "'(1 . x)" exception:wrong-type-arg
+ (filter-map noop '(1 . x)))
+
(pass-if "(1)"
(equal? '(1) (filter-map noop '(1))))
@@ -745,14 +751,63 @@
(equal? '(1 2) (filter-map noop '(1 2 #f)))))
(with-test-prefix "two lists"
+ (pass-if-exception "'x '(1 2 3)" exception:wrong-type-arg
+ (filter-map noop 'x '(1 2 3)))
+
+ (pass-if-exception "'(1 2 3) 'x" exception:wrong-type-arg
+ (filter-map noop '(1 2 3) 'x))
+
+ (pass-if-exception "'(1 . x) '(1 2 3)" exception:wrong-type-arg
+ (filter-map noop '(1 . x) '(1 2 3)))
+
+ (pass-if-exception "'(1 2 3) '(1 . x)" exception:wrong-type-arg
+ (filter-map noop '(1 2 3) '(1 . x)))
+
(pass-if "(1 2 3) (4 5 6)"
- (equal? '(1 2 3) (filter-map noop '(1 2 3) '(4 5 6))))
+ (equal? '(5 7 9) (filter-map + '(1 2 3) '(4 5 6))))
(pass-if "(#f 2 3) (4 5)"
(equal? '(2) (filter-map noop '(#f 2 3) '(4 5))))
(pass-if "(4 #f) (1 2 3)"
- (equal? '(4) (filter-map noop '(4 #f) '(1 2 3))))))
+ (equal? '(4) (filter-map noop '(4 #f) '(1 2 3))))
+
+ (pass-if "() (1 2 3)"
+ (equal? '() (filter-map noop '() '(1 2 3))))
+
+ (pass-if "(1 2 3) ()"
+ (equal? '() (filter-map noop '(1 2 3) '()))))
+
+ (with-test-prefix "three lists"
+ (pass-if-exception "'x '(1 2 3) '(1 2 3)" exception:wrong-type-arg
+ (filter-map noop 'x '(1 2 3) '(1 2 3)))
+
+ (pass-if-exception "'(1 2 3) 'x '(1 2 3)" exception:wrong-type-arg
+ (filter-map noop '(1 2 3) 'x '(1 2 3)))
+
+ (pass-if-exception "'(1 2 3) '(1 2 3) 'x" exception:wrong-type-arg
+ (filter-map noop '(1 2 3) '(1 2 3) 'x))
+
+ (pass-if-exception "'(1 . x) '(1 2 3) '(1 2 3)" exception:wrong-type-arg
+ (filter-map noop '(1 . x) '(1 2 3) '(1 2 3)))
+
+ (pass-if-exception "'(1 2 3) '(1 . x) '(1 2 3)" exception:wrong-type-arg
+ (filter-map noop '(1 2 3) '(1 . x) '(1 2 3)))
+
+ (pass-if-exception "'(1 2 3) '(1 2 3) '(1 . x)" exception:wrong-type-arg
+ (filter-map noop '(1 2 3) '(1 2 3) '(1 . x)))
+
+ (pass-if "(1 2 3) (4 5 6) (7 8 9)"
+ (equal? '(12 15 18) (filter-map + '(1 2 3) '(4 5 6) '(7 8 9))))
+
+ (pass-if "(#f 2 3) (4 5) (7 8 9)"
+ (equal? '(2) (filter-map noop '(#f 2 3) '(4 5) '(7 8 9))))
+
+ (pass-if "(#f 2 3) (7 8 9) (4 5)"
+ (equal? '(2) (filter-map noop '(#f 2 3) '(7 8 9) '(4 5))))
+
+ (pass-if "(4 #f) (1 2 3) (7 8 9)"
+ (equal? '(4) (filter-map noop '(4 #f) '(1 2 3) '(7 8 9))))))
;;
;; find