| 1 |
;;; r6rs-unicode.test --- Test suite for R6RS (rnrs unicode) -*-scheme-*- |
| 2 |
|
| 3 |
;; Copyright (C) 2010 Free Software Foundation, Inc. |
| 4 |
;; |
| 5 |
;; This library is free software; you can redistribute it and/or |
| 6 |
;; modify it under the terms of the GNU Lesser General Public |
| 7 |
;; License as published by the Free Software Foundation; either |
| 8 |
;; version 3 of the License, or (at your option) any later version. |
| 9 |
;; |
| 10 |
;; This library is distributed in the hope that it will be useful, |
| 11 |
;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
;; Lesser General Public License for more details. |
| 14 |
;; |
| 15 |
;; You should have received a copy of the GNU Lesser General Public |
| 16 |
;; License along with this library; if not, write to the Free Software |
| 17 |
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 |
|
| 19 |
|
| 20 |
(define-module (test-suite test-rnrs-unicode) |
| 21 |
:use-module ((rnrs unicode) :version (6)) |
| 22 |
:use-module (test-suite lib)) |
| 23 |
|
| 24 |
(with-test-prefix "char-foldcase" |
| 25 |
(pass-if "basic case folding" |
| 26 |
(and (eqv? (char-foldcase #\i) #\i) |
| 27 |
(eqv? (char-foldcase #\337) #\337) |
| 28 |
(eqv? (char-foldcase #\1643) #\1703) |
| 29 |
(eqv? (char-foldcase #\1702) #\1703))) |
| 30 |
|
| 31 |
(pass-if "Turkic characters" |
| 32 |
(and (eqv? (char-foldcase #\460) #\460) |
| 33 |
(eqv? (char-foldcase #\461) #\461)))) |
| 34 |
|
| 35 |
(with-test-prefix "char-title-case?" |
| 36 |
(pass-if "simple" |
| 37 |
(and (not (char-title-case? #\I)) |
| 38 |
(char-title-case? #\705)))) |
| 39 |
|
| 40 |
(with-test-prefix "string-foldcase" |
| 41 |
(pass-if "basic case folding" |
| 42 |
(and (equal? (string-foldcase "Hi") "hi") |
| 43 |
(equal? (string-foldcase |
| 44 |
(list->string '(#\1647 #\1621 #\1637 #\1643 #\1643))) |
| 45 |
(list->string '(#\1707 #\1661 #\1677 #\1703 #\1703))))) |
| 46 |
|
| 47 |
(pass-if "case folding expands string" |
| 48 |
(or (equal? (string-foldcase (list->string '(#\S #\t #\r #\a #\337 #\e))) |
| 49 |
"strasse") |
| 50 |
(throw 'unresolved)))) |