Make *uncompacted-fun-maps* synchronized.
[sbcl.git] / tests / enc-cn.pure.lisp
blob0460a828b747849fd29ccc0013ff73c2679d6651
1 ;;; -*- coding: utf-8 -*-
2 ;;; enc-cn.impure.lisp: test case for enc-cn.lisp and enc-cn-tbl.lisp
3 #+(or (not sb-unicode) unicode-lite) (invoke-restart 'run-tests::skip-file)
5 (let ((str (coerce '(#\u0031 #\u0041 #\uff21 #\u3042 #\u80e1 #\u73a5 #\u59ee)
6 'string))
7 (gbk '(#x31 #x41 #xa3 #xc1 #xa4 #xa2 #xba #xfa #xab #x68 #x8a #xac))
8 (file (scratch-file-name)))
9 (dolist (pair (list (list gbk :gbk)))
10 (destructuring-bind (bytes enc) pair
11 ;; check if output works
12 (with-open-file (s file :direction :output
13 :if-exists :supersede :external-format enc)
14 (write-string str s))
15 (with-open-file (s file :direction :input
16 :element-type '(unsigned-byte 8))
17 (loop for c in bytes
18 do (assert (eql (read-byte s) c))))
20 ;; check if input works
21 (with-open-file (s file :direction :input :external-format enc)
22 (loop for c across str
23 do (assert (eql (read-char s) c))))
25 ;; check if string conversion works
26 (assert (equal (coerce (string-to-octets str :external-format enc)
27 'list)
28 bytes))
29 (assert (equal (octets-to-string (coerce bytes
30 '(vector (unsigned-byte 8)))
31 :external-format enc)
32 str))))
33 (delete-file file))
34 ;;; success