1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
6 ;;;; Purpose: UFFI test file of i18n functions
7 ;;;; Author: Kevin M. Rosenberg
8 ;;;; Date Started: Feb 2010
10 ;;;; This file, part of UFFI, is Copyright (c) 2010 by Kevin M. Rosenberg
12 ;;;; *************************************************************************
14 (in-package #:uffi-tests)
17 (uffi:string-to-octets "")
21 (uffi:string-to-octets "A")
25 (uffi:string-to-octets "abc")
28 ;; Below is UTF-8 encoded, 27 octets / 20 lisp characters
30 (uffi:string-to-octets "Iñtërnâtiônàlizætiøn" :encoding :utf-8)
31 #(73 195 177 116 195 171 114 110 195 162 116 105 195 180 110 195 160 108 105 122 195 166 116 105 195 184 110))
34 (length (uffi:string-to-octets "Iñtërnâtiônàlizætiøn" :encoding :utf-8))
38 (uffi:foreign-encoded-octet-count "")
42 (uffi:foreign-encoded-octet-count "A")
46 (uffi:foreign-encoded-octet-count "abc")
50 (uffi:foreign-encoded-octet-count "Iñtërnâtiônàlizætiøn"
57 (uffi:octets-to-string (make-array (list (length octets)) :element-type '(unsigned-byte 8)
58 :initial-contents octets)))
63 (uffi:octets-to-string (make-array (list (length octets)) :element-type '(unsigned-byte 8)
64 :initial-contents octets)))
68 (let ((octets '(97 98 99)))
69 (uffi:octets-to-string (make-array (list (length octets)) :element-type '(unsigned-byte 8)
70 :initial-contents octets)))
74 (let ((octets '(73 195 177 116 195 171 114 110 195 162 116 105 195 180
75 110 195 160 108 105 122 195 166 116 105 195 184 110)))
76 (uffi:octets-to-string (make-array (list (length octets)) :element-type '(unsigned-byte 8)
77 :initial-contents octets)
79 "Iñtërnâtiônàlizætiøn")