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

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

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

revision 1.1 by pfdietz, Thu Sep 26 16:53:38 2002 UTC revision 1.2 by pfdietz, Mon Nov 11 02:12:22 2002 UTC
# Line 300  Line 300 
300      result)      result)
301    #(1 2 3 4 5 6 7 x 9))    #(1 2 3 4 5 6 7 x 9))
302    
303    (deftest nsubstitute-vector.28
304      (let* ((x (make-array '(10) :initial-contents '(a b a c b a d e a f)
305                           :fill-pointer 5))
306             (result (nsubstitute 'z 'a x)))
307        result)
308      #(z b z c b))
309    
310    (deftest nsubstitute-vector.29
311      (let* ((x (make-array '(10) :initial-contents '(a b a c b a d e a f)
312                           :fill-pointer 5))
313             (result (nsubstitute 'z 'a x :from-end t)))
314        result)
315      #(z b z c b))
316    
317    (deftest nsubstitute-vector.30
318      (let* ((x (make-array '(10) :initial-contents '(a b a c b a d e a f)
319                           :fill-pointer 5))
320             (result (nsubstitute 'z 'a x :count 1)))
321        result)
322      #(z b a c b))
323    
324    (deftest nsubstitute-vector.31
325      (let* ((x (make-array '(10) :initial-contents '(a b a c b a d e a f)
326                           :fill-pointer 5))
327             (result (nsubstitute 'z 'a x :from-end t :count 1)))
328        result)
329      #(a b z c b))
330    
331  ;;; Tests on strings  ;;; Tests on strings
332    
333  (deftest nsubstitute-string.1  (deftest nsubstitute-string.1
# Line 466  Line 494 
494      result)      result)
495    "1234567x9")    "1234567x9")
496    
497  ;;; Tests on bitstrings  (deftest nsubstitute-string.28
498      (let* ((x (make-array '(10) :initial-contents (coerce "abacbadeaf" 'list)
499                           :fill-pointer 5 :element-type 'character))
500             (result (nsubstitute #\z #\a x)))
501        result)
502      "zbzcb")
503    
504    (deftest nsubstitute-string.29
505      (let* ((x (make-array '(10) :initial-contents (coerce "abacbadeaf" 'list)
506                           :fill-pointer 5 :element-type 'character))
507             (result (nsubstitute #\z #\a x :from-end t)))
508        result)
509      "zbzcb")
510    
511    (deftest nsubstitute-string.30
512      (let* ((x (make-array '(10) :initial-contents (coerce "abacbadeaf" 'list)
513                           :fill-pointer 5 :element-type 'character))
514             (result (nsubstitute #\z #\a x :count 1)))
515        result)
516      "zbacb")
517    
518  (deftest nsubstitute-bitstring.1  (deftest nsubstitute-string.31
519      (let* ((x (make-array '(10) :initial-contents (coerce "abacbadeaf" 'list)
520                           :fill-pointer 5 :element-type 'character))
521             (result (nsubstitute #\z #\a x :from-end t :count 1)))
522        result)
523      "abzcb")
524    
525    
526    ;;; Tests on bit-vectors
527    
528    (deftest nsubstitute-bit-vector.1
529    (let* ((orig #*)    (let* ((orig #*)
530           (x (copy-seq orig))           (x (copy-seq orig))
531           (result (nsubstitute 0 1 x)))           (result (nsubstitute 0 1 x)))
532      result)      result)
533    #*)    #*)
534    
535  (deftest nsubstitute-bitstring.2  (deftest nsubstitute-bit-vector.2
536    (let* ((orig #*)    (let* ((orig #*)
537           (x (copy-seq orig))           (x (copy-seq orig))
538           (result (nsubstitute 1 0 x)))           (result (nsubstitute 1 0 x)))
539      result)      result)
540    #*)    #*)
541    
542  (deftest nsubstitute-bitstring.3  (deftest nsubstitute-bit-vector.3
543    (let* ((orig #*010101)    (let* ((orig #*010101)
544           (x (copy-seq orig))           (x (copy-seq orig))
545           (result (nsubstitute 0 1 x)))           (result (nsubstitute 0 1 x)))
546      result)      result)
547    #*000000)    #*000000)
548    
549  (deftest nsubstitute-bitstring.4  (deftest nsubstitute-bit-vector.4
550    (let* ((orig #*010101)    (let* ((orig #*010101)
551           (x (copy-seq orig))           (x (copy-seq orig))
552           (result (nsubstitute 1 0 x)))           (result (nsubstitute 1 0 x)))
553      result)      result)
554    #*111111)    #*111111)
555    
556  (deftest nsubstitute-bitstring.5  (deftest nsubstitute-bit-vector.5
557    (let* ((orig #*010101)    (let* ((orig #*010101)
558           (x (copy-seq orig))           (x (copy-seq orig))
559           (result (nsubstitute 1 0 x :start 1)))           (result (nsubstitute 1 0 x :start 1)))
560      result)      result)
561    #*011111)    #*011111)
562        
563  (deftest nsubstitute-bitstring.6  (deftest nsubstitute-bit-vector.6
564    (let* ((orig #*010101)    (let* ((orig #*010101)
565           (x (copy-seq orig))           (x (copy-seq orig))
566           (result (nsubstitute 0 1 x :start 2 :end nil)))           (result (nsubstitute 0 1 x :start 2 :end nil)))
567      result)      result)
568    #*010000)    #*010000)
569    
570  (deftest nsubstitute-bitstring.7  (deftest nsubstitute-bit-vector.7
571    (let* ((orig #*010101)    (let* ((orig #*010101)
572           (x (copy-seq orig))           (x (copy-seq orig))
573           (result (nsubstitute 1 0 x :end 4)))           (result (nsubstitute 1 0 x :end 4)))
574      result)      result)
575    #*111101)    #*111101)
576        
577  (deftest nsubstitute-bitstring.8  (deftest nsubstitute-bit-vector.8
578    (let* ((orig #*010101)    (let* ((orig #*010101)
579           (x (copy-seq orig))           (x (copy-seq orig))
580           (result (nsubstitute 0 1 x :end nil)))           (result (nsubstitute 0 1 x :end nil)))
581      result)      result)
582    #*000000)    #*000000)
583    
584  (deftest nsubstitute-bitstring.9  (deftest nsubstitute-bit-vector.9
585    (let* ((orig #*010101)    (let* ((orig #*010101)
586           (x (copy-seq orig))           (x (copy-seq orig))
587           (result (nsubstitute 0 1 x :end 3)))           (result (nsubstitute 0 1 x :end 3)))
588      result)      result)
589    #*000101)    #*000101)
590    
591  (deftest nsubstitute-bitstring.10  (deftest nsubstitute-bit-vector.10
592    (let* ((orig #*010101)    (let* ((orig #*010101)
593           (x (copy-seq orig))           (x (copy-seq orig))
594           (result (nsubstitute 0 1 x :start 2 :end 4)))           (result (nsubstitute 0 1 x :start 2 :end 4)))
595      result)      result)
596    #*010001)    #*010001)
597    
598  (deftest nsubstitute-bitstring.11  (deftest nsubstitute-bit-vector.11
599    (let* ((orig #*010101)    (let* ((orig #*010101)
600           (x (copy-seq orig))           (x (copy-seq orig))
601           (result (nsubstitute 1 0 x :start 2 :end 4)))           (result (nsubstitute 1 0 x :start 2 :end 4)))
602      result)      result)
603    #*011101)    #*011101)
604    
605  (deftest nsubstitute-bitstring.12  (deftest nsubstitute-bit-vector.12
606    (let* ((orig #*010101)    (let* ((orig #*010101)
607           (x (copy-seq orig))           (x (copy-seq orig))
608           (result (nsubstitute 1 0 x :count 1)))           (result (nsubstitute 1 0 x :count 1)))
609      result)      result)
610    #*110101)    #*110101)
611    
612  (deftest nsubstitute-bitstring.13  (deftest nsubstitute-bit-vector.13
613    (let* ((orig #*010101)    (let* ((orig #*010101)
614           (x (copy-seq orig))           (x (copy-seq orig))
615           (result (nsubstitute 1 0 x :count 0)))           (result (nsubstitute 1 0 x :count 0)))
616      result)      result)
617    #*010101)    #*010101)
618    
619  (deftest nsubstitute-bitstring.14  (deftest nsubstitute-bit-vector.14
620    (let* ((orig #*010101)    (let* ((orig #*010101)
621           (x (copy-seq orig))           (x (copy-seq orig))
622           (result (nsubstitute 1 0 x :count -1)))           (result (nsubstitute 1 0 x :count -1)))
623      result)      result)
624    #*010101)    #*010101)
625    
626  (deftest nsubstitute-bitstring.15  (deftest nsubstitute-bit-vector.15
627    (let* ((orig #*010101)    (let* ((orig #*010101)
628           (x (copy-seq orig))           (x (copy-seq orig))
629           (result (nsubstitute 1 0 x :count 1 :from-end t)))           (result (nsubstitute 1 0 x :count 1 :from-end t)))
630      result)      result)
631    #*010111)    #*010111)
632    
633  (deftest nsubstitute-bitstring.16  (deftest nsubstitute-bit-vector.16
634    (let* ((orig #*010101)    (let* ((orig #*010101)
635           (x (copy-seq orig))           (x (copy-seq orig))
636           (result (nsubstitute 1 0 x :count 0 :from-end t)))           (result (nsubstitute 1 0 x :count 0 :from-end t)))
637      result)      result)
638    #*010101)    #*010101)
639    
640  (deftest nsubstitute-bitstring.17  (deftest nsubstitute-bit-vector.17
641    (let* ((orig #*010101)    (let* ((orig #*010101)
642           (x (copy-seq orig))           (x (copy-seq orig))
643           (result (nsubstitute 1 0 x :count -1 :from-end t)))           (result (nsubstitute 1 0 x :count -1 :from-end t)))
644      result)      result)
645    #*010101)    #*010101)
646    
647  (deftest nsubstitute-bitstring.18  (deftest nsubstitute-bit-vector.18
648    (let* ((orig #*010101)    (let* ((orig #*010101)
649           (x (copy-seq orig))           (x (copy-seq orig))
650           (result (nsubstitute 1 0 x :count nil)))           (result (nsubstitute 1 0 x :count nil)))
651      result)      result)
652    #*111111)    #*111111)
653    
654  (deftest nsubstitute-bitstring.19  (deftest nsubstitute-bit-vector.19
655    (let* ((orig #*010101)    (let* ((orig #*010101)
656           (x (copy-seq orig))           (x (copy-seq orig))
657           (result (nsubstitute 1 0 x :count nil :from-end t)))           (result (nsubstitute 1 0 x :count nil :from-end t)))
658      result)      result)
659    #*111111)    #*111111)
660    
661  (deftest nsubstitute-bitstring.20  (deftest nsubstitute-bit-vector.20
662    (loop for i from 0 to 9 always    (loop for i from 0 to 9 always
663          (loop for j from i to 10 always          (loop for j from i to 10 always
664                (loop for c from 0 to (- j i) always                (loop for c from 0 to (- j i) always
# Line 615  Line 672 
672                                   (make-list (- 10 (+ i c)) :initial-element 0)))))))                                   (make-list (- 10 (+ i c)) :initial-element 0)))))))
673    t)    t)
674    
675  (deftest nsubstitute-bitstring.21  (deftest nsubstitute-bit-vector.21
676    (loop for i from 0 to 9 always    (loop for i from 0 to 9 always
677          (loop for j from i to 10 always          (loop for j from i to 10 always
678                (loop for c from 0 to (- j i) always                (loop for c from 0 to (- j i) always
# Line 629  Line 686 
686                                   (make-list (- 10 j) :initial-element 1)))))))                                   (make-list (- 10 j) :initial-element 1)))))))
687    t)    t)
688    
689  (deftest nsubstitute-bitstring.22  (deftest nsubstitute-bit-vector.22
690    (let* ((orig #*0101010101)    (let* ((orig #*0101010101)
691           (x (copy-seq orig))           (x (copy-seq orig))
692           (c 0)           (c 0)
# Line 637  Line 694 
694      result)      result)
695    #*0111110101)    #*0111110101)
696    
697  (deftest nsubstitute-bitstring.23  (deftest nsubstitute-bit-vector.23
698    (let* ((orig #*0101010101)    (let* ((orig #*0101010101)
699           (x (copy-seq orig))           (x (copy-seq orig))
700           (c 0)           (c 0)
# Line 646  Line 703 
703      result)      result)
704    #*0111110101)    #*0111110101)
705    
706  (deftest nsubstitute-bitstring.24  (deftest nsubstitute-bit-vector.24
707    (let* ((orig #*0101010101)    (let* ((orig #*0101010101)
708           (x (copy-seq orig))           (x (copy-seq orig))
709           (c 0)           (c 0)
# Line 655  Line 712 
712      result)      result)
713    #*0101011111)    #*0101011111)
714    
715  (deftest nsubstitute-bitstring.25  (deftest nsubstitute-bit-vector.25
716    (let* ((orig #*0101010101)    (let* ((orig #*0101010101)
717           (x (copy-seq orig))           (x (copy-seq orig))
718           (c 0)           (c 0)
# Line 750  Line 807 
807           (result (nsubstitute #\a #\1 x :key #'nextdigit :test-not #'eq)))           (result (nsubstitute #\a #\1 x :key #'nextdigit :test-not #'eq)))
808      result)      result)
809    "0a0aaaa0aa")    "0a0aaaa0aa")
810    
811    (deftest nsubstitute-bit-vector.30
812      (let* ((x (make-array '(10) :initial-contents '(0 1 0 1 1 0 1 1 0 1)
813                           :fill-pointer 5 :element-type 'bit))
814             (result (nsubstitute 1 0 x)))
815        result)
816      #*11111)
817    
818    (deftest nsubstitute-bit-vector.31
819      (let* ((x (make-array '(10) :initial-contents '(0 1 0 1 1 0 1 1 0 1)
820                           :fill-pointer 5 :element-type 'bit))
821             (result (nsubstitute 1 0 x :from-end t)))
822        result)
823      #*11111)
824    
825    (deftest nsubstitute-bit-vector.32
826      (let* ((x (make-array '(10) :initial-contents '(0 1 0 1 1 0 1 1 0 1)
827                           :fill-pointer 5 :element-type 'bit))
828             (result (nsubstitute 1 0 x :count 1)))
829        result)
830      #*11011)
831    
832    (deftest nsubstitute-bit-vector.33
833      (let* ((x (make-array '(10) :initial-contents '(0 1 0 1 1 0 1 1 0 1)
834                           :fill-pointer 5 :element-type 'bit))
835             (result (nsubstitute 1 0 x :from-end t :count 1)))
836        result)
837      #*01111)

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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