Author: gschneider
Date: Wed Aug 5 19:13:12 2009
New Revision: 42408
URL:
http://svn.reactos.org/svn/reactos?rev=42408&view=rev
Log:
-Add a crt regression test suite, extending the msvcrt winetests
-iofunc tests were used to verify r42382, added another one that tests swprintf double
conversion (roscalc issue)
-time tests crash with the current crt implementation
Added:
trunk/rostests/regtests/crt/ (with props)
trunk/rostests/regtests/crt/crt_regtest.rbuild (with props)
trunk/rostests/regtests/crt/iofuncs.c (with props)
trunk/rostests/regtests/crt/testlist.c (with props)
trunk/rostests/regtests/crt/time.c (with props)
Modified:
trunk/rostests/regtests/directory.rbuild
Propchange: trunk/rostests/regtests/crt/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Wed Aug 5 19:13:12 2009
@@ -1,0 +1,2 @@
+([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))?
+(\d+)
Propchange: trunk/rostests/regtests/crt/
------------------------------------------------------------------------------
bugtraq:message = See issue #%BUGID% for more details.
Propchange: trunk/rostests/regtests/crt/
------------------------------------------------------------------------------
bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: trunk/rostests/regtests/crt/
------------------------------------------------------------------------------
tsvn:logminsize = 10
Added: trunk/rostests/regtests/crt/crt_regtest.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/regtests/crt/crt_regtest.…
==============================================================================
--- trunk/rostests/regtests/crt/crt_regtest.rbuild (added)
+++ trunk/rostests/regtests/crt/crt_regtest.rbuild [iso-8859-1] Wed Aug 5 19:13:12 2009
@@ -1,0 +1,12 @@
+<?xml version="1.0"?>
+<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
+<group>
+<module name="crt_regtest" type="win32cui"
installbase="bin" installname="crt_regtest.exe">
+ <include base="crt_regtest">.</include>
+ <library>wine</library>
+ <library>msvcrt</library>
+ <file>iofuncs.c</file>
+ <file>testlist.c</file>
+ <file>time.c</file>
+</module>
+</group>
Propchange: trunk/rostests/regtests/crt/crt_regtest.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/regtests/crt/iofuncs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/regtests/crt/iofuncs.c?re…
==============================================================================
--- trunk/rostests/regtests/crt/iofuncs.c (added)
+++ trunk/rostests/regtests/crt/iofuncs.c [iso-8859-1] Wed Aug 5 19:13:12 2009
@@ -1,0 +1,100 @@
+/*
+ * PROJECT: ReactOS CRT regression tests
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: rostests/regtests/crt/iofuncs.c
+ * PURPOSE: Tests for input/output functions of the CRT
+ * PROGRAMMERS: Gregor Schneider
+ */
+
+#include <stdio.h>
+#include <wine/test.h>
+
+#define _CRT_NON_CONFORMING_SWPRINTFS
+
+struct _testData
+{
+ double val;
+ int prec;
+ char* exp;
+ char* exp2;
+} ECVTTESTDATA[] =
+{
+ { 45.0, 2, "+4.50E+001",
"+4.5000E+001" }, /*0*/
+ { 0.0001, 1, "+1.0E-004", "+1.000E-004"
},
+ { 0.0001, -10, "+1.000000E-004",
"+1.000000E-004" },
+ { 0.0001, 10, "+1.0000000000E-004",
"+1.000000000000E-004" },
+ { -111.0001, 5, "-1.11000E+002",
"-1.1100010E+002" },
+ { 111.0001, 5, "+1.11000E+002",
"+1.1100010E+002" }, /*5*/
+ { 3333.3, 2, "+3.33E+003",
"+3.3333E+003" },
+ { 999999999999.9, 3, "+1.000E+012",
"+1.00000E+012" },
+ { 0.0, 5, "+0.00000E+000",
"+0.0000000E+000" },
+ { 0.0, 0, "+0E+000", "+0.00E+000"
},
+ { 0.0, -1, "+0.000000E+000", "+0.0E+000"
}, /*10*/
+ { -123.0001, 0, "-1E+002", "-1.23E+002"
},
+ { -123.0001, -1, "-1.230001E+002", "-1.2E+002"
},
+ { -123.0001, -2, "-1.230001E+002", "-1E+002"
},
+ { -123.0001, -3, "-1.230001E+002",
"-1.230001E+002" },
+ { 99.99, 1, "+1.0E+002", "+9.999E+001"
}, /*15*/
+ { 0.0063, 2, "+6.30E-003",
"+6.3000E-003" },
+ { 0.0063, 3, "+6.300E-003",
"+6.30000E-003" },
+ { 0.09999999996, 2, "+1.00E-001",
"+1.0000E-001" },
+ { 0.6, 1, "+6.0E-001", "+6.000E-001"
},
+ { 0.6, 0, "+6E-001", "+6.00E-001"
}, /*20*/
+ { 0.4, 0, "+4E-001", "+4.00E-001"
},
+ { 0.49, 0, "+5E-001", "+4.90E-001"
},
+ { 0.51, 0, "+5E-001", "+5.10E-001"
}
+};
+
+void Test_ofuncs()
+{
+ int i;
+ char* buf = NULL;
+
+ /* Test exponential format */
+ buf = malloc(30 * sizeof(char));
+ if (buf == NULL)
+ {
+ printf("Memory full, exiting\n");
+ return;
+ }
+ for (i = 0; i < sizeof(ECVTTESTDATA)/sizeof(ECVTTESTDATA[0]); i++)
+ {
+ sprintf(buf, "%-+.*E", ECVTTESTDATA[i].prec, ECVTTESTDATA[i].val);
+ ok(!strcmp(buf, ECVTTESTDATA[i].exp),
+ "sprintf exp test %d failed: got %s, expected %s\n",
+ i, buf, ECVTTESTDATA[i].exp);
+ }
+ for (i = 0; i < sizeof(ECVTTESTDATA)/sizeof(ECVTTESTDATA[0]); i++)
+ {
+ sprintf(buf, "%-+.*E", ECVTTESTDATA[i].prec + 2, ECVTTESTDATA[i].val);
+ ok(!strcmp(buf, ECVTTESTDATA[i].exp2),
+ "sprintf exp +2 prec test %d failed: got %s, expected %s\n",
+ i, buf, ECVTTESTDATA[i].exp2);
+ }
+
+ /* Test with negative number to be rounded */
+ sprintf(buf, "%-+.*E", ECVTTESTDATA[18].prec + 2, -ECVTTESTDATA[18].val);
+ ok(!strcmp(buf, "-1.0000E-001"), "Negative number sprintf rounding
failed: got %s, expected %s\n",
+ buf, "-1.0000E-001");
+ free(buf);
+}
+
+void Test_ifuncs()
+{
+ double var;
+ char cnum[] = "12.3";
+ wchar_t wnum[] = L"12.3";
+
+ /* Test sscanf behaviour */
+ sscanf(cnum, "%lf", &var);
+ ok(var == 12.3, "sscanf double conversion failed: got %f\n", var);
+ swscanf(wnum, L"%lf", &var);
+ ok(var == 12.3, "swscanf double conversion failed: got %f\n", var);
+}
+
+START_TEST(iofuncs)
+{
+ Test_ofuncs();
+ Test_ifuncs();
+}
+
Propchange: trunk/rostests/regtests/crt/iofuncs.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/regtests/crt/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/regtests/crt/testlist.c?r…
==============================================================================
--- trunk/rostests/regtests/crt/testlist.c (added)
+++ trunk/rostests/regtests/crt/testlist.c [iso-8859-1] Wed Aug 5 19:13:12 2009
@@ -1,0 +1,19 @@
+/* Automatically generated file; DO NOT EDIT!! */
+
+#define WIN32_LEAN_AND_MEAN
+#define __ROS_LONG64__
+#include <windows.h>
+
+#define STANDALONE
+#include "wine/test.h"
+
+extern void func_iofuncs(void);
+extern void func_time(void);
+
+const struct test winetest_testlist[] =
+{
+ { "iofuncs", func_iofuncs },
+ { "time", func_time },
+ { 0, 0 }
+};
+
Propchange: trunk/rostests/regtests/crt/testlist.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/regtests/crt/time.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/regtests/crt/time.c?rev=4…
==============================================================================
--- trunk/rostests/regtests/crt/time.c (added)
+++ trunk/rostests/regtests/crt/time.c [iso-8859-1] Wed Aug 5 19:13:12 2009
@@ -1,0 +1,48 @@
+/*
+ * PROJECT: ReactOS CRT regression tests
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: rostests/regtests/crt/time.c
+ * PURPOSE: Tests for time functions of the CRT
+ * PROGRAMMERS: Gregor Schneider
+ */
+
+#include <stdio.h>
+#include <time.h>
+#include <wine/test.h>
+
+void Test_asctime()
+{
+ /* Test asctime */
+ struct tm time;
+ char* timestr;
+ char explowtime[] = "Mon Jun 04 00:30:20 1909\n"; /* XP's crt returns
new line after the string */
+
+ time.tm_hour = 0;
+ time.tm_mday = 4;
+ time.tm_min = 30;
+ time.tm_mon = 5;
+ time.tm_sec = 20;
+ time.tm_wday = 1;
+ time.tm_yday = 200;
+ time.tm_year = 9;
+
+ timestr = asctime(&time);
+ ok(!strcmp(timestr, explowtime), "Wrong time returned, got %s\n",
timestr);
+}
+
+void Test_ctime()
+{
+ /* Test border ctime cases */
+ time_t time;
+ time = -15;
+ ok(ctime(&time) == NULL, "ctime doesn't return NULL for invalid
parameters\n");
+ time = -5000000;
+ ok(ctime(&time) == NULL, "ctime doesn't return NULL for invalid
parameters\n");
+}
+
+START_TEST(time)
+{
+ Test_asctime();
+ Test_ctime();
+}
+
Propchange: trunk/rostests/regtests/crt/time.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/regtests/directory.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/regtests/directory.rbuild…
==============================================================================
--- trunk/rostests/regtests/directory.rbuild [iso-8859-1] (original)
+++ trunk/rostests/regtests/directory.rbuild [iso-8859-1] Wed Aug 5 19:13:12 2009
@@ -4,4 +4,7 @@
<directory name="gdi">
<xi:include href="gdi/gdi_regtest.rbuild" />
</directory>
+ <directory name="crt">
+ <xi:include href="crt/crt_regtest.rbuild" />
+ </directory>
</group>