[cxml-cvs] CVS cxml/test

dlichteblau dlichteblau at common-lisp.net
Sun Jul 22 19:59:27 UTC 2007


Update of /project/cxml/cvsroot/cxml/test
In directory clnet:/tmp/cvs-serv8223/test

Added Files:
	misc.lisp 
Log Message:
UTF-8 fix, thanks to Francis Leboutte



--- /project/cxml/cvsroot/cxml/test/misc.lisp	2007/07/22 19:59:27	NONE
+++ /project/cxml/cvsroot/cxml/test/misc.lisp	2007/07/22 19:59:27	1.1
;;;
;;; When I'll grow up, I'll be a complete test suite.

(deftest utf-8
    (flet ((doit (from below)
	     (loop for code from from below below do
		  (when (and (code-char code)
			     (not (eql code #xfffe))
			     (not (eql code #xffff)))
		    (let* ((a (if (< code #x10000)
				  (format nil "abc~C" (code-char code))
				  (let* ((x (- code #x10000))
					 (lo (ldb (byte 10 0) x))
					 (hi (ldb (byte 10 10) x)))
				    (format nil "abc~C~C"
					    (code-char (logior #xD800 hi))
					    (code-char 
					     (logior #xDC00 lo))))))
			   (b (cxml:utf8-string-to-rod
			       (cxml:rod-to-utf8-string
				a))))
		      (unless (string= a b)
			(format t "FAIL: ~S ~A ~A~%"
				(code-char code)
				(map 'vector #'char-code a)
				(map 'vector #'char-code b))))))))
      (doit 32 #xD800)
      (doit #x10000 char-code-limit)
      (values)))



More information about the Cxml-cvs mailing list