mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-05 15:10:27 +02:00
* tests/strings.test (string<?, string-ci<?, string<=?, string-ci<=?,
string>?, string-ci>?, string>=?, string-ci>=?): Check ordering is the same as char<? etc. Use a define-module to keep private test bits private. * tests/srfi-13.test (string-compare, string-compare-ci): Ditto.
This commit is contained in:
parent
4c2dc0f0b5
commit
6ac0ec9692
1 changed files with 36 additions and 1 deletions
|
@ -18,11 +18,20 @@
|
||||||
;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
;;;; Boston, MA 02110-1301 USA
|
;;;; Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
(use-modules (srfi srfi-13) (srfi srfi-14) (test-suite lib))
|
(define-module (test-strings)
|
||||||
|
#:use-module (test-suite lib)
|
||||||
|
#:use-module (srfi srfi-13)
|
||||||
|
#:use-module (srfi srfi-14))
|
||||||
|
|
||||||
|
|
||||||
(define exception:strict-infix-grammar
|
(define exception:strict-infix-grammar
|
||||||
(cons 'misc-error "^strict-infix"))
|
(cons 'misc-error "^strict-infix"))
|
||||||
|
|
||||||
|
;; Create a string from integer char values, eg. (string-ints 65) => "A"
|
||||||
|
(define (string-ints . args)
|
||||||
|
(apply string (map integer->char args)))
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; string-any
|
;;; string-any
|
||||||
;;;
|
;;;
|
||||||
|
@ -185,6 +194,32 @@
|
||||||
|
|
||||||
(pass-if (equal? "abc" (string-concatenate '("a" "b" "c")))))
|
(pass-if (equal? "abc" (string-concatenate '("a" "b" "c")))))
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; string-compare
|
||||||
|
;;
|
||||||
|
|
||||||
|
(with-test-prefix "string-compare"
|
||||||
|
|
||||||
|
(pass-if "same as char<?"
|
||||||
|
(eq? (char<? (integer->char 0) (integer->char 255))
|
||||||
|
(string-compare (string-ints 0) (string-ints 255)
|
||||||
|
(lambda (pos) #t) ;; lt
|
||||||
|
(lambda (pos) #f) ;; eq
|
||||||
|
(lambda (pos) #f))))) ;; gt
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; string-compare-ci
|
||||||
|
;;
|
||||||
|
|
||||||
|
(with-test-prefix "string-compare-ci"
|
||||||
|
|
||||||
|
(pass-if "same as char-ci<?"
|
||||||
|
(eq? (char-ci<? (integer->char 0) (integer->char 255))
|
||||||
|
(string-compare-ci (string-ints 0) (string-ints 255)
|
||||||
|
(lambda (pos) #t) ;; lt
|
||||||
|
(lambda (pos) #f) ;; eq
|
||||||
|
(lambda (pos) #f))))) ;; gt
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; string-concatenate/shared
|
;;; string-concatenate/shared
|
||||||
;;;
|
;;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue