9 LARGE_INTEGER localTime;
10 FILETIME localFileTime;
11 LARGE_INTEGER systemTime;
12 FILETIME systemFileTime;
15 fileTime.dwLowDateTime = time.LowPart;
16 fileTime.dwHighDateTime = time.HighPart;
19 FileTimeToLocalFileTime(&fileTime, &localFileTime);
21 assert(localTime.LowPart == localFileTime.dwLowDateTime);
22 assert(localTime.HighPart == localFileTime.dwHighDateTime);
25 LocalFileTimeToFileTime(&localFileTime, &systemFileTime);
27 assert(systemTime.LowPart == systemFileTime.dwLowDateTime);
28 assert(systemTime.HighPart == systemFileTime.dwHighDateTime);
31 static VOID Test_stringz(
36 CHAR inputA[16] =
"test";
38 WCHAR inputW[16] = L
"test";
41 PWSTR zero = L
"\0\0\0\0\0\0\0\0";
42 PWSTR asdf = L
"asdfasdfasdfasdf";
45 for (i = 0; i < 8; i++)
47 for (i = 0; i < 16; i++)
50 result =
PhCopyBytesZ(inputA, 4, outputA, 4, &returnCount);
51 assert(!result && returnCount == 5);
52 result =
PhCopyBytesZ(inputA, 100, outputA, 4, &returnCount);
53 assert(!result && returnCount == 5);
54 result =
PhCopyBytesZ(inputA, 3, outputA, 4, &returnCount);
55 assert(result && returnCount == 4);
56 result =
PhCopyBytesZ(inputA, 4, outputA, 5, &returnCount);
57 assert(result && returnCount == 5);
58 result =
PhCopyBytesZ(inputA, 100, outputA, 5, &returnCount);
59 assert(result && returnCount == 5);
61 result =
PhCopyStringZ(inputW, 100, outputW, 4, &returnCount);
62 assert(!result && returnCount == 5);
64 assert(result && returnCount == 5);
65 result =
PhCopyStringZ(inputW, 100, outputW, 5, &returnCount);
66 assert(result && returnCount == 5);
69 assert(!result && returnCount == 5);
71 assert(!result && returnCount == 5);
73 assert(result && returnCount == 4);
75 assert(result && returnCount == 5);
77 assert(result && returnCount == 5);
101 WCHAR buffer[26 * 2];
108 s1.
Length =
sizeof(buffer);
110 for (i = 0; i < 26; i++)
113 for (i = 0; i < 26; i++)
116 memset(buffer, 0,
sizeof(buffer));
119 for (i = 0; i < 26; i++)
124 for (i = 0; i < 26; i++)
126 s1.
Buffer = buffer + 26 - i;
127 s1.
Length = i *
sizeof(WCHAR);
131 for (i = 1; i < 26; i++)
134 s1.
Length = i * 2 *
sizeof(WCHAR);
136 for (j = 0; j < i; j++)
138 buffer[j] = (WCHAR)(
'a' + j);
139 buffer[i + j] = (WCHAR)(
'A' + j);
143 s2.
Length = i *
sizeof(WCHAR);
145 s3.
Length = i *
sizeof(WCHAR);
149 for (j = 0; j < i; j++)
154 buffer[j] = (WCHAR)(
'a' + j);
161 for (j = 0; j < i; j++)
169 s1.
Length = i *
sizeof(WCHAR);
171 for (j = 0; j < i; j++)
181 for (j = 0; j < i; j++)
192 #define DO_STRSTR_TEST(func, s1, s2, expected, ...) \
194 PH_STRINGREF ___t1; \
195 PH_STRINGREF ___t2; \
196 PhInitializeStringRef(&___t1, s1); \
197 PhInitializeStringRef(&___t2, s2); \
198 assert(func(&___t1, &___t2, __VA_ARGS__) == expected); \
230 assert(result && buffer[0] == 0 && buffer[1] == 0x11 && buffer[2] == 0x22 && buffer[3] == 0x33 && buffer[4] == 0x44);
241 assert(wcscmp(string->
Buffer, L
"0099ff") == 0);
254 assert(integer == 123);
256 assert(integer == 123);
258 assert(integer == 0123);
260 assert(integer == 0x123);
264 assert(integer == 0123);
267 assert(integer == 0x123);
270 assert(wcscmp(string->
Buffer, L
"123") == 0);
272 assert(wcscmp(string->
Buffer, L
"123") == 0);
274 assert(wcscmp(string->
Buffer, L
"173") == 0);
276 assert(wcscmp(string->
Buffer, L
"7b") == 0);
279 assert(wcscmp(string->
Buffer, L
"-123") == 0);
281 assert(wcscmp(string->
Buffer, L
"-123") == 0);
283 assert(wcscmp(string->
Buffer, L
"-173") == 0);
285 assert(wcscmp(string->
Buffer, L
"-7b") == 0);
288 assert(wcscmp(string->
Buffer, L
"18446744073709551493") == 0);
298 WCHAR utf16[
sizeof(codePoints) /
sizeof(WCHAR)];
299 CHAR utf8[
sizeof(codePoints) /
sizeof(CHAR)];
300 ULONG numberOfCodePoints;
301 SIZE_T utf16Position = 0;
302 SIZE_T utf8Position = 0;
307 codePoints[1] = 0x50;
308 codePoints[2] = 0x312;
309 codePoints[3] = 0x3121;
310 codePoints[4] = 0x31212;
313 for (i = 0; i <
sizeof(codePoints) /
sizeof(ULONG); i++)
317 utf16Position += numberOfCodePoints;
321 utf8Position += numberOfCodePoints;