Fixed a typo in CryptExportKey.
[wine/hacks.git] / dlls / kernel / tests / profile.c
blob78be6b21a9f8f4cbdd87696d37a32bfcaf026c7e
1 /*
2 * Unit tests for profile functions
4 * Copyright (c) 2003 Stefan Leichter
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <stdarg.h>
23 #include "wine/test.h"
24 #include "windef.h"
25 #include "winbase.h"
26 #include "windows.h"
28 #define KEY "ProfileInt"
29 #define SECTION "Test"
30 #define TESTFILE ".\\testwine.ini"
32 struct _profileInt {
33 LPCSTR section;
34 LPCSTR key;
35 LPCSTR value;
36 LPCSTR iniFile;
37 INT defaultVal;
38 UINT result;
39 UINT result9x;
42 static void test_profile_int(void)
44 struct _profileInt profileInt[]={
45 { NULL, NULL, NULL, NULL, 70, 0 , 0}, /* 0 */
46 { NULL, NULL, NULL, TESTFILE, -1, 4294967295U, 0},
47 { NULL, NULL, NULL, TESTFILE, 1, 1 , 0},
48 { SECTION, NULL, NULL, TESTFILE, -1, 4294967295U, 0},
49 { SECTION, NULL, NULL, TESTFILE, 1, 1 , 0},
50 { NULL, KEY, NULL, TESTFILE, -1, 4294967295U, 0}, /* 5 */
51 { NULL, KEY, NULL, TESTFILE, 1, 1 , 0},
52 { SECTION, KEY, NULL, TESTFILE, -1, 4294967295U, 4294967295U},
53 { SECTION, KEY, NULL, TESTFILE, 1, 1 , 1},
54 { SECTION, KEY, "-1", TESTFILE, -1, 4294967295U, 4294967295U},
55 { SECTION, KEY, "-1", TESTFILE, 1, 4294967295U, 4294967295U}, /* 10 */
56 { SECTION, KEY, "1", TESTFILE, -1, 1 , 1},
57 { SECTION, KEY, "1", TESTFILE, 1, 1 , 1},
58 { SECTION, KEY, "+1", TESTFILE, -1, 1 , 0},
59 { SECTION, KEY, "+1", TESTFILE, 1, 1 , 0},
60 { SECTION, KEY, "4294967296", TESTFILE, -1, 0 , 0}, /* 15 */
61 { SECTION, KEY, "4294967296", TESTFILE, 1, 0 , 0},
62 { SECTION, KEY, "4294967297", TESTFILE, -1, 1 , 1},
63 { SECTION, KEY, "4294967297", TESTFILE, 1, 1 , 1},
64 { SECTION, KEY, "-4294967297", TESTFILE, -1, 4294967295U, 4294967295U},
65 { SECTION, KEY, "-4294967297", TESTFILE, 1, 4294967295U, 4294967295U}, /* 20 */
66 { SECTION, KEY, "42A94967297", TESTFILE, -1, 42 , 42},
67 { SECTION, KEY, "42A94967297", TESTFILE, 1, 42 , 42},
68 { SECTION, KEY, "B4294967297", TESTFILE, -1, 0 , 0},
69 { SECTION, KEY, "B4294967297", TESTFILE, 1, 0 , 0},
71 int i, num_test = (sizeof(profileInt)/sizeof(struct _profileInt));
72 UINT res;
74 DeleteFileA( TESTFILE);
76 for (i=0; i < num_test; i++) {
77 if (profileInt[i].value)
78 WritePrivateProfileStringA(SECTION, KEY, profileInt[i].value,
79 profileInt[i].iniFile);
81 res = GetPrivateProfileIntA(profileInt[i].section, profileInt[i].key,
82 profileInt[i].defaultVal, profileInt[i].iniFile);
83 ok((res == profileInt[i].result) || (res == profileInt[i].result9x),
84 "test<%02d>: ret<%010u> exp<%010u><%010u>\n",
85 i, res, profileInt[i].result, profileInt[i].result9x);
88 DeleteFileA( TESTFILE);
91 START_TEST(profile)
93 test_profile_int();