/[gcl]/gcl/ansi-tests/fill.lsp
ViewVC logotype

Diff of /gcl/ansi-tests/fill.lsp

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

revision 1.6 by pfdietz, Sun Nov 3 11:07:16 2002 UTC revision 1.7 by pfdietz, Sun Nov 3 11:46:46 2002 UTC
# Line 238  Line 238 
238    t    t
239    "zzzzz")    "zzzzz")
240    
241    (deftest fill.string.5
242      (let* ((s1 "aaaaaaaa")
243             (len (length s1)))
244        (loop for start from 0 to (1- len)
245              always
246              (loop for end from (1+ start) to len
247                    always
248                    (let* ((s2 (copy-seq s1))
249                           (s3 (fill s2 #\z :start start :end end)))
250                      (and (eqt s2 s3)
251                           (string= s3
252                                    (substitute-if #\z (constantly t) s1
253                                                   :start start :end end))
254                           t)))))
255      t)
256    
257    (deftest fill.string.6
258      (let* ((s1 "aaaaaaaa")
259             (len (length s1)))
260        (loop for start from 0 to (1- len)
261              always
262              (let* ((s2 (copy-seq s1))
263                     (s3 (fill s2 #\z :start start)))
264                (and (eqt s2 s3)
265                     (string= s3
266                              (substitute-if #\z (constantly t) s1
267                                             :start start))
268                     t))))
269      t)
270    
271    (deftest fill.string.7
272      (let* ((s1 "aaaaaaaa")
273             (len (length s1)))
274        (loop for start from 0 to (1- len)
275              always
276              (let* ((s2 (copy-seq s1))
277                     (s3 (fill s2 #\z :end nil :start start)))
278                (and (eqt s2 s3)
279                     (string= s3
280                              (substitute-if #\z (constantly t) s1
281                                             :end nil :start start))
282                     t))))
283      t)
284    
285    (deftest fill.string.8
286      (let* ((s1 "aaaaaaaa")
287             (len (length s1)))
288        (loop for end from 1 to len
289              always
290              (let* ((s2 (copy-seq s1))
291                     (s3 (fill s2 #\z :end end)))
292                (and (eqt s2 s3)
293                     (string= s3
294                              (substitute-if #\z (constantly t) s1
295                                             :end end))
296                     t))))
297      t)
298    
299    (deftest fill.string.9
300      (let* ((s1 (make-array '(8) :element-type 'character
301                             :initial-element #\a
302                             :fill-pointer 4))
303             (s2 (fill s1 #\a)))
304        (and (eqt s1 s2)
305             (coerce (loop for i from 0 to 7 collect (aref s2 i))
306                     'string)))
307      "aaaazzzz")
308    
309    (deftest fill.string.10
310      (let* ((s1 (make-array '(8) :element-type 'base-char
311                             :initial-element #\a
312                             :fill-pointer 4))
313             (s2 (fill s1 #\a)))
314        (and (eqt s1 s2)
315             (coerce (loop for i from 0 to 7 collect (aref s2 i))
316                     'base-string)))
317      "aaaazzzz")
318    
319    ;;; Tests for bit vectors
320    
321    (deftest fill.bit-vector.1
322      (let* ((s1 (copy-seq #*01100))
323             (s2 (fill s1 0)))
324        (values (eqt s1 s2) s2))
325      t
326      #*00000)
327    
328    (deftest fill.bit-vector.2
329      (let* ((s1 (copy-seq #*00100))
330             (s2 (fill s1 1 :start 0 :end 1)))
331        (values (eqt s1 s2) s2))
332      t
333      #*10100)
334    
335    (deftest fill.bit-vector.3
336      (let* ((s1 (copy-seq #*00010))
337             (s2 (fill s1 1 :end 2)))
338        (values (eqt s1 s2) s2))
339      t
340      #*11010)
341    
342    (deftest fill.bit-vector.4
343      (let* ((s1 (copy-seq #*00111))
344             (s2 (fill s1 0 :end nil)))
345        (values (eqt s1 s2) s2))
346      t
347      #*00000)
348    
349    (deftest fill.bit-vector.5
350      (let* ((s1 #*00000000)
351             (len (length s1)))
352        (loop for start from 0 to (1- len)
353              always
354              (loop for end from (1+ start) to len
355                    always
356                    (let* ((s2 (copy-seq s1))
357                           (s3 (fill s2 1 :start start :end end)))
358                      (and (eqt s2 s3)
359                           (equalp s3
360                                   (substitute-if 1 (constantly t) s1
361                                                  :start start :end end))
362                           t)))))
363      t)
364    
365    (deftest fill.bit-vector.6
366      (let* ((s1 #*11111111)
367             (len (length s1)))
368        (loop for start from 0 to (1- len)
369              always
370              (let* ((s2 (copy-seq s1))
371                     (s3 (fill s2 0 :start start)))
372                (and (eqt s2 s3)
373                     (equalp s3
374                             (substitute-if 0 (constantly t) s1
375                                            :start start))
376                     t))))
377      t)
378    
379    (deftest fill.bit-vector.7
380      (let* ((s1 #*00000000)
381             (len (length s1)))
382        (loop for start from 0 to (1- len)
383              always
384              (let* ((s2 (copy-seq s1))
385                     (s3 (fill s2 1 :end nil :start start)))
386                (and (eqt s2 s3)
387                     (equalp s3
388                             (substitute-if 1 (constantly t) s1
389                                            :end nil :start start))
390                     t))))
391      t)
392    
393    (deftest fill.bit-vector.8
394      (let* ((s1 #*11111111)
395             (len (length s1)))
396        (loop for end from 1 to len
397              always
398              (let* ((s2 (copy-seq s1))
399                     (s3 (fill s2 0 :end end)))
400                (and (eqt s2 s3)
401                     (equalp s3
402                             (substitute-if 0 (constantly t) s1
403                                            :end end))
404                     t))))
405      t)
406    
407    (deftest fill.bit-vector.9
408      (let* ((s1 (make-array '(8) :element-type 'bit
409                             :initial-element 0
410                             :fill-pointer 4))
411             (s2 (fill s1 1)))
412        (and (eqt s1 s2)
413             (coerce (loop for i from 0 to 7 collect (aref s2 i))
414                     'bit-vector)))
415      #*11110000)
416    
           
     

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