/[gcl]/gcl/ansi-tests/cons-test-07.lsp
ViewVC logotype

Diff of /gcl/ansi-tests/cons-test-07.lsp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by pfdietz, Mon Jan 13 14:11:49 2003 UTC revision 1.7 by pfdietz, Sat Feb 8 06:23:02 2003 UTC
# Line 11  Line 11 
11  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12  ;;; nconc  ;;; nconc
13    
14  (deftest nconc-1  (deftest nconc.1
15    (nconc)    (nconc)
16    nil)    nil)
17    
18  (deftest nconc-2  (deftest nconc.2
19    (nconc (copy-tree '(a b c d e f)))    (nconc (copy-tree '(a b c d e f)))
20    (a b c d e f))    (a b c d e f))
21    
22  (deftest nconc-3  (deftest nconc.3
23    (nconc 1)    (nconc 1)
24    1)    1)
25    
26  (deftest nconc-4  (deftest nconc.4
27    (let ((x (list 'a 'b 'c))    (let ((x (list 'a 'b 'c))
28          (y (list 'd 'e 'f)))          (y (list 'd 'e 'f)))
29      (let ((ycopy (make-scaffold-copy y)))      (let ((ycopy (make-scaffold-copy y)))
# Line 34  Line 34 
34           result))))           result))))
35    (a b c d e f))    (a b c d e f))
36    
37  (deftest nconc-5  (deftest nconc.5
38    (let ((x (list 'a 'b 'c)))    (let ((x (list 'a 'b 'c)))
39      (nconc x x)      (nconc x x)
40      (and      (and
# Line 42  Line 42 
42       (null (list-length x))))       (null (list-length x))))
43    t)    t)
44    
45  (deftest nconc-6  (deftest nconc.6
46    (let ((x (list 'a 'b 'c))    (let ((x (list 'a 'b 'c))
47          (y (list 'd 'e 'f 'g 'h))          (y (list 'd 'e 'f 'g 'h))
48          (z (list 'i 'j 'k)))          (z (list 'i 'j 'k)))
# Line 54  Line 54 
54         result)))         result)))
55    (a b c d e f g h i j k . foo))    (a b c d e f g h i j k . foo))
56    
57  (deftest nconc-7  (deftest nconc.7
58    (nconc (copy-tree '(a . b))    (nconc (copy-tree '(a . b))
59           (copy-tree '(c . d))           (copy-tree '(c . d))
60           (copy-tree '(e . f))           (copy-tree '(e . f))
61           'foo)           'foo)
62    (a c e . foo))    (a c e . foo))
63    
64    (deftest nconc.8
65      (let ((i 0) x y z)
66        (values
67         (nconc (progn (setf x (incf i)) (copy-list '(a b c)))
68                (progn (setf y (incf i)) (copy-list '(d e f)))
69                (progn (setf z (incf i)) (copy-list '(g h i))))
70         i x y z))
71      (a b c d e f g h i) 3 1 2 3)
72                
73    
74  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
75  ;;; append  ;;; append
76    
77  (deftest append-1  (deftest append.1
78      (append)    (append)
79    nil)    nil)
80    
81  (deftest append-2  (deftest append.2
82      (append 'x)    (append 'x)
83    x)    x)
84    
85  (deftest append-3  (deftest append.3
86      (let ((x (list 'a 'b 'c 'd))    (let ((x (list 'a 'b 'c 'd))
87            (y (list 'e 'f 'g)))          (y (list 'e 'f 'g)))
88        (let ((xcopy (make-scaffold-copy x))      (let ((xcopy (make-scaffold-copy x))
89              (ycopy (make-scaffold-copy y)))            (ycopy (make-scaffold-copy y)))
90          (let ((result (append x y)))        (let ((result (append x y)))
91            (and          (and
92             (check-scaffold-copy x xcopy)           (check-scaffold-copy x xcopy)
93             (check-scaffold-copy y ycopy)           (check-scaffold-copy y ycopy)
94             result))))           result))))
95    (a b c d e f g))    (a b c d e f g))
96    
97  (deftest append-4  (deftest append.4
98      (append (list 'a) (list 'b) (list 'c)    (append (list 'a) (list 'b) (list 'c)
99              (list 'd) (list 'e) (list 'f)            (list 'd) (list 'e) (list 'f)
100              (list 'g) 'h)            (list 'g) 'h)
101    (a b c d e f g . h))    (a b c d e f g . h))
102    
103  (deftest append-5  (deftest append.5
104      (append nil nil nil nil nil nil nil nil 'a)    (append nil nil nil nil nil nil nil nil 'a)
105    a)    a)
106    
107  (deftest append-6  (deftest append.6
108      (append-6-body)    (append-6-body)
109    0)    0)
110    
111    (deftest append.7
112      (let ((i 0) x y z)
113        (values
114         (append (progn (setf x (incf i)) (copy-list '(a b c)))
115                 (progn (setf y (incf i)) (copy-list '(d e f)))
116                 (progn (setf z (incf i)) (copy-list '(g h i))))
117         i x y z))
118      (a b c d e f g h i) 3 1 2 3)
119    
120  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
121  ;;; revappend  ;;; revappend
122    
123  (deftest revappend-1  (deftest revappend.1
124      (let* ((x (list 'a 'b 'c))      (let* ((x (list 'a 'b 'c))
125             (y (list 'd 'e 'f))             (y (list 'd 'e 'f))
126             (xcopy (make-scaffold-copy x))             (xcopy (make-scaffold-copy x))
# Line 116  Line 134 
134           result)))           result)))
135    (c b a d e f))    (c b a d e f))
136    
137  (deftest revappend-2  (deftest revappend.2
138      (revappend (copy-tree '(a b c d e)) 10)      (revappend (copy-tree '(a b c d e)) 10)
139    (e d c b a . 10))    (e d c b a . 10))
140    
141  (deftest revappend-3  (deftest revappend.3
142      (revappend nil 'a)      (revappend nil 'a)
143    a)    a)
144    
145  (deftest revappend-4  (deftest revappend.4
146      (revappend (copy-tree '(a (b c) d)) nil)      (revappend (copy-tree '(a (b c) d)) nil)
147    (d (b c) a))    (d (b c) a))
148    
149    (deftest revappend.5
150      (let ((i 0) x y)
151        (values
152         (revappend (progn (setf x (incf i)) (copy-list '(a b c)))
153                    (progn (setf y (incf i)) (copy-list '(d e f))))
154         i x y))
155      (c b a d e f) 2 1 2)
156    
157  (deftest revappend.error.1  (deftest revappend.error.1
158    (classify-error (revappend))    (classify-error (revappend))
159    program-error)    program-error)
# Line 143  Line 169 
169  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
170  ;;; nreconc  ;;; nreconc
171    
172  (deftest nreconc-1  (deftest nreconc.1
173    (let* ((x (list 'a 'b 'c))    (let* ((x (list 'a 'b 'c))
174           (y (copy-tree '(d e f)))           (y (copy-tree '(d e f)))
175           (result (nreconc x y)))           (result (nreconc x y)))
# Line 151  Line 177 
177           result))           result))
178    (c b a d e f))    (c b a d e f))
179    
180  (deftest nreconc-2  (deftest nreconc.2
181    (nreconc nil 'a)    (nreconc nil 'a)
182    a)    a)
183    
184    (deftest nreconc.3
185      (let ((i 0) x y)
186        (values
187         (nreconc (progn (setf x (incf i)) (copy-list '(a b c)))
188                  (progn (setf y (incf i)) (copy-list '(d e f))))
189         i x y))
190      (c b a d e f) 2 1 2)
191    
192  (deftest nreconc.error.1  (deftest nreconc.error.1
193    (classify-error (nreconc))    (classify-error (nreconc))
194    program-error)    program-error)

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26