| 1 |
;;;; multilingual.nottest --- tests of multilingual support -*- scheme -*- |
| 2 |
;;;; Jim Blandy <[email protected]> --- 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 |
|
| 21 |
(use-modules (test-suite lib)) |
| 22 |
|
| 23 |
|
| 24 |
;;; Tests of Emacs 20.4 character encoding. |
| 25 |
|
| 26 |
;;; Check that characters are being encoded correctly. |
| 27 |
|
| 28 |
;;; These tests are specific to the Emacs 20.4 encoding; they'll need |
| 29 |
;;; to be replaced when Guile switches to UTF-8. See mb.c for a |
| 30 |
;;; description of this encoding. |
| 31 |
|
| 32 |
(define (check-encoding char-number encoding) |
| 33 |
(let ((singleton (string (integer->char char-number)))) |
| 34 |
(pass-if (string-append "encoding character " |
| 35 |
(number->string char-number)) |
| 36 |
(equal? (string->bytes singleton) encoding)) |
| 37 |
(pass-if (string-append "decoding character " |
| 38 |
(number->string char-number)) |
| 39 |
(catch #t |
| 40 |
(lambda () |
| 41 |
(equal? (bytes->string encoding) singleton)) |
| 42 |
(lambda dummy #f))))) |
| 43 |
|
| 44 |
|
| 45 |
;; Check some ASCII characters. |
| 46 |
(check-encoding 0 #y(0)) |
| 47 |
(check-encoding 127 #y(127)) |
| 48 |
(check-encoding 31 #y(31)) |
| 49 |
(check-encoding 32 #y(32)) |
| 50 |
(check-encoding 42 #y(42)) |
| 51 |
|
| 52 |
;;; Sometimes we mark something as an "end of range", when it's not |
| 53 |
;;; actually the last character that would use that encoding form. |
| 54 |
;;; This is because not all character set numbers are assigned, and we |
| 55 |
;;; can't use unassigned character set numbers. So the value given is |
| 56 |
;;; the last value which actually corresponds to something in a real |
| 57 |
;;; character set. |
| 58 |
|
| 59 |
;; Check some characters encoded in two bytes. |
| 60 |
(check-encoding 2208 #y(#x81 #xA0)) ; beginning of range |
| 61 |
(check-encoding 3839 #y(#x8d #xFF)) ; end of range |
| 62 |
(check-encoding 2273 #y(#x81 #xE1)) |
| 63 |
|
| 64 |
;; Check some big characters encoded in three bytes. |
| 65 |
(check-encoding 20512 #y(#x90 #xA0 #xA0)) ; beginning of range |
| 66 |
(check-encoding 180223 #y(#x99 #xFF #xFF)) ; end of range |
| 67 |
(check-encoding 53931 #y(#x92 #xA5 #xAB)) |
| 68 |
|
| 69 |
;; Check some small characters encoded in three bytes --- some from |
| 70 |
;; the #x9A prefix range, and some from the #x9B prefix range. |
| 71 |
(check-encoding 6176 #y(#x9A #xA0 #xA0)) ; start of the #9A prefix range |
| 72 |
(check-encoding 7167 #y(#x9A #xA7 #xFF)) ; end of the #9A prefix range |
| 73 |
(check-encoding 14368 #y(#x9B #xE0 #xA0)) ; start of the #9B prefix range |
| 74 |
(check-encoding 14591 #y(#x9B #xE1 #xFF)) ; end of the #9B prefix range |
| 75 |
|
| 76 |
;; Check some characters encoded in four bytes. |
| 77 |
(check-encoding 266272 #y(#x9C #xF0 #xA0 #xA0)) ; start of the #9C prefix range |
| 78 |
(check-encoding 294911 #y(#x9C #xF1 #xFF #xFF)) ; end of the #9C prefix range |
| 79 |
(check-encoding 348192 #y(#x9D #xF5 #xA0 #xA0)) ; start of the #9D prefix range |
| 80 |
(check-encoding 475135 #y(#x9D #xFC #xFF #xFF)) ; start of the #9D prefix range |