/[gcl]/gcl/ansi-tests/map-into.lsp
ViewVC logotype

Diff of /gcl/ansi-tests/map-into.lsp

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

revision 1.3 by pfdietz, Sun Nov 3 13:21:47 2002 UTC revision 1.4 by pfdietz, Sun Nov 3 14:03:49 2002 UTC
# Line 56  Line 56 
56      a)      a)
57    (1 1 1 1 1 1))    (1 1 1 1 1 1))
58    
59    (deftest map-into-list.8
60      (let ((a (copy-seq '(a b c d e f)))
61            (s2 (make-array '(6) :initial-element 'x
62                            :fill-pointer 4)))
63        (map-into a #'identity s2)
64        a)
65      (x x x x e f))
66    
67  (deftest map-into-array.1  (deftest map-into-array.1
68    (let ((a (copy-seq #(a b c d e f)))    (let ((a (copy-seq #(a b c d e f)))
69          b)          b)
# Line 135  Line 143 
143           a))           a))
144    #(y y y y y y))    #(y y y y y y))
145    
146    (deftest map-into-array.11
147      (let ((a (copy-seq #(a b c d e f)))
148            (s2 (make-array '(6) :initial-element 'x
149                            :fill-pointer 4)))
150        (map-into a #'identity s2)
151        a)
152      #(x x x x e f))
153    
154  ;;; mapping into strings  ;;; mapping into strings
155    
156  (deftest map-into-string.1  (deftest map-into-string.1
# Line 158  Line 174 
174    t    t
175    "1234")    "1234")
176    
177  (deftest map-into-string.4  `w(deftest map-into-string.4
178    (let ((a (make-array 6 :initial-element #\x    (let ((a (make-array 6 :initial-element #\x
179                         :element-type 'character                         :element-type 'character
180                         :fill-pointer 3)))                         :fill-pointer 3)))
# Line 217  Line 233 
233      a)      a)
234    "yyyyyy")    "yyyyyy")
235    
236    (deftest map-into-string.10
237      (let ((a (copy-seq "abcdef"))
238            (s2 (make-array '(6) :initial-element #\x
239                            :fill-pointer 4)))
240        (map-into a #'identity s2)
241        a)
242      "xxxxef")
243    
244    (deftest map-into-string.11
245      (let ((a (make-array 6 :initial-element #\x
246                           :element-type 'character
247                           :fill-pointer 3)))
248        (map-into a #'identity "abcd")
249        (values
250         (fill-pointer a)
251         (aref a 4)
252         (aref a 5)
253         a))
254      4
255      #\x
256      #\x
257      "abcd")
258    
259    (deftest map-into-string.12
260      (let ((a (make-array 6 :initial-element #\x
261                           :element-type 'character
262                           :fill-pointer 3)))
263        (map-into a #'identity "abcdefgh")
264        (values
265         (fill-pointer a)
266         a))
267      6
268      "abcdef")
269    
270    ;;; Tests on bit vectors
271    
272    (deftest map-into.bit-vector.1
273      (let ((v #*0100110))
274        (map-into v #'(lambda (x) (- 1 x)) v)
275        (and (bit-vector-p v)
276             v))
277      #*1011001)
278    
279    (deftest map-into.bit-vector.2
280      (let ((v #*0100110))
281        (map-into v #'(lambda () 0))
282        (and (bit-vector-p v)
283             v))
284      #*0000000)
285    
286    (deftest map-into.bit-vector.3
287      (let ((v #*0100110))
288        (map-into v #'identity '(0 1 1 1 0 0 1))
289        (and (bit-vector-p v)
290             v))
291      #*0111001)
292    
293    (deftest map-into.bit-vector.4
294      (let ((v #*0100110))
295        (map-into v #'identity '(0 1 1 1))
296        (and (bit-vector-p v)
297             v))
298      #*0111110)
299    
300    (deftest map-into.bit-vector.5
301      (let ((v #*0100110))
302        (map-into v #'identity '(0 1 1 1 0 0 1 4 5 6 7))
303        (and (bit-vector-p v)
304             v))
305      #*0111001)
306    
307    (deftest map-into.bit-vector.6
308      (let ((v (make-array '(8) :initial-contents '(0 1 0 0 1 1 0 1)
309                           :fill-pointer 4
310                           :element-type 'bit)))
311        (map-into v #'(lambda () 1))
312        (and (bit-vector-p v)
313             v))
314      #*11111111)
315    
316    (deftest map-into.bit-vector.7
317      (let ((v (make-array '(8) :initial-contents '(0 1 0 0 1 1 0 1)
318                           :fill-pointer 4
319                           :element-type 'bit)))
320        (map-into v  #'identity v)
321        (and (bit-vector-p v)
322             v))
323      #*0100)
324    
325    (deftest map-into.bit-vector.8
326      (let ((v (make-array '(8) :initial-contents '(0 1 0 0 1 1 0 1)
327                           :fill-pointer 4
328                           :element-type 'bit)))
329        (map-into v #'identity '(1 1 1 1 1 1))
330        (and (bit-vector-p v)
331             (values (fill-pointer v)
332                     v)))
333      6
334      #*111111)
335    
336    (deftest map-into.bit-vector.9
337      (let ((v (make-array '(8) :initial-contents '(0 1 0 0 1 1 0 1)
338                           :fill-pointer 4
339                           :element-type 'bit)))
340        (map-into v #'identity '(1 1 1 1 1 1 0 0 1 1 1))
341        (and (bit-vector-p v)
342             (values (fill-pointer v)
343                     v)))
344      8
345      #*11111100)
346    
347  (deftest map-into-error.1  (deftest map-into-error.1
348    (classify-error (map-into 'a #'(lambda () nil)))    (classify-error (map-into 'a #'(lambda () nil)))
349    type-error)    type-error)
# Line 228  Line 355 
355  (deftest map-into-error.3  (deftest map-into-error.3
356    (classify-error (map-into (copy-seq '(a b c)) #'cons '(d e f) 100))    (classify-error (map-into (copy-seq '(a b c)) #'cons '(d e f) 100))
357    type-error)    type-error)
   

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

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