;;;; While most of SBCL is derived from the CMU CL system, the test
;;;; files (like this one) were written from scratch after the fork
;;;; from CMU CL.
;;;; While most of SBCL is derived from the CMU CL system, the test
;;;; files (like this one) were written from scratch after the fork
;;;; from CMU CL.
;;;; This software is in the public domain and is provided with
;;;; absolutely no warranty. See the COPYING and CREDITS files for
;;;; more information.
;;;; This software is in the public domain and is provided with
;;;; absolutely no warranty. See the COPYING and CREDITS files for
;;;; more information.
- '((:args ((1 2 3 4 5)) :result (1 2 3 4))
- (:args ((1 2 3 4 5) 6) :result nil)
- (:args (nil) :result nil)
- (:args ((1 2 3) 0) :result (1 2 3))
- (:args ((1 2 3) 1) :result (1 2))
- (:args ((1 2 3)) :result (1 2))
- (:args ((1 2 3) 2) :result (1))
- (:args ((1 2 3) 3) :result nil)
- (:args ((1 2 3) 4) :result nil)
- (:args ((1 2 3 . 4) 0) :result (1 2 3 . 4))
- (:args ((1 2 3 . 4) 1) :result (1 2))
- (:args ((1 2 3 . 4)) :result (1 2))
- (:args ((1 2 3 . 4) 2) :result (1))
- (:args ((1 2 3 . 4) 3) :result nil)
- (:args ((1 2 3 . 4) 4) :result nil)))
+ '((:args ((1 2 3 4 5)) :result (1 2 3 4))
+ (:args ((1 2 3 4 5) 6) :result nil)
+ (:args (nil) :result nil)
+ (:args ((1 2 3) 0) :result (1 2 3))
+ (:args ((1 2 3) 1) :result (1 2))
+ (:args ((1 2 3)) :result (1 2))
+ (:args ((1 2 3) 2) :result (1))
+ (:args ((1 2 3) 3) :result nil)
+ (:args ((1 2 3) 4) :result nil)
+ (:args ((1 2 3 . 4) 0) :result (1 2 3 . 4))
+ (:args ((1 2 3 . 4) 1) :result (1 2))
+ (:args ((1 2 3 . 4)) :result (1 2))
+ (:args ((1 2 3 . 4) 2) :result (1))
+ (:args ((1 2 3 . 4) 3) :result nil)
+ (:args ((1 2 3 . 4) 4) :result nil)))
(destructuring-bind (&key args result) testcase
(destructuring-bind (list &rest rest) args
;; Test with BUTLAST.
(let ((actual-result (apply #'butlast args)))
(destructuring-bind (&key args result) testcase
(destructuring-bind (list &rest rest) args
;; Test with BUTLAST.
(let ((actual-result (apply #'butlast args)))
- (when (and (consp list) (eq actual-result list))
- (error "not a copy in BUTLAST for ~S" args))
- (unless (equal actual-result result)
- (error "failed BUTLAST for ~S" args)))
+ (when (and (consp list) (eq actual-result list))
+ (error "not a copy in BUTLAST for ~S" args))
+ (unless (equal actual-result result)
+ (error "failed BUTLAST for ~S" args)))
- (actual-result (apply #'nbutlast copied-list rest)))
- (unless (equal actual-result result)
- (error "failed NBUTLAST for ~S" args))))))
+ (actual-result (apply #'nbutlast copied-list rest)))
+ (unless (equal actual-result result)
+ (error "failed NBUTLAST for ~S" args))))))
(loop for (args result) in tests
do (assert (equal (apply 'nconc (copy-tree args)) result))
do (let ((exp `(nconc ,@ (mapcar (lambda (arg)
(loop for (args result) in tests
do (assert (equal (apply 'nconc (copy-tree args)) result))
do (let ((exp `(nconc ,@ (mapcar (lambda (arg)
(loop for (args fail) in tests
do (check-error (apply #'nconc (copy-tree args)) fail)
do (let ((exp `(nconc ,@ (mapcar (lambda (arg)
(loop for (args fail) in tests
do (check-error (apply #'nconc (copy-tree args)) fail)
do (let ((exp `(nconc ,@ (mapcar (lambda (arg)
;;; Bug reported by Paul Dietz: NSET-EXCLUSIVE-OR should not return
;;; extra elements, even when given "sets" contain duplications
;;; Bug reported by Paul Dietz: NSET-EXCLUSIVE-OR should not return
;;; extra elements, even when given "sets" contain duplications