multilingual.nottest 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. ;;;; multilingual.nottest --- tests of multilingual support -*- scheme -*-
  2. ;;;; Jim Blandy <jimb@red-bean.com> --- September 1999
  3. ;;;; This isn't a test yet, because we don't have multilingual support yet.
  4. ;;;;
  5. ;;;; Copyright (C) 1999, 2006 Free Software Foundation, Inc.
  6. ;;;;
  7. ;;;; This library is free software; you can redistribute it and/or
  8. ;;;; modify it under the terms of the GNU Lesser General Public
  9. ;;;; License as published by the Free Software Foundation; either
  10. ;;;; version 3 of the License, or (at your option) any later version.
  11. ;;;;
  12. ;;;; This library is distributed in the hope that it will be useful,
  13. ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. ;;;; Lesser General Public License for more details.
  16. ;;;;
  17. ;;;; You should have received a copy of the GNU Lesser General Public
  18. ;;;; License along with this library; if not, write to the Free Software
  19. ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. (use-modules (test-suite lib))
  21. ;;; Tests of Emacs 20.4 character encoding.
  22. ;;; Check that characters are being encoded correctly.
  23. ;;; These tests are specific to the Emacs 20.4 encoding; they'll need
  24. ;;; to be replaced when Guile switches to UTF-8. See mb.c for a
  25. ;;; description of this encoding.
  26. (define (check-encoding char-number encoding)
  27. (let ((singleton (string (integer->char char-number))))
  28. (pass-if (string-append "encoding character "
  29. (number->string char-number))
  30. (equal? (string->bytes singleton) encoding))
  31. (pass-if (string-append "decoding character "
  32. (number->string char-number))
  33. (catch #t
  34. (lambda ()
  35. (equal? (bytes->string encoding) singleton))
  36. (lambda dummy #f)))))
  37. ;; Check some ASCII characters.
  38. (check-encoding 0 #y(0))
  39. (check-encoding 127 #y(127))
  40. (check-encoding 31 #y(31))
  41. (check-encoding 32 #y(32))
  42. (check-encoding 42 #y(42))
  43. ;;; Sometimes we mark something as an "end of range", when it's not
  44. ;;; actually the last character that would use that encoding form.
  45. ;;; This is because not all character set numbers are assigned, and we
  46. ;;; can't use unassigned character set numbers. So the value given is
  47. ;;; the last value which actually corresponds to something in a real
  48. ;;; character set.
  49. ;; Check some characters encoded in two bytes.
  50. (check-encoding 2208 #y(#x81 #xA0)) ; beginning of range
  51. (check-encoding 3839 #y(#x8d #xFF)) ; end of range
  52. (check-encoding 2273 #y(#x81 #xE1))
  53. ;; Check some big characters encoded in three bytes.
  54. (check-encoding 20512 #y(#x90 #xA0 #xA0)) ; beginning of range
  55. (check-encoding 180223 #y(#x99 #xFF #xFF)) ; end of range
  56. (check-encoding 53931 #y(#x92 #xA5 #xAB))
  57. ;; Check some small characters encoded in three bytes --- some from
  58. ;; the #x9A prefix range, and some from the #x9B prefix range.
  59. (check-encoding 6176 #y(#x9A #xA0 #xA0)) ; start of the #9A prefix range
  60. (check-encoding 7167 #y(#x9A #xA7 #xFF)) ; end of the #9A prefix range
  61. (check-encoding 14368 #y(#x9B #xE0 #xA0)) ; start of the #9B prefix range
  62. (check-encoding 14591 #y(#x9B #xE1 #xFF)) ; end of the #9B prefix range
  63. ;; Check some characters encoded in four bytes.
  64. (check-encoding 266272 #y(#x9C #xF0 #xA0 #xA0)) ; start of the #9C prefix range
  65. (check-encoding 294911 #y(#x9C #xF1 #xFF #xFF)) ; end of the #9C prefix range
  66. (check-encoding 348192 #y(#x9D #xF5 #xA0 #xA0)) ; start of the #9D prefix range
  67. (check-encoding 475135 #y(#x9D #xFC #xFF #xFF)) ; start of the #9D prefix range