nreconc.lsp 893 Bytes
Newer Older
1 2 3 4 5
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sat Apr 19 22:38:12 2003
;;;; Contains: Tests of NRECONC

6

7

8

9

10 11
(deftest nreconc.1
  (let* ((x (list 'a 'b 'c))
sds's avatar
sds committed
12 13
         (y (copy-tree '(d e f)))
         (result (nreconc x y)))
14
    (and (equal y '(d e f))
sds's avatar
sds committed
15
         result))
16 17 18 19 20 21 22 23 24 25
  (c b a d e f))

(deftest nreconc.2
  (nreconc nil 'a)
  a)

(deftest nreconc.order.1
  (let ((i 0) x y)
    (values
     (nreconc (progn (setf x (incf i)) (copy-list '(a b c)))
sds's avatar
sds committed
26
              (progn (setf y (incf i)) (copy-list '(d e f))))
27 28 29 30
     i x y))
  (c b a d e f) 2 1 2)

(deftest nreconc.error.1
31 32
  (signals-error (nreconc) program-error)
  t)
33 34

(deftest nreconc.error.2
35 36
  (signals-error (nreconc nil) program-error)
  t)
37 38

(deftest nreconc.error.3
39 40
  (signals-error (nreconc nil nil nil) program-error)
  t)
41 42

(deftest nreconc.error.4
43 44
  (signals-error (nreconc (cons 'a 'b) (list 'z)) type-error)
  t)