Commit 33ae1dc1 authored by pfdietz's avatar pfdietz

Added tests for STRING-LEFT-TRIM, STRING-RIGHT-TRIM.

parent e3acefff
......@@ -121,4 +121,6 @@
(load "nstring-upcase.lsp")
(load "nstring-downcase.lsp")
(load "nstring-capitalize.lsp")
(load "string-trim.lsp")
\ No newline at end of file
(load "string-trim.lsp")
(load "string-left-trim.lsp")
(load "string-right-trim.lsp")
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Fri Oct 4 04:57:41 2002
;;;; Contains: Tests for STRING-LEFT-TRIM
(in-package :cl-test)
(deftest string-left-trim.1
(let* ((s (copy-seq "abcdaba"))
(s2 (string-left-trim "ab" s)))
(values s s2))
"abcdaba"
"cdaba")
(deftest string-left-trim.2
(let* ((s (copy-seq "abcdaba"))
(s2 (string-left-trim '(#\a #\b) s)))
(values s s2))
"abcdaba"
"cdaba")
(deftest string-left-trim.3
(let* ((s (copy-seq "abcdaba"))
(s2 (string-left-trim #(#\a #\b) s)))
(values s s2))
"abcdaba"
"cdaba")
(deftest string-left-trim.4
(let* ((s (copy-seq "abcdaba"))
(s2 (string-left-trim (make-array 2 :initial-contents '(#\a #\b))
s)))
(values s s2))
"abcdaba"
"cdaba")
(deftest string-left-trim.5
(let* ((s (copy-seq "abcdaba"))
(s2 (string-left-trim (make-array 2 :initial-contents '(#\a #\b)
:element-type 'character)
s)))
(values s s2))
"abcdaba"
"cdaba")
(deftest string-left-trim.6
(let* ((s (copy-seq "abcdaba"))
(s2 (string-left-trim (make-array 2 :initial-contents '(#\a #\b)
:element-type 'standard-char)
s)))
(values s s2))
"abcdaba"
"cdaba")
(deftest string-left-trim.7
(let* ((s (copy-seq "abcdaba"))
(s2 (string-left-trim (make-array 2 :initial-contents '(#\a #\b)
:element-type 'base-char)
s)))
(values s s2))
"abcdaba"
"cdaba")
(deftest string-left-trim.8
(let* ((s (copy-seq "abcdaba"))
(s2 (string-left-trim (make-array 2 :initial-contents '(#\a #\b #\c #\d)
:element-type 'character
:fill-pointer 2)
s)))
(values s s2))
"abcdaba"
"cdaba")
(deftest string-left-trim.9
(let* ((s (make-array 7 :initial-contents (coerce "abcdaba" 'list)
:element-type 'character
))
(s2 (string-left-trim "ab" s)))
(values s s2))
"abcdaba"
"cdaba")
(deftest string-left-trim.10
(let* ((s (make-array 9 :initial-contents (coerce "abcdabadd" 'list)
:element-type 'character
: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 (coerce "abcdaba" 'list)
:element-type 'standard-char
))
(s2 (string-left-trim "ab" s)))
(values s s2))
"abcdaba"
"cdaba")
(deftest string-left-trim.12
(let* ((s (make-array 7 :initial-contents (coerce "abcdaba" 'list)
:element-type 'base-char
))
(s2 (string-left-trim "ab" s)))
(values s s2))
"abcdaba"
"cdaba")
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Fri Oct 4 04:59:46 2002
;;;; Contains: Tests of STRING-RIGHT-TRIM
(in-package :cl-test)
(deftest string-right-trim.1
(let* ((s (copy-seq "abcdaba"))
(s2 (string-right-trim "ab" s)))
(values s s2))
"abcdaba"
"abcd")
(deftest string-right-trim.2
(let* ((s (copy-seq "abcdaba"))
(s2 (string-right-trim '(#\a #\b) s)))
(values s s2))
"abcdaba"
"abcd")
(deftest string-right-trim.3
(let* ((s (copy-seq "abcdaba"))
(s2 (string-right-trim #(#\a #\b) s)))
(values s s2))
"abcdaba"
"abcd")
(deftest string-right-trim.4
(let* ((s (copy-seq "abcdaba"))
(s2 (string-right-trim (make-array 2 :initial-contents '(#\a #\b))
s)))
(values s s2))
"abcdaba"
"abcd")
(deftest string-right-trim.5
(let* ((s (copy-seq "abcdaba"))
(s2 (string-right-trim (make-array 2 :initial-contents '(#\a #\b)
:element-type 'character)
s)))
(values s s2))
"abcdaba"
"abcd")
(deftest string-right-trim.6
(let* ((s (copy-seq "abcdaba"))
(s2 (string-right-trim (make-array 2 :initial-contents '(#\a #\b)
:element-type 'standard-char)
s)))
(values s s2))
"abcdaba"
"abcd")
(deftest string-right-trim.7
(let* ((s (copy-seq "abcdaba"))
(s2 (string-right-trim (make-array 2 :initial-contents '(#\a #\b)
:element-type 'base-char)
s)))
(values s s2))
"abcdaba"
"abcd")
(deftest string-right-trim.8
(let* ((s (copy-seq "abcdaba"))
(s2 (string-right-trim (make-array 2 :initial-contents '(#\a #\b #\c #\d)
:element-type 'character
:fill-pointer 2)
s)))
(values s s2))
"abcdaba"
"abcd")
(deftest string-right-trim.9
(let* ((s (make-array 7 :initial-contents (coerce "abcdaba" 'list)
:element-type 'character
))
(s2 (string-right-trim "ab" s)))
(values s s2))
"abcdaba"
"abcd")
(deftest string-right-trim.10
(let* ((s (make-array 9 :initial-contents (coerce "abcdabadd" 'list)
:element-type 'character
: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 (coerce "abcdaba" 'list)
:element-type 'standard-char
))
(s2 (string-right-trim "ab" s)))
(values s s2))
"abcdaba"
"abcd")
(deftest string-right-trim.12
(let* ((s (make-array 7 :initial-contents (coerce "abcdaba" 'list)
:element-type 'base-char
))
(s2 (string-right-trim "ab" s)))
(values s s2))
"abcdaba"
"abcd")
......@@ -106,4 +106,3 @@
(values s s2))
"abcdaba"
"cd")
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