libwinpr-crt: added test strings for character set conversion

This commit is contained in:
Marc-André Moreau 2012-12-14 14:45:52 -05:00
parent 3e1ac9a55e
commit b60754cee6
2 changed files with 61 additions and 1 deletions

View File

@ -3,8 +3,63 @@
#include <winpr/crt.h>
#include <winpr/windows.h>
/*
* Conversion *to* Unicode
* MultiByteToWideChar: http://msdn.microsoft.com/en-us/library/windows/desktop/dd319072/
*/
#if 0
/* English */
static BYTE enHello_UTF8[] = "Hello";
static BYTE enHello_UTF16[] = "\x48\x00\x65\x00\x6C\x00\x6C\x00\x6F\x00";
static BYTE enHowAreYou_UTF8[] = "How are you?";
static BYTE enHowAreYou_UTF16[] = "\x48\x00\x6F\x00\x77\x00\x20\x00\x61\x00\x72\x00\x65\x00\x20\x00"
"\x79\x00\x6F\x00\x75\x00\x3F\x00";
/* French */
static BYTE frHello_UTF8[] = "Allo";
static BYTE frHello_UTF16[] = "\x41\x00\x6C\x00\x6C\x00\x6F\x00";
static BYTE frHowAreYou_UTF8[] = "\x43\x6F\x6D\x6D\x65\x6E\x74\x20\xC3\xA7\x61\x20\x76\x61\x3F";
static BYTE frHowAreYou_UTF16[] = "\x43\x00\x6F\x00\x6D\x00\x6D\x00\x65\x00\x6E\x00\x74\x00\x20\x00"
"\xE7\x00\x61\x00\x20\x00\x76\x00\x61\x00\x3F\x00";
/* Russian */
static BYTE ruHello_UTF8[] = "\xD0\x97\xD0\xB4\xD0\xBE\xD1\x80\xD0\xBE\xD0\xB2\xD0\xBE";
static BYTE ruHello_UTF16[] = "\x17\x04\x34\x04\x3E\x04\x40\x04\x3E\x04\x32\x04\x3E\x04";
static BYTE ruHowAreYou_UTF8[] = "\xD0\x9A\xD0\xB0\xD0\xBA\x20\xD0\xB4\xD0\xB5\xD0\xBB\xD0\xB0\x3F";
static BYTE ruHowAreYou_UTF16[] = "\x1A\x04\x30\x04\x3A\x04\x20\x00\x34\x04\x35\x04\x3B\x04\x30\x04"
"\x3F\x00";
/* Arabic */
static BYTE arHello_UTF8[] = "\xD8\xA7\xD9\x84\xD8\xB3\xD9\x84\x\xD8\xA7\xD9\x85\x20\xD8\xB9\xD9"
"\x84\xD9\x8A\xD9\x83\xD9\x85";
static BYTE arHello_UTF16[] = "\x27\x06\x44\x06\x33\x06\x44\x06\x\x27\x06\x45\x06\x20\x00\x39\x06"
"\x44\x06\x4A\x06\x43\x06\x45\x06";
static BYTE arHowAreYou_UTF8[] = "\xD9\x83\xD9\x8A\xD9\x81\x20\xD8\x\xAD\xD8\xA7\xD9\x84\xD9\x83\xD8"
"\9F";
static BYTE arHowAreYou_UTF16[] = "\x43\x06\x4A\x06\x41\x06\x20\x00\x\x2D\x06\x27\x06\x44\x06\x43\x06"
"\x1F\x06";
/* Chinese */
static BYTE chHello_UTF8[] = "\xE4\xBD\xA0\xE5\xA5\xBD";
static BYTE chHello_UTF16[] = "\x60\x4F\x7D\x59";
static BYTE chHowAreYou_UTF8[] = "\xE4\xBD\xA0\xE5\xA5\xBD\xE5\x90\x\x97";
static BYTE chHowAreYou_UTF16[] = "\x60\x4F\x7D\x59\x17\x54";
#endif
int TestMultiByteToWideChar(int argc, char* argv[])
{
return 0;
}

View File

@ -3,6 +3,11 @@
#include <winpr/crt.h>
#include <winpr/windows.h>
/*
* Conversion *from* Unicode
* WideCharToMultiByte: http://msdn.microsoft.com/en-us/library/windows/desktop/dd374130/
*/
int TestWideCharToMultiByte(int argc, char* argv[])
{
return 0;