"Return t if SEQ1 and SEQ2 have the same contents, nil otherwise."
(equal (append seq1 '()) (append seq2 '())))
-(defun test-sequences-evenp (integer)
- "Return t if INTEGER is even."
- (eq (logand integer 1) 0))
-
-(defun test-sequences-oddp (integer)
- "Return t if INTEGER is odd."
- (not (test-sequences-evenp integer)))
-
(ert-deftest test-setf-seq-elt ()
(with-test-sequences (seq '(1 2 3))
(setf (seq-elt seq 1) 4)
(ert-deftest test-seq-drop-while ()
(with-test-sequences (seq '(1 3 2 4))
- (should (equal (seq-drop-while #'test-sequences-oddp seq)
+ (should (equal (seq-drop-while #'oddp seq)
(seq-drop seq 2)))
- (should (equal (seq-drop-while #'test-sequences-evenp seq)
+ (should (equal (seq-drop-while #'evenp seq)
seq))
(should (seq-empty-p (seq-drop-while #'numberp seq))))
(with-test-sequences (seq '())
- (should (seq-empty-p (seq-drop-while #'test-sequences-oddp seq)))))
+ (should (seq-empty-p (seq-drop-while #'oddp seq)))))
(ert-deftest test-seq-take-while ()
(with-test-sequences (seq '(1 3 2 4))
- (should (equal (seq-take-while #'test-sequences-oddp seq)
+ (should (equal (seq-take-while #'oddp seq)
(seq-take seq 2)))
- (should (seq-empty-p (seq-take-while #'test-sequences-evenp seq)))
+ (should (seq-empty-p (seq-take-while #'evenp seq)))
(should (equal (seq-take-while #'numberp seq) seq)))
(with-test-sequences (seq '())
- (should (seq-empty-p (seq-take-while #'test-sequences-oddp seq)))))
+ (should (seq-empty-p (seq-take-while #'oddp seq)))))
(ert-deftest test-seq-map-indexed ()
(should (equal (seq-map-indexed (lambda (elt i)
(ert-deftest test-seq-filter ()
(with-test-sequences (seq '(6 7 8 9 10))
- (should (equal (seq-filter #'test-sequences-evenp seq) '(6 8 10)))
- (should (equal (seq-filter #'test-sequences-oddp seq) '(7 9)))
+ (should (equal (seq-filter #'evenp seq) '(6 8 10)))
+ (should (equal (seq-filter #'oddp seq) '(7 9)))
(should (equal (seq-filter (lambda (_) nil) seq) '())))
(with-test-sequences (seq '())
- (should (equal (seq-filter #'test-sequences-evenp seq) '()))))
+ (should (equal (seq-filter #'evenp seq) '()))))
(ert-deftest test-seq-remove ()
(with-test-sequences (seq '(6 7 8 9 10))
- (should (equal (seq-remove #'test-sequences-evenp seq) '(7 9)))
- (should (equal (seq-remove #'test-sequences-oddp seq) '(6 8 10)))
+ (should (equal (seq-remove #'evenp seq) '(7 9)))
+ (should (equal (seq-remove #'oddp seq) '(6 8 10)))
(should (same-contents-p (seq-remove (lambda (_) nil) seq) seq)))
(with-test-sequences (seq '())
- (should (equal (seq-remove #'test-sequences-evenp seq) '()))))
+ (should (equal (seq-remove #'evenp seq) '()))))
(ert-deftest test-seq-remove-at-position ()
(with-test-sequences (seq '(1 2 3 4))
(ert-deftest test-seq-count ()
(with-test-sequences (seq '(6 7 8 9 10))
- (should (equal (seq-count #'test-sequences-evenp seq) 3))
- (should (equal (seq-count #'test-sequences-oddp seq) 2))
+ (should (equal (seq-count #'evenp seq) 3))
+ (should (equal (seq-count #'oddp seq) 2))
(should (equal (seq-count (lambda (_) nil) seq) 0)))
(with-test-sequences (seq '())
- (should (equal (seq-count #'test-sequences-evenp seq) 0))))
+ (should (equal (seq-count #'evenp seq) 0))))
(ert-deftest test-seq-reduce ()
(with-test-sequences (seq '(1 2 3 4))
(ert-deftest test-seq-some ()
(with-test-sequences (seq '(4 3 2 1))
- (should (seq-some #'test-sequences-evenp seq))
- (should (seq-some #'test-sequences-oddp seq))
+ (should (seq-some #'evenp seq))
+ (should (seq-some #'oddp seq))
(should-not (seq-some (lambda (elt) (> elt 10)) seq)))
(with-test-sequences (seq '())
- (should-not (seq-some #'test-sequences-oddp seq)))
+ (should-not (seq-some #'oddp seq)))
(should (seq-some #'null '(1 nil 2))))
(ert-deftest test-seq-find ()
(with-test-sequences (seq '(4 3 2 1))
- (should (= 4 (seq-find #'test-sequences-evenp seq)))
- (should (= 3 (seq-find #'test-sequences-oddp seq)))
+ (should (= 4 (seq-find #'evenp seq)))
+ (should (= 3 (seq-find #'oddp seq)))
(should-not (seq-find (lambda (elt) (> elt 10)) seq)))
(should-not (seq-find #'null '(1 nil 2)))
(should-not (seq-find #'null '(1 nil 2) t))
(ert-deftest test-seq-every-p ()
(with-test-sequences (seq '(43 54 22 1))
(should (seq-every-p (lambda (_) t) seq))
- (should-not (seq-every-p #'test-sequences-oddp seq))
- (should-not (seq-every-p #'test-sequences-evenp seq)))
+ (should-not (seq-every-p #'oddp seq))
+ (should-not (seq-every-p #'evenp seq)))
(with-test-sequences (seq '(42 54 22 2))
- (should (seq-every-p #'test-sequences-evenp seq))
- (should-not (seq-every-p #'test-sequences-oddp seq)))
+ (should (seq-every-p #'evenp seq))
+ (should-not (seq-every-p #'oddp seq)))
(with-test-sequences (seq '())
(should (seq-every-p #'identity seq))
- (should (seq-every-p #'test-sequences-evenp seq))))
+ (should (seq-every-p #'evenp seq))))
(ert-deftest test-seq-set-equal-p ()
(with-test-sequences (seq1 '(1 2 3))
(ert-deftest test-seq-group-by ()
(with-test-sequences (seq '(1 2 3 4))
- (should (equal (seq-group-by #'test-sequences-oddp seq)
+ (should (equal (seq-group-by #'oddp seq)
'((t 1 3) (nil 2 4)))))
(should (equal (seq-group-by #'car '((a 1) (b 3) (c 4) (a 2)))
'((b (b 3)) (c (c 4)) (a (a 1) (a 2))))))