1 /* Unit test suite for SHLWAPI ordinal functions
3 * Copyright 2004 Jon Griffiths
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "wine/test.h"
27 #define NO_SHLWAPI_REG
28 #define NO_SHLWAPI_PATH
29 #define NO_SHLWAPI_GDI
30 #define NO_SHLWAPI_STREAM
33 /* Function ptrs for ordinal calls */
34 static HMODULE hShlwapi;
35 static int (WINAPI *pSHSearchMapInt)(const int*,const int*,int,int);
38 static void test_SHSearchMapInt(void)
40 int keys[8], values[8];
46 memset(keys, 0, sizeof(keys));
47 memset(values, 0, sizeof(values));
48 keys[0] = 99; values[0] = 101;
50 /* NULL key/value lists crash native, so skip testing them */
53 i = pSHSearchMapInt(keys, values, 1, keys[0]);
54 ok(i == values[0], "Len 1, expected %d, got %d\n", values[0], i);
56 /* Key doesn't exist */
57 i = pSHSearchMapInt(keys, values, 1, 100);
58 ok(i == -1, "Len 1 - bad key, expected -1, got %d\n", i);
60 /* Len = 0 => not found */
61 i = pSHSearchMapInt(keys, values, 0, keys[0]);
62 ok(i == -1, "Len 1 - passed len 0, expected -1, got %d\n", i);
64 /* 2 elements, len = 1 */
65 keys[1] = 98; values[1] = 102;
66 i = pSHSearchMapInt(keys, values, 1, keys[1]);
67 ok(i == -1, "Len 1 - array len 2, expected -1, got %d\n", i);
69 /* 2 elements, len = 2 */
70 i = pSHSearchMapInt(keys, values, 2, keys[1]);
71 ok(i == values[1], "Len 2, expected %d, got %d\n", values[1], i);
73 /* Searches forward */
74 keys[2] = 99; values[2] = 103;
75 i = pSHSearchMapInt(keys, values, 3, keys[0]);
76 ok(i == values[0], "Len 3, expected %d, got %d\n", values[0], i);
82 hShlwapi = LoadLibraryA("shlwapi.dll");
83 ok(hShlwapi != 0, "LoadLibraryA failed\n");
87 pSHSearchMapInt = (void*)GetProcAddress(hShlwapi, (LPSTR)198);
89 test_SHSearchMapInt();
90 FreeLibrary(hShlwapi);