FreeRDP
TestUnicodeConversion.c File Reference
#include <stdio.h>
#include <winpr/wtypes.h>
#include <winpr/crt.h>
#include <winpr/assert.h>
#include <winpr/error.h>
#include <winpr/print.h>
#include <winpr/windows.h>

Macros

#define TESTCASE_BUFFER_SIZE   8192
 
#define MIN(x, y)   (((x) < (y)) ? (x) : (y))
 
#define compare_utf16(what, buffersize, rc, inputlen, test)    compare_utf16_int((what), (buffersize), (rc), (inputlen), (test), __func__, __LINE__)
 
#define compare_utf8(what, buffersize, rc, inputlen, test)    compare_utf8_int((what), (buffersize), (rc), (inputlen), (test), __func__, __LINE__)
 

Functions

static void create_prefix (char *prefix, size_t prefixlen, size_t buffersize, SSIZE_T rc, SSIZE_T inputlen, const testcase_t *test, const char *fkt, size_t line)
 
static BOOL check_short_buffer (const char *prefix, int rc, size_t buffersize, const testcase_t *test, BOOL utf8)
 
static BOOL compare_utf16_int (const WCHAR *what, size_t buffersize, SSIZE_T rc, SSIZE_T inputlen, const testcase_t *test, const char *fkt, size_t line)
 
static BOOL compare_utf8_int (const char *what, size_t buffersize, SSIZE_T rc, SSIZE_T inputlen, const testcase_t *test, const char *fkt, size_t line)
 
static BOOL test_convert_to_utf16 (const testcase_t *test)
 
static BOOL test_convert_to_utf16_n (const testcase_t *test)
 
static BOOL test_convert_to_utf8 (const testcase_t *test)
 
static BOOL test_convert_to_utf8_n (const testcase_t *test)
 
static BOOL test_conversion (const testcase_t *testcases, size_t count)
 
int TestUnicodeConversion (int argc, char *argv[])
 

Variables

static const testcase_t unit_testcases []
 

Macro Definition Documentation

◆ compare_utf16

#define compare_utf16 (   what,
  buffersize,
  rc,
  inputlen,
  test 
)     compare_utf16_int((what), (buffersize), (rc), (inputlen), (test), __func__, __LINE__)

◆ compare_utf8

#define compare_utf8 (   what,
  buffersize,
  rc,
  inputlen,
  test 
)     compare_utf8_int((what), (buffersize), (rc), (inputlen), (test), __func__, __LINE__)

◆ MIN

#define MIN (   x,
  y 
)    (((x) < (y)) ? (x) : (y))

◆ TESTCASE_BUFFER_SIZE

#define TESTCASE_BUFFER_SIZE   8192

Function Documentation

◆ check_short_buffer()

static BOOL check_short_buffer ( const char *  prefix,
int  rc,
size_t  buffersize,
const testcase_t *  test,
BOOL  utf8 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ compare_utf16_int()

static BOOL compare_utf16_int ( const WCHAR *  what,
size_t  buffersize,
SSIZE_T  rc,
SSIZE_T  inputlen,
const testcase_t *  test,
const char *  fkt,
size_t  line 
)
static
Here is the call graph for this function:

◆ compare_utf8_int()

static BOOL compare_utf8_int ( const char *  what,
size_t  buffersize,
SSIZE_T  rc,
SSIZE_T  inputlen,
const testcase_t *  test,
const char *  fkt,
size_t  line 
)
static
Here is the call graph for this function:

◆ create_prefix()

static void create_prefix ( char *  prefix,
size_t  prefixlen,
size_t  buffersize,
SSIZE_T  rc,
SSIZE_T  inputlen,
const testcase_t *  test,
const char *  fkt,
size_t  line 
)
static
Here is the caller graph for this function:

◆ test_conversion()

static BOOL test_conversion ( const testcase_t *  testcases,
size_t  count 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_convert_to_utf16()

static BOOL test_convert_to_utf16 ( const testcase_t *  test)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_convert_to_utf16_n()

static BOOL test_convert_to_utf16_n ( const testcase_t *  test)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_convert_to_utf8()

static BOOL test_convert_to_utf8 ( const testcase_t *  test)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_convert_to_utf8_n()

static BOOL test_convert_to_utf8_n ( const testcase_t *  test)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TestUnicodeConversion()

int TestUnicodeConversion ( int  argc,
char *  argv[] 
)
Here is the call graph for this function:

Variable Documentation

◆ unit_testcases

const testcase_t unit_testcases[]
static
Initial value:
= {
{ "foo", 3, (const WCHAR*)"f\x00o\x00o\x00\x00\x00", 3 },
{ "foo", 4, (const WCHAR*)"f\x00o\x00o\x00\x00\x00", 4 },
{ "βœŠπŸŽ…Δ™Κ₯κ£Έπ‘—Ša", 19,
(const WCHAR*)"\x0a\x27\x3c\xd8\x85\xdf\x19\x01\xa5\x02\xf8\xa8\x05\xd8\xca\xdd\x61\x00\x00"
"\x00",
9 }
}