(resend) tests for GetPrivateProfileInt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello list,

here are some tests for the function GetPrivateProfileInt. The expected results are the one from NT4. Hopefully the will match for Win 9x also.
Before i convert GetPrivateProfileInt from ascii to unicode i like to see some test result from Win9x/ME.

ChangeLog
-------------
Added test for GetPrivateProfileInt


diff -Nruw ../wine/dlls/kernel/tests/.cvsignore dlls/kernel/tests/.cvsignore
--- ../wine/dlls/kernel/tests/.cvsignore Fri Oct 4 19:42:26 2002
+++ dlls/kernel/tests/.cvsignore Sun Jan 26 18:53:47 2003
@@ -12,5 +12,6 @@
locale.ok
path.ok
process.ok
+profile.ok
testlist.c
thread.ok
diff -Nruw ../wine/dlls/kernel/tests/Makefile.in dlls/kernel/tests/Makefile.in
--- ../wine/dlls/kernel/tests/Makefile.in Fri Oct 4 19:42:26 2002
+++ dlls/kernel/tests/Makefile.in Sun Jan 26 18:52:23 2003
@@ -18,6 +18,7 @@
locale.c \
path.c \
process.c \
+ profile.c \
thread.c

@MAKE_TEST_RULES@
diff -Nruw ../wine/dlls/kernel/tests/profile.c dlls/kernel/tests/profile.c
--- ../wine/dlls/kernel/tests/profile.c Thu Jan 1 01:00:00 1970
+++ dlls/kernel/tests/profile.c Sun Jan 26 17:40:12 2003
@@ -0,0 +1,89 @@
+/*
+ * Unit tests for profile functions
+ *
+ * Copyright (c) 2003 Stefan Leichter
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "wine/test.h"
+#include "winbase.h"
+#include "windows.h"
+
+#define KEY "ProfileInt"
+#define SECTION "Test"
+#define TESTFILE ".\\testwine.ini"
+
+struct _profileInt {
+ LPCSTR section;
+ LPCSTR key;
+ LPCSTR value;
+ LPCSTR iniFile;
+ INT defaultVal;
+ UINT result;
+};
+
+static void test_profile_int(void)
+{
+ struct _profileInt profileInt[]={
+ { NULL, NULL, NULL, NULL, 70, 0 }, /* 0 */
+ { NULL, NULL, NULL, TESTFILE, -1, 4294967295},
+ { NULL, NULL, NULL, TESTFILE, 1, 1 },
+ { SECTION, NULL, NULL, TESTFILE, -1, 4294967295},
+ { SECTION, NULL, NULL, TESTFILE, 1, 1 },
+ { NULL, KEY, NULL, TESTFILE, -1, 4294967295}, /* 5 */
+ { NULL, KEY, NULL, TESTFILE, 1, 1 },
+ { SECTION, KEY, NULL, TESTFILE, -1, 4294967295},
+ { SECTION, KEY, NULL, TESTFILE, 1, 1 },
+ { SECTION, KEY, "-1", TESTFILE, -1, 4294967295},
+ { SECTION, KEY, "-1", TESTFILE, 1, 4294967295}, /* 10 */
+ { SECTION, KEY, "1", TESTFILE, -1, 1 },
+ { SECTION, KEY, "1", TESTFILE, 1, 1 },
+ { SECTION, KEY, "+1", TESTFILE, -1, 1 },
+ { SECTION, KEY, "+1", TESTFILE, 1, 1 },
+ { SECTION, KEY, "4294967296", TESTFILE, -1, 0 }, /* 15 */
+ { SECTION, KEY, "4294967296", TESTFILE, 1, 0 },
+ { SECTION, KEY, "4294967297", TESTFILE, -1, 1 },
+ { SECTION, KEY, "4294967297", TESTFILE, 1, 1 },
+ { SECTION, KEY, "-4294967297", TESTFILE, -1, 4294967295},
+ { SECTION, KEY, "-4294967297", TESTFILE, 1, 4294967295}, /* 20 */
+ { SECTION, KEY, "42A94967297", TESTFILE, -1, 42 },
+ { SECTION, KEY, "42A94967297", TESTFILE, 1, 42 },
+ { SECTION, KEY, "B4294967297", TESTFILE, -1, 0 },
+ { SECTION, KEY, "B4294967297", TESTFILE, 1, 0 },
+ };
+ int i, num_test = (sizeof(profileInt)/sizeof(struct _profileInt));
+ UINT res;
+
+ DeleteFile( TESTFILE);
+
+ for (i=0; i < num_test; i++) {
+ if (profileInt[i].value)
+ WritePrivateProfileString(SECTION, KEY, profileInt[i].value,
+ profileInt[i].iniFile);
+
+ res = GetPrivateProfileInt(profileInt[i].section, profileInt[i].key,
+ profileInt[i].defaultVal, profileInt[i].iniFile);
+ ok(res == profileInt[i].result, "test<%02d>: ret<%010u> exp<%010u>",
+ i, res, profileInt[i].result);
+ }
+
+ DeleteFile( TESTFILE);
+}
+
+START_TEST(profile)
+{
+ test_profile_int();
+}





[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux