multilingual.nottest 3.5 KB

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