Process Hacker
t_format.c
Go to the documentation of this file.
1 #include "tests.h"
2 
3 static VOID Test_buffer(
4  VOID
5  )
6 {
7 #define OUTPUT_COUNT 10
8 
9  BOOLEAN result;
10  PH_FORMAT format[1];
11  WCHAR buffer[16];
12  SIZE_T returnLength;
13 
14  format[0].Type = Int32FormatType;
15  format[0].u.Int32 = 1234567890;
16 
17  result = PhFormatToBuffer(format, 1, buffer, (OUTPUT_COUNT + 1) * sizeof(WCHAR), &returnLength);
18  assert(result && wcscmp(buffer, L"1234567890") == 0 && returnLength == (OUTPUT_COUNT + 1) * sizeof(WCHAR));
19  result = PhFormatToBuffer(format, 1, buffer, 16 * sizeof(WCHAR), &returnLength);
20  assert(result && wcscmp(buffer, L"1234567890") == 0 && returnLength == (OUTPUT_COUNT + 1) * sizeof(WCHAR));
21  result = PhFormatToBuffer(format, 1, buffer, OUTPUT_COUNT * sizeof(WCHAR), &returnLength);
22  assert(!result && buffer[0] == 0 && returnLength == (OUTPUT_COUNT + 1) * sizeof(WCHAR));
23  result = PhFormatToBuffer(format, 1, buffer, 0, &returnLength);
24  assert(!result && returnLength == (OUTPUT_COUNT + 1) * sizeof(WCHAR));
25  result = PhFormatToBuffer(format, 1, NULL, 9999, &returnLength);
26  assert(!result && returnLength == (OUTPUT_COUNT + 1) * sizeof(WCHAR));
27 }
28 
29 static VOID Test_char(
30  VOID
31  )
32 {
33  BOOLEAN result;
34  PH_FORMAT format[2];
35  WCHAR buffer[1024];
36 
37  format[0].Type = CharFormatType;
38  format[0].u.Char = 'H';
39  format[1].Type = CharFormatType;
40  format[1].u.Char = 'i';
41  result = PhFormatToBuffer(format, 2, buffer, sizeof(buffer), NULL);
42  assert(result && wcscmp(buffer, L"Hi") == 0);
43 }
44 
45 static VOID Test_string(
46  VOID
47  )
48 {
49  BOOLEAN result;
50  PH_FORMAT format[4];
51  WCHAR buffer[1024];
52 
53  format[0].Type = StringFormatType;
54  PhInitializeStringRef(&format[0].u.String, L"This ");
55  format[1].Type = StringZFormatType;
56  format[1].u.StringZ = L"is ";
57  format[2].Type = MultiByteStringFormatType;
58  PhInitializeBytesRef(&format[2].u.MultiByteString, "a ");
59  format[3].Type = MultiByteStringZFormatType;
60  format[3].u.MultiByteStringZ = "string.";
61  result = PhFormatToBuffer(format, 4, buffer, sizeof(buffer), NULL);
62  assert(result && wcscmp(buffer, L"This is a string.") == 0);
63 }
64 
65 static BOOLEAN IsThousandSepComma(
66  VOID
67  )
68 {
69  WCHAR thousandSep[4];
70 
71  if (!GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, thousandSep, 4))
72  return FALSE;
73  if (thousandSep[0] != ',' || thousandSep[1] != 0)
74  return FALSE;
75 
76  return TRUE;
77 }
78 
79 static VOID Test_integer(
80  VOID
81  )
82 {
83  BOOLEAN result;
84  PH_FORMAT format[1];
85  WCHAR buffer[1024];
86 
87  // Basic
88 
89  format[0].Type = Int32FormatType;
90  format[0].u.Int32 = 0;
91  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
92  assert(result && wcscmp(buffer, L"0") == 0);
93 
94  format[0].Type = Int32FormatType;
95  format[0].u.Int32 = 123;
96  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
97  assert(result && wcscmp(buffer, L"123") == 0);
98 
99  format[0].Type = Int32FormatType;
100  format[0].u.Int32 = -123;
101  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
102  assert(result && wcscmp(buffer, L"-123") == 0);
103 
104  format[0].Type = UInt32FormatType;
105  format[0].u.UInt32 = -123;
106  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
107  assert(result && wcscmp(buffer, L"4294967173") == 0);
108 
109  format[0].Type = Int64FormatType;
110  format[0].u.Int64 = -1234567890;
111  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
112  assert(result && wcscmp(buffer, L"-1234567890") == 0);
113 
114  format[0].Type = UInt64FormatType;
115  format[0].u.UInt64 = 12345678901234567890;
116  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
117  assert(result && wcscmp(buffer, L"12345678901234567890") == 0);
118 
119  // Bases
120 
121  format[0].Type = UInt64FormatType | FormatUseRadix;
122  format[0].u.UInt64 = 12345678901234567890;
123  format[0].Radix = 16;
124  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
125  assert(result && wcscmp(buffer, L"ab54a98ceb1f0ad2") == 0);
126 
128  format[0].u.UInt64 = 12345678901234567890;
129  format[0].Radix = 16;
130  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
131  assert(result && wcscmp(buffer, L"AB54A98CEB1F0AD2") == 0);
132 
133  format[0].Type = Int32FormatType | FormatUseRadix;
134  format[0].u.Int32 = -1234;
135  format[0].Radix = 8;
136  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
137  assert(result && wcscmp(buffer, L"-2322") == 0);
138 
139  // Prefix sign
140 
141  format[0].Type = Int32FormatType | FormatPrefixSign;
142  format[0].u.Int32 = 1234;
143  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
144  assert(result && wcscmp(buffer, L"+1234") == 0);
145 
146  format[0].Type = Int32FormatType | FormatPrefixSign;
147  format[0].u.Int32 = -1234;
148  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
149  assert(result && wcscmp(buffer, L"-1234") == 0);
150 
151  // Zero pad
152 
153  format[0].Type = Int32FormatType | FormatPadZeros;
154  format[0].Width = 6;
155 
156  format[0].u.Int32 = 0;
157  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
158  assert(result && wcscmp(buffer, L"000000") == 0);
159  format[0].u.Int32 = 1;
160  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
161  assert(result && wcscmp(buffer, L"000001") == 0);
162  format[0].u.Int32 = 12345;
163  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
164  assert(result && wcscmp(buffer, L"012345") == 0);
165  format[0].u.Int32 = 123456;
166  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
167  assert(result && wcscmp(buffer, L"123456") == 0);
168  format[0].u.Int32 = 1234567890;
169  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
170  assert(result && wcscmp(buffer, L"1234567890") == 0);
171  format[0].u.Int32 = -1;
172  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
173  assert(result && wcscmp(buffer, L"-00001") == 0);
174  format[0].u.Int32 = -1234;
175  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
176  assert(result && wcscmp(buffer, L"-01234") == 0);
177  format[0].u.Int32 = -12345;
178  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
179  assert(result && wcscmp(buffer, L"-12345") == 0);
180  format[0].u.Int32 = -1234567890;
181  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
182  assert(result && wcscmp(buffer, L"-1234567890") == 0);
183 
184  // Digit grouping
185 
186  if (!IsThousandSepComma())
187  return;
188 
189  format[0].Type = Int32FormatType | FormatGroupDigits;
190 
191  format[0].u.Int32 = 0;
192  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
193  assert(result && wcscmp(buffer, L"0") == 0);
194  format[0].u.Int32 = 1;
195  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
196  assert(result && wcscmp(buffer, L"1") == 0);
197  format[0].u.Int32 = 12;
198  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
199  assert(result && wcscmp(buffer, L"12") == 0);
200  format[0].u.Int32 = 123;
201  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
202  assert(result && wcscmp(buffer, L"123") == 0);
203  format[0].u.Int32 = 1234;
204  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
205  assert(result && wcscmp(buffer, L"1,234") == 0);
206  format[0].u.Int32 = 12345;
207  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
208  assert(result && wcscmp(buffer, L"12,345") == 0);
209  format[0].u.Int32 = 123456;
210  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
211  assert(result && wcscmp(buffer, L"123,456") == 0);
212  format[0].u.Int32 = -123;
213  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
214  assert(result && wcscmp(buffer, L"-123") == 0);
215  format[0].u.Int32 = -1234;
216  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
217  assert(result && wcscmp(buffer, L"-1,234") == 0);
218  format[0].u.Int32 = -12345;
219  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
220  assert(result && wcscmp(buffer, L"-12,345") == 0);
221 }
222 
223 static VOID Test_float(
224  VOID
225  )
226 {
227  BOOLEAN result;
228  PH_FORMAT format[1];
229  WCHAR buffer[1024];
230 
231  // TODO: Standard and hexadecimal form
232 
233  // Basic
234 
235  format[0].Type = DoubleFormatType;
236  format[0].u.Double = 0;
237  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
238  assert(result && wcscmp(buffer, L"0.000000") == 0);
239 
240  format[0].Type = DoubleFormatType;
241  format[0].u.Double = 1;
242  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
243  assert(result && wcscmp(buffer, L"1.000000") == 0);
244 
245  format[0].Type = DoubleFormatType;
246  format[0].u.Double = 123456789;
247  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
248  assert(result && wcscmp(buffer, L"123456789.000000") == 0);
249 
250  format[0].Type = DoubleFormatType;
251  format[0].u.Double = 3.14159265358979;
252  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
253  assert(result && wcscmp(buffer, L"3.141593") == 0);
254 
255  // Precision
256 
258  format[0].u.Double = 0;
259  format[0].Precision = 0;
260  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
261  assert(result && wcscmp(buffer, L"0") == 0);
262 
264  format[0].u.Double = 3.14159265358979;
265  format[0].Precision = 0;
266  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
267  assert(result && wcscmp(buffer, L"3") == 0);
268 
270  format[0].u.Double = 3.14159265358979;
271  format[0].Precision = 1;
272  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
273  assert(result && wcscmp(buffer, L"3.1") == 0);
274 
276  format[0].u.Double = 3.14159265358979;
277  format[0].Precision = 4;
278  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
279  assert(result && wcscmp(buffer, L"3.1416") == 0);
280 
281  // Crop zeros
282 
284  format[0].u.Double = 0;
285  format[0].Precision = 3;
286  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
287  assert(result && wcscmp(buffer, L"0") == 0);
288 
290  format[0].u.Double = 1.2;
291  format[0].Precision = 3;
292  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
293  assert(result && wcscmp(buffer, L"1.2") == 0);
294 
296  format[0].u.Double = 1.21;
297  format[0].Precision = 3;
298  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
299  assert(result && wcscmp(buffer, L"1.21") == 0);
300 
302  format[0].u.Double = 1.216;
303  format[0].Precision = 3;
304  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
305  assert(result && wcscmp(buffer, L"1.216") == 0);
306 
308  format[0].u.Double = 1.2159;
309  format[0].Precision = 3;
310  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
311  assert(result && wcscmp(buffer, L"1.216") == 0);
312 
313  // Prefix sign
314 
315  format[0].Type = DoubleFormatType | FormatPrefixSign;
316  format[0].u.Double = 1234;
317  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
318  assert(result && wcscmp(buffer, L"+1234.000000") == 0);
319 
321  format[0].u.Double = 1234;
322  format[0].Precision = 0;
323  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
324  assert(result && wcscmp(buffer, L"+1234") == 0);
325 
326  format[0].Type = DoubleFormatType | FormatPrefixSign;
327  format[0].u.Double = -1234;
328  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
329  assert(result && wcscmp(buffer, L"-1234.000000") == 0);
330 
331  format[0].Type = DoubleFormatType | FormatPrefixSign;
332  format[0].u.Double = -1234.12;
333  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
334  assert(result && wcscmp(buffer, L"-1234.120000") == 0);
335 
336  // Zero pad
337 
339  format[0].Width = 6;
340 
341  format[0].u.Double = 0;
342  format[0].Precision = 3;
343  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
344  assert(result && wcscmp(buffer, L"00.000") == 0);
345  format[0].u.Double = 1.23;
346  format[0].Precision = 3;
347  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
348  assert(result && wcscmp(buffer, L"01.230") == 0);
349  format[0].u.Double = 123456;
350  format[0].Precision = 3;
351  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
352  assert(result && wcscmp(buffer, L"123456.000") == 0);
353  format[0].u.Double = -1.23;
354  format[0].Precision = 2;
355  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
356  assert(result && wcscmp(buffer, L"-01.23") == 0);
357  format[0].u.Double = -1.23;
358  format[0].Precision = 3;
359  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
360  assert(result && wcscmp(buffer, L"-1.230") == 0);
361 
362  // Digit grouping
363 
364  if (!IsThousandSepComma())
365  return;
366 
368 
369  format[0].u.Double = 0;
370  format[0].Precision = 0;
371  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
372  assert(result && wcscmp(buffer, L"0") == 0);
373  format[0].u.Double = 1;
374  format[0].Precision = 0;
375  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
376  assert(result && wcscmp(buffer, L"1") == 0);
377  format[0].u.Double = 12;
378  format[0].Precision = 0;
379  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
380  assert(result && wcscmp(buffer, L"12") == 0);
381  format[0].u.Double = 123;
382  format[0].Precision = 0;
383  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
384  assert(result && wcscmp(buffer, L"123") == 0);
385  format[0].u.Double = 1234;
386  format[0].Precision = 0;
387  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
388  assert(result && wcscmp(buffer, L"1,234") == 0);
389  format[0].u.Double = 12345;
390  format[0].Precision = 0;
391  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
392  assert(result && wcscmp(buffer, L"12,345") == 0);
393  format[0].u.Double = 123456;
394  format[0].Precision = 0;
395  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
396  assert(result && wcscmp(buffer, L"123,456") == 0);
397  format[0].u.Double = -123;
398  format[0].Precision = 0;
399  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
400  assert(result && wcscmp(buffer, L"-123") == 0);
401  format[0].u.Double = -1234;
402  format[0].Precision = 0;
403  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
404  assert(result && wcscmp(buffer, L"-1,234") == 0);
405  format[0].u.Double = -12345;
406  format[0].Precision = 0;
407  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
408  assert(result && wcscmp(buffer, L"-12,345") == 0);
409  format[0].u.Double = -12345;
410  format[0].Precision = 2;
411  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
412  assert(result && wcscmp(buffer, L"-12,345.00") == 0);
413  format[0].u.Double = -9876543.21;
414  format[0].Precision = 5;
415  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
416  assert(result && wcscmp(buffer, L"-9,876,543.21000") == 0);
417 }
418 
419 static VOID Test_width(
420  VOID
421  )
422 {
423  BOOLEAN result;
424  PH_FORMAT format[2];
425  WCHAR buffer[1024];
426 
427  PhInitializeStringRef(&format[0].u.String, L"asdf");
428 
429  format[0].Type = StringFormatType;
430  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
431  assert(result && wcscmp(buffer, L"asdf") == 0);
432 
433  // Left align
434 
435  format[0].Type = StringFormatType | FormatLeftAlign;
436  format[0].Width = 4;
437  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
438  assert(result && wcscmp(buffer, L"asdf") == 0);
439 
440  format[0].Type = StringFormatType | FormatLeftAlign;
441  format[0].Width = 2;
442  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
443  assert(result && wcscmp(buffer, L"asdf") == 0);
444 
445  format[0].Type = StringFormatType | FormatLeftAlign;
446  format[0].Width = 5;
447  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
448  assert(result && wcscmp(buffer, L"asdf ") == 0);
449 
450  format[0].Type = StringFormatType | FormatLeftAlign;
451  format[0].Width = 10;
452  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
453  assert(result && wcscmp(buffer, L"asdf ") == 0);
454 
456  format[0].Width = 6;
457  format[0].Pad = '!';
458  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
459  assert(result && wcscmp(buffer, L"asdf!!") == 0);
460 
461  // Right align
462 
463  format[0].Type = StringFormatType | FormatRightAlign;
464  format[0].Width = 4;
465  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
466  assert(result && wcscmp(buffer, L"asdf") == 0);
467 
468  format[0].Type = StringFormatType | FormatRightAlign;
469  format[0].Width = 2;
470  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
471  assert(result && wcscmp(buffer, L"asdf") == 0);
472 
473  format[0].Type = StringFormatType | FormatRightAlign;
474  format[0].Width = 5;
475  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
476  assert(result && wcscmp(buffer, L" asdf") == 0);
477 
478  format[0].Type = StringFormatType | FormatRightAlign;
479  format[0].Width = 10;
480  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
481  assert(result && wcscmp(buffer, L" asdf") == 0);
482 
484  format[0].Width = 6;
485  format[0].Pad = '!';
486  result = PhFormatToBuffer(format, 1, buffer, sizeof(buffer), NULL);
487  assert(result && wcscmp(buffer, L"!!asdf") == 0);
488 
489  // Multiple
490 
491  format[0].Type = Int32FormatType | FormatRightAlign;
492  format[0].u.Int32 = 1234;
493  format[0].Width = 7;
494  format[1].Type = StringZFormatType | FormatLeftAlign;
495  format[1].u.StringZ = L"asdf";
496  format[1].Width = 10;
497  result = PhFormatToBuffer(format, 2, buffer, sizeof(buffer), NULL);
498  assert(result && wcscmp(buffer, L" 1234asdf ") == 0);
499 }
500 
501 static VOID Test_wildcards(
502  VOID
503  )
504 {
505  static WCHAR *testCases[][3] =
506  {
507  { L"", L"", L"true" },
508  { L"", L"a", L"false" },
509  { L"a", L"a", L"true" },
510  { L"a", L"b", L"false" },
511  { L"?", L"b", L"true" },
512  { L"??", L"bc", L"true" },
513  { L"?c", L"bc", L"true" },
514  { L"b?", L"bc", L"true" },
515  { L"*", L"a", L"true" },
516  { L"**", L"a", L"true" },
517  { L"*", L"", L"true" },
518  { L"*bc*hij", L"abcdfghij", L"true" },
519  { L"*b*a*", L"b", L"false" },
520  { L"*bc*hik", L"abcdfghij", L"false" },
521  { L"abc*", L"abc", L"true" },
522  { L"abc**", L"abc", L"true" },
523  { L"*???", L"abc", L"true" },
524  { L"*???", L"ab", L"false" },
525  { L"*???", L"abcd", L"true" },
526  { L"*?*", L"abcd", L"true" },
527  { L"*bc", L"abc", L"true" },
528  { L"*cc", L"abc", L"false" },
529  { L"*a*", L"de", L"false" },
530  { L"*???*", L"123", L"true" },
531  { L"a*bc", L"abbc", L"true" },
532  { L"a*b", L"a", L"false" },
533  { L"a*?b", L"axb", L"true" },
534  { L"a**b", L"axb", L"true" }
535  };
536 
537  ULONG i;
538  BOOLEAN r;
539  BOOLEAN fail;
540 
541  for (i = 0; i < sizeof(testCases) / sizeof(WCHAR *[3]); i++)
542  {
543  r = PhMatchWildcards(testCases[i][0], testCases[i][1], TRUE);
544  fail = r != PhEqualStringZ(testCases[i][2], L"true", FALSE);
545 
546  if (fail)
547  {
548  wprintf(L"pattern '%s' against '%s': %s (%s expected)\n",
549  testCases[i][0], testCases[i][1], r ? L"true" : L"false", testCases[i][2]);
550  assert(FALSE);
551  }
552  }
553 }
554 
556  VOID
557  )
558 {
559  Test_buffer();
560  Test_char();
561  Test_string();
562  Test_integer();
563  Test_float();
564  Test_width();
565  Test_wildcards();
566 }