r6rs-unicode.test 1.8 KB

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