mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
(filter-map): More tests.
This commit is contained in:
parent
c16359466b
commit
cfa1ef52a2
1 changed files with 57 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue