Fixed header dependencies to be fully compatible with the Windows
[wine/multimedia.git] / dlls / kernel / tests / profile.c
blob3853c1aea1ac1f14c6326245c6e83f654c4ab740
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;
41 static void test_profile_int(void)
43 struct _profileInt profileInt[]={
44 { NULL, NULL, NULL, NULL, 70, 0 }, /* 0 */
45 { NULL, NULL, NULL, TESTFILE, -1, 4294967295U},
46 { NULL, NULL, NULL, TESTFILE, 1, 1 },
47 { SECTION, NULL, NULL, TESTFILE, -1, 4294967295U},
48 { SECTION, NULL, NULL, TESTFILE, 1, 1 },
49 { NULL, KEY, NULL, TESTFILE, -1, 4294967295U}, /* 5 */
50 { NULL, KEY, NULL, TESTFILE, 1, 1 },
51 { SECTION, KEY, NULL, TESTFILE, -1, 4294967295U},
52 { SECTION, KEY, NULL, TESTFILE, 1, 1 },
53 { SECTION, KEY, "-1", TESTFILE, -1, 4294967295U},
54 { SECTION, KEY, "-1", TESTFILE, 1, 4294967295U}, /* 10 */
55 { SECTION, KEY, "1", TESTFILE, -1, 1 },
56 { SECTION, KEY, "1", TESTFILE, 1, 1 },
57 { SECTION, KEY, "+1", TESTFILE, -1, 1 },
58 { SECTION, KEY, "+1", TESTFILE, 1, 1 },
59 { SECTION, KEY, "4294967296", TESTFILE, -1, 0 }, /* 15 */
60 { SECTION, KEY, "4294967296", TESTFILE, 1, 0 },
61 { SECTION, KEY, "4294967297", TESTFILE, -1, 1 },
62 { SECTION, KEY, "4294967297", TESTFILE, 1, 1 },
63 { SECTION, KEY, "-4294967297", TESTFILE, -1, 4294967295U},
64 { SECTION, KEY, "-4294967297", TESTFILE, 1, 4294967295U}, /* 20 */
65 { SECTION, KEY, "42A94967297", TESTFILE, -1, 42 },
66 { SECTION, KEY, "42A94967297", TESTFILE, 1, 42 },
67 { SECTION, KEY, "B4294967297", TESTFILE, -1, 0 },
68 { SECTION, KEY, "B4294967297", TESTFILE, 1, 0 },
70 int i, num_test = (sizeof(profileInt)/sizeof(struct _profileInt));
71 UINT res;
73 DeleteFileA( TESTFILE);
75 for (i=0; i < num_test; i++) {
76 if (profileInt[i].value)
77 WritePrivateProfileStringA(SECTION, KEY, profileInt[i].value,
78 profileInt[i].iniFile);
80 res = GetPrivateProfileIntA(profileInt[i].section, profileInt[i].key,
81 profileInt[i].defaultVal, profileInt[i].iniFile);
82 ok(res == profileInt[i].result, "test<%02d>: ret<%010u> exp<%010u>",
83 i, res, profileInt[i].result);
86 DeleteFileA( TESTFILE);
89 START_TEST(profile)
91 test_profile_int();