1
0
mirror of synced 2026-05-04 23:26:25 +00:00
Files
Interlisp.medley/internal/test/LANGUAGE/AUTO/18-3-STRING-UPCASE.TEST

51 lines
1.7 KiB
Plaintext

;; Function To Be Tested: string-upcase
;;
;; Source: CLtL p. 303
;; Chapter 18: Strings Section 3: String Construction and Manipulation
;;
;; Created By: Peter Reidy
;;
;; Creation Date: 23 July 86
;;
;; Last Update: 14 December 86
;;
;; Filed As: {eris}<lispcore>cml>test>18-3-string-upcase.test
;;
;;
;; Syntax: string-upcase string &key :start :end
;;
;; Function Description: converts all lower case characters in string from :start to :end (counting from 0, with :end the character after the last to be converted) to upper case.
;;
;; Argument(s): string - any valid character string
;; :start, :end - the first and last+1 characters (counting from 0) in string to be converted.
;;
;; Returns: a string of the same length with the specified conversions.
;;
(do-test-group string-upcase-group
:before (test-setq
upcase "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
lowcase '|abcdefghijklmnopqrstuvwxyz|
alphalength (length upcase)
digits "0123456789"
punc "|\\!@#$%^ &*()_+-={}[]:\"~<>?,./")
;;
(do-test string-upcase-test
(AND
(string= upcase (string-upcase lowcase))
(string= upcase (string-upcase upcase))
;; Numeric characters, punctuation marks and non-string characters have no upper case.
(string= digits (string-upcase digits))
(string= punc (string-upcase punc))
(string=
(coerce '(#\linefeed #\page #\tab #\return #\rubout #\backspace #\page) 'string)
(string-upcase
(coerce '(#\linefeed #\page #\tab #\return #\rubout #\backspace #\page) 'string) :start 0 :end 6)
) ; string=
;; Results should be the same length regardless of keywords.
(string-equal upcase (string-upcase lowcase :end 20 :start 10))
)
)
)
STOP