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
23 #include "wine/test.h"
28 #define KEY "ProfileInt"
29 #define SECTION "Test"
30 #define TESTFILE ".\\testwine.ini"
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
));
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
);