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 "wine/test.h"
25 #define KEY "ProfileInt"
26 #define SECTION "Test"
27 #define TESTFILE ".\\testwine.ini"
38 static void test_profile_int(void)
40 struct _profileInt profileInt[]={
41 { NULL, NULL, NULL, NULL, 70, 0 }, /* 0 */
42 { NULL, NULL, NULL, TESTFILE, -1, 4294967295U},
43 { NULL, NULL, NULL, TESTFILE, 1, 1 },
44 { SECTION, NULL, NULL, TESTFILE, -1, 4294967295U},
45 { SECTION, NULL, NULL, TESTFILE, 1, 1 },
46 { NULL, KEY, NULL, TESTFILE, -1, 4294967295U}, /* 5 */
47 { NULL, KEY, NULL, TESTFILE, 1, 1 },
48 { SECTION, KEY, NULL, TESTFILE, -1, 4294967295U},
49 { SECTION, KEY, NULL, TESTFILE, 1, 1 },
50 { SECTION, KEY, "-1", TESTFILE, -1, 4294967295U},
51 { SECTION, KEY, "-1", TESTFILE, 1, 4294967295U}, /* 10 */
52 { SECTION, KEY, "1", TESTFILE, -1, 1 },
53 { SECTION, KEY, "1", TESTFILE, 1, 1 },
54 { SECTION, KEY, "+1", TESTFILE, -1, 1 },
55 { SECTION, KEY, "+1", TESTFILE, 1, 1 },
56 { SECTION, KEY, "4294967296", TESTFILE, -1, 0 }, /* 15 */
57 { SECTION, KEY, "4294967296", TESTFILE, 1, 0 },
58 { SECTION, KEY, "4294967297", TESTFILE, -1, 1 },
59 { SECTION, KEY, "4294967297", TESTFILE, 1, 1 },
60 { SECTION, KEY, "-4294967297", TESTFILE, -1, 4294967295U},
61 { SECTION, KEY, "-4294967297", TESTFILE, 1, 4294967295U}, /* 20 */
62 { SECTION, KEY, "42A94967297", TESTFILE, -1, 42 },
63 { SECTION, KEY, "42A94967297", TESTFILE, 1, 42 },
64 { SECTION, KEY, "B4294967297", TESTFILE, -1, 0 },
65 { SECTION, KEY, "B4294967297", TESTFILE, 1, 0 },
67 int i, num_test = (sizeof(profileInt)/sizeof(struct _profileInt));
70 DeleteFileA( TESTFILE);
72 for (i=0; i < num_test; i++) {
73 if (profileInt[i].value)
74 WritePrivateProfileStringA(SECTION, KEY, profileInt[i].value,
75 profileInt[i].iniFile);
77 res = GetPrivateProfileIntA(profileInt[i].section, profileInt[i].key,
78 profileInt[i].defaultVal, profileInt[i].iniFile);
79 ok(res == profileInt[i].result, "test<%02d>: ret<%010u> exp<%010u>",
80 i, res, profileInt[i].result);
83 DeleteFileA( TESTFILE);