[SCRRUN_WINETEST] Sync with Wine Staging 1.9.23. CORE-12409
[reactos.git] / rostests / winetests / scrrun / dictionary.c
1 /*
2 * Copyright (C) 2012 Alistair Leslie-Hughes
3 * Copyright 2015 Nikolay Sivov for CodeWeavers
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20 #define COBJMACROS
21 #include <stdio.h>
22
23 #include "windows.h"
24 #include "ole2.h"
25 #include "oleauto.h"
26 #include "olectl.h"
27 #include "dispex.h"
28
29 #include "wine/test.h"
30
31 #include "scrrun.h"
32
33 static void test_interfaces(void)
34 {
35 static const WCHAR key_add[] = {'a', 0};
36 static const WCHAR key_add_value[] = {'a', 0};
37 static const WCHAR key_non_exist[] = {'b', 0};
38 HRESULT hr;
39 IDispatch *disp;
40 IDispatchEx *dispex;
41 IDictionary *dict;
42 IObjectWithSite *site;
43 VARIANT key, value;
44 VARIANT_BOOL exists;
45 LONG count = 0;
46
47 hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
48 &IID_IDispatch, (void**)&disp);
49 ok(hr == S_OK, "got 0x%08x\n", hr);
50
51 VariantInit(&key);
52 VariantInit(&value);
53
54 hr = IDispatch_QueryInterface(disp, &IID_IDictionary, (void**)&dict);
55 ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
56
57 hr = IDispatch_QueryInterface(disp, &IID_IObjectWithSite, (void**)&site);
58 ok(hr == E_NOINTERFACE, "got 0x%08x, expected 0x%08x\n", hr, E_NOINTERFACE);
59
60 hr = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
61 ok(hr == E_NOINTERFACE, "got 0x%08x, expected 0x%08x\n", hr, E_NOINTERFACE);
62
63 V_VT(&key) = VT_BSTR;
64 V_BSTR(&key) = SysAllocString(key_add);
65 V_VT(&value) = VT_BSTR;
66 V_BSTR(&value) = SysAllocString(key_add_value);
67 hr = IDictionary_Add(dict, &key, &value);
68 ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
69 VariantClear(&value);
70
71 exists = VARIANT_FALSE;
72 hr = IDictionary_Exists(dict, &key, &exists);
73 ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
74 ok(exists == VARIANT_TRUE, "Expected TRUE but got FALSE.\n");
75 VariantClear(&key);
76
77 exists = VARIANT_TRUE;
78 V_VT(&key) = VT_BSTR;
79 V_BSTR(&key) = SysAllocString(key_non_exist);
80 hr = IDictionary_Exists(dict, &key, &exists);
81 ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
82 ok(exists == VARIANT_FALSE, "Expected FALSE but got TRUE.\n");
83 VariantClear(&key);
84
85 hr = IDictionary_get_Count(dict, &count);
86 ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
87 ok(count == 1, "got %d, expected 1\n", count);
88
89 IDictionary_Release(dict);
90 IDispatch_Release(disp);
91 }
92
93 static void test_comparemode(void)
94 {
95 CompareMethod method;
96 IDictionary *dict;
97 VARIANT key, item;
98 HRESULT hr;
99
100 hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
101 &IID_IDictionary, (void**)&dict);
102 ok(hr == S_OK, "got 0x%08x\n", hr);
103
104 if (0) /* crashes on native */
105 hr = IDictionary_get_CompareMode(dict, NULL);
106
107 method = 10;
108 hr = IDictionary_get_CompareMode(dict, &method);
109 ok(hr == S_OK, "got 0x%08x\n", hr);
110 ok(method == BinaryCompare, "got %d\n", method);
111
112 /* invalid mode value is not checked */
113 hr = IDictionary_put_CompareMode(dict, 10);
114 ok(hr == S_OK, "got 0x%08x\n", hr);
115
116 hr = IDictionary_get_CompareMode(dict, &method);
117 ok(hr == S_OK, "got 0x%08x\n", hr);
118 ok(method == 10, "got %d\n", method);
119
120 hr = IDictionary_put_CompareMode(dict, DatabaseCompare);
121 ok(hr == S_OK, "got 0x%08x\n", hr);
122
123 hr = IDictionary_get_CompareMode(dict, &method);
124 ok(hr == S_OK, "got 0x%08x\n", hr);
125 ok(method == DatabaseCompare, "got %d\n", method);
126
127 /* try to change mode of a non-empty dict */
128 V_VT(&key) = VT_I2;
129 V_I2(&key) = 0;
130 VariantInit(&item);
131 hr = IDictionary_Add(dict, &key, &item);
132 ok(hr == S_OK, "got 0x%08x\n", hr);
133
134 hr = IDictionary_put_CompareMode(dict, BinaryCompare);
135 ok(hr == CTL_E_ILLEGALFUNCTIONCALL, "got 0x%08x\n", hr);
136
137 IDictionary_Release(dict);
138 }
139
140 static DWORD get_str_hash(const WCHAR *str, CompareMethod method)
141 {
142 DWORD hash = 0;
143
144 while (*str) {
145 WCHAR ch;
146
147 if (method == TextCompare || method == DatabaseCompare)
148 ch = PtrToInt(CharLowerW(IntToPtr(*str)));
149 else
150 ch = *str;
151
152 hash += (hash << 4) + ch;
153 str++;
154 }
155
156 return hash % 1201;
157 }
158
159 static DWORD get_num_hash(FLOAT num)
160 {
161 return (*((DWORD*)&num)) % 1201;
162 }
163
164 static DWORD get_ptr_hash(void *ptr)
165 {
166 return PtrToUlong(ptr) % 1201;
167 }
168
169 typedef union
170 {
171 struct
172 {
173 unsigned int m : 23;
174 unsigned int exp_bias : 8;
175 unsigned int sign : 1;
176 } i;
177 float f;
178 } R4_FIELDS;
179
180 typedef union
181 {
182 struct
183 {
184 unsigned int m_lo : 32; /* 52 bits of precision */
185 unsigned int m_hi : 20;
186 unsigned int exp_bias : 11; /* bias == 1023 */
187 unsigned int sign : 1;
188 } i;
189 double d;
190 } R8_FIELDS;
191
192 static HRESULT WINAPI test_unk_QI(IUnknown *iface, REFIID riid, void **obj)
193 {
194 if (IsEqualIID(riid, &IID_IUnknown)) {
195 *obj = iface;
196 return S_OK;
197 }
198
199 ok(0, "unexpected %s\n", wine_dbgstr_guid(riid));
200 *obj = NULL;
201 return E_NOINTERFACE;
202 }
203
204 static HRESULT WINAPI test_unk_no_QI(IUnknown *iface, REFIID riid, void **obj)
205 {
206 *obj = NULL;
207 return E_NOINTERFACE;
208 }
209
210 static ULONG WINAPI test_unk_AddRef(IUnknown *iface)
211 {
212 ok(0, "unexpected\n");
213 return 2;
214 }
215
216 static ULONG WINAPI test_unk_Release(IUnknown *iface)
217 {
218 return 1;
219 }
220
221 static /* const */ IUnknownVtbl test_unk_vtbl = {
222 test_unk_QI,
223 test_unk_AddRef,
224 test_unk_Release
225 };
226
227 static /* const */ IUnknownVtbl test_unk_no_vtbl = {
228 test_unk_no_QI,
229 test_unk_AddRef,
230 test_unk_Release
231 };
232
233 static HRESULT WINAPI test_disp_QI(IDispatch *iface, REFIID riid, void **obj)
234 {
235 if (IsEqualIID(riid, &IID_IDispatch) || IsEqualIID(riid, &IID_IUnknown)) {
236 *obj = iface;
237 return S_OK;
238 }
239
240 ok(0, "unexpected %s\n", wine_dbgstr_guid(riid));
241 *obj = NULL;
242 return E_NOINTERFACE;
243 }
244
245 static ULONG WINAPI test_disp_AddRef(IDispatch *iface)
246 {
247 ok(0, "unexpected\n");
248 return 2;
249 }
250
251 static ULONG WINAPI test_disp_Release(IDispatch *iface)
252 {
253 return 1;
254 }
255
256 static HRESULT WINAPI test_disp_GetTypeInfoCount(IDispatch *iface, UINT *count)
257 {
258 ok(0, "unexpected call\n");
259 return E_NOTIMPL;
260 }
261
262 static HRESULT WINAPI test_disp_GetTypeInfo(IDispatch *iface, UINT index, LCID lcid, ITypeInfo **ti)
263 {
264 ok(0, "unexpected call\n");
265 return E_NOTIMPL;
266 }
267
268 static HRESULT WINAPI test_disp_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *names,
269 UINT name_count, LCID lcid, DISPID *dispid)
270 {
271 ok(0, "unexpected call\n");
272 return E_NOTIMPL;
273 }
274
275 static HRESULT WINAPI test_disp_Invoke(IDispatch *iface, DISPID dispid, REFIID riid,
276 LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *arg_err)
277 {
278 ok(0, "unexpected call\n");
279 return E_NOTIMPL;
280 }
281
282 static /* const */ IDispatchVtbl test_disp_vtbl = {
283 test_disp_QI,
284 test_disp_AddRef,
285 test_disp_Release,
286 test_disp_GetTypeInfoCount,
287 test_disp_GetTypeInfo,
288 test_disp_GetIDsOfNames,
289 test_disp_Invoke
290 };
291
292 static IUnknown test_unk = { &test_unk_vtbl };
293 static IUnknown test_unk2 = { &test_unk_no_vtbl };
294 static IDispatch test_disp = { &test_disp_vtbl };
295
296 static void test_hash_value(void)
297 {
298 /* string test data */
299 static const WCHAR str_hash_tests[][10] = {
300 {'a','b','c','d',0},
301 {'a','B','C','d','1',0},
302 {'1','2','3',0},
303 {'A',0},
304 {'a',0},
305 { 0 }
306 };
307
308 static const int int_hash_tests[] = {
309 0, -1, 100, 1, 255
310 };
311
312 static const FLOAT float_hash_tests[] = {
313 0.0, -1.0, 100.0, 1.0, 255.0, 1.234
314 };
315
316 IDictionary *dict;
317 VARIANT key, hash;
318 IDispatch *disp;
319 DWORD expected;
320 IUnknown *unk;
321 R8_FIELDS fx8;
322 R4_FIELDS fx4;
323 HRESULT hr;
324 unsigned i;
325
326 hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
327 &IID_IDictionary, (void**)&dict);
328 ok(hr == S_OK, "got 0x%08x\n", hr);
329
330 V_VT(&key) = VT_BSTR;
331 V_BSTR(&key) = NULL;
332 VariantInit(&hash);
333 hr = IDictionary_get_HashVal(dict, &key, &hash);
334 ok(hr == S_OK, "got 0x%08x\n", hr);
335 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
336 ok(V_I4(&hash) == 0, "got %d\n", V_I4(&hash));
337
338 for (i = 0; i < sizeof(str_hash_tests)/sizeof(str_hash_tests[0]); i++) {
339 expected = get_str_hash(str_hash_tests[i], BinaryCompare);
340
341 hr = IDictionary_put_CompareMode(dict, BinaryCompare);
342 ok(hr == S_OK, "got 0x%08x\n", hr);
343
344 V_VT(&key) = VT_BSTR;
345 V_BSTR(&key) = SysAllocString(str_hash_tests[i]);
346 VariantInit(&hash);
347 hr = IDictionary_get_HashVal(dict, &key, &hash);
348 ok(hr == S_OK, "got 0x%08x\n", hr);
349 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
350 ok(V_I4(&hash) == expected, "%d: binary mode: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
351 expected);
352 VariantClear(&key);
353
354 expected = get_str_hash(str_hash_tests[i], TextCompare);
355 hr = IDictionary_put_CompareMode(dict, TextCompare);
356 ok(hr == S_OK, "got 0x%08x\n", hr);
357
358 V_VT(&key) = VT_BSTR;
359 V_BSTR(&key) = SysAllocString(str_hash_tests[i]);
360 VariantInit(&hash);
361 hr = IDictionary_get_HashVal(dict, &key, &hash);
362 ok(hr == S_OK, "got 0x%08x\n", hr);
363 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
364 ok(V_I4(&hash) == expected, "%d: text mode: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
365 expected);
366 VariantClear(&key);
367
368 expected = get_str_hash(str_hash_tests[i], DatabaseCompare);
369 hr = IDictionary_put_CompareMode(dict, DatabaseCompare);
370 ok(hr == S_OK, "got 0x%08x\n", hr);
371
372 V_VT(&key) = VT_BSTR;
373 V_BSTR(&key) = SysAllocString(str_hash_tests[i]);
374 VariantInit(&hash);
375 hr = IDictionary_get_HashVal(dict, &key, &hash);
376 ok(hr == S_OK, "got 0x%08x\n", hr);
377 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
378 ok(V_I4(&hash) == expected, "%d: db mode: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
379 expected);
380 VariantClear(&key);
381 }
382
383 V_VT(&key) = VT_INT;
384 V_INT(&key) = 1;
385 VariantInit(&hash);
386 hr = IDictionary_get_HashVal(dict, &key, &hash);
387 ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "got 0x%08x\n", hr);
388 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
389 ok(V_I4(&hash) == ~0u, "got hash 0x%08x\n", V_I4(&hash));
390
391 V_VT(&key) = VT_UINT;
392 V_UINT(&key) = 1;
393 VariantInit(&hash);
394 hr = IDictionary_get_HashVal(dict, &key, &hash);
395 ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "got 0x%08x\n", hr);
396 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
397 ok(V_I4(&hash) == ~0u, "got hash 0x%08x\n", V_I4(&hash));
398
399 V_VT(&key) = VT_I1;
400 V_I1(&key) = 1;
401 VariantInit(&hash);
402 hr = IDictionary_get_HashVal(dict, &key, &hash);
403 ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "got 0x%08x\n", hr);
404 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
405 ok(V_I4(&hash) == ~0u || broken(V_I4(&hash) == 0xa1), "got hash 0x%08x\n", V_I4(&hash));
406
407 V_VT(&key) = VT_I8;
408 V_I8(&key) = 1;
409 VariantInit(&hash);
410 hr = IDictionary_get_HashVal(dict, &key, &hash);
411 ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "got 0x%08x\n", hr);
412 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
413 ok(V_I4(&hash) == ~0u, "got hash 0x%08x\n", V_I4(&hash));
414
415 V_VT(&key) = VT_UI2;
416 V_UI2(&key) = 1;
417 VariantInit(&hash);
418 hr = IDictionary_get_HashVal(dict, &key, &hash);
419 ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "got 0x%08x\n", hr);
420 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
421 ok(V_I4(&hash) == ~0u, "got hash 0x%08x\n", V_I4(&hash));
422
423 V_VT(&key) = VT_UI4;
424 V_UI4(&key) = 1;
425 VariantInit(&hash);
426 hr = IDictionary_get_HashVal(dict, &key, &hash);
427 ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "got 0x%08x\n", hr);
428 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
429 ok(V_I4(&hash) == ~0u, "got hash 0x%08x\n", V_I4(&hash));
430
431 for (i = 0; i < sizeof(int_hash_tests)/sizeof(int_hash_tests[0]); i++) {
432 SHORT i2;
433 BYTE ui1;
434 LONG i4;
435
436 expected = get_num_hash(int_hash_tests[i]);
437
438 V_VT(&key) = VT_I2;
439 V_I2(&key) = int_hash_tests[i];
440 VariantInit(&hash);
441 hr = IDictionary_get_HashVal(dict, &key, &hash);
442 ok(hr == S_OK, "got 0x%08x\n", hr);
443 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
444 ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
445 expected);
446
447 i2 = int_hash_tests[i];
448 V_VT(&key) = VT_I2|VT_BYREF;
449 V_I2REF(&key) = &i2;
450 VariantInit(&hash);
451 hr = IDictionary_get_HashVal(dict, &key, &hash);
452 ok(hr == S_OK, "got 0x%08x\n", hr);
453 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
454 ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
455 expected);
456
457 V_VT(&key) = VT_I4;
458 V_I4(&key) = int_hash_tests[i];
459 VariantInit(&hash);
460 hr = IDictionary_get_HashVal(dict, &key, &hash);
461 ok(hr == S_OK, "got 0x%08x\n", hr);
462 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
463 ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
464 expected);
465
466 i4 = int_hash_tests[i];
467 V_VT(&key) = VT_I4|VT_BYREF;
468 V_I4REF(&key) = &i4;
469 VariantInit(&hash);
470 hr = IDictionary_get_HashVal(dict, &key, &hash);
471 ok(hr == S_OK, "got 0x%08x\n", hr);
472 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
473 ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
474 expected);
475
476 expected = get_num_hash((FLOAT)(BYTE)int_hash_tests[i]);
477 V_VT(&key) = VT_UI1;
478 V_UI1(&key) = int_hash_tests[i];
479 VariantInit(&hash);
480 hr = IDictionary_get_HashVal(dict, &key, &hash);
481 ok(hr == S_OK, "got 0x%08x\n", hr);
482 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
483 ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
484 expected);
485
486 ui1 = int_hash_tests[i];
487 V_VT(&key) = VT_UI1|VT_BYREF;
488 V_UI1REF(&key) = &ui1;
489 VariantInit(&hash);
490 hr = IDictionary_get_HashVal(dict, &key, &hash);
491 ok(hr == S_OK, "got 0x%08x\n", hr);
492 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
493 ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
494 expected);
495 }
496
497 /* nan */
498 fx4.f = 10.0;
499 fx4.i.exp_bias = 0xff;
500
501 V_VT(&key) = VT_R4;
502 V_R4(&key) = fx4.f;
503 VariantInit(&hash);
504 hr = IDictionary_get_HashVal(dict, &key, &hash);
505 ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "got 0x%08x\n", hr);
506 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
507 ok(V_I4(&hash) == ~0u || broken(V_I4(&hash) == 0 /* win2k */ ||
508 V_I4(&hash) == 0x1f4 /* vista, win2k8 */), "got hash 0x%08x\n", V_I4(&hash));
509
510 /* inf */
511 fx4.f = 10.0;
512 fx4.i.m = 0;
513 fx4.i.exp_bias = 0xff;
514
515 V_VT(&key) = VT_R4;
516 V_R4(&key) = fx4.f;
517 V_I4(&hash) = 10;
518 hr = IDictionary_get_HashVal(dict, &key, &hash);
519 ok(hr == S_OK, "got 0x%08x\n", hr);
520 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
521 ok(V_I4(&hash) == 0, "got hash 0x%08x\n", V_I4(&hash));
522
523 /* nan */
524 fx8.d = 10.0;
525 fx8.i.exp_bias = 0x7ff;
526
527 V_VT(&key) = VT_R8;
528 V_R8(&key) = fx8.d;
529 VariantInit(&hash);
530 hr = IDictionary_get_HashVal(dict, &key, &hash);
531 ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "got 0x%08x\n", hr);
532 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
533 ok(V_I4(&hash) == ~0u || broken(V_I4(&hash) == 0 /* win2k */ ||
534 V_I4(&hash) == 0x1f4 /* vista, win2k8 */), "got hash 0x%08x\n", V_I4(&hash));
535
536 V_VT(&key) = VT_DATE;
537 V_DATE(&key) = fx8.d;
538 VariantInit(&hash);
539 hr = IDictionary_get_HashVal(dict, &key, &hash);
540 ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k, win2k3 */, "got 0x%08x\n", hr);
541 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
542 ok(V_I4(&hash) == ~0u || broken(V_I4(&hash) == 0 /* win2k */ ||
543 V_I4(&hash) == 0x1f4 /* vista, win2k8 */), "got hash 0x%08x\n", V_I4(&hash));
544
545 /* inf */
546 fx8.d = 10.0;
547 fx8.i.m_lo = 0;
548 fx8.i.m_hi = 0;
549 fx8.i.exp_bias = 0x7ff;
550
551 V_VT(&key) = VT_R8;
552 V_R8(&key) = fx8.d;
553 V_I4(&hash) = 10;
554 hr = IDictionary_get_HashVal(dict, &key, &hash);
555 ok(hr == S_OK, "got 0x%08x\n", hr);
556 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
557 ok(V_I4(&hash) == 0, "got hash 0x%08x\n", V_I4(&hash));
558
559 V_VT(&key) = VT_DATE;
560 V_DATE(&key) = fx8.d;
561 V_I4(&hash) = 10;
562 hr = IDictionary_get_HashVal(dict, &key, &hash);
563 ok(hr == S_OK, "got 0x%08x\n", hr);
564 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
565 ok(V_I4(&hash) == 0, "got hash 0x%08x\n", V_I4(&hash));
566
567 for (i = 0; i < sizeof(float_hash_tests)/sizeof(float_hash_tests[0]); i++) {
568 double dbl;
569 FLOAT flt;
570 DATE date;
571
572 expected = get_num_hash(float_hash_tests[i]);
573
574 V_VT(&key) = VT_R4;
575 V_R4(&key) = float_hash_tests[i];
576 VariantInit(&hash);
577 hr = IDictionary_get_HashVal(dict, &key, &hash);
578 ok(hr == S_OK, "got 0x%08x\n", hr);
579 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
580 ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
581 expected);
582
583 flt = float_hash_tests[i];
584 V_VT(&key) = VT_R4|VT_BYREF;
585 V_R4REF(&key) = &flt;
586 VariantInit(&hash);
587 hr = IDictionary_get_HashVal(dict, &key, &hash);
588 ok(hr == S_OK, "got 0x%08x\n", hr);
589 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
590 ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
591 expected);
592
593 V_VT(&key) = VT_R8;
594 V_R8(&key) = float_hash_tests[i];
595 VariantInit(&hash);
596 hr = IDictionary_get_HashVal(dict, &key, &hash);
597 ok(hr == S_OK, "got 0x%08x\n", hr);
598 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
599 ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
600 expected);
601
602 dbl = float_hash_tests[i];
603 V_VT(&key) = VT_R8|VT_BYREF;
604 V_R8REF(&key) = &dbl;
605 VariantInit(&hash);
606 hr = IDictionary_get_HashVal(dict, &key, &hash);
607 ok(hr == S_OK, "got 0x%08x\n", hr);
608 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
609 ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
610 expected);
611
612 V_VT(&key) = VT_DATE;
613 V_DATE(&key) = float_hash_tests[i];
614 VariantInit(&hash);
615 hr = IDictionary_get_HashVal(dict, &key, &hash);
616 ok(hr == S_OK, "got 0x%08x\n", hr);
617 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
618 ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
619 expected);
620
621 V_VT(&key) = VT_DATE|VT_BYREF;
622 date = float_hash_tests[i];
623 V_DATEREF(&key) = &date;
624 VariantInit(&hash);
625 hr = IDictionary_get_HashVal(dict, &key, &hash);
626 ok(hr == S_OK, "got 0x%08x\n", hr);
627 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
628 ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
629 expected);
630 }
631
632 /* interface pointers as keys */
633 V_VT(&key) = VT_UNKNOWN;
634 V_UNKNOWN(&key) = 0;
635 VariantInit(&hash);
636 V_I4(&hash) = 1;
637 hr = IDictionary_get_HashVal(dict, &key, &hash);
638 ok(hr == S_OK, "got 0x%08x\n", hr);
639 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
640 ok(V_I4(&hash) == 0, "got hash 0x%08x, expected 0\n", V_I4(&hash));
641
642 /* QI doesn't work */
643 V_VT(&key) = VT_UNKNOWN;
644 V_UNKNOWN(&key) = &test_unk2;
645 VariantInit(&hash);
646 expected = get_ptr_hash(&test_unk2);
647 hr = IDictionary_get_HashVal(dict, &key, &hash);
648 ok(hr == CTL_E_ILLEGALFUNCTIONCALL || broken(hr == S_OK) /* win2k */, "got 0x%08x\n", hr);
649 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
650 ok(V_I4(&hash) == ~0u, "got hash 0x%08x, expected 0x%08x\n", V_I4(&hash), expected);
651
652 V_VT(&key) = VT_UNKNOWN;
653 V_UNKNOWN(&key) = &test_unk;
654 VariantInit(&hash);
655 expected = get_ptr_hash(&test_unk);
656 hr = IDictionary_get_HashVal(dict, &key, &hash);
657 ok(hr == S_OK, "got 0x%08x\n", hr);
658 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
659 ok(V_I4(&hash) == expected, "got hash 0x%08x, expected 0x%08x\n", V_I4(&hash), expected);
660
661 /* interface without IDispatch support */
662 V_VT(&key) = VT_DISPATCH;
663 V_DISPATCH(&key) = (IDispatch*)&test_unk;
664 VariantInit(&hash);
665 expected = get_ptr_hash(&test_unk);
666 hr = IDictionary_get_HashVal(dict, &key, &hash);
667 ok(hr == S_OK, "got 0x%08x\n", hr);
668 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
669 ok(V_I4(&hash) == expected, "got hash 0x%08x, expected 0x%08x\n", V_I4(&hash), expected);
670
671 V_VT(&key) = VT_DISPATCH;
672 V_DISPATCH(&key) = &test_disp;
673 VariantInit(&hash);
674 expected = get_ptr_hash(&test_disp);
675 hr = IDictionary_get_HashVal(dict, &key, &hash);
676 ok(hr == S_OK, "got 0x%08x\n", hr);
677 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
678 ok(V_I4(&hash) == expected, "got hash 0x%08x, expected 0x%08x\n", V_I4(&hash), expected);
679
680 /* same with BYREF */
681 if (0) { /* crashes on native */
682 V_VT(&key) = VT_UNKNOWN|VT_BYREF;
683 V_UNKNOWNREF(&key) = 0;
684 hr = IDictionary_get_HashVal(dict, &key, &hash);
685 }
686 unk = NULL;
687 V_VT(&key) = VT_UNKNOWN|VT_BYREF;
688 V_UNKNOWNREF(&key) = &unk;
689 VariantInit(&hash);
690 V_I4(&hash) = 1;
691 hr = IDictionary_get_HashVal(dict, &key, &hash);
692 ok(hr == S_OK, "got 0x%08x\n", hr);
693 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
694 ok(V_I4(&hash) == 0, "got hash 0x%08x, expected 0\n", V_I4(&hash));
695
696 V_VT(&key) = VT_UNKNOWN|VT_BYREF;
697 unk = &test_unk;
698 V_UNKNOWNREF(&key) = &unk;
699 VariantInit(&hash);
700 expected = get_ptr_hash(&test_unk);
701 hr = IDictionary_get_HashVal(dict, &key, &hash);
702 ok(hr == S_OK, "got 0x%08x\n", hr);
703 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
704 ok(V_I4(&hash) == expected, "got hash 0x%08x, expected 0x%08x\n", V_I4(&hash), expected);
705
706 /* interface without IDispatch support */
707 V_VT(&key) = VT_DISPATCH|VT_BYREF;
708 unk = &test_unk;
709 V_DISPATCHREF(&key) = (IDispatch**)&unk;
710 VariantInit(&hash);
711 expected = get_ptr_hash(&test_unk);
712 hr = IDictionary_get_HashVal(dict, &key, &hash);
713 ok(hr == S_OK, "got 0x%08x\n", hr);
714 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
715 ok(V_I4(&hash) == expected, "got hash 0x%08x, expected 0x%08x\n", V_I4(&hash), expected);
716
717 V_VT(&key) = VT_DISPATCH|VT_BYREF;
718 disp = &test_disp;
719 V_DISPATCHREF(&key) = &disp;
720 VariantInit(&hash);
721 expected = get_ptr_hash(&test_disp);
722 hr = IDictionary_get_HashVal(dict, &key, &hash);
723 ok(hr == S_OK, "got 0x%08x\n", hr);
724 ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
725 ok(V_I4(&hash) == expected, "got hash 0x%08x, expected 0x%08x\n", V_I4(&hash), expected);
726
727 IDictionary_Release(dict);
728 }
729
730 static void test_Exists(void)
731 {
732 VARIANT_BOOL exists;
733 IDictionary *dict;
734 VARIANT key, item;
735 HRESULT hr;
736
737 hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
738 &IID_IDictionary, (void**)&dict);
739 ok(hr == S_OK, "got 0x%08x\n", hr);
740
741 if (0) /* crashes on native */
742 hr = IDictionary_Exists(dict, NULL, NULL);
743
744 V_VT(&key) = VT_I2;
745 V_I2(&key) = 0;
746 hr = IDictionary_Exists(dict, &key, NULL);
747 ok(hr == CTL_E_ILLEGALFUNCTIONCALL, "got 0x%08x\n", hr);
748
749 V_VT(&key) = VT_I2;
750 V_I2(&key) = 0;
751 exists = VARIANT_TRUE;
752 hr = IDictionary_Exists(dict, &key, &exists);
753 ok(hr == S_OK, "got 0x%08x\n", hr);
754 ok(exists == VARIANT_FALSE, "got %x\n", exists);
755
756 VariantInit(&item);
757 hr = IDictionary_Add(dict, &key, &item);
758 ok(hr == S_OK, "got 0x%08x\n", hr);
759
760 V_VT(&key) = VT_R4;
761 V_R4(&key) = 0.0;
762 hr = IDictionary_Add(dict, &key, &item);
763 ok(hr == CTL_E_KEY_ALREADY_EXISTS, "got 0x%08x\n", hr);
764
765 V_VT(&key) = VT_I2;
766 V_I2(&key) = 0;
767 hr = IDictionary_Exists(dict, &key, NULL);
768 ok(hr == CTL_E_ILLEGALFUNCTIONCALL, "got 0x%08x\n", hr);
769
770 V_VT(&key) = VT_I2;
771 V_I2(&key) = 0;
772 exists = VARIANT_FALSE;
773 hr = IDictionary_Exists(dict, &key, &exists);
774 ok(hr == S_OK, "got 0x%08x\n", hr);
775 ok(exists == VARIANT_TRUE, "got %x\n", exists);
776
777 /* key of different type, but resolves to same hash value */
778 V_VT(&key) = VT_R4;
779 V_R4(&key) = 0.0;
780 exists = VARIANT_FALSE;
781 hr = IDictionary_Exists(dict, &key, &exists);
782 ok(hr == S_OK, "got 0x%08x\n", hr);
783 ok(exists == VARIANT_TRUE, "got %x\n", exists);
784
785 IDictionary_Release(dict);
786 }
787
788 static void test_Keys(void)
789 {
790 VARIANT key, keys, item;
791 IDictionary *dict;
792 LONG index;
793 HRESULT hr;
794
795 hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
796 &IID_IDictionary, (void**)&dict);
797 ok(hr == S_OK, "got 0x%08x\n", hr);
798
799 hr = IDictionary_Keys(dict, NULL);
800 ok(hr == S_OK, "got 0x%08x\n", hr);
801
802 VariantInit(&keys);
803 hr = IDictionary_Keys(dict, &keys);
804 ok(hr == S_OK, "got 0x%08x\n", hr);
805 ok(V_VT(&keys) == (VT_ARRAY|VT_VARIANT), "got %d\n", V_VT(&keys));
806 VariantClear(&keys);
807
808 V_VT(&key) = VT_R4;
809 V_R4(&key) = 0.0;
810 VariantInit(&item);
811 hr = IDictionary_Add(dict, &key, &item);
812 ok(hr == S_OK, "got 0x%08x\n", hr);
813
814 VariantInit(&keys);
815 hr = IDictionary_Keys(dict, &keys);
816 ok(hr == S_OK, "got 0x%08x\n", hr);
817 ok(V_VT(&keys) == (VT_ARRAY|VT_VARIANT), "got %d\n", V_VT(&keys));
818
819 VariantInit(&key);
820 index = 0;
821 hr = SafeArrayGetElement(V_ARRAY(&keys), &index, &key);
822 ok(hr == S_OK, "got 0x%08x\n", hr);
823 ok(V_VT(&key) == VT_R4, "got %d\n", V_VT(&key));
824
825 index = SafeArrayGetDim(V_ARRAY(&keys));
826 ok(index == 1, "got %d\n", index);
827
828 hr = SafeArrayGetUBound(V_ARRAY(&keys), 1, &index);
829 ok(hr == S_OK, "got 0x%08x\n", hr);
830 ok(index == 0, "got %d\n", index);
831
832 VariantClear(&keys);
833
834 IDictionary_Release(dict);
835 }
836
837 static void test_Remove(void)
838 {
839 VARIANT key, item;
840 IDictionary *dict;
841 HRESULT hr;
842
843 hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
844 &IID_IDictionary, (void**)&dict);
845 ok(hr == S_OK, "got 0x%08x\n", hr);
846
847 if (0)
848 hr = IDictionary_Remove(dict, NULL);
849
850 /* nothing added yet */
851 V_VT(&key) = VT_R4;
852 V_R4(&key) = 0.0;
853 hr = IDictionary_Remove(dict, &key);
854 ok(hr == CTL_E_ELEMENT_NOT_FOUND, "got 0x%08x\n", hr);
855
856 VariantInit(&item);
857 hr = IDictionary_Add(dict, &key, &item);
858 ok(hr == S_OK, "got 0x%08x\n", hr);
859
860 hr = IDictionary_Remove(dict, &key);
861 ok(hr == S_OK, "got 0x%08x\n", hr);
862
863 IDictionary_Release(dict);
864 }
865
866 static void test_Item(void)
867 {
868 VARIANT key, item;
869 IDictionary *dict;
870 HRESULT hr;
871
872 hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
873 &IID_IDictionary, (void**)&dict);
874 ok(hr == S_OK, "got 0x%08x\n", hr);
875
876 V_VT(&key) = VT_I2;
877 V_I2(&key) = 10;
878 V_VT(&item) = VT_I2;
879 V_I2(&item) = 123;
880 hr = IDictionary_get_Item(dict, &key, &item);
881 ok(hr == S_OK, "got 0x%08x\n", hr);
882 ok(V_VT(&item) == VT_EMPTY, "got %d\n", V_VT(&item));
883
884 V_VT(&key) = VT_I2;
885 V_I2(&key) = 10;
886 V_VT(&item) = VT_I2;
887 hr = IDictionary_get_Item(dict, &key, &item);
888 ok(hr == S_OK, "got 0x%08x\n", hr);
889 ok(V_VT(&item) == VT_EMPTY, "got %d\n", V_VT(&item));
890
891 IDictionary_Release(dict);
892 }
893
894 static void test_Add(void)
895 {
896 static const WCHAR testW[] = {'t','e','s','t','W',0};
897 VARIANT key, item;
898 IDictionary *dict;
899 HRESULT hr;
900 BSTR str;
901
902 hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
903 &IID_IDictionary, (void**)&dict);
904 ok(hr == S_OK, "got 0x%08x\n", hr);
905
906 str = SysAllocString(testW);
907 V_VT(&key) = VT_I2;
908 V_I2(&key) = 1;
909 V_VT(&item) = VT_BSTR|VT_BYREF;
910 V_BSTRREF(&item) = &str;
911 hr = IDictionary_Add(dict, &key, &item);
912 ok(hr == S_OK, "got 0x%08x\n", hr);
913
914 hr = IDictionary_get_Item(dict, &key, &item);
915 ok(hr == S_OK, "got 0x%08x\n", hr);
916 ok(V_VT(&item) == VT_BSTR, "got %d\n", V_VT(&item));
917
918 SysFreeString(str);
919
920 IDictionary_Release(dict);
921 }
922
923 static void test_IEnumVARIANT(void)
924 {
925 IUnknown *enum1, *enum2;
926 IEnumVARIANT *enumvar;
927 VARIANT key, item;
928 IDictionary *dict;
929 ULONG fetched;
930 HRESULT hr;
931
932 hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
933 &IID_IDictionary, (void**)&dict);
934 ok(hr == S_OK, "got 0x%08x\n", hr);
935
936 if (0) /* crashes on native */
937 hr = IDictionary__NewEnum(dict, NULL);
938
939 hr = IDictionary__NewEnum(dict, &enum1);
940 ok(hr == S_OK, "got 0x%08x\n", hr);
941
942 hr = IDictionary__NewEnum(dict, &enum2);
943 ok(hr == S_OK, "got 0x%08x\n", hr);
944 ok(enum1 != enum2, "got %p, %p\n", enum2, enum1);
945 IUnknown_Release(enum2);
946
947 hr = IUnknown_QueryInterface(enum1, &IID_IEnumVARIANT, (void**)&enumvar);
948 ok(hr == S_OK, "got 0x%08x\n", hr);
949 IUnknown_Release(enum1);
950
951 /* dictionary is empty */
952 hr = IEnumVARIANT_Skip(enumvar, 1);
953 ok(hr == S_FALSE, "got 0x%08x\n", hr);
954
955 hr = IEnumVARIANT_Skip(enumvar, 0);
956 ok(hr == S_OK, "got 0x%08x\n", hr);
957
958 V_VT(&key) = VT_I2;
959 V_I2(&key) = 1;
960 V_VT(&item) = VT_I4;
961 V_I4(&item) = 100;
962 hr = IDictionary_Add(dict, &key, &item);
963 ok(hr == S_OK, "got 0x%08x\n", hr);
964
965 hr = IEnumVARIANT_Skip(enumvar, 0);
966 ok(hr == S_OK, "got 0x%08x\n", hr);
967
968 hr = IEnumVARIANT_Reset(enumvar);
969 ok(hr == S_OK, "got 0x%08x\n", hr);
970 hr = IEnumVARIANT_Skip(enumvar, 1);
971 ok(hr == S_OK, "got 0x%08x\n", hr);
972 hr = IEnumVARIANT_Skip(enumvar, 1);
973 ok(hr == S_FALSE, "got 0x%08x\n", hr);
974
975 V_VT(&key) = VT_I2;
976 V_I2(&key) = 4000;
977 V_VT(&item) = VT_I4;
978 V_I4(&item) = 200;
979 hr = IDictionary_Add(dict, &key, &item);
980 ok(hr == S_OK, "got 0x%08x\n", hr);
981
982 V_VT(&key) = VT_I2;
983 V_I2(&key) = 0;
984 V_VT(&item) = VT_I4;
985 V_I4(&item) = 300;
986 hr = IDictionary_Add(dict, &key, &item);
987 ok(hr == S_OK, "got 0x%08x\n", hr);
988
989 hr = IEnumVARIANT_Reset(enumvar);
990 ok(hr == S_OK, "got 0x%08x\n", hr);
991
992 VariantInit(&key);
993 hr = IEnumVARIANT_Next(enumvar, 1, &key, &fetched);
994 ok(hr == S_OK, "got 0x%08x\n", hr);
995 ok(V_VT(&key) == VT_I2, "got %d\n", V_VT(&key));
996 ok(V_I2(&key) == 1, "got %d\n", V_I2(&key));
997 ok(fetched == 1, "got %u\n", fetched);
998
999 hr = IEnumVARIANT_Reset(enumvar);
1000 ok(hr == S_OK, "got 0x%08x\n", hr);
1001
1002 hr = IDictionary_Remove(dict, &key);
1003 ok(hr == S_OK, "got 0x%08x\n", hr);
1004
1005 VariantInit(&key);
1006 hr = IEnumVARIANT_Next(enumvar, 1, &key, &fetched);
1007 ok(hr == S_OK, "got 0x%08x\n", hr);
1008 ok(V_VT(&key) == VT_I2, "got %d\n", V_VT(&key));
1009 ok(V_I2(&key) == 4000, "got %d\n", V_I2(&key));
1010 ok(fetched == 1, "got %u\n", fetched);
1011
1012 VariantInit(&key);
1013 hr = IEnumVARIANT_Next(enumvar, 1, &key, &fetched);
1014 ok(hr == S_OK, "got 0x%08x\n", hr);
1015 ok(V_VT(&key) == VT_I2, "got %d\n", V_VT(&key));
1016 ok(V_I2(&key) == 0, "got %d\n", V_I2(&key));
1017 ok(fetched == 1, "got %u\n", fetched);
1018
1019 /* enumeration reached the bottom, add one more pair */
1020 VariantInit(&key);
1021 hr = IEnumVARIANT_Next(enumvar, 1, &key, &fetched);
1022 ok(hr == S_FALSE, "got 0x%08x\n", hr);
1023
1024 V_VT(&key) = VT_I2;
1025 V_I2(&key) = 13;
1026 V_VT(&item) = VT_I4;
1027 V_I4(&item) = 350;
1028 hr = IDictionary_Add(dict, &key, &item);
1029 ok(hr == S_OK, "got 0x%08x\n", hr);
1030
1031 /* still doesn't work until Reset() */
1032 VariantInit(&key);
1033 hr = IEnumVARIANT_Next(enumvar, 1, &key, &fetched);
1034 ok(hr == S_FALSE, "got 0x%08x\n", hr);
1035
1036 IEnumVARIANT_Release(enumvar);
1037 IDictionary_Release(dict);
1038 }
1039
1040 START_TEST(dictionary)
1041 {
1042 IDispatch *disp;
1043 HRESULT hr;
1044
1045 CoInitialize(NULL);
1046
1047 hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
1048 &IID_IDispatch, (void**)&disp);
1049 if(FAILED(hr)) {
1050 win_skip("Dictionary object is not supported: %08x\n", hr);
1051 CoUninitialize();
1052 return;
1053 }
1054 IDispatch_Release(disp);
1055
1056 test_interfaces();
1057 test_comparemode();
1058 test_hash_value();
1059 test_Exists();
1060 test_Keys();
1061 test_Remove();
1062 test_Item();
1063 test_Add();
1064 test_IEnumVARIANT();
1065
1066 CoUninitialize();
1067 }