435 |
result) |
result) |
436 |
#(a b z c b)) |
#(a b z c b)) |
437 |
|
|
438 |
|
(deftest substitute-vector.32 |
439 |
|
(let* ((v1 (copy-seq #(a b c d a b c d a b c d a b c d))) |
440 |
|
(v2 (make-array '(8) :displaced-to v1 |
441 |
|
:displaced-index-offset 3))) |
442 |
|
(values |
443 |
|
(substitute 'x 'c v2 :count 1) |
444 |
|
v1)) |
445 |
|
#(d a b x d a b c) |
446 |
|
#(a b c d a b c d a b c d a b c d)) |
447 |
|
|
448 |
|
(deftest substitute-vector.33 |
449 |
|
(let* ((v1 (copy-seq #(a b c d a b c d a b c d a b c d))) |
450 |
|
(v2 (make-array '(8) :displaced-to v1 |
451 |
|
:displaced-index-offset 3))) |
452 |
|
(values |
453 |
|
(substitute 'x 'c v2 :count 1 :from-end t) |
454 |
|
v1)) |
455 |
|
#(d a b c d a b x) |
456 |
|
#(a b c d a b c d a b c d a b c d)) |
457 |
|
|
458 |
;;; Tests on strings |
;;; Tests on strings |
459 |
|
|
460 |
(deftest substitute-string.1 |
(deftest substitute-string.1 |
702 |
result) |
result) |
703 |
"abzcb") |
"abzcb") |
704 |
|
|
705 |
|
(deftest substitute-string.32 |
706 |
|
(do-special-strings |
707 |
|
(s "xyzabcxyzabc" nil) |
708 |
|
(assert (string= (substitute #\! #\a s) "xyz!bcxyz!bc")) |
709 |
|
(assert (string= (substitute #\! #\a s :count 1) "xyz!bcxyzabc")) |
710 |
|
(assert (string= (substitute #\! #\a s :count 1 :from-end t) "xyzabcxyz!bc")) |
711 |
|
(assert (string= s "xyzabcxyzabc"))) |
712 |
|
nil) |
713 |
|
|
714 |
;;; Tests on bit-vectors |
;;; Tests on bit-vectors |
715 |
|
|
716 |
(deftest substitute-bit-vector.1 |
(deftest substitute-bit-vector.1 |