adding tests for first..tenth

This commit is contained in:
Alex Shinn 2015-06-08 23:59:55 +09:00
parent a31da07a25
commit 35279b45c3

View file

@ -40,6 +40,16 @@
(test '2 (cdr '(1 . 2)))
(test-error (car '()))
(test-error (cdr '()))
(test 1 (first '(1 2 3 4 5 6 7 8 9 10)))
(test 2 (second '(1 2 3 4 5 6 7 8 9 10)))
(test 3 (third '(1 2 3 4 5 6 7 8 9 10)))
(test 4 (fourth '(1 2 3 4 5 6 7 8 9 10)))
(test 5 (fifth '(1 2 3 4 5 6 7 8 9 10)))
(test 6 (sixth '(1 2 3 4 5 6 7 8 9 10)))
(test 7 (seventh '(1 2 3 4 5 6 7 8 9 10)))
(test 8 (eighth '(1 2 3 4 5 6 7 8 9 10)))
(test 9 (ninth '(1 2 3 4 5 6 7 8 9 10)))
(test 10 (tenth '(1 2 3 4 5 6 7 8 9 10)))
(test 'c (list-ref '(a b c d) 2))
(test 'c (third '(a b c d e)))
(test '(a b) (take '(a b c d e) 2))
@ -100,14 +110,14 @@
(test #t (any even? '(1 2 3)))
(test #f (find even? '(1 7 3)))
(test #f (any even? '(1 7 3)))
;(test-error (find even? '(1 3 . x)))
;(test-error (any even? '(1 3 . x)))
;(test 'error/undefined (find even? '(1 2 . x)))
;(test 'error/undefined (any even? '(1 2 . x))) ; success, error or other
;;(test-error (find even? '(1 3 . x)))
;;(test-error (any even? '(1 3 . x)))
;;(test 'error/undefined (find even? '(1 2 . x)))
;;(test 'error/undefined (any even? '(1 2 . x))) ; success, error or other
(test 6 (find even? (circular-list 1 6 3)))
(test #t (any even? (circular-list 1 6 3)))
;(test-error (find even? (circular-list 1 3))) ; divergent
;(test-error (any even? (circular-list 1 3))) ; divergent
;;(test-error (find even? (circular-list 1 3))) ; divergent
;;(test-error (any even? (circular-list 1 3))) ; divergent
(test 4 (find even? '(3 1 4 1 5 9)))
(test #f (every odd? '(1 2 3)))
(test #t (every < '(1 2 3) '(4 5 6)))
@ -129,7 +139,7 @@
(test #f (memq 'a '(b c d)))
(test #f (memq (list 'a) '(b (a) c)))
(test '((a) c) (member (list 'a) '(b (a) c)))
;(test '*unspecified* (memq 101 '(100 101 102)))
;;(test '*unspecified* (memq 101 '(100 101 102)))
(test '(101 102) (memv 101 '(100 101 102)))
(test '(a b c z) (delete-duplicates '(a b a c a b c z)))
(test '((a . 3) (b . 7) (c . 1)) (delete-duplicates '((a . 3) (b . 7) (a . 9) (c . 1)) (lambda (x y) (eq? (car x) (car y)))))
@ -139,7 +149,7 @@
(test #f (assq 'd e))
(test #f (assq (list 'a) '(((a)) ((b)) ((c)))))
(test '((a)) (assoc (list 'a) '(((a)) ((b)) ((c)))))
;(test '*unspecified* (assq 5 '((2 3) (5 7) (11 13))))
;;(test '*unspecified* (assq 5 '((2 3) (5 7) (11 13))))
(test '(5 7) (assv 5 '((2 3) (5 7) (11 13)))))
(test #t (lset<= eq? '(a) '(a b a) '(a b c c)))
(test #t (lset<= eq?))
@ -167,7 +177,7 @@
(test '(a b c d e) (lset-xor eq? '(a b c d e)))
(let ((f (lambda () (list 'not-a-constant-list)))
(g (lambda () '(constant-list))))
;(test '*unspecified* (set-car! (f) 3))
;;(test '*unspecified* (set-car! (f) 3))
(test-error (set-car! (g) 3)))
(test-end))))