2014-12-15 09:24:48 +01:00
|
|
|
/*
|
|
|
|
* Unit tests for Windows String functions
|
|
|
|
*
|
|
|
|
* Copyright (c) 2014 Martin Storsjo
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
#include "winstring.h"
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
2014-12-15 09:24:49 +01:00
|
|
|
#define check_string(str, content, length, has_null) _check_string(__LINE__, str, content, length, has_null)
|
|
|
|
static void _check_string(int line, HSTRING str, LPCWSTR content, UINT32 length, BOOL has_null)
|
|
|
|
{
|
|
|
|
BOOL out_null;
|
|
|
|
BOOL empty = length == 0;
|
|
|
|
UINT32 out_length;
|
|
|
|
LPCWSTR ptr;
|
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok_(__FILE__, line)(WindowsIsStringEmpty(str) == empty, "WindowsIsStringEmpty failed\n");
|
|
|
|
ok_(__FILE__, line)(WindowsStringHasEmbeddedNull(str, &out_null) == S_OK, "WindowsStringHasEmbeddedNull failed\n");
|
2014-12-15 09:24:49 +01:00
|
|
|
ok_(__FILE__, line)(out_null == has_null, "WindowsStringHasEmbeddedNull failed\n");
|
2021-04-15 05:19:09 +02:00
|
|
|
ok_(__FILE__, line)(WindowsGetStringLen(str) == length, "WindowsGetStringLen failed\n");
|
|
|
|
ptr = WindowsGetStringRawBuffer(str, &out_length);
|
2014-12-15 09:24:49 +01:00
|
|
|
/* WindowsGetStringRawBuffer should return a non-null, null terminated empty string
|
|
|
|
* even if str is NULL. */
|
|
|
|
ok_(__FILE__, line)(ptr != NULL, "WindowsGetStringRawBuffer returned null\n");
|
|
|
|
ok_(__FILE__, line)(out_length == length, "WindowsGetStringRawBuffer returned incorrect length\n");
|
2021-04-15 05:19:09 +02:00
|
|
|
ptr = WindowsGetStringRawBuffer(str, NULL);
|
2014-12-15 09:24:49 +01:00
|
|
|
ok_(__FILE__, line)(ptr != NULL, "WindowsGetStringRawBuffer returned null\n");
|
|
|
|
ok_(__FILE__, line)(ptr[length] == '\0', "WindowsGetStringRawBuffer doesn't return a null terminated buffer\n");
|
|
|
|
ok_(__FILE__, line)(memcmp(ptr, content, sizeof(*content) * length) == 0, "Incorrect string content\n");
|
|
|
|
}
|
|
|
|
|
2020-09-30 23:14:48 +02:00
|
|
|
static const WCHAR input_string[] = L"abcdef\0";
|
|
|
|
static const WCHAR input_string1[] = L"abc";
|
|
|
|
static const WCHAR input_string2[] = L"def";
|
|
|
|
static const WCHAR input_embed_null[] = L"a\0c\0ef";
|
|
|
|
static const WCHAR output_substring[] = L"cdef";
|
2014-12-15 09:24:48 +01:00
|
|
|
|
|
|
|
static void test_create_delete(void)
|
|
|
|
{
|
|
|
|
HSTRING str;
|
|
|
|
HSTRING_HEADER header;
|
|
|
|
|
|
|
|
/* Test normal creation of a string */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateString(input_string, 6, &str) == S_OK, "Failed to create string\n");
|
2014-12-15 09:24:49 +01:00
|
|
|
check_string(str, input_string, 6, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
2014-12-15 09:24:48 +01:00
|
|
|
/* Test error handling in WindowsCreateString */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateString(input_string, 6, NULL) == E_INVALIDARG, "Incorrect error handling\n");
|
|
|
|
ok(WindowsCreateString(NULL, 6, &str) == E_POINTER, "Incorrect error handling\n");
|
2014-12-15 09:24:48 +01:00
|
|
|
|
|
|
|
/* Test handling of a NULL string */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(NULL) == S_OK, "Failed to delete null string\n");
|
2014-12-15 09:24:48 +01:00
|
|
|
|
|
|
|
/* Test creation of a string reference */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateStringReference(input_string, 6, &header, &str) == S_OK, "Failed to create string ref\n");
|
2014-12-15 09:24:49 +01:00
|
|
|
check_string(str, input_string, 6, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string ref\n");
|
2014-12-15 09:24:48 +01:00
|
|
|
|
|
|
|
/* Test error handling in WindowsCreateStringReference */
|
|
|
|
/* Strings to CreateStringReference must be null terminated with the correct
|
|
|
|
* length. According to MSDN this should be E_INVALIDARG, but it returns
|
|
|
|
* 0x80000017 in practice. */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(FAILED(WindowsCreateStringReference(input_string, 5, &header, &str)), "Incorrect error handling\n");
|
2015-10-29 09:21:22 +01:00
|
|
|
/* If the input string is non-null, it must be null-terminated even if the
|
|
|
|
* length is zero. */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(FAILED(WindowsCreateStringReference(input_string, 0, &header, &str)), "Incorrect error handling\n");
|
|
|
|
ok(WindowsCreateStringReference(input_string, 6, NULL, &str) == E_INVALIDARG, "Incorrect error handling\n");
|
|
|
|
ok(WindowsCreateStringReference(input_string, 6, &header, NULL) == E_INVALIDARG, "Incorrect error handling\n");
|
|
|
|
ok(WindowsCreateStringReference(NULL, 6, &header, &str) == E_POINTER, "Incorrect error handling\n");
|
2014-12-15 09:24:48 +01:00
|
|
|
|
|
|
|
/* Test creating a string without a null-termination at the specified length */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateString(input_string, 3, &str) == S_OK, "Failed to create string\n");
|
2014-12-15 09:24:49 +01:00
|
|
|
check_string(str, input_string, 3, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
2014-12-15 09:24:48 +01:00
|
|
|
|
|
|
|
/* Test an empty string */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateString(L"", 0, &str) == S_OK, "Failed to create string\n");
|
2014-12-15 09:24:48 +01:00
|
|
|
ok(str == NULL, "Empty string not a null string\n");
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
2014-12-15 09:24:48 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateString(input_string, 0, &str) == S_OK, "Failed to create string\n");
|
2015-10-29 09:21:22 +01:00
|
|
|
ok(str == NULL, "Empty string not a null string\n");
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
2015-10-29 09:21:22 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateStringReference(L"", 0, &header, &str) == S_OK, "Failed to create string\n");
|
2014-12-15 09:24:48 +01:00
|
|
|
ok(str == NULL, "Empty string not a null string\n");
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
2015-10-29 09:21:22 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateString(NULL, 0, &str) == S_OK, "Failed to create string\n");
|
2015-10-29 09:21:22 +01:00
|
|
|
ok(str == NULL, "Empty string not a null string\n");
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
2015-10-29 09:21:22 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateStringReference(NULL, 0, &header, &str) == S_OK, "Failed to create string\n");
|
2015-10-29 09:21:22 +01:00
|
|
|
ok(str == NULL, "Empty string not a null string\n");
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
2014-12-15 09:24:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_duplicate(void)
|
|
|
|
{
|
|
|
|
HSTRING str, str2;
|
|
|
|
HSTRING_HEADER header;
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateString(input_string, 6, &str) == S_OK, "Failed to create string\n");
|
|
|
|
ok(WindowsDuplicateString(str, NULL) == E_INVALIDARG, "Incorrect error handling\n");
|
|
|
|
ok(WindowsDuplicateString(str, &str2) == S_OK, "Failed to duplicate string\n");
|
2014-12-15 09:24:48 +01:00
|
|
|
ok(str == str2, "Duplicated string created new string\n");
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
|
|
|
ok(WindowsDeleteString(str2) == S_OK, "Failed to delete string\n");
|
2014-12-15 09:24:48 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateStringReference(input_string, 6, &header, &str) == S_OK, "Failed to create string ref\n");
|
|
|
|
ok(WindowsDuplicateString(str, &str2) == S_OK, "Failed to duplicate string\n");
|
2014-12-15 09:24:48 +01:00
|
|
|
ok(str != str2, "Duplicated string ref didn't create new string\n");
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
|
|
|
ok(WindowsDeleteString(str2) == S_OK, "Failed to delete string ref\n");
|
2014-12-15 09:24:48 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDuplicateString(NULL, &str2) == S_OK, "Failed to duplicate NULL string\n");
|
2014-12-15 09:24:48 +01:00
|
|
|
ok(str2 == NULL, "Duplicated string created new string\n");
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str2) == S_OK, "Failed to delete string\n");
|
2014-12-15 09:24:48 +01:00
|
|
|
}
|
|
|
|
|
2014-12-15 09:24:49 +01:00
|
|
|
static void test_access(void)
|
|
|
|
{
|
|
|
|
HSTRING str;
|
|
|
|
HSTRING_HEADER header;
|
|
|
|
|
|
|
|
/* Test handling of a NULL string */
|
|
|
|
check_string(NULL, NULL, 0, FALSE);
|
|
|
|
|
|
|
|
/* Test strings with embedded null chars */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateString(input_embed_null, 6, &str) == S_OK, "Failed to create string\n");
|
2014-12-15 09:24:49 +01:00
|
|
|
check_string(str, input_embed_null, 6, TRUE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
2014-12-15 09:24:49 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateStringReference(input_embed_null, 6, &header, &str) == S_OK, "Failed to create string ref\n");
|
2014-12-15 09:24:49 +01:00
|
|
|
check_string(str, input_embed_null, 6, TRUE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string ref\n");
|
2014-12-15 09:24:49 +01:00
|
|
|
|
|
|
|
/* Test normal creation of a string with trailing null */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateString(input_string, 7, &str) == S_OK, "Failed to create string\n");
|
2014-12-15 09:24:49 +01:00
|
|
|
check_string(str, input_string, 7, TRUE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
2014-12-15 09:24:49 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateStringReference(input_string, 7, &header, &str) == S_OK, "Failed to create string ref\n");
|
2014-12-15 09:24:49 +01:00
|
|
|
check_string(str, input_string, 7, TRUE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string ref\n");
|
2014-12-15 09:24:49 +01:00
|
|
|
}
|
|
|
|
|
2014-12-15 09:24:50 +01:00
|
|
|
static void test_string_buffer(void)
|
|
|
|
{
|
|
|
|
/* Initialize ptr to NULL to make sure it actually is set in the first
|
|
|
|
* test below. */
|
|
|
|
HSTRING_BUFFER buf = NULL;
|
|
|
|
WCHAR *ptr = NULL;
|
|
|
|
HSTRING str;
|
|
|
|
|
|
|
|
/* Test creation of an empty buffer */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsPreallocateStringBuffer(0, &ptr, &buf) == S_OK, "Failed to preallocate string buffer\n");
|
2014-12-15 09:24:50 +01:00
|
|
|
ok(ptr != NULL, "Empty string didn't return a buffer pointer\n");
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsPromoteStringBuffer(buf, &str) == S_OK, "Failed to promote string buffer\n");
|
2014-12-15 09:24:50 +01:00
|
|
|
ok(str == NULL, "Empty string isn't a null string\n");
|
2020-09-30 23:14:48 +02:00
|
|
|
check_string(str, L"", 0, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
2014-12-15 09:24:50 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteStringBuffer(NULL) == S_OK, "Failed to delete null string buffer\n");
|
2014-12-15 09:24:50 +01:00
|
|
|
|
|
|
|
/* Test creation and deletion of string buffers */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsPreallocateStringBuffer(6, &ptr, &buf) == S_OK, "Failed to preallocate string buffer\n");
|
|
|
|
ok(WindowsDeleteStringBuffer(buf) == S_OK, "Failed to delete string buffer\n");
|
2014-12-15 09:24:50 +01:00
|
|
|
|
|
|
|
/* Test creation and promotion of string buffers */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsPreallocateStringBuffer(6, &ptr, &buf) == S_OK, "Failed to preallocate string buffer\n");
|
2014-12-15 09:24:50 +01:00
|
|
|
ok(ptr[6] == '\0', "Preallocated string buffer didn't have null termination\n");
|
|
|
|
memcpy(ptr, input_string, 6 * sizeof(*input_string));
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsPromoteStringBuffer(buf, NULL) == E_POINTER, "Incorrect error handling\n");
|
|
|
|
ok(WindowsPromoteStringBuffer(buf, &str) == S_OK, "Failed to promote string buffer\n");
|
2014-12-15 09:24:50 +01:00
|
|
|
check_string(str, input_string, 6, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
2014-12-15 09:24:50 +01:00
|
|
|
|
|
|
|
/* Test error handling in preallocation */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsPreallocateStringBuffer(6, NULL, &buf) == E_POINTER, "Incorrect error handling\n");
|
|
|
|
ok(WindowsPreallocateStringBuffer(6, &ptr, NULL) == E_POINTER, "Incorrect error handling\n");
|
2014-12-15 09:24:50 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsPreallocateStringBuffer(6, &ptr, &buf) == S_OK, "Failed to preallocate string buffer\n");
|
2014-12-15 09:24:50 +01:00
|
|
|
ptr[6] = 'a'; /* Overwrite the buffer's null termination, promotion should fail */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsPromoteStringBuffer(buf, &str) == E_INVALIDARG, "Incorrect error handling\n");
|
|
|
|
ok(WindowsDeleteStringBuffer(buf) == S_OK, "Failed to delete string buffer\n");
|
2014-12-15 09:24:50 +01:00
|
|
|
|
|
|
|
/* Test strings with trailing null chars */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsPreallocateStringBuffer(7, &ptr, &buf) == S_OK, "Failed to preallocate string buffer\n");
|
2014-12-15 09:24:50 +01:00
|
|
|
memcpy(ptr, input_string, 7 * sizeof(*input_string));
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsPromoteStringBuffer(buf, &str) == S_OK, "Failed to promote string buffer\n");
|
2014-12-15 09:24:50 +01:00
|
|
|
check_string(str, input_string, 7, TRUE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
2014-12-15 09:24:50 +01:00
|
|
|
}
|
|
|
|
|
2015-10-23 03:23:02 +02:00
|
|
|
static void test_substring(void)
|
|
|
|
{
|
|
|
|
HSTRING str, substr;
|
|
|
|
HSTRING_HEADER header;
|
|
|
|
|
|
|
|
/* Test substring of string buffers */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateString(input_string, 6, &str) == S_OK, "Failed to create string\n");
|
|
|
|
ok(WindowsSubstring(str, 2, &substr) == S_OK, "Failed to create substring\n");
|
2015-10-23 03:23:02 +02:00
|
|
|
check_string(substr, output_substring, 4, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(substr) == S_OK, "Failed to delete string\n");
|
|
|
|
ok(WindowsSubstringWithSpecifiedLength(str, 2, 3, &substr) == S_OK, "Failed to create substring\n");
|
2015-10-25 15:32:45 +01:00
|
|
|
check_string(substr, output_substring, 3, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(substr) == S_OK, "Failed to delete string\n");
|
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
2015-10-23 03:23:02 +02:00
|
|
|
|
|
|
|
/* Test duplication of string using substring */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateString(input_string, 6, &str) == S_OK, "Failed to create string\n");
|
|
|
|
ok(WindowsSubstring(str, 0, &substr) == S_OK, "Failed to create substring\n");
|
2015-10-23 03:23:02 +02:00
|
|
|
ok(str != substr, "Duplicated string didn't create new string\n");
|
|
|
|
check_string(substr, input_string, 6, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(substr) == S_OK, "Failed to delete string\n");
|
|
|
|
ok(WindowsSubstringWithSpecifiedLength(str, 0, 6, &substr) == S_OK, "Failed to create substring\n");
|
2015-10-25 15:32:45 +01:00
|
|
|
ok(str != substr, "Duplicated string didn't create new string\n");
|
|
|
|
check_string(substr, input_string, 6, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(substr) == S_OK, "Failed to delete string\n");
|
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
2015-10-23 03:23:02 +02:00
|
|
|
|
|
|
|
/* Test substring of string reference */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateStringReference(input_string, 6, &header, &str) == S_OK, "Failed to create string ref\n");
|
|
|
|
ok(WindowsSubstring(str, 2, &substr) == S_OK, "Failed to create substring of string ref\n");
|
2015-10-23 03:23:02 +02:00
|
|
|
check_string(substr, output_substring, 4, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(substr) == S_OK, "Failed to delete string\n");
|
|
|
|
ok(WindowsSubstringWithSpecifiedLength(str, 2, 3, &substr) == S_OK, "Failed to create substring of string ref\n");
|
2015-10-25 15:32:45 +01:00
|
|
|
check_string(substr, output_substring, 3, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(substr) == S_OK, "Failed to delete string\n");
|
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string ref\n");
|
2015-10-23 03:23:02 +02:00
|
|
|
|
|
|
|
/* Test duplication of string reference using substring */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateStringReference(input_string, 6, &header, &str) == S_OK, "Failed to create string ref\n");
|
|
|
|
ok(WindowsSubstring(str, 0, &substr) == S_OK, "Failed to create substring of string ref\n");
|
2015-10-23 03:23:02 +02:00
|
|
|
ok(str != substr, "Duplicated string ref didn't create new string\n");
|
|
|
|
check_string(substr, input_string, 6, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(substr) == S_OK, "Failed to delete string\n");
|
|
|
|
ok(WindowsSubstringWithSpecifiedLength(str, 0, 6, &substr) == S_OK, "Failed to create substring of string ref\n");
|
2015-10-25 15:32:45 +01:00
|
|
|
ok(str != substr, "Duplicated string ref didn't create new string\n");
|
|
|
|
check_string(substr, input_string, 6, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(substr) == S_OK, "Failed to delete string\n");
|
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string ref\n");
|
2015-10-23 03:23:02 +02:00
|
|
|
|
|
|
|
/* Test get substring of empty string */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsSubstring(NULL, 0, &substr) == S_OK, "Failed to duplicate NULL string\n");
|
2015-10-23 03:23:02 +02:00
|
|
|
ok(substr == NULL, "Substring created new string\n");
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsSubstringWithSpecifiedLength(NULL, 0, 0, &substr) == S_OK, "Failed to duplicate NULL string\n");
|
2015-10-25 15:32:45 +01:00
|
|
|
ok(substr == NULL, "Substring created new string\n");
|
2015-10-23 03:23:02 +02:00
|
|
|
|
|
|
|
/* Test get empty substring of string */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateString(input_string, 6, &str) == S_OK, "Failed to create string\n");
|
|
|
|
ok(WindowsSubstring(str, 6, &substr) == S_OK, "Failed to create substring\n");
|
2015-10-23 03:23:02 +02:00
|
|
|
ok(substr == NULL, "Substring created new string\n");
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsSubstringWithSpecifiedLength(str, 6, 0, &substr) == S_OK, "Failed to create substring\n");
|
2015-10-25 15:32:45 +01:00
|
|
|
ok(substr == NULL, "Substring created new string\n");
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
2015-10-23 03:23:02 +02:00
|
|
|
|
2015-10-25 15:32:45 +01:00
|
|
|
/* Test handling of using too high start index or length */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateString(input_string, 6, &str) == S_OK, "Failed to create string\n");
|
|
|
|
ok(WindowsSubstring(str, 7, &substr) == E_BOUNDS, "Incorrect error handling\n");
|
|
|
|
ok(WindowsSubstringWithSpecifiedLength(str, 7, 0, &substr) == E_BOUNDS, "Incorrect error handling\n");
|
|
|
|
ok(WindowsSubstringWithSpecifiedLength(str, 6, 1, &substr) == E_BOUNDS, "Incorrect error handling\n");
|
|
|
|
ok(WindowsSubstringWithSpecifiedLength(str, 7, ~0U, &substr) == E_BOUNDS, "Incorrect error handling\n");
|
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
2015-10-23 03:23:02 +02:00
|
|
|
|
|
|
|
/* Test handling of a NULL string */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateString(input_string, 6, &str) == S_OK, "Failed to create string\n");
|
|
|
|
ok(WindowsSubstring(str, 7, NULL) == E_INVALIDARG, "Incorrect error handling\n");
|
|
|
|
ok(WindowsSubstringWithSpecifiedLength(str, 7, 0, NULL) == E_INVALIDARG, "Incorrect error handling\n");
|
|
|
|
ok(WindowsDeleteString(str) == S_OK, "Failed to delete string\n");
|
2015-10-23 03:23:02 +02:00
|
|
|
}
|
|
|
|
|
2015-10-29 05:07:23 +01:00
|
|
|
static void test_concat(void)
|
|
|
|
{
|
|
|
|
HSTRING str1, str2, concat;
|
|
|
|
HSTRING_HEADER header1, header2;
|
|
|
|
|
|
|
|
/* Test concatenation of string buffers */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateString(input_string1, 3, &str1) == S_OK, "Failed to create string\n");
|
|
|
|
ok(WindowsCreateString(input_string2, 3, &str2) == S_OK, "Failed to create string\n");
|
2015-10-29 05:07:23 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsConcatString(str1, NULL, NULL) == E_INVALIDARG, "Incorrect error handling\n");
|
|
|
|
ok(WindowsConcatString(str1, NULL, &concat) == S_OK, "Failed to concatenate string\n");
|
2015-10-29 05:07:23 +01:00
|
|
|
ok(str1 == concat, "Concatenate created new string\n");
|
|
|
|
check_string(concat, input_string1, 3, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(concat) == S_OK, "Failed to delete string\n");
|
2015-10-29 05:07:23 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsConcatString(NULL, str2, NULL) == E_INVALIDARG, "Incorrect error handling\n");
|
|
|
|
ok(WindowsConcatString(NULL, str2, &concat) == S_OK, "Failed to concatenate string\n");
|
2015-10-29 05:07:23 +01:00
|
|
|
ok(str2 == concat, "Concatenate created new string\n");
|
|
|
|
check_string(concat, input_string2, 3, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(concat) == S_OK, "Failed to delete string\n");
|
2015-10-29 05:07:23 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsConcatString(str1, str2, NULL) == E_INVALIDARG, "Incorrect error handling\n");
|
|
|
|
ok(WindowsConcatString(str1, str2, &concat) == S_OK, "Failed to concatenate string\n");
|
2015-10-29 05:07:23 +01:00
|
|
|
check_string(concat, input_string, 6, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(concat) == S_OK, "Failed to delete string\n");
|
2015-10-29 05:07:23 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str2) == S_OK, "Failed to delete string\n");
|
|
|
|
ok(WindowsDeleteString(str1) == S_OK, "Failed to delete string\n");
|
2015-10-29 05:07:23 +01:00
|
|
|
|
|
|
|
/* Test concatenation of string references */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateStringReference(input_string1, 3, &header1, &str1) == S_OK, "Failed to create string ref\n");
|
|
|
|
ok(WindowsCreateStringReference(input_string2, 3, &header2, &str2) == S_OK, "Failed to create string ref\n");
|
2015-10-29 05:07:23 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsConcatString(str1, NULL, &concat) == S_OK, "Failed to concatenate string\n");
|
2015-10-29 05:07:23 +01:00
|
|
|
ok(str1 != concat, "Concatenate string ref didn't create new string\n");
|
|
|
|
check_string(concat, input_string1, 3, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(concat) == S_OK, "Failed to delete string\n");
|
2015-10-29 05:07:23 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsConcatString(NULL, str2, &concat) == S_OK, "Failed to concatenate string\n");
|
2015-10-29 05:07:23 +01:00
|
|
|
ok(str2 != concat, "Concatenate string ref didn't create new string\n");
|
|
|
|
check_string(concat, input_string2, 3, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(concat) == S_OK, "Failed to delete string\n");
|
2015-10-29 05:07:23 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsConcatString(str1, str2, &concat) == S_OK, "Failed to concatenate string\n");
|
2015-10-29 05:07:23 +01:00
|
|
|
check_string(concat, input_string, 6, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(concat) == S_OK, "Failed to delete string\n");
|
2015-10-29 05:07:23 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str2) == S_OK, "Failed to delete string ref\n");
|
|
|
|
ok(WindowsDeleteString(str1) == S_OK, "Failed to delete string ref\n");
|
2015-10-29 05:07:23 +01:00
|
|
|
|
|
|
|
/* Test concatenation of two empty strings */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsConcatString(NULL, NULL, NULL) == E_INVALIDARG, "Incorrect error handling\n");
|
|
|
|
ok(WindowsConcatString(NULL, NULL, &concat) == S_OK, "Failed to concatenate string\n");
|
2015-10-29 05:07:23 +01:00
|
|
|
ok(concat == NULL, "Concatenate created new string\n");
|
|
|
|
}
|
|
|
|
|
2016-02-10 23:25:48 +01:00
|
|
|
static void test_compare(void)
|
|
|
|
{
|
|
|
|
HSTRING str1, str2;
|
|
|
|
HSTRING_HEADER header1, header2;
|
|
|
|
INT32 res;
|
|
|
|
|
|
|
|
/* Test comparison of string buffers */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateString(input_string1, 3, &str1) == S_OK, "Failed to create string\n");
|
|
|
|
ok(WindowsCreateString(input_string2, 3, &str2) == S_OK, "Failed to create string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCompareStringOrdinal(str1, str1, &res) == S_OK, "Failed to compare string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
ok(res == 0, "Expected 0, got %d\n", res);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCompareStringOrdinal(str1, str2, &res) == S_OK, "Failed to compare string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
ok(res == -1, "Expected -1, got %d\n", res);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCompareStringOrdinal(str2, str1, &res) == S_OK, "Failed to compare string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
ok(res == 1, "Expected 1, got %d\n", res);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCompareStringOrdinal(str2, str2, &res) == S_OK, "Failed to compare string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
ok(res == 0, "Expected 0, got %d\n", res);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCompareStringOrdinal(str1, NULL, &res) == S_OK, "Failed to compare string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
ok(res == 1, "Expected 1, got %d\n", res);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCompareStringOrdinal(NULL, str1, &res) == S_OK, "Failed to compare string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
ok(res == -1, "Expected -1, got %d\n", res);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCompareStringOrdinal(str2, NULL, &res) == S_OK, "Failed to compare string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
ok(res == 1, "Expected 1, got %d\n", res);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCompareStringOrdinal(NULL, str2, &res) == S_OK, "Failed to compare string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
ok(res == -1, "Expected -1, got %d\n", res);
|
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str2) == S_OK, "Failed to delete string\n");
|
|
|
|
ok(WindowsDeleteString(str1) == S_OK, "Failed to delete string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
|
|
|
|
/* Test comparison of string references */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateStringReference(input_string1, 3, &header1, &str1) == S_OK, "Failed to create string ref\n");
|
|
|
|
ok(WindowsCreateStringReference(input_string2, 3, &header2, &str2) == S_OK, "Failed to create string ref\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCompareStringOrdinal(str1, str1, &res) == S_OK, "Failed to compare string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
ok(res == 0, "Expected 0, got %d\n", res);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCompareStringOrdinal(str1, str2, &res) == S_OK, "Failed to compare string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
ok(res == -1, "Expected -1, got %d\n", res);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCompareStringOrdinal(str2, str1, &res) == S_OK, "Failed to compare string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
ok(res == 1, "Expected 1, got %d\n", res);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCompareStringOrdinal(str2, str2, &res) == S_OK, "Failed to compare string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
ok(res == 0, "Expected 0, got %d\n", res);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCompareStringOrdinal(str1, NULL, &res) == S_OK, "Failed to compare string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
ok(res == 1, "Expected 1, got %d\n", res);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCompareStringOrdinal(NULL, str1, &res) == S_OK, "Failed to compare string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
ok(res == -1, "Expected -1, got %d\n", res);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCompareStringOrdinal(str2, NULL, &res) == S_OK, "Failed to compare string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
ok(res == 1, "Expected 1, got %d\n", res);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCompareStringOrdinal(NULL, str2, &res) == S_OK, "Failed to compare string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
ok(res == -1, "Expected -1, got %d\n", res);
|
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str2) == S_OK, "Failed to delete string ref\n");
|
|
|
|
ok(WindowsDeleteString(str1) == S_OK, "Failed to delete string ref\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
|
|
|
|
/* Test comparison of two empty strings */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCompareStringOrdinal(NULL, NULL, NULL) == E_INVALIDARG, "Incorrect error handling\n");
|
|
|
|
ok(WindowsCompareStringOrdinal(NULL, NULL, &res) == S_OK, "Failed to compare NULL string\n");
|
2016-02-10 23:25:48 +01:00
|
|
|
ok(res == 0, "Expected 0, got %d\n", res);
|
|
|
|
}
|
|
|
|
|
2016-02-10 23:28:08 +01:00
|
|
|
static void test_trim(void)
|
|
|
|
{
|
|
|
|
HSTRING str1, str2, trimmed;
|
|
|
|
HSTRING_HEADER header1, header2;
|
|
|
|
|
|
|
|
/* Test trimming of string buffers */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateString(input_string, 6, &str1) == S_OK, "Failed to create string\n");
|
|
|
|
ok(WindowsCreateString(input_string1, 3, &str2) == S_OK, "Failed to create string\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsTrimStringStart(str1, str2, &trimmed) == S_OK, "Failed to trim string\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
check_string(trimmed, input_string2, 3, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(trimmed) == S_OK, "Failed to delete string\n");
|
|
|
|
ok(WindowsTrimStringEnd(str1, str2, &trimmed) == S_OK, "Failed to trim string\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
ok(trimmed == str1, "Trimmed string created new string\n");
|
|
|
|
check_string(trimmed, input_string, 6, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(trimmed) == S_OK, "Failed to delete string\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str2) == S_OK, "Failed to delete string\n");
|
|
|
|
ok(WindowsCreateString(input_string2, 3, &str2) == S_OK, "Failed to create string\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsTrimStringStart(str1, str2, &trimmed) == S_OK, "Failed to trim string\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
ok(trimmed == str1, "Trimmed string created new string\n");
|
|
|
|
check_string(trimmed, input_string, 6, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(trimmed) == S_OK, "Failed to delete string\n");
|
|
|
|
ok(WindowsTrimStringEnd(str1, str2, &trimmed) == S_OK, "Failed to trim string\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
check_string(trimmed, input_string1, 3, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(trimmed) == S_OK, "Failed to delete string\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str2) == S_OK, "Failed to delete string\n");
|
|
|
|
ok(WindowsDeleteString(str1) == S_OK, "Failed to delete string\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
|
|
|
|
/* Test trimming of string references */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateStringReference(input_string, 6, &header1, &str1) == S_OK, "Failed to create string ref\n");
|
|
|
|
ok(WindowsCreateStringReference(input_string1, 3, &header2, &str2) == S_OK, "Failed to create string ref\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsTrimStringStart(str1, str2, &trimmed) == S_OK, "Failed to trim string\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
check_string(trimmed, input_string2, 3, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(trimmed) == S_OK, "Failed to delete string\n");
|
|
|
|
ok(WindowsTrimStringEnd(str1, str2, &trimmed) == S_OK, "Failed to trim string\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
ok(trimmed != str1, "Trimmed string ref didn't create new string\n");
|
|
|
|
check_string(trimmed, input_string, 6, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(trimmed) == S_OK, "Failed to delete string\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str2) == S_OK, "Failed to delete string ref\n");
|
|
|
|
ok(WindowsCreateStringReference(input_string2, 3, &header2, &str2) == S_OK, "Failed to create string ref\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsTrimStringStart(str1, str2, &trimmed) == S_OK, "Failed to trim string\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
ok(trimmed != str1, "Trimmed string ref didn't create new string\n");
|
|
|
|
check_string(trimmed, input_string, 6, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(trimmed) == S_OK, "Failed to delete string\n");
|
|
|
|
ok(WindowsTrimStringEnd(str1, str2, &trimmed) == S_OK, "Failed to trim string\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
check_string(trimmed, input_string1, 3, FALSE);
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(trimmed) == S_OK, "Failed to delete string\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str2) == S_OK, "Failed to delete string ref\n");
|
|
|
|
ok(WindowsDeleteString(str1) == S_OK, "Failed to delete string ref\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
|
|
|
|
/* Test handling of NULL strings */
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsCreateString(input_string, 6, &str1) == S_OK, "Failed to create string\n");
|
|
|
|
ok(WindowsTrimStringStart(NULL, NULL, NULL) == E_INVALIDARG, "Incorrect error handling\n");
|
|
|
|
ok(WindowsTrimStringStart(NULL, str1, NULL) == E_INVALIDARG, "Incorrect error handling\n");
|
|
|
|
ok(WindowsTrimStringStart(NULL, NULL, &trimmed) == E_INVALIDARG, "Incorrect error handling\n");
|
|
|
|
ok(WindowsTrimStringStart(NULL, str1, &trimmed) == S_OK, "Failed to trim empty string\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
ok(trimmed == NULL, "Trimming created new string\n");
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsTrimStringEnd(NULL, NULL, NULL) == E_INVALIDARG, "Incorrect error handling\n");
|
|
|
|
ok(WindowsTrimStringEnd(NULL, str1, NULL) == E_INVALIDARG, "Incorrect error handling\n");
|
|
|
|
ok(WindowsTrimStringEnd(NULL, NULL, &trimmed) == E_INVALIDARG, "Incorrect error handling\n");
|
|
|
|
ok(WindowsTrimStringEnd(NULL, str1, &trimmed) == S_OK, "Failed to trim empty string\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
ok(trimmed == NULL, "Trimming created new string\n");
|
2021-04-15 05:19:09 +02:00
|
|
|
ok(WindowsDeleteString(str1) == S_OK, "Failed to delete string\n");
|
2016-02-10 23:28:08 +01:00
|
|
|
}
|
|
|
|
|
2014-12-15 09:24:48 +01:00
|
|
|
START_TEST(string)
|
|
|
|
{
|
|
|
|
test_create_delete();
|
|
|
|
test_duplicate();
|
2014-12-15 09:24:49 +01:00
|
|
|
test_access();
|
2014-12-15 09:24:50 +01:00
|
|
|
test_string_buffer();
|
2015-10-23 03:23:02 +02:00
|
|
|
test_substring();
|
2015-10-29 05:07:23 +01:00
|
|
|
test_concat();
|
2016-02-10 23:25:48 +01:00
|
|
|
test_compare();
|
2016-02-10 23:28:08 +01:00
|
|
|
test_trim();
|
2014-12-15 09:24:48 +01:00
|
|
|
}
|