tests/list.ss
#lang scheme
(provide (all-defined-out))
(require (planet cce/scheme:7/planet)
         test-engine/scheme-tests
         (this-package-in list))

;;======================================================================
;; Tests

(check-expect (remf positive? '()) '())
(check-expect (remf positive? '(1 -2 3 4 -5)) '(-2 3 4 -5))
(check-expect (remf even? '(1 -2 3 4 -5)) '(1 3 4 -5))
(check-expect (remf (λ (x) #f) '(1 -2 3 4 -5)) '(1 -2 3 4 -5))

(check-expect (interleave 'a (make-list 3 'b))
              (list 'b 'a 'b 'a 'b))

(check-expect (remove-at (list 'a) 0) empty)
(check-expect (remove-at (list 'a 'b) 0) (list 'b))
(check-expect (remove-at (list 'a 'b) 1) (list 'a))

(check-expect (replace-at (list 'a) 'x 0) (list 'x))
(check-expect (replace-at (list 'a 'b) 'x 0) (list 'x 'b))
(check-expect (replace-at (list 'a 'b) 'x 1) (list 'a 'x))

(test)