Commit 4664102e authored by pfdietz's avatar pfdietz

Added tests on string trim functions for more specialized strings.

parent 06034e3a
......@@ -89,6 +89,25 @@
"abcdaba"
"cdaba")
(deftest string-left-trim.10a
(let* ((s (make-array 9 :initial-contents "abcdabadd"
:element-type 'base-char
:fill-pointer 7))
(s2 (string-left-trim "ab" s)))
(values s s2))
"abcdaba"
"cdaba")
(deftest string-left-trim.10b
(let* ((s (make-array 9 :initial-contents "abcdabadd"
:element-type 'base-char
:adjustable t
:fill-pointer 7))
(s2 (string-left-trim "ab" s)))
(values s s2))
"abcdaba"
"cdaba")
(deftest string-left-trim.11
(let* ((s (make-array 7 :initial-contents "abcdaba"
:element-type 'standard-char
......@@ -151,6 +170,41 @@
(string-left-trim (make-array '(0) :element-type nil) "abcd")
"abcd")
(deftest string-left-trim.22
(let ((s (make-array '(6) :initial-contents "abcaeb"
:element-type 'base-char
:adjustable t)))
(values (string-left-trim "ab" s) s))
"caeb" "abcaeb")
(deftest string-left-trim.23
(let ((s (make-array '(6) :initial-contents "abcaeb"
:element-type 'character
:adjustable t)))
(values (string-left-trim "ab" s) s))
"caeb" "abcaeb")
(deftest string-left-trim.24
(let* ((etype 'base-char)
(s0 (make-array '(6) :initial-contents "abcaeb"
:element-type etype))
(s (make-array '(3) :element-type etype
:displaced-to s0
:displaced-index-offset 1)))
(values (string-left-trim "ab" s) s s0))
"ca" "bca" "abcaeb")
(deftest string-left-trim.25
(let* ((etype 'character)
(s0 (make-array '(6) :initial-contents "abcaeb"
:element-type etype))
(s (make-array '(3) :element-type etype
:displaced-to s0
:displaced-index-offset 1)))
(values (string-left-trim "ab" s) s s0))
"ca" "bca" "abcaeb")
(deftest string-left-trim.order.1
(let ((i 0) x y)
(values
......
......@@ -89,6 +89,25 @@
"abcdaba"
"abcd")
(deftest string-right-trim.10a
(let* ((s (make-array 9 :initial-contents "abcdabadd"
:element-type 'base-char
:fill-pointer 7))
(s2 (string-right-trim "ab" s)))
(values s s2))
"abcdaba"
"abcd")
(deftest string-right-trim.10b
(let* ((s (make-array 9 :initial-contents "abcdabadd"
:element-type 'base-char
:adjustable t
:fill-pointer 7))
(s2 (string-right-trim "ab" s)))
(values s s2))
"abcdaba"
"abcd")
(deftest string-right-trim.11
(let* ((s (make-array 7 :initial-contents "abcdaba"
:element-type 'standard-char
......@@ -151,6 +170,40 @@
(string-right-trim (make-array '(0) :element-type nil) "abcd")
"abcd")
(deftest string-right-trim.22
(let ((s (make-array '(6) :initial-contents "abcaeb"
:element-type 'base-char
:adjustable t)))
(values (string-right-trim "ab" s) s))
"abcae" "abcaeb")
(deftest string-right-trim.23
(let ((s (make-array '(6) :initial-contents "abcaeb"
:element-type 'character
:adjustable t)))
(values (string-right-trim "ab" s) s))
"abcae" "abcaeb")
(deftest string-right-trim.24
(let* ((etype 'base-char)
(s0 (make-array '(6) :initial-contents "abcaeb"
:element-type etype))
(s (make-array '(3) :element-type etype
:displaced-to s0
:displaced-index-offset 1)))
(values (string-right-trim "ab" s) s s0))
"bc" "bca" "abcaeb")
(deftest string-right-trim.25
(let* ((etype 'character)
(s0 (make-array '(6) :initial-contents "abcaeb"
:element-type etype))
(s (make-array '(3) :element-type etype
:displaced-to s0
:displaced-index-offset 1)))
(values (string-right-trim "ab" s) s s0))
"bc" "bca" "abcaeb")
(deftest string-right-trim.order.1
(let ((i 0) x y)
(values
......
......@@ -71,6 +71,16 @@
"abcdaba"
"cd")
(deftest string-trim.8a
(let* ((s (copy-seq "abcdaba"))
(s2 (string-trim (make-array 4 :initial-contents '(#\a #\b #\c #\d)
:element-type 'base-char
:fill-pointer 2)
s)))
(values s s2))
"abcdaba"
"cd")
(deftest string-trim.9
(let* ((s (make-array 7 :initial-contents "abcdaba"
:element-type 'character
......@@ -89,6 +99,16 @@
"abcdaba"
"cd")
(deftest string-trim.10a
(let* ((s (make-array 9 :initial-contents "abcdabadd"
:element-type 'base-char
:adjustable t
:fill-pointer 7))
(s2 (string-trim "ab" s)))
(values s s2))
"abcdaba"
"cd")
(deftest string-trim.11
(let* ((s (make-array 7 :initial-contents "abcdaba"
:element-type 'standard-char
......@@ -151,6 +171,40 @@
(string-trim (make-array '(0) :element-type nil) "abcd")
"abcd")
(deftest string-trim.22
(let ((s (make-array '(6) :initial-contents "abcaeb"
:element-type 'base-char
:adjustable t)))
(values (string-trim "ab" s) s))
"cae" "abcaeb")
(deftest string-trim.23
(let ((s (make-array '(6) :initial-contents "abcaeb"
:element-type 'character
:adjustable t)))
(values (string-trim "ab" s) s))
"cae" "abcaeb")
(deftest string-trim.24
(let* ((etype 'base-char)
(s0 (make-array '(6) :initial-contents "abcaeb"
:element-type etype))
(s (make-array '(3) :element-type etype
:displaced-to s0
:displaced-index-offset 1)))
(values (string-trim "ab" s) s s0))
"c" "bca" "abcaeb")
(deftest string-trim.25
(let* ((etype 'character)
(s0 (make-array '(6) :initial-contents "abcaeb"
:element-type etype))
(s (make-array '(3) :element-type etype
:displaced-to s0
:displaced-index-offset 1)))
(values (string-trim "ab" s) s s0))
"c" "bca" "abcaeb")
(deftest string-trim.order.1
(let ((i 0) x y)
(values
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment