30#define check_string(str, content, length, has_null) _check_string(__LINE__, str, content, length, has_null)
40 ok_(__FILE__,
line)(out_null == has_null,
"WindowsStringHasEmbeddedNull failed\n");
45 ok_(__FILE__,
line)(
ptr !=
NULL,
"WindowsGetStringRawBuffer returned null\n");
46 ok_(__FILE__,
line)(out_length ==
length,
"WindowsGetStringRawBuffer returned incorrect length\n");
48 ok_(__FILE__,
line)(
ptr !=
NULL,
"WindowsGetStringRawBuffer returned null\n");
49 ok_(__FILE__,
line)(
ptr[
length] ==
'\0',
"WindowsGetStringRawBuffer doesn't return a null terminated buffer\n");
99 ok(
str ==
NULL,
"Empty string not a null string\n");
103 ok(
str ==
NULL,
"Empty string not a null string\n");
107 ok(
str ==
NULL,
"Empty string not a null string\n");
111 ok(
str ==
NULL,
"Empty string not a null string\n");
115 ok(
str ==
NULL,
"Empty string not a null string\n");
126 ok(
str ==
str2,
"Duplicated string created new string\n");
132 ok(
str !=
str2,
"Duplicated string ref didn't create new string\n");
137 ok(
str2 ==
NULL,
"Duplicated string created new string\n");
178 ok(
ptr !=
NULL,
"Empty string didn't return a buffer pointer\n");
180 ok(
str ==
NULL,
"Empty string isn't a null string\n");
192 ok(
ptr[6] ==
'\0',
"Preallocated string buffer didn't have null termination\n");
234 ok(
str !=
substr,
"Duplicated string didn't create new string\n");
238 ok(
str !=
substr,
"Duplicated string didn't create new string\n");
256 ok(
str !=
substr,
"Duplicated string ref didn't create new string\n");
260 ok(
str !=
substr,
"Duplicated string ref didn't create new string\n");
305 ok(
str1 == concat,
"Concatenate created new string\n");
311 ok(
str2 == concat,
"Concatenate created new string\n");
328 ok(
str1 != concat,
"Concatenate string ref didn't create new string\n");
333 ok(
str2 != concat,
"Concatenate string ref didn't create new string\n");
347 ok(concat ==
NULL,
"Concatenate created new string\n");
361 ok(
res == 0,
"Expected 0, got %d\n",
res);
363 ok(
res == -1,
"Expected -1, got %d\n",
res);
365 ok(
res == 1,
"Expected 1, got %d\n",
res);
367 ok(
res == 0,
"Expected 0, got %d\n",
res);
369 ok(
res == 1,
"Expected 1, got %d\n",
res);
371 ok(
res == -1,
"Expected -1, got %d\n",
res);
373 ok(
res == 1,
"Expected 1, got %d\n",
res);
375 ok(
res == -1,
"Expected -1, got %d\n",
res);
385 ok(
res == 0,
"Expected 0, got %d\n",
res);
387 ok(
res == -1,
"Expected -1, got %d\n",
res);
389 ok(
res == 1,
"Expected 1, got %d\n",
res);
391 ok(
res == 0,
"Expected 0, got %d\n",
res);
393 ok(
res == 1,
"Expected 1, got %d\n",
res);
395 ok(
res == -1,
"Expected -1, got %d\n",
res);
397 ok(
res == 1,
"Expected 1, got %d\n",
res);
399 ok(
res == -1,
"Expected -1, got %d\n",
res);
407 ok(
res == 0,
"Expected 0, got %d\n",
res);
423 ok(trimmed ==
str1,
"Trimmed string created new string\n");
431 ok(trimmed ==
str1,
"Trimmed string created new string\n");
449 ok(trimmed !=
str1,
"Trimmed string ref didn't create new string\n");
457 ok(trimmed !=
str1,
"Trimmed string ref didn't create new string\n");
473 ok(trimmed ==
NULL,
"Trimming created new string\n");
478 ok(trimmed ==
NULL,
"Trimming created new string\n");
506 BOOL arch64 = (
sizeof(
void*) == 8);
508 ok(arch64 ? (
sizeof(prv->
header) == 24) : (
sizeof(prv->
header) == 20),
"hstring_header size incorrect.\n");
514 ok(prv->
header.flags == 0,
"Expected 0 in flags field, got %#x.\n", prv->
header.flags);
515 ok(prv->
header.length == 6,
"Expected 6 in length field, got %u.\n", prv->
header.length);
516 ok(prv->
header.str == prv->
buffer,
"Expected str to point at buffer, instead pointing at %p.\n", prv->
header.str);
519 ok(prv->
buffer[prv->
header.length] ==
'\0',
"Expected buffer to be null terminated.\n");
540 ok(prv == prv2,
"Pointers not identical.\n");
541 ok(prv2->
header.flags == 1,
"Expected HSTRING_REFERENCE_FLAG to be set, got %#x.\n", prv2->
header.flags);
542 ok(prv2->
header.length == 6,
"Expected 6 in length field, got %u.\n", prv2->
header.length);
HRESULT WINAPI WindowsDeleteStringBuffer(HSTRING_BUFFER buf)
UINT32 WINAPI WindowsGetStringLen(HSTRING str)
HRESULT WINAPI WindowsCreateString(LPCWSTR ptr, UINT32 len, HSTRING *out)
LPCWSTR WINAPI WindowsGetStringRawBuffer(HSTRING str, UINT32 *len)
HRESULT WINAPI WindowsConcatString(HSTRING str1, HSTRING str2, HSTRING *out)
HRESULT WINAPI WindowsCompareStringOrdinal(HSTRING str1, HSTRING str2, INT32 *res)
HRESULT WINAPI WindowsSubstringWithSpecifiedLength(HSTRING str, UINT32 start, UINT32 len, HSTRING *out)
HRESULT WINAPI WindowsDeleteString(HSTRING str)
HRESULT WINAPI WindowsTrimStringStart(HSTRING str1, HSTRING str2, HSTRING *out)
HRESULT WINAPI WindowsSubstring(HSTRING str, UINT32 start, HSTRING *out)
static const WCHAR empty[1]
HRESULT WINAPI WindowsDuplicateString(HSTRING str, HSTRING *out)
HRESULT WINAPI WindowsTrimStringEnd(HSTRING str1, HSTRING str2, HSTRING *out)
HRESULT WINAPI WindowsPromoteStringBuffer(HSTRING_BUFFER buf, HSTRING *out)
HRESULT WINAPI WindowsStringHasEmbeddedNull(HSTRING str, BOOL *out)
HRESULT WINAPI WindowsPreallocateStringBuffer(UINT32 len, WCHAR **outptr, HSTRING_BUFFER *out)
HRESULT WINAPI WindowsCreateStringReference(LPCWSTR ptr, UINT32 len, HSTRING_HEADER *header, HSTRING *out)
BOOL WINAPI WindowsIsStringEmpty(HSTRING str)
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLsizei GLsizei * length
static substr_t substr(const WCHAR *str, size_t len)
#define memcpy(s1, s2, n)
static void test_access(void)
static void test_substring(void)
static const WCHAR input_embed_null[]
static const WCHAR input_string1[]
#define check_string(str, content, length, has_null)
static void test_trim(void)
static void test_create_delete(void)
static const WCHAR input_string2[]
static void test_compare(void)
static void _check_string(int line, HSTRING str, LPCWSTR content, UINT32 length, BOOL has_null)
static void test_duplicate(void)
static const WCHAR output_substring[]
static const WCHAR input_string[]
static void test_string_buffer(void)
static void test_concat(void)
static void test_hstring_struct(void)
XML_HIDDEN void xmlParserErrors const char const xmlChar const xmlChar * str2
XML_HIDDEN void xmlParserErrors const char const xmlChar * str1
struct hstring_header header
#define CONTAINING_RECORD(address, type, field)