Author: fireball
Date: Wed May 24 00:16:57 2006
New Revision: 21994
URL:
http://svn.reactos.ru/svn/reactos?rev=21994&view=rev
Log:
Update msvcrt_winetest to Wine-23052006
Modified:
trunk/reactos/regtests/winetests/msvcrt/cpp.c
trunk/reactos/regtests/winetests/msvcrt/environ.c
trunk/reactos/regtests/winetests/msvcrt/file.c
trunk/reactos/regtests/winetests/msvcrt/msvcrt.rbuild
trunk/reactos/regtests/winetests/msvcrt/printf.c
trunk/reactos/regtests/winetests/msvcrt/scanf.c
trunk/reactos/regtests/winetests/msvcrt/string.c
trunk/reactos/regtests/winetests/msvcrt/testlist.c
trunk/reactos/regtests/winetests/msvcrt/time.c
Modified: trunk/reactos/regtests/winetests/msvcrt/cpp.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/regtests/winetests/msvcrt/c…
==============================================================================
--- trunk/reactos/regtests/winetests/msvcrt/cpp.c (original)
+++ trunk/reactos/regtests/winetests/msvcrt/cpp.c Wed May 24 00:16:57 2006
@@ -117,12 +117,16 @@
static void* (*p__RTCastToVoid)(void*);
static void* (*p__RTDynamicCast)(void*,int,void*,void*,int);
+/*Demangle*/
+static char* (*p__unDName)(char*,const char*,int,void*,void*,unsigned short int);
+
+
/* _very_ early native versions have serious RTTI bugs, so we check */
static void* bAncientVersion;
/* Emulate a __thiscall */
#ifdef _MSC_VER
-__inline static void* do_call_func1(void *func, void *_this)
+inline static void* do_call_func1(void *func, void *_this)
{
volatile void* retval = 0;
__asm
@@ -136,7 +140,7 @@
return (void*)retval;
}
-__inline static void* do_call_func2(void *func, void *_this, void* arg)
+inline static void* do_call_func2(void *func, void *_this, void* arg)
{
volatile void* retval = 0;
__asm
@@ -178,7 +182,7 @@
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(hMsvcrt,y)
#define SET(x,y) SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not
found\n", y)
-static void InitFunctionPtrs()
+static void InitFunctionPtrs(void)
{
hMsvcrt = LoadLibraryA("msvcrt.dll");
ok(hMsvcrt != 0, "LoadLibraryA failed\n");
@@ -238,9 +242,7 @@
SET(ptype_info_dtor, "??1type_info@@UAE@XZ");
SET(ptype_info_raw_name, "?raw_name@type_info@@QBEPBDXZ");
-#ifndef __REACTOS__
SET(ptype_info_name, "?name@type_info@@QBEPBDXZ");
-#endif
SET(ptype_info_before, "?before@type_info@@QBEHABV1@@Z");
SET(ptype_info_opequals_equals, "??8type_info@@QBEHABV0@@Z");
SET(ptype_info_opnot_equals, "??9type_info@@QBEHABV0@@Z");
@@ -248,6 +250,8 @@
SET(p__RTtypeid, "__RTtypeid");
SET(p__RTCastToVoid, "__RTCastToVoid");
SET(p__RTDynamicCast, "__RTDynamicCast");
+
+ SET(p__unDName,"__unDName");
/* Extremely early versions export logic_error, and crash in RTTI */
SETNOFAIL(bAncientVersion, "??0logic_error@@QAE@ABQBD@Z");
@@ -814,6 +818,174 @@
ok (casted == NULL, "Cast succeeded\n");
}
+struct _demangle {
+ LPCSTR mangled;
+ LPCSTR result;
+ BOOL test_in_wine;
+};
+
+static void test_demangle_datatype(void)
+{
+ char * name;
+ struct _demangle demangle[]={
+/* { "BlaBla"," ?? ::Bla", FALSE}, */
+ { "ABVVec4@ref2@dice@@","class dice::ref2::Vec4 const &",TRUE},
+ { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0H@@@", "class
CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,7>", TRUE},
+ { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HO@@@", "class
CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,126>",TRUE},
+ { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HOA@@@", "class
CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,2016>",TRUE},
+ { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HOAA@@@", "class
CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,32256>",TRUE},
+ { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$01@@@",
"?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$01@@@", FALSE},
+/* { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$011@@@",
"?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$011@@@",FALSE}, */
+ };
+ int i, num_test = (sizeof(demangle)/sizeof(struct _demangle));
+
+ for (i = 0; i < num_test; i++)
+ {
+ name = p__unDName(0, demangle[i].mangled, 0, pmalloc, pfree, 0x2800);
+ if (demangle[i].test_in_wine)
+ ok(name != NULL && !strcmp(name,demangle[i].result), "Got name
\"%s\" for %d\n", name, i);
+ else
+ todo_wine ok(name != NULL && !strcmp(name,demangle[i].result), "Got
name %s for %d\n", name, i);
+
+ }
+}
+
+/* Compare two strings treating multiple spaces (' ', ascii 0x20) in s2
+ as single space. Needed for test_demangle as __unDName() returns sometimes
+ two spaces instead of one in some older native msvcrt dlls. */
+static int strcmp_space(const char *s1, const char *s2)
+{
+ const char* s2start = s2;
+ do {
+ while (*s1 == *s2 && *s1) {
+ s1++;
+ s2++;
+ }
+ if (*s2 == ' ' && s2 > s2start && *(s2 - 1) == '
')
+ s2++;
+ else
+ break;
+ } while (*s1 && *s2);
+ return *s1 - *s2;
+}
+
+static void test_demangle(void)
+{
+ static struct {const char* in; const char* out;} test[] = {
+{"??0bad_alloc@std@@QAE@ABV01@@Z", "public: __thiscall
std::bad_alloc::bad_alloc(class std::bad_alloc const &)"},
+{"??0bad_alloc@std@@QAE@PBD@Z", "public: __thiscall
std::bad_alloc::bad_alloc(char const *)"},
+{"??0bad_cast@@AAE@PBQBD@Z", "private: __thiscall bad_cast::bad_cast(char
const * const *)"},
+{"??0bad_cast@@QAE@ABQBD@Z", "public: __thiscall bad_cast::bad_cast(char
const * const &)"},
+{"??0bad_cast@@QAE@ABV0@@Z", "public: __thiscall bad_cast::bad_cast(class
bad_cast const &)"},
+{"??0bad_exception@std@@QAE@ABV01@@Z", "public: __thiscall
std::bad_exception::bad_exception(class std::bad_exception const &)"},
+{"??0bad_exception@std@@QAE@PBD@Z", "public: __thiscall
std::bad_exception::bad_exception(char const *)"},
+{"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@ABV01@@Z", "public:
__thiscall std::basic_filebuf<char,struct std::char_traits<char>
>::basic_filebuf<char,struct std::char_traits<char> >(class
std::basic_filebuf<char,struct std::char_traits<char> > const &)"},
+{"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z",
"public: __thiscall std::basic_filebuf<char,struct std::char_traits<char>
>::basic_filebuf<char,struct std::char_traits<char> >(struct _iobuf
*)"},
+{"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@@Z",
"public: __thiscall std::basic_filebuf<char,struct std::char_traits<char>
>::basic_filebuf<char,struct std::char_traits<char> >(enum
std::_Uninitialized)"},
+{"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@ABV01@@Z", "public:
__thiscall std::basic_filebuf<unsigned short,struct std::char_traits<unsigned
short> >::basic_filebuf<unsigned short,struct std::char_traits<unsigned
short> >(class std::basic_filebuf<unsigned short,struct
std::char_traits<unsigned short> > const &)"},
+{"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z",
"public: __thiscall std::basic_filebuf<unsigned short,struct
std::char_traits<unsigned short> >::basic_filebuf<unsigned short,struct
std::char_traits<unsigned short> >(struct _iobuf *)"},
+{"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@@Z",
"public: __thiscall std::basic_filebuf<unsigned short,struct
std::char_traits<unsigned short> >::basic_filebuf<unsigned short,struct
std::char_traits<unsigned short> >(enum std::_Uninitialized)"},
+{"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z",
"public: __thiscall std::basic_stringstream<char,struct
std::char_traits<char>,class std::allocator<char>
>::basic_stringstream<char,struct std::char_traits<char>,class
std::allocator<char> >(class std::basic_stringstream<char,struct
std::char_traits<char>,class std::allocator<char> > const &)"},
+{"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z",
"public: __thiscall std::basic_stringstream<char,struct
std::char_traits<char>,class std::allocator<char>
>::basic_stringstream<char,struct std::char_traits<char>,class
std::allocator<char> >(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const
&,int)"},
+{"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z",
"public: __thiscall std::basic_stringstream<char,struct
std::char_traits<char>,class std::allocator<char>
>::basic_stringstream<char,struct std::char_traits<char>,class
std::allocator<char> >(int)"},
+{"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV01@@Z",
"public: __thiscall std::basic_stringstream<unsigned short,struct
std::char_traits<unsigned short>,class std::allocator<unsigned short>
>::basic_stringstream<unsigned short,struct std::char_traits<unsigned
short>,class std::allocator<unsigned short> >(class
std::basic_stringstream<unsigned short,struct std::char_traits<unsigned
short>,class std::allocator<unsigned short> > const &)"},
+{"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z",
"public: __thiscall std::basic_stringstream<unsigned short,struct
std::char_traits<unsigned short>,class std::allocator<unsigned short>
>::basic_stringstream<unsigned short,struct std::char_traits<unsigned
short>,class std::allocator<unsigned short> >(class
std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class
std::allocator<unsigned short> > const &,int)"},
+{"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z",
"public: __thiscall std::basic_stringstream<unsigned short,struct
std::char_traits<unsigned short>,class std::allocator<unsigned short>
>::basic_stringstream<unsigned short,struct std::char_traits<unsigned
short>,class std::allocator<unsigned short> >(int)"},
+{"??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z",
"public: __thiscall std::num_get<char,class
std::istreambuf_iterator<char,struct std::char_traits<char> >
>::num_get<char,class std::istreambuf_iterator<char,struct
std::char_traits<char> > >(class std::_Locinfo const &,unsigned
int)"},
+{"??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z",
"public: __thiscall std::num_get<char,class
std::istreambuf_iterator<char,struct std::char_traits<char> >
>::num_get<char,class std::istreambuf_iterator<char,struct
std::char_traits<char> > >(unsigned int)"},
+{"??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z",
"public: __thiscall std::num_get<unsigned short,class
std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short>
> >::num_get<unsigned short,class std::istreambuf_iterator<unsigned
short,struct std::char_traits<unsigned short> > >(class std::_Locinfo const
&,unsigned int)"},
+{"??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z",
"public: __thiscall std::num_get<unsigned short,class
std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short>
> >::num_get<unsigned short,class std::istreambuf_iterator<unsigned
short,struct std::char_traits<unsigned short> > >(unsigned int)"},
+{"??0streambuf@@QAE@ABV0@@Z", "public: __thiscall
streambuf::streambuf(class streambuf const &)"},
+{"??0strstreambuf@@QAE@ABV0@@Z", "public: __thiscall
strstreambuf::strstreambuf(class strstreambuf const &)"},
+{"??0strstreambuf@@QAE@H@Z", "public: __thiscall
strstreambuf::strstreambuf(int)"},
+{"??0strstreambuf@@QAE@P6APAXJ@ZP6AXPAX@Z@Z", "public: __thiscall
strstreambuf::strstreambuf(void * (__cdecl*)(long),void (__cdecl*)(void *))"},
+{"??0strstreambuf@@QAE@PADH0@Z", "public: __thiscall
strstreambuf::strstreambuf(char *,int,char *)"},
+{"??0strstreambuf@@QAE@PAEH0@Z", "public: __thiscall
strstreambuf::strstreambuf(unsigned char *,int,unsigned char *)"},
+{"??0strstreambuf@@QAE@XZ", "public: __thiscall
strstreambuf::strstreambuf(void)"},
+{"??1__non_rtti_object@std@@UAE@XZ", "public: virtual __thiscall
std::__non_rtti_object::~__non_rtti_object(void)"},
+{"??1__non_rtti_object@@UAE@XZ", "public: virtual __thiscall
__non_rtti_object::~__non_rtti_object(void)"},
+{"??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ",
"public: virtual __thiscall std::num_get<char,class
std::istreambuf_iterator<char,struct std::char_traits<char> >
>::~num_get<char,class std::istreambuf_iterator<char,struct
std::char_traits<char> > >(void)"},
+{"??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ",
"public: virtual __thiscall std::num_get<unsigned short,class
std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short>
> >::~num_get<unsigned short,class std::istreambuf_iterator<unsigned
short,struct std::char_traits<unsigned short> > >(void)"},
+{"??4istream_withassign@@QAEAAV0@ABV0@@Z", "public: class
istream_withassign & __thiscall istream_withassign::operator=(class istream_withassign
const &)"},
+{"??4istream_withassign@@QAEAAVistream@@ABV1@@Z", "public: class istream
& __thiscall istream_withassign::operator=(class istream const &)"},
+{"??4istream_withassign@@QAEAAVistream@@PAVstreambuf@@@Z", "public: class
istream & __thiscall istream_withassign::operator=(class streambuf *)"},
+{"??5std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAC@Z",
"class std::basic_istream<char,struct std::char_traits<char> > &
__cdecl std::operator>>(class std::basic_istream<char,struct
std::char_traits<char> > &,signed char &)"},
+{"??5std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAD@Z",
"class std::basic_istream<char,struct std::char_traits<char> > &
__cdecl std::operator>>(class std::basic_istream<char,struct
std::char_traits<char> > &,char &)"},
+{"??5std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAE@Z",
"class std::basic_istream<char,struct std::char_traits<char> > &
__cdecl std::operator>>(class std::basic_istream<char,struct
std::char_traits<char> > &,unsigned char &)"},
+{"??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z",
"public: class std::basic_ostream<unsigned short,struct
std::char_traits<unsigned short> > & __thiscall
std::basic_ostream<unsigned short,struct std::char_traits<unsigned short>
>::operator<<(class std::ios_base & (__cdecl*)(class std::ios_base
&))"},
+{"??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z",
"public: class std::basic_ostream<unsigned short,struct
std::char_traits<unsigned short> > & __thiscall
std::basic_ostream<unsigned short,struct std::char_traits<unsigned short>
>::operator<<(class std::basic_streambuf<unsigned short,struct
std::char_traits<unsigned short> > *)"},
+{"??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PBX@Z",
"public: class std::basic_ostream<unsigned short,struct
std::char_traits<unsigned short> > & __thiscall
std::basic_ostream<unsigned short,struct std::char_traits<unsigned short>
>::operator<<(void const *)"},
+{"??_8?$basic_fstream@DU?$char_traits@D@std@@@std@@7B?$basic_ostream@DU?$char_traits@D@std@@@1@@",
"const std::basic_fstream<char,struct std::char_traits<char>
>::`vbtable'{for `std::basic_ostream<char,struct std::char_traits<char>
>'}"},
+{"??_8?$basic_fstream@GU?$char_traits@G@std@@@std@@7B?$basic_istream@GU?$char_traits@G@std@@@1@@",
"const std::basic_fstream<unsigned short,struct std::char_traits<unsigned
short> >::`vbtable'{for `std::basic_istream<unsigned short,struct
std::char_traits<unsigned short> >'}"},
+{"??_8?$basic_fstream@GU?$char_traits@G@std@@@std@@7B?$basic_ostream@GU?$char_traits@G@std@@@1@@",
"const std::basic_fstream<unsigned short,struct std::char_traits<unsigned
short> >::`vbtable'{for `std::basic_ostream<unsigned short,struct
std::char_traits<unsigned short> >'}"},
+{"??9std@@YA_NPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z",
"bool __cdecl std::operator!=(char const *,class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &)"},
+{"??9std@@YA_NPBGABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z",
"bool __cdecl std::operator!=(unsigned short const *,class
std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class
std::allocator<unsigned short> > const &)"},
+{"??A?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAADI@Z",
"public: char & __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::operator[](unsigned
int)"},
+{"??A?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEABDI@Z",
"public: char const & __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::operator[](unsigned
int)const "},
+{"??A?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAGI@Z",
"public: unsigned short & __thiscall std::basic_string<unsigned short,struct
std::char_traits<unsigned short>,class std::allocator<unsigned short>
>::operator[](unsigned int)"},
+{"??A?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEABGI@Z",
"public: unsigned short const & __thiscall std::basic_string<unsigned
short,struct std::char_traits<unsigned short>,class std::allocator<unsigned
short> >::operator[](unsigned int)const "},
+{"?abs@std@@YAMABV?$complex@M@1@@Z", "float __cdecl std::abs(class
std::complex<float> const &)"},
+{"?abs@std@@YANABV?$complex@N@1@@Z", "double __cdecl std::abs(class
std::complex<double> const &)"},
+{"?abs@std@@YAOABV?$complex@O@1@@Z", "long double __cdecl std::abs(class
std::complex<long double> const &)"},
+{"?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A", "class
std::basic_istream<char,struct std::char_traits<char> > std::cin"},
+{"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAG@Z",
"protected: virtual class std::istreambuf_iterator<char,struct
std::char_traits<char> > __thiscall std::num_get<char,class
std::istreambuf_iterator<char,struct std::char_traits<char> >
>::do_get(class std::istreambuf_iterator<char,struct std::char_traits<char>
>,class std::istreambuf_iterator<char,struct std::char_traits<char> >,class
std::ios_base &,int &,unsigned short &)const "},
+{"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAI@Z",
"protected: virtual class std::istreambuf_iterator<char,struct
std::char_traits<char> > __thiscall std::num_get<char,class
std::istreambuf_iterator<char,struct std::char_traits<char> >
>::do_get(class std::istreambuf_iterator<char,struct std::char_traits<char>
>,class std::istreambuf_iterator<char,struct std::char_traits<char> >,class
std::ios_base &,int &,unsigned int &)const "},
+{"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAJ@Z",
"protected: virtual class std::istreambuf_iterator<char,struct
std::char_traits<char> > __thiscall std::num_get<char,class
std::istreambuf_iterator<char,struct std::char_traits<char> >
>::do_get(class std::istreambuf_iterator<char,struct std::char_traits<char>
>,class std::istreambuf_iterator<char,struct std::char_traits<char> >,class
std::ios_base &,int &,long &)const "},
+{"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAK@Z",
"protected: virtual class std::istreambuf_iterator<char,struct
std::char_traits<char> > __thiscall std::num_get<char,class
std::istreambuf_iterator<char,struct std::char_traits<char> >
>::do_get(class std::istreambuf_iterator<char,struct std::char_traits<char>
>,class std::istreambuf_iterator<char,struct std::char_traits<char> >,class
std::ios_base &,int &,unsigned long &)const "},
+{"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAM@Z",
"protected: virtual class std::istreambuf_iterator<char,struct
std::char_traits<char> > __thiscall std::num_get<char,class
std::istreambuf_iterator<char,struct std::char_traits<char> >
>::do_get(class std::istreambuf_iterator<char,struct std::char_traits<char>
>,class std::istreambuf_iterator<char,struct std::char_traits<char> >,class
std::ios_base &,int &,float &)const "},
+{"?_query_new_handler@@YAP6AHI@ZXZ", "int (__cdecl*__cdecl
_query_new_handler(void))(unsigned int)"},
+{"?register_callback@ios_base@std@@QAEXP6AXW4event@12@AAV12@H@ZH@Z",
"public: void __thiscall std::ios_base::register_callback(void (__cdecl*)(enum
std::ios_base::event,class std::ios_base &,int),int)"},
+{"?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@JW4seekdir@ios_base@2@@Z",
"public: class std::basic_istream<char,struct std::char_traits<char> >
& __thiscall std::basic_istream<char,struct std::char_traits<char>
>::seekg(long,enum std::ios_base::seekdir)"},
+{"?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z",
"public: class std::basic_istream<char,struct std::char_traits<char> >
& __thiscall std::basic_istream<char,struct std::char_traits<char>
>::seekg(class std::fpos<int>)"},
+{"?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@JW4seekdir@ios_base@2@@Z",
"public: class std::basic_istream<unsigned short,struct
std::char_traits<unsigned short> > & __thiscall
std::basic_istream<unsigned short,struct std::char_traits<unsigned short>
>::seekg(long,enum std::ios_base::seekdir)"},
+{"?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z",
"public: class std::basic_istream<unsigned short,struct
std::char_traits<unsigned short> > & __thiscall
std::basic_istream<unsigned short,struct std::char_traits<unsigned short>
>::seekg(class std::fpos<int>)"},
+{"?seekoff@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@JW4seekdir@ios_base@2@H@Z",
"protected: virtual class std::fpos<int> __thiscall
std::basic_filebuf<char,struct std::char_traits<char> >::seekoff(long,enum
std::ios_base::seekdir,int)"},
+{"?seekoff@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@JW4seekdir@ios_base@2@H@Z",
"protected: virtual class std::fpos<int> __thiscall
std::basic_filebuf<unsigned short,struct std::char_traits<unsigned short>
>::seekoff(long,enum std::ios_base::seekdir,int)"},
+{"?set_new_handler@@YAP6AXXZP6AXXZ@Z", "void (__cdecl*__cdecl
set_new_handler(void (__cdecl*)(void)))(void)"},
+{"?str@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z",
"public: void __thiscall std::basic_istringstream<char,struct
std::char_traits<char>,class std::allocator<char> >::str(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &)"},
+{"?str@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ",
"public: class std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > __thiscall std::basic_istringstream<char,struct
std::char_traits<char>,class std::allocator<char> >::str(void)const
"},
+{"?str@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z",
"public: void __thiscall std::basic_istringstream<unsigned short,struct
std::char_traits<unsigned short>,class std::allocator<unsigned short>
>::str(class std::basic_string<unsigned short,struct std::char_traits<unsigned
short>,class std::allocator<unsigned short> > const &)"},
+{"?str@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ",
"public: class std::basic_string<unsigned short,struct
std::char_traits<unsigned short>,class std::allocator<unsigned short> >
__thiscall std::basic_istringstream<unsigned short,struct std::char_traits<unsigned
short>,class std::allocator<unsigned short> >::str(void)const "},
+{"?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z",
"public: void __thiscall std::basic_ostringstream<char,struct
std::char_traits<char>,class std::allocator<char> >::str(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &)"},
+{"?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ",
"public: class std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > __thiscall std::basic_ostringstream<char,struct
std::char_traits<char>,class std::allocator<char> >::str(void)const
"},
+{"?str@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z",
"public: void __thiscall std::basic_ostringstream<unsigned short,struct
std::char_traits<unsigned short>,class std::allocator<unsigned short>
>::str(class std::basic_string<unsigned short,struct std::char_traits<unsigned
short>,class std::allocator<unsigned short> > const &)"},
+{"?str@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ",
"public: class std::basic_string<unsigned short,struct
std::char_traits<unsigned short>,class std::allocator<unsigned short> >
__thiscall std::basic_ostringstream<unsigned short,struct std::char_traits<unsigned
short>,class std::allocator<unsigned short> >::str(void)const "},
+{"?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z",
"public: void __thiscall std::basic_stringbuf<char,struct
std::char_traits<char>,class std::allocator<char> >::str(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &)"},
+{"?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ",
"public: class std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > __thiscall std::basic_stringbuf<char,struct
std::char_traits<char>,class std::allocator<char> >::str(void)const
"},
+{"?str@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z",
"public: void __thiscall std::basic_stringbuf<unsigned short,struct
std::char_traits<unsigned short>,class std::allocator<unsigned short>
>::str(class std::basic_string<unsigned short,struct std::char_traits<unsigned
short>,class std::allocator<unsigned short> > const &)"},
+{"?str@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ",
"public: class std::basic_string<unsigned short,struct
std::char_traits<unsigned short>,class std::allocator<unsigned short> >
__thiscall std::basic_stringbuf<unsigned short,struct std::char_traits<unsigned
short>,class std::allocator<unsigned short> >::str(void)const "},
+{"?str@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z",
"public: void __thiscall std::basic_stringstream<char,struct
std::char_traits<char>,class std::allocator<char> >::str(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &)"},
+{"?str@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ",
"public: class std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > __thiscall std::basic_stringstream<char,struct
std::char_traits<char>,class std::allocator<char> >::str(void)const
"},
+{"?str@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z",
"public: void __thiscall std::basic_stringstream<unsigned short,struct
std::char_traits<unsigned short>,class std::allocator<unsigned short>
>::str(class std::basic_string<unsigned short,struct std::char_traits<unsigned
short>,class std::allocator<unsigned short> > const &)"},
+{"?str@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ",
"public: class std::basic_string<unsigned short,struct
std::char_traits<unsigned short>,class std::allocator<unsigned short> >
__thiscall std::basic_stringstream<unsigned short,struct std::char_traits<unsigned
short>,class std::allocator<unsigned short> >::str(void)const "},
+{"?_Sync@ios_base@std@@0_NA", "private: static bool
std::ios_base::_Sync"},
+{"??_U@YAPAXI@Z", "void * __cdecl operator new[](unsigned int)"},
+{"??_V@YAXPAX@Z", "void __cdecl operator delete[](void *)"},
+{"??X?$_Complex_base@M@std@@QAEAAV01@ABM@Z", "public: class
std::_Complex_base<float> & __thiscall
std::_Complex_base<float>::operator*=(float const &)"},
+{"??Xstd@@YAAAV?$complex@M@0@AAV10@ABV10@@Z", "class
std::complex<float> & __cdecl std::operator*=(class std::complex<float>
&,class std::complex<float> const &)"},
+{"?aaa@@YAHAAUbbb@@@Z", "int __cdecl aaa(struct bbb &)"},
+{"?aaa@@YAHBAUbbb@@@Z", "int __cdecl aaa(struct bbb &
volatile)"},
+{"?aaa@@YAHPAUbbb@@@Z", "int __cdecl aaa(struct bbb *)"},
+{"?aaa@@YAHQAUbbb@@@Z", "int __cdecl aaa(struct bbb * const)"},
+{"?aaa@@YAHRAUbbb@@@Z", "int __cdecl aaa(struct bbb * volatile)"},
+{"?aaa@@YAHSAUbbb@@@Z", "int __cdecl aaa(struct bbb * const
volatile)"},
+{"??0aa.a@@QAE@XZ", "??0aa.a@@QAE@XZ"},
+{"??0aa$_3a@@QAE@XZ", "public: __thiscall aa$_3a::aa$_3a(void)"},
+{"??2?$aaa@AAUbbb@@AAUccc@@AAU2@@ddd@1eee@2@QAEHXZ", "public: int
__thiscall eee::eee::ddd::ddd::aaa<struct bbb &,struct ccc &,struct ccc
&>::operator new(void)"},
+{"?pSW@@3P6GHKPAX0PAU_tagSTACKFRAME@@0P6GH0K0KPAK@ZP6GPAX0K@ZP6GK0K@ZP6GK00PAU_tagADDRESS@@@Z@ZA",
"int (__stdcall* pSW)(unsigned long,void *,void *,struct _tagSTACKFRAME *,void *,int
(__stdcall*)(void *,unsigned long,void *,unsigned long,unsigned long *),void *
(__stdcall*)(void *,unsigned long),unsigned long (__stdcall*)(void *,unsigned
long),unsigned long (__stdcall*)(void *,void *,struct _tagADDRESS *))"},
+ };
+ int i, num_test = (sizeof(test)/sizeof(test[0]));
+ char* name;
+
+ for (i = 0; i < num_test; i++)
+ {
+ name = p__unDName(0, test[i].in, 0, pmalloc, pfree, 0);
+ ok(name != NULL && !strcmp_space(test[i].out, name),
+ "Got name \"%s\" for %d\n", name, i);
+ pfree(name);
+ }
+}
+
START_TEST(cpp)
{
InitFunctionPtrs();
@@ -824,6 +996,8 @@
test___non_rtti_object();
test_type_info();
test_rtti();
+ test_demangle_datatype();
+ test_demangle();
if (hMsvcrt)
FreeLibrary(hMsvcrt);
Modified: trunk/reactos/regtests/winetests/msvcrt/environ.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/regtests/winetests/msvcrt/e…
==============================================================================
--- trunk/reactos/regtests/winetests/msvcrt/environ.c (original)
+++ trunk/reactos/regtests/winetests/msvcrt/environ.c Wed May 24 00:16:57 2006
@@ -23,16 +23,13 @@
START_TEST(environ)
{
-#ifndef __REACTOS__
- ok( _putenv("cat=") == 0, "_putenv failed on deletion of non-existent
environment variable\n" );
-#endif
+ ok( _putenv("cat=") == 0, "_putenv failed on deletion of nonexistent
environment variable\n" );
ok( _putenv("cat=dog") == 0, "failed setting cat=dog\n" );
ok( strcmp(getenv("cat"), "dog") == 0, "getenv did not
return 'dog'\n" );
ok( _putenv("cat=") == 0, "failed deleting cat\n" );
ok( _putenv("=") == -1, "should not accept '=' as
input\n" );
-#ifndef __REACTOS__
ok( _putenv("=dog") == -1, "should not accept '=dog' as
input\n" );
-#endif
+
ok( getenv("nonexistent") == NULL, "getenv should fail with
nonexistent var name\n" );
}
Modified: trunk/reactos/regtests/winetests/msvcrt/file.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/regtests/winetests/msvcrt/f…
==============================================================================
--- trunk/reactos/regtests/winetests/msvcrt/file.c (original)
+++ trunk/reactos/regtests/winetests/msvcrt/file.c Wed May 24 00:16:57 2006
@@ -2,6 +2,7 @@
* Unit test suite for file functions
*
* Copyright 2002 Bill Currie
+ * Copyright 2005 Paul Rupe
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -58,6 +59,8 @@
WCHAR wbuffer[256];
int fd;
FILE *file;
+ fpos_t pos;
+ int i, c;
fd = open ("fdopen.tst", O_WRONLY | O_CREAT | O_BINARY, _S_IREAD
|_S_IWRITE);
write (fd, outbuffer, sizeof (outbuffer));
@@ -71,10 +74,39 @@
ok(feof(file) !=0,"feof doesn't signal EOF\n");
rewind(file);
ok(fgets(buffer,strlen(outbuffer),file) !=0,"fgets failed unexpected\n");
- ok(lstrlenA(buffer) == strlen(outbuffer) -1,"fgets didn't read right
size\n");
+ ok(lstrlenA(buffer) == lstrlenA(outbuffer) -1,"fgets didn't read right
size\n");
ok(fgets(buffer,sizeof(outbuffer),file) !=0,"fgets failed unexpected\n");
ok(strlen(buffer) == 1,"fgets dropped chars\n");
ok(buffer[0] == outbuffer[strlen(outbuffer)-1],"fgets exchanged chars\n");
+
+ rewind(file);
+ for (i = 0, c = EOF; i < sizeof(outbuffer); i++)
+ {
+ ok((c = fgetc(file)) == outbuffer[i], "fgetc returned wrong data\n");
+ }
+ ok((c = fgetc(file)) == EOF, "getc did not return EOF\n");
+ ok(feof(file), "feof did not return EOF\n");
+ ok(ungetc(c, file) == EOF, "ungetc(EOF) did not return EOF\n");
+ ok(feof(file), "feof after ungetc(EOF) did not return EOF\n");
+ ok((c = fgetc(file)) == EOF, "getc did not return EOF\n");
+ c = outbuffer[sizeof(outbuffer) - 1];
+ ok(ungetc(c, file) == c, "ungetc did not return its input\n");
+ ok(!feof(file), "feof after ungetc returned EOF\n");
+ ok((c = fgetc(file)) != EOF, "getc after ungetc returned EOF\n");
+ ok(c == outbuffer[sizeof(outbuffer) - 1],
+ "getc did not return ungetc'd data\n");
+ ok(!feof(file), "feof after getc returned EOF prematurely\n");
+ ok((c = fgetc(file)) == EOF, "getc did not return EOF\n");
+ ok(feof(file), "feof after getc did not return EOF\n");
+
+ rewind(file);
+ ok(fgetpos(file,&pos) == 0, "fgetpos failed unexpected\n");
+ ok(pos == 0, "Unexpected result of fgetpos 0x%Lx\n", pos);
+ pos = (ULONGLONG)sizeof (outbuffer);
+ ok(fsetpos(file, &pos) == 0, "fsetpos failed unexpected\n");
+ ok(fgetpos(file,&pos) == 0, "fgetpos failed unexpected\n");
+ ok(pos == (ULONGLONG)sizeof (outbuffer), "Unexpected result of fgetpos
0x%Lx\n", pos);
+
fclose (file);
fd = open ("fdopen.tst", O_RDONLY | O_TEXT);
file = fdopen (fd, "rt"); /* open in TEXT mode */
@@ -83,10 +115,19 @@
ok(feof(file) !=0,"feof doesn't signal EOF\n");
rewind(file);
ok(fgetws(wbuffer,strlen(outbuffer),file) !=0,"fgetws failed
unexpected\n");
- ok(lstrlenW(wbuffer) == (strlen(outbuffer) -1),"fgetws didn't read right
size\n");
+ ok(lstrlenW(wbuffer) == (lstrlenA(outbuffer) -1),"fgetws didn't read right
size\n");
ok(fgetws(wbuffer,sizeof(outbuffer),file) !=0,"fgets failed
unexpected\n");
ok(lstrlenW(wbuffer) == 1,"fgets dropped chars\n");
fclose (file);
+
+ file = fopen("fdopen.tst", "rb");
+ ok( file != NULL, "fopen failed\n");
+ /* sizeof(buffer) > content of file */
+ ok(fread(buffer, sizeof(buffer), 1, file) == 0, "fread test failed\n");
+ /* feof should be set now */
+ ok(feof(file), "feof after fread failed\n");
+ fclose (file);
+
unlink ("fdopen.tst");
}
@@ -187,10 +228,12 @@
static const char mytext[]= "This is test_file_write_read\nsecond line\n";
static const char dostext[]= "This is test_file_write_read\r\nsecond
line\r\n";
char btext[LLEN];
+ int ret;
tempf=_tempnam(".","wne");
- ok((tempfd = _open(tempf,_O_CREAT|_O_TRUNC|_O_TEXT|_O_RDWR,
- _S_IREAD | _S_IWRITE)) != -1,
+ tempfd = _open(tempf,_O_CREAT|_O_TRUNC|_O_TEXT|_O_RDWR,
+ _S_IREAD | _S_IWRITE);
+ ok( tempfd != -1,
"Can't open '%s': %d\n", tempf, errno); /* open in TEXT mode
*/
ok(_write(tempfd,mytext,strlen(mytext)) == lstrlenA(mytext),
"_write _O_TEXT bad return value\n");
@@ -208,10 +251,34 @@
ok( memcmp(mytext,btext,strlen(mytext)) == 0,
"problems with _O_TEXT _write / _read\n");
_close(tempfd);
- ok(unlink(tempf) !=-1 ,"Can't unlink '%s': %d\n", tempf, errno);
+
+ memset(btext, 0, LLEN);
+ tempfd = _open(tempf,_O_APPEND|_O_RDWR); /* open for APPEND in default mode */
+ ok(tell(tempfd) == 0, "bad position %lu expecting 0\n", tell(tempfd));
+ ok(_read(tempfd,btext,LLEN) == lstrlenA(mytext), "_read _O_APPEND got bad
length\n");
+ ok( memcmp(mytext,btext,strlen(mytext)) == 0, "problems with _O_APPEND
_read\n");
+ _close(tempfd);
+
+ /* Test reading only \n or \r */
+ tempfd = _open(tempf,_O_RDONLY|_O_TEXT); /* open in TEXT mode */
+ _lseek(tempfd, -1, FILE_END);
+ ret = _read(tempfd,btext,LLEN);
+ ok(ret == 1, "_read expected 1 got bad length: %d\n", ret);
+ _lseek(tempfd, -2, FILE_END);
+ ret = _read(tempfd,btext,LLEN);
+ ok(ret == 1 && *btext == '\n', "_read expected '\\n' got
bad length: %d\n", ret);
+ _lseek(tempfd, -3, FILE_END);
+ ret = _read(tempfd,btext,2);
+ todo_wine ok(ret == 1 && *btext == 'e', "_read expected
'e' got \"%.*s\" bad length: %d\n", ret, btext, ret);
+ todo_wine ok(tell(tempfd) == 42, "bad position %lu expecting 42\n",
tell(tempfd));
+ _close(tempfd);
+
+ ret = unlink(tempf);
+ ok( ret == 0 ,"Can't unlink '%s': %d\n", tempf, errno);
tempf=_tempnam(".","wne");
- ok((tempfd = _open(tempf,_O_CREAT|_O_TRUNC|_O_BINARY|_O_RDWR,0)) != -1,
+ tempfd = _open(tempf,_O_CREAT|_O_TRUNC|_O_BINARY|_O_RDWR,0);
+ ok( tempfd != -1,
"Can't open '%s': %d\n", tempf, errno); /* open in BINARY mode
*/
ok(_write(tempfd,dostext,strlen(dostext)) == lstrlenA(dostext),
"_write _O_BINARY bad return value\n");
@@ -230,17 +297,21 @@
"problems with _O_BINARY _write / _O_TEXT _read\n");
_close(tempfd);
- ok(_chmod (tempf, _S_IREAD | _S_IWRITE) == 0,
+ ret =_chmod (tempf, _S_IREAD | _S_IWRITE);
+ ok( ret == 0,
"Can't chmod '%s' to read-write: %d\n", tempf, errno);
- ok(unlink(tempf) !=-1 ,"Can't unlink '%s': %d\n", tempf, errno);
+ ret = unlink(tempf);
+ ok( ret == 0 ,"Can't unlink '%s': %d\n", tempf, errno);
}
static void test_file_inherit_child(const char* fd_s)
{
int fd = atoi(fd_s);
char buffer[32];
-
- ok(write(fd, "Success", 8) == 8, "Couldn't write in child process
on %d (%s)\n", fd, strerror(errno));
+ int ret;
+
+ ret =write(fd, "Success", 8);
+ ok( ret == 8, "Couldn't write in child process on %d (%s)\n", fd,
strerror(errno));
lseek(fd, 0, SEEK_SET);
ok(read(fd, buffer, sizeof (buffer)) == 8, "Couldn't read back the
data\n");
ok(memcmp(buffer, "Success", 8) == 0, "Couldn't read back the
data\n");
@@ -249,8 +320,10 @@
static void test_file_inherit_child_no(const char* fd_s)
{
int fd = atoi(fd_s);
-
- ok(write(fd, "Success", 8) == -1 && errno == EBADF,
+ int ret;
+
+ ret = write(fd, "Success", 8);
+ ok( ret == -1 && errno == EBADF,
"Wrong write result in child process on %d (%s)\n", fd,
strerror(errno));
}
@@ -261,7 +334,7 @@
char buffer[16];
fd = open ("fdopen.tst", O_CREAT | O_RDWR | O_BINARY, _S_IREAD
|_S_IWRITE);
- ok(fd != -1, "Couldn't create test file\n ");
+ ok(fd != -1, "Couldn't create test file\n");
arg_v[0] = selfname;
arg_v[1] = "tests/file.c";
arg_v[2] = buffer; sprintf(buffer, "%d", fd);
@@ -271,10 +344,10 @@
lseek(fd, 0, SEEK_SET);
ok(read(fd, buffer, sizeof (buffer)) == 8 && memcmp(buffer,
"Success", 8) == 0, "Couldn't read back the data\n");
close (fd);
- ok(unlink("fdopen.tst") != 1, "Couldn't unlink\n");
+ ok(unlink("fdopen.tst") == 0, "Couldn't unlink\n");
fd = open ("fdopen.tst", O_CREAT | O_RDWR | O_BINARY | O_NOINHERIT,
_S_IREAD |_S_IWRITE);
- ok(fd != -1, "Couldn't create test file\n ");
+ ok(fd != -1, "Couldn't create test file\n");
arg_v[0] = selfname;
arg_v[1] = "tests/file.c";
arg_v[2] = buffer; sprintf(buffer, "%d", fd);
@@ -284,7 +357,7 @@
ok(tell(fd) == 0, "bad position %lu expecting 0\n", tell(fd));
ok(read(fd, buffer, sizeof (buffer)) == 0, "Found unexpected data (%s)\n",
buffer);
close (fd);
- ok(unlink("fdopen.tst") != 1, "Couldn't unlink\n");
+ ok(unlink("fdopen.tst") == 0, "Couldn't unlink\n");
}
static void test_tmpnam( void )
@@ -306,7 +379,90 @@
ok(res[strlen(res)-1] != '.', "second call - last character is a
dot\n");
}
-
+static void test_chsize( void )
+{
+ int fd;
+ long cur, pos, count;
+ char temptext[] = "012345678";
+ char *tempfile = _tempnam( ".", "tst" );
+
+ ok( tempfile != NULL, "Couldn't create test file: %s\n", tempfile );
+
+ fd = _open( tempfile, _O_CREAT|_O_TRUNC|_O_RDWR, _S_IREAD|_S_IWRITE );
+ ok( fd > 0, "Couldn't open test file\n" );
+
+ count = _write( fd, temptext, sizeof(temptext) );
+ ok( count > 0, "Couldn't write to test file\n" );
+
+ /* get current file pointer */
+ cur = _lseek( fd, 0, SEEK_CUR );
+
+ /* make the file smaller */
+ ok( _chsize( fd, sizeof(temptext) / 2 ) == 0, "_chsize() failed\n" );
+
+ pos = _lseek( fd, 0, SEEK_CUR );
+ ok( cur == pos, "File pointer changed from: %ld to: %ld\n", cur, pos );
+ ok( _filelength( fd ) == sizeof(temptext) / 2, "Wrong file size\n" );
+
+ /* enlarge the file */
+ ok( _chsize( fd, sizeof(temptext) * 2 ) == 0, "_chsize() failed\n" );
+
+ pos = _lseek( fd, 0, SEEK_CUR );
+ ok( cur == pos, "File pointer changed from: %ld to: %ld\n", cur, pos );
+ ok( _filelength( fd ) == sizeof(temptext) * 2, "Wrong file size\n" );
+
+ _close( fd );
+ _unlink( tempfile );
+}
+
+static void test_fopen_fclose_fcloseall( void )
+{
+ char fname1[] = "empty1";
+ char fname2[] = "empty2";
+ char fname3[] = "empty3";
+ FILE *stream1, *stream2, *stream3, *stream4;
+ int ret, numclosed;
+
+ /* testing fopen() */
+ stream1 = fopen(fname1, "w+");
+ ok(stream1 != NULL, "The file '%s' was not opened\n", fname1);
+ stream2 = fopen(fname2, "w ");
+ ok(stream2 != NULL, "The file '%s' was not opened\n", fname2 );
+ _unlink(fname3);
+ stream3 = fopen(fname3, "r");
+ ok(stream3 == NULL, "The file '%s' shouldn't exist before\n",
fname3 );
+ stream3 = fopen(fname3, "w+");
+ ok(stream3 != NULL, "The file '%s' should be opened now\n", fname3
);
+ errno = 0xfaceabad;
+ stream4 = fopen("", "w+");
+ ok(stream4 == NULL && errno == ENOENT,
+ "filename is empty, errno = %d (expected 2)\n", errno);
+ errno = 0xfaceabad;
+ stream4 = fopen(NULL, "w+");
+ ok(stream4 == NULL && (errno == EINVAL || errno == ENOENT),
+ "filename is NULL, errno = %d (expected 2 or 22)\n", errno);
+
+ /* testing fclose() */
+ ret = fclose(stream2);
+ ok(ret == 0, "The file '%s' was not closed\n", fname2);
+ ret = fclose(stream3);
+ ok(ret == 0, "The file '%s' was not closed\n", fname3);
+ ret = fclose(stream2);
+ ok(ret == EOF, "Closing file '%s' returned %d\n", fname2, ret);
+ ret = fclose(stream3);
+ ok(ret == EOF, "Closing file '%s' returned %d\n", fname3, ret);
+
+ /* testing fcloseall() */
+ numclosed = _fcloseall();
+ /* fname1 should be closed here */
+ ok(numclosed == 1, "Number of files closed by fcloseall(): %u\n",
numclosed);
+ numclosed = _fcloseall();
+ ok(numclosed == 0, "Number of files closed by fcloseall(): %u\n",
numclosed);
+
+ ok(_unlink(fname1) == 0, "Couldn't unlink file named '%s'\n",
fname1);
+ ok(_unlink(fname2) == 0, "Couldn't unlink file named '%s'\n",
fname2);
+ ok(_unlink(fname3) == 0, "Couldn't unlink file named '%s'\n",
fname3);
+}
START_TEST(file)
{
@@ -315,17 +471,22 @@
arg_c = winetest_get_mainargs( &arg_v );
+ /* testing low-level I/O */
if (arg_c >= 3)
{
- if (arg_c == 3) test_file_inherit_child(arg_v[2]); else
test_file_inherit_child_no(arg_v[2]);
+ if (arg_c == 3) test_file_inherit_child(arg_v[2]);
+ else test_file_inherit_child_no(arg_v[2]);
return;
}
-
+ test_file_inherit(arg_v[0]);
+ test_file_write_read();
+ test_chsize();
+
+ /* testing stream I/O */
test_fdopen();
+ test_fopen_fclose_fcloseall();
test_fileops();
test_fgetwc();
test_file_put_get();
- test_file_write_read();
- test_file_inherit(arg_v[0]);
test_tmpnam();
}
Modified: trunk/reactos/regtests/winetests/msvcrt/msvcrt.rbuild
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/regtests/winetests/msvcrt/m…
==============================================================================
--- trunk/reactos/regtests/winetests/msvcrt/msvcrt.rbuild (original)
+++ trunk/reactos/regtests/winetests/msvcrt/msvcrt.rbuild Wed May 24 00:16:57 2006
@@ -3,6 +3,7 @@
<define name="__USE_W32API" />
<library>ntdll</library>
<file>cpp.c</file>
+ <file>dir.c</file>
<file>environ.c</file>
<file>file.c</file>
<file>heap.c</file>
Modified: trunk/reactos/regtests/winetests/msvcrt/printf.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/regtests/winetests/msvcrt/p…
==============================================================================
--- trunk/reactos/regtests/winetests/msvcrt/printf.c (original)
+++ trunk/reactos/regtests/winetests/msvcrt/printf.c Wed May 24 00:16:57 2006
@@ -3,6 +3,7 @@
*
* Copyright 2002 Uwe Bonnes
* Copyright 2004 Aneurin Price
+ * Copyright 2005 Mike McCormack
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -26,54 +27,439 @@
static void test_sprintf( void )
{
char buffer[100];
- const char *I64d = "%I64d";
- const char *O4c = "%04c";
- const char *O4s = "%04s";
- const char *hash012p = "%#012p";
+ const char *format;
double pnumber=789456123;
-/** WCHAR
widestring[]={'w','i','d','e','s','t','r','i','n','g',0};**/
- sprintf(buffer,"%+#23.15e",pnumber);
- todo_wine
- {
- ok(strstr(buffer,"e+008") != 0,"Sprintf different
\"%s\"\n",buffer);
- }
- sprintf(buffer,I64d,((ULONGLONG)0xffffffff)*0xffffffff);
- todo_wine
- {
- ok(strlen(buffer) == 11,"Problem with long long
\"%s\"\n",buffer);
- }
- sprintf(buffer,"%lld",((ULONGLONG)0xffffffff)*0xffffffff);
- todo_wine
- {
- ok(strlen(buffer) == 1,"Problem with \"ll\" interpretation
\"%s\"\n",buffer);
- }
-/** This one actually crashes WINE at the moment, when using builtin msvcrt.dll.
- sprintf(buffer,"%S",widestring);
- todo_wine
- {
- ok(strlen(buffer) == 10,"Problem with \"%%S\" interpretation
\"%s\"\n",buffer);
- }
- **/
- sprintf(buffer,O4c,'1');
- todo_wine
- {
- ok(!strcmp(buffer,"0001"),"Character not zero-prefixed
\"%s\"\n",buffer);
- }
- sprintf(buffer,"%p",(void *)57);
- todo_wine
- {
- ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly
\"%s\"\n",buffer);
- }
- sprintf(buffer,hash012p,(void *)57);
- todo_wine
- {
- ok(!strcmp(buffer," 0X00000039"),"Pointer formatted incorrectly
\"%s\"\n",buffer);
- }
- sprintf(buffer,O4s,"foo");/**Warning again**/
- todo_wine
- {
- ok(!strcmp(buffer,"0foo"),"String not zero-prefixed
\"%s\"\n",buffer);
- }
+ int x, r;
+ WCHAR wide[] = { 'w','i','d','e',0};
+
+ format = "%+#23.15e";
+ r = sprintf(buffer,format,pnumber);
+ todo_wine {
+ ok(!strcmp(buffer,"+7.894561230000000e+008"),"exponent format
incorrect\n");
+ }
+ ok( r==23, "return count wrong\n");
+
+ format = "%I64d";
+ r = sprintf(buffer,format,((ULONGLONG)0xffffffff)*0xffffffff);
+ ok(!strcmp(buffer,"-8589934591"),"Problem with long long\n");
+ ok( r==11, "return count wrong\n");
+
+ format = "%+8I64d";
+ r = sprintf(buffer,format,(LONGLONG)100);
+ ok(!strcmp(buffer," +100") && r==8,"+8I64d failed:
'%s'\n", buffer);
+
+ format = "%+.8I64d";
+ r = sprintf(buffer,format,(LONGLONG)100);
+ ok(!strcmp(buffer,"+00000100") && r==9,"+.8I64d failed:
'%s'\n", buffer);
+
+ format = "%+10.8I64d";
+ r = sprintf(buffer,format,(LONGLONG)100);
+ ok(!strcmp(buffer," +00000100") && r==10,"+10.8I64d failed:
'%s'\n", buffer);
+ format = "%_1I64d";
+ r = sprintf(buffer,format,(LONGLONG)100);
+ ok(!strcmp(buffer,"_1I64d") && r==6,"_1I64d failed\n");
+
+ format = "%-1.5I64d";
+ r = sprintf(buffer,format,(LONGLONG)-100);
+ ok(!strcmp(buffer,"-00100") && r==6,"-1.5I64d failed:
'%s'\n", buffer);
+
+ format = "%5I64d";
+ r = sprintf(buffer,format,(LONGLONG)100);
+ ok(!strcmp(buffer," 100") && r==5,"5I64d failed:
'%s'\n", buffer);
+
+ format = "%5I64d";
+ r = sprintf(buffer,format,(LONGLONG)-100);
+ ok(!strcmp(buffer," -100") && r==5,"5I64d failed:
'%s'\n", buffer);
+
+ format = "%-5I64d";
+ r = sprintf(buffer,format,(LONGLONG)100);
+ ok(!strcmp(buffer,"100 ") && r==5,"-5I64d failed:
'%s'\n", buffer);
+
+ format = "%-5I64d";
+ r = sprintf(buffer,format,(LONGLONG)-100);
+ ok(!strcmp(buffer,"-100 ") && r==5,"-5I64d failed:
'%s'\n", buffer);
+
+ format = "%-.5I64d";
+ r = sprintf(buffer,format,(LONGLONG)100);
+ ok(!strcmp(buffer,"00100") && r==5,"-.5I64d failed:
'%s'\n", buffer);
+
+ format = "%-.5I64d";
+ r = sprintf(buffer,format,(LONGLONG)-100);
+ ok(!strcmp(buffer,"-00100") && r==6,"-.5I64d failed:
'%s'\n", buffer);
+
+ format = "%-8.5I64d";
+ r = sprintf(buffer,format,(LONGLONG)100);
+ ok(!strcmp(buffer,"00100 ") && r==8,"-8.5I64d failed:
'%s'\n", buffer);
+
+ format = "%-8.5I64d";
+ r = sprintf(buffer,format,(LONGLONG)-100);
+ ok(!strcmp(buffer,"-00100 ") && r==8,"-8.5I64d failed:
'%s'\n", buffer);
+
+ format = "%05I64d";
+ r = sprintf(buffer,format,(LONGLONG)100);
+ ok(!strcmp(buffer,"00100") && r==5,"05I64d failed:
'%s'\n", buffer);
+
+ format = "%05I64d";
+ r = sprintf(buffer,format,(LONGLONG)-100);
+ ok(!strcmp(buffer,"-0100") && r==5,"05I64d failed:
'%s'\n", buffer);
+
+ format = "% I64d";
+ r = sprintf(buffer,format,(LONGLONG)100);
+ ok(!strcmp(buffer," 100") && r==4,"' I64d' failed:
'%s'\n", buffer);
+
+ format = "% I64d";
+ r = sprintf(buffer,format,(LONGLONG)-100);
+ ok(!strcmp(buffer,"-100") && r==4,"' I64d' failed:
'%s'\n", buffer);
+
+ format = "% 5I64d";
+ r = sprintf(buffer,format,(LONGLONG)100);
+ ok(!strcmp(buffer," 100") && r==5,"' 5I64d' failed:
'%s'\n", buffer);
+
+ format = "% 5I64d";
+ r = sprintf(buffer,format,(LONGLONG)-100);
+ ok(!strcmp(buffer," -100") && r==5,"' 5I64d' failed:
'%s'\n", buffer);
+
+ format = "% .5I64d";
+ r = sprintf(buffer,format,(LONGLONG)100);
+ ok(!strcmp(buffer," 00100") && r==6,"' .5I64d' failed:
'%s'\n", buffer);
+
+ format = "% .5I64d";
+ r = sprintf(buffer,format,(LONGLONG)-100);
+ ok(!strcmp(buffer,"-00100") && r==6,"' .5I64d' failed:
'%s'\n", buffer);
+
+ format = "% 8.5I64d";
+ r = sprintf(buffer,format,(LONGLONG)100);
+ ok(!strcmp(buffer," 00100") && r==8,"' 8.5I64d'
failed: '%s'\n", buffer);
+
+ format = "% 8.5I64d";
+ r = sprintf(buffer,format,(LONGLONG)-100);
+ ok(!strcmp(buffer," -00100") && r==8,"' 8.5I64d'
failed: '%s'\n", buffer);
+
+ format = "%.0I64d";
+ r = sprintf(buffer,format,(LONGLONG)0);
+ ok(r==0,".0I64d failed: '%s'\n", buffer);
+
+ format = "%#+21.18I64x";
+ r = sprintf(buffer,format,(LONGLONG)-100);
+ ok(!strcmp(buffer," 0x00ffffffffffffff9c") &&
r==21,"#+21.18I64x failed: '%s'\n", buffer);
+
+ format = "%#.25I64o";
+ r = sprintf(buffer,format,(LONGLONG)-100);
+ ok(!strcmp(buffer,"0001777777777777777777634") &&
r==25,"#.25I64o failed: '%s'\n", buffer);
+
+ format = "%#+24.20I64o";
+ r = sprintf(buffer,format,(LONGLONG)-100);
+ ok(!strcmp(buffer," 01777777777777777777634") &&
r==24,"#+24.20I64o failed: '%s'\n", buffer);
+
+ format = "%#+18.21I64X";
+ r = sprintf(buffer,format,(LONGLONG)-100);
+ ok(!strcmp(buffer,"0X00000FFFFFFFFFFFFFF9C") &&
r==23,"#+18.21I64X failed: '%s '\n", buffer);
+
+ format = "%#+20.24I64o";
+ r = sprintf(buffer,format,(LONGLONG)-100);
+ ok(!strcmp(buffer,"001777777777777777777634") &&
r==24,"#+20.24I64o failed: '%s'\n", buffer);
+
+ format = "%#+25.22I64u";
+ r = sprintf(buffer,format,(LONGLONG)-1);
+ ok(!strcmp(buffer," 0018446744073709551615") &&
r==25,"#+25.22I64u conversion failed: '%s'\n", buffer);
+
+ format = "%#+25.22I64u";
+ r = sprintf(buffer,format,(LONGLONG)-1);
+ ok(!strcmp(buffer," 0018446744073709551615") &&
r==25,"#+25.22I64u failed: '%s'\n", buffer);
+
+ format = "%#+30.25I64u";
+ r = sprintf(buffer,format,(LONGLONG)-1);
+ ok(!strcmp(buffer," 0000018446744073709551615") &&
r==30,"#+30.25I64u failed: '%s'\n", buffer);
+
+ format = "%+#25.22I64d";
+ r = sprintf(buffer,format,(LONGLONG)-1);
+ ok(!strcmp(buffer," -0000000000000000000001") &&
r==25,"+#25.22I64d failed: '%s'\n", buffer);
+
+ format = "%#-8.5I64o";
+ r = sprintf(buffer,format,(LONGLONG)100);
+ ok(!strcmp(buffer,"00144 ") && r==8,"-8.5I64o failed:
'%s'\n", buffer);
+
+ format = "%#-+ 08.5I64d";
+ r = sprintf(buffer,format,(LONGLONG)100);
+ ok(!strcmp(buffer,"+00100 ") && r==8,"'#-+ 08.5I64d
failed: '%s'\n", buffer);
+
+ format = "%#-+ 08.5I64d";
+ r = sprintf(buffer,format,(LONGLONG)100);
+ ok(!strcmp(buffer,"+00100 ") && r==8,"#-+ 08.5I64d failed:
'%s'\n", buffer);
+
+ format = "%lld";
+ r = sprintf(buffer,format,((ULONGLONG)0xffffffff)*0xffffffff);
+ ok(!strcmp(buffer, "1"), "Problem with \"ll\"
interpretation\n");
+ ok( r==1, "return count wrong\n");
+
+ format = "%I";
+ r = sprintf(buffer,format,1);
+ ok(!strcmp(buffer, "I"), "Problem with \"I\"
interpretation\n");
+ ok( r==1, "return count wrong\n");
+
+ format = "%I0d";
+ r = sprintf(buffer,format,1);
+ ok(!strcmp(buffer,"I0d"),"I0d failed\n");
+ ok( r==3, "return count wrong\n");
+
+ format = "%I32d";
+ r = sprintf(buffer,format,1);
+ ok(!strcmp(buffer,"1"),"I32d failed\n");
+ ok( r==1, "return count wrong\n");
+
+ format = "%I64D";
+ r = sprintf(buffer,format,(LONGLONG)-1);
+ ok(!strcmp(buffer,"D"),"I64D failed: %s\n",buffer);
+ ok( r==1, "return count wrong\n");
+
+ format = "% d";
+ r = sprintf(buffer,format,1);
+ ok(!strcmp(buffer, " 1"),"Problem with sign place-holder:
'%s'\n",buffer);
+ ok( r==2, "return count wrong\n");
+
+ format = "%+ d";
+ r = sprintf(buffer,format,1);
+ ok(!strcmp(buffer, "+1"),"Problem with sign flags:
'%s'\n",buffer);
+ ok( r==2, "return count wrong\n");
+
+ format = "%S";
+ r = sprintf(buffer,format,wide);
+ ok(!strcmp(buffer,"wide"),"Problem with wide string format\n");
+ ok( r==4, "return count wrong\n");
+
+ format = "%04c";
+ r = sprintf(buffer,format,'1');
+ ok(!strcmp(buffer,"0001"),"Character not zero-prefixed
\"%s\"\n",buffer);
+ ok( r==4, "return count wrong\n");
+
+ format = "%-04c";
+ r = sprintf(buffer,format,'1');
+ ok(!strcmp(buffer,"1 "),"Character zero-padded and/or not
left-adjusted \"%s\"\n",buffer);
+ ok( r==4, "return count wrong\n");
+
+ format = "%p";
+ r = sprintf(buffer,format,(void *)57);
+ ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly
\"%s\"\n",buffer);
+ ok( r==8, "return count wrong\n");
+
+ format = "%#012p";
+ r = sprintf(buffer,format,(void *)57);
+ ok(!strcmp(buffer," 0X00000039"),"Pointer formatted
incorrectly\n");
+ ok( r==12, "return count wrong\n");
+
+ format = "%Fp";
+ r = sprintf(buffer,format,(void *)57);
+ ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly
\"%s\"\n",buffer);
+ ok( r==8, "return count wrong\n");
+
+ format = "%04s";
+ r = sprintf(buffer,format,"foo");
+ ok(!strcmp(buffer,"0foo"),"String not zero-prefixed
\"%s\"\n",buffer);
+ ok( r==4, "return count wrong\n");
+
+ format = "%.1s";
+ r = sprintf(buffer,format,"foo");
+ ok(!strcmp(buffer,"f"),"Precision ignored
\"%s\"\n",buffer);
+ ok( r==1, "return count wrong\n");
+
+ format = "%.*s";
+ r = sprintf(buffer,format,1,"foo");
+ ok(!strcmp(buffer,"f"),"Precision ignored
\"%s\"\n",buffer);
+ ok( r==1, "return count wrong\n");
+
+ format = "%#-012p";
+ r = sprintf(buffer,format,(void *)57);
+ ok(!strcmp(buffer,"0X00000039 "),"Pointer formatted
incorrectly\n");
+ ok( r==12, "return count wrong\n");
+
+ format = "hello";
+ r = sprintf(buffer, format);
+ ok(!strcmp(buffer,"hello"), "failed\n");
+ ok( r==5, "return count wrong\n");
+
+ format = "%ws";
+ r = sprintf(buffer, format, wide);
+ ok(!strcmp(buffer,"wide"), "failed\n");
+ ok( r==4, "return count wrong\n");
+
+ format = "%-10ws";
+ r = sprintf(buffer, format, wide );
+ ok(!strcmp(buffer,"wide "), "failed\n");
+ ok( r==10, "return count wrong\n");
+
+ format = "%10ws";
+ r = sprintf(buffer, format, wide );
+ ok(!strcmp(buffer," wide"), "failed\n");
+ ok( r==10, "return count wrong\n");
+
+ format = "%#+ -03whlls";
+ r = sprintf(buffer, format, wide );
+ ok(!strcmp(buffer,"wide"), "failed\n");
+ ok( r==4, "return count wrong\n");
+
+ format = "%w0s";
+ r = sprintf(buffer, format, wide );
+ ok(!strcmp(buffer,"0s"), "failed\n");
+ ok( r==2, "return count wrong\n");
+
+ format = "%w-s";
+ r = sprintf(buffer, format, wide );
+ ok(!strcmp(buffer,"-s"), "failed\n");
+ ok( r==2, "return count wrong\n");
+
+ format = "%ls";
+ r = sprintf(buffer, format, wide );
+ ok(!strcmp(buffer,"wide"), "failed\n");
+ ok( r==4, "return count wrong\n");
+
+ format = "%Ls";
+ r = sprintf(buffer, format, "not wide" );
+ ok(!strcmp(buffer,"not wide"), "failed\n");
+ ok( r==8, "return count wrong\n");
+
+ format = "%b";
+ r = sprintf(buffer, format);
+ ok(!strcmp(buffer,"b"), "failed\n");
+ ok( r==1, "return count wrong\n");
+
+ format = "%3c";
+ r = sprintf(buffer, format,'a');
+ ok(!strcmp(buffer," a"), "failed\n");
+ ok( r==3, "return count wrong\n");
+
+ format = "%3d";
+ r = sprintf(buffer, format,1234);
+ ok(!strcmp(buffer,"1234"), "failed\n");
+ ok( r==4, "return count wrong\n");
+
+ format = "%3h";
+ r = sprintf(buffer, format);
+ ok(!strcmp(buffer,""), "failed\n");
+ ok( r==0, "return count wrong\n");
+
+ format = "%j%k%m%q%r%t%v%y%z";
+ r = sprintf(buffer, format);
+ ok(!strcmp(buffer,"jkmqrtvyz"), "failed\n");
+ ok( r==9, "return count wrong\n");
+
+ format = "asdf%n";
+ x = 0;
+ r = sprintf(buffer, format, &x );
+ ok(x == 4, "should write to x\n");
+ ok(!strcmp(buffer,"asdf"), "failed\n");
+ ok( r==4, "return count wrong\n");
+
+ format = "%-1d";
+ r = sprintf(buffer, format,2);
+ ok(!strcmp(buffer,"2"), "failed\n");
+ ok( r==1, "return count wrong\n");
+
+ format = "%2.4f";
+ r = sprintf(buffer, format,8.6);
+ ok(!strcmp(buffer,"8.6000"), "failed\n");
+ ok( r==6, "return count wrong\n");
+
+ format = "%0f";
+ r = sprintf(buffer, format,0.6);
+ ok(!strcmp(buffer,"0.600000"), "failed\n");
+ ok( r==8, "return count wrong\n");
+
+ format = "%.0f";
+ r = sprintf(buffer, format,0.6);
+ ok(!strcmp(buffer,"1"), "failed\n");
+ ok( r==1, "return count wrong\n");
+
+ todo_wine {
+ format = "%2.4e";
+ r = sprintf(buffer, format,8.6);
+ ok(!strcmp(buffer,"8.6000e+000"), "failed\n");
+ ok( r==11, "return count wrong\n");
+ }
+
+ format = "%2.4g";
+ r = sprintf(buffer, format,8.6);
+ ok(!strcmp(buffer,"8.6"), "failed\n");
+ ok( r==3, "return count wrong\n");
+
+ format = "%-i";
+ r = sprintf(buffer, format,-1);
+ ok(!strcmp(buffer,"-1"), "failed\n");
+ ok( r==2, "return count wrong\n");
+
+ format = "%-i";
+ r = sprintf(buffer, format,1);
+ ok(!strcmp(buffer,"1"), "failed\n");
+ ok( r==1, "return count wrong\n");
+
+ format = "%+i";
+ r = sprintf(buffer, format,1);
+ ok(!strcmp(buffer,"+1"), "failed\n");
+ ok( r==2, "return count wrong\n");
+
+ format = "%o";
+ r = sprintf(buffer, format,10);
+ ok(!strcmp(buffer,"12"), "failed\n");
+ ok( r==2, "return count wrong\n");
+
+ format = "%p";
+ r = sprintf(buffer, format,0);
+ ok(!strcmp(buffer,"00000000"), "failed\n");
+ ok( r==8, "return count wrong\n");
+
+ format = "%s";
+ r = sprintf(buffer, format,0);
+ ok(!strcmp(buffer,"(null)"), "failed\n");
+ ok( r==6, "return count wrong\n");
+
+ format = "%s";
+ r = sprintf(buffer, format,"%%%%");
+ ok(!strcmp(buffer,"%%%%"), "failed\n");
+ ok( r==4, "return count wrong\n");
+
+ format = "%u";
+ r = sprintf(buffer, format,-1);
+ ok(!strcmp(buffer,"4294967295"), "failed\n");
+ ok( r==10, "return count wrong\n");
+
+ format = "%w";
+ r = sprintf(buffer, format,-1);
+ ok(!strcmp(buffer,""), "failed\n");
+ ok( r==0, "return count wrong\n");
+
+ format = "%h";
+ r = sprintf(buffer, format,-1);
+ ok(!strcmp(buffer,""), "failed\n");
+ ok( r==0, "return count wrong\n");
+
+ format = "%z";
+ r = sprintf(buffer, format,-1);
+ ok(!strcmp(buffer,"z"), "failed\n");
+ ok( r==1, "return count wrong\n");
+
+ format = "%j";
+ r = sprintf(buffer, format,-1);
+ ok(!strcmp(buffer,"j"), "failed\n");
+ ok( r==1, "return count wrong\n");
+
+ format = "%F";
+ r = sprintf(buffer, format,-1);
+ ok(!strcmp(buffer,""), "failed\n");
+ ok( r==0, "return count wrong\n");
+
+ format = "%H";
+ r = sprintf(buffer, format,-1);
+ ok(!strcmp(buffer,"H"), "failed\n");
+ ok( r==1, "return count wrong\n");
+
+ format = "x%cx";
+ r = sprintf(buffer, format, 0x100+'X');
+ ok(!strcmp(buffer,"xXx"), "failed\n");
+ ok( r==3, "return count wrong\n");
+
+ format = "%%0";
+ r = sprintf(buffer, format);
+ ok(!strcmp(buffer,"%0"), "failed: \"%s\"\n", buffer);
+ ok( r==2, "return count wrong\n");
}
static void test_swprintf( void )
@@ -91,10 +477,7 @@
ok(wcsstr(buffer,e008) != 0,"Sprintf different\n");
}
swprintf(buffer,I64d,((ULONGLONG)0xffffffff)*0xffffffff);
- todo_wine
- {
- ok(wcslen(buffer) == 11,"Problem with long long\n");
- }
+ ok(wcslen(buffer) == 11,"Problem with long long\n");
swprintf(buffer,S,string);
ok(wcslen(buffer) == 6,"Problem with \"%%S\"
interpretation\n");
}
@@ -113,16 +496,12 @@
struct snprintf_test {
const char *format;
int expected;
- struct {
- int retval;
- int render;
- } todo;
};
/* Pre-2.1 libc behaviour, not C99 compliant. */
- const struct snprintf_test tests[] = {{"short", 5, {0, 0}},
- {"justfit", 7, {0, 0}},
- {"justfits", 8, {0, 1}},
- {"muchlonger", -1, {1, 1}}};
+ const struct snprintf_test tests[] = {{"short", 5},
+ {"justfit", 7},
+ {"justfits", 8},
+ {"muchlonger", -1}};
char buffer[8];
const int bufsiz = sizeof buffer;
unsigned int i;
@@ -133,13 +512,59 @@
const int n = _snprintf (buffer, bufsiz, fmt);
const int valid = n < 0 ? bufsiz : (n == bufsiz ? n : n+1);
- todo (tests[i].todo.retval ? "wine" : "none")
- ok (n == expect, "\"%s\": expected %d, returned %d\n",
- fmt, expect, n);
- todo (tests[i].todo.render ? "wine" : "none")
- ok (!memcmp (fmt, buffer, valid),
- "\"%s\": rendered \"%.*s\"\n", fmt, valid,
buffer);
+ ok (n == expect, "\"%s\": expected %d, returned %d\n",
+ fmt, expect, n);
+ ok (!memcmp (fmt, buffer, valid),
+ "\"%s\": rendered \"%.*s\"\n", fmt, valid,
buffer);
};
+}
+
+static void test_fcvt(void)
+{
+ char *str;
+ int dec=100, sign=100;
+
+ str = _fcvt(0.0001, 1, &dec, &sign );
+ todo_wine {
+ ok( 0 == strcmp(str,""), "bad return\n");
+ ok( -3 == dec, "dec wrong\n");
+ }
+ ok( 0 == sign, "dec wrong\n");
+
+ str = _fcvt(0.0001, -10, &dec, &sign );
+ todo_wine {
+ ok( 0 == strcmp(str,""), "bad return\n");
+ ok( -3 == dec, "dec wrong\n");
+ }
+ ok( 0 == sign, "dec wrong\n");
+
+ str = _fcvt(0.0001, 10, &dec, &sign );
+ todo_wine {
+ ok( 0 == strcmp(str,"1000000"), "bad return\n");
+ ok( -3 == dec, "dec wrong\n");
+ }
+ ok( 0 == sign, "dec wrong\n");
+
+ str = _fcvt(-111.0001, 5, &dec, &sign );
+ todo_wine {
+ ok( 0 == strcmp(str,"11100010"), "bad return\n");
+ ok( 3 == dec, "dec wrong\n");
+ }
+ ok( 1 == sign, "dec wrong\n");
+
+ str = _fcvt(111.0001, 5, &dec, &sign );
+ todo_wine {
+ ok( 0 == strcmp(str,"11100010"), "bad return\n");
+ ok( 3 == dec, "dec wrong\n");
+ }
+ ok( 0 == sign, "dec wrong\n");
+
+ str = _fcvt(0.0, 5, &dec, &sign );
+ todo_wine {
+ ok( 0 == strcmp(str,"00000"), "bad return\n");
+ ok( 0 == dec, "dec wrong\n");
+ }
+ ok( 0 == sign, "dec wrong\n");
}
START_TEST(printf)
@@ -148,4 +573,5 @@
test_swprintf();
test_fwprintf();
test_snprintf();
+ test_fcvt();
}
Modified: trunk/reactos/regtests/winetests/msvcrt/scanf.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/regtests/winetests/msvcrt/s…
==============================================================================
--- trunk/reactos/regtests/winetests/msvcrt/scanf.c (original)
+++ trunk/reactos/regtests/winetests/msvcrt/scanf.c Wed May 24 00:16:57 2006
@@ -27,6 +27,7 @@
char buffer[100], buffer1[100];
char format[20];
int result, ret;
+ char c;
float res1= -82.6267f, res2= 27.76f, res11, res12;
static const char pname[]=" St. Petersburg, Florida\n";
int hour=21,min=59,sec=20;
@@ -90,11 +91,40 @@
/* Check %i according to bug 1878 */
strcpy(buffer,"123");
ret = sscanf(buffer, "%i", &result);
- ok( ret == 1 , "Wrong number of arguments read\n");
+ ok(ret == 1, "Wrong number of arguments read: %d\n", ret);
ok(result == 123, "Wrong number read\n");
ret = sscanf(buffer, "%d", &result);
- ok( ret == 1 , "Wrong number of arguments read\n");
+ ok(ret == 1, "Wrong number of arguments read: %d\n", ret);
ok(result == 123, "Wrong number read\n");
+
+ /* Check %c */
+ strcpy(buffer,"a");
+ c = 0x55;
+ ret = sscanf(buffer, "%c", &c);
+ ok(ret == 1, "Wrong number of arguments read: %d\n", ret);
+ ok(c == 'a', "Field incorrect: '%c'\n", c);
+
+ strcpy(buffer," a");
+ c = 0x55;
+ ret = sscanf(buffer, "%c", &c);
+ ok(ret == 1, "Wrong number of arguments read: %d\n", ret);
+ ok(c == ' ', "Field incorrect: '%c'\n", c);
+
+ strcpy(buffer,"18:59");
+ c = 0x55;
+ ret = sscanf(buffer, "%d:%d%c", &hour, &min, &c);
+ ok(ret == 2, "Wrong number of arguments read: %d\n", ret);
+ ok(hour == 18, "Field 1 incorrect: %d\n", hour);
+ ok(min == 59, "Field 2 incorrect: %d\n", min);
+ ok(c == 0x55, "Field 3 incorrect: 0x%02x\n", c);
+
+ /* Check %n (also whitespace in format strings and %s) */
+ buffer[0]=0; buffer1[0]=0;
+ ret = sscanf("abc def", "%s %n%s", buffer, &number_so_far,
buffer1);
+ ok(strcmp(buffer, "abc")==0, "First %%s read incorrectly: %s\n",
buffer);
+ ok(strcmp(buffer1,"def")==0, "Second %%s read incorrectly: %s\n",
buffer1);
+ ok(number_so_far==6, "%%n yielded wrong result: %d\n", number_so_far);
+ ok(ret == 2, "%%n shouldn't count as a conversion: %d\n", ret);
}
START_TEST(scanf)
Modified: trunk/reactos/regtests/winetests/msvcrt/string.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/regtests/winetests/msvcrt/s…
==============================================================================
--- trunk/reactos/regtests/winetests/msvcrt/string.c (original)
+++ trunk/reactos/regtests/winetests/msvcrt/string.c Wed May 24 00:16:57 2006
@@ -21,7 +21,9 @@
#include "wine/test.h"
#include "winbase.h"
#include <string.h>
+#include <mbstring.h>
#include <stdlib.h>
+#include <mbctype.h>
static void* (*pmemcpy)(void *, const void *, size_t n);
static int* (*pmemcmp)(void *, const void *, size_t n);
@@ -29,6 +31,73 @@
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(hMsvcrt,y)
#define SET(x,y) SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not
found\n", y)
+static void test_swab( void ) {
+ char original[] = "BADCFEHGJILKNMPORQTSVUXWZY@#";
+ char expected1[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ@#";
+ char expected2[] = "ABCDEFGHIJKLMNOPQRSTUVWX$";
+ char expected3[] = "$";
+
+ char from[30];
+ char to[30];
+
+ int testsize;
+
+ /* Test 1 - normal even case */
+ memset(to,'$', sizeof(to));
+ memset(from,'@', sizeof(from));
+ testsize = 26;
+ memcpy(from, original, testsize);
+ _swab( from, to, testsize );
+ ok(memcmp(to,expected1,testsize) == 0, "Testing even size %d returned
'%*.*s'\n", testsize, testsize, testsize, to);
+
+ /* Test 2 - uneven case */
+ memset(to,'$', sizeof(to));
+ memset(from,'@', sizeof(from));
+ testsize = 25;
+ memcpy(from, original, testsize);
+ _swab( from, to, testsize );
+ ok(memcmp(to,expected2,testsize) == 0, "Testing odd size %d returned
'%*.*s'\n", testsize, testsize, testsize, to);
+
+ /* Test 3 - from = to */
+ memset(to,'$', sizeof(to));
+ memset(from,'@', sizeof(from));
+ testsize = 26;
+ memcpy(to, original, testsize);
+ _swab( to, to, testsize );
+ ok(memcmp(to,expected1,testsize) == 0, "Testing overlapped size %d returned
'%*.*s'\n", testsize, testsize, testsize, to);
+
+ /* Test 4 - 1 bytes */
+ memset(to,'$', sizeof(to));
+ memset(from,'@', sizeof(from));
+ testsize = 1;
+ memcpy(from, original, testsize);
+ _swab( from, to, testsize );
+ ok(memcmp(to,expected3,testsize) == 0, "Testing small size %d returned
'%*.*s'\n", testsize, testsize, testsize, to);
+}
+
+void test_ismbblead(void)
+{
+ unsigned int s = '\354';
+
+ _setmbcp(936);
+ todo_wine ok(_ismbblead(s), "got result %d\n", _ismbblead(s));
+ _setmbcp(1252);
+}
+
+static void test_mbsspn( void)
+{
+ unsigned char str1[]="cabernet";
+ unsigned char str2[]="shiraz";
+ unsigned char set[]="abc";
+ unsigned char empty[]="";
+ int ret;
+ ret=_mbsspn( str1, set);
+ ok( ret==3, "_mbsspn returns %d should be 3\n", ret);
+ ret=_mbsspn( str2, set);
+ ok( ret==0, "_mbsspn returns %d should be 0\n", ret);
+ ret=_mbsspn( str1, empty);
+ ok( ret==0, "_mbsspn returns %d should be 0\n", ret);
+}
START_TEST(string)
{
@@ -48,4 +117,12 @@
pmemcpy((char*)mem+5, mem,nLen+1);
ok(pmemcmp((char*)mem+5,xilstring, nLen) == 0,
"Got result %s\n",(char*)mem+5);
+
+ /* Test _swab function */
+ test_swab();
+
+ /* Test ismbblead*/
+ test_ismbblead();
+ /* test _mbsspn */
+ test_mbsspn();
}
Modified: trunk/reactos/regtests/winetests/msvcrt/testlist.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/regtests/winetests/msvcrt/t…
==============================================================================
--- trunk/reactos/regtests/winetests/msvcrt/testlist.c (original)
+++ trunk/reactos/regtests/winetests/msvcrt/testlist.c Wed May 24 00:16:57 2006
@@ -8,6 +8,7 @@
#include "winbase.h"
extern void func_cpp(void);
+extern void func_dir(void);
extern void func_environ(void);
extern void func_file(void);
extern void func_heap(void);
@@ -25,6 +26,7 @@
static const struct test winetest_testlist[] =
{
{ "cpp", func_cpp },
+ { "dir", func_dir },
{ "environ", func_environ },
{ "file", func_file },
{ "heap", func_heap },
Modified: trunk/reactos/regtests/winetests/msvcrt/time.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/regtests/winetests/msvcrt/t…
==============================================================================
--- trunk/reactos/regtests/winetests/msvcrt/time.c (original)
+++ trunk/reactos/regtests/winetests/msvcrt/time.c Wed May 24 00:16:57 2006
@@ -31,7 +31,7 @@
#define MINSPERHOUR 60
#define HOURSPERDAY 24
-static void test_gmtime()
+static void test_gmtime(void)
{
time_t gmt = (time_t)NULL;
struct tm* gmt_tm = gmtime(&gmt);
@@ -48,7 +48,7 @@
gmt_tm->tm_hour, gmt_tm->tm_min, gmt_tm->tm_sec, gmt_tm->tm_isdst);
}
-static void test_mktime()
+static void test_mktime(void)
{
TIME_ZONE_INFORMATION tzinfo;
DWORD res = GetTimeZoneInformation(&tzinfo);
@@ -146,7 +146,7 @@
ok(((DWORD)nulltime == SECSPERDAY),"mktime returned
0x%08lx\n",(DWORD)nulltime);
putenv(TZ_env);
}
-static void test_localtime()
+static void test_localtime(void)
{
TIME_ZONE_INFORMATION tzinfo;
DWORD res = GetTimeZoneInformation(&tzinfo);
@@ -179,11 +179,64 @@
lt->tm_min, lt->tm_sec, lt->tm_isdst);
putenv(TZ_env);
}
-
+static void test_strdate(void)
+{
+ char date[16], * result;
+ int month, day, year, count, len;
+
+ result = _strdate(date);
+ ok(result == date, "Wrong return value\n");
+ len = strlen(date);
+ ok(len == 8, "Wrong length: returned %d, should be 8\n", len);
+ count = sscanf(date, "%02d/%02d/%02d", &month, &day, &year);
+ ok(count == 3, "Wrong format: count = %d, should be 3\n", count);
+}
+static void test_strtime(void)
+{
+ char time[16], * result;
+ int hour, minute, second, count, len;
+
+ result = _strtime(time);
+ ok(result == time, "Wrong return value\n");
+ len = strlen(time);
+ ok(len == 8, "Wrong length: returned %d, should be 8\n", len);
+ count = sscanf(time, "%02d:%02d:%02d", &hour, &minute,
&second);
+ ok(count == 3, "Wrong format: count = %d, should be 3\n", count);
+}
+static void test_wstrdate(void)
+{
+ wchar_t date[16], * result;
+ int month, day, year, count, len;
+ wchar_t format[] = {
'%','0','2','d','/','%','0','2','d','/','%','0','2','d',0
};
+
+ result = _wstrdate(date);
+ ok(result == date, "Wrong return value\n");
+ len = wcslen(date);
+ ok(len == 8, "Wrong length: returned %d, should be 8\n", len);
+ count = swscanf(date, format, &month, &day, &year);
+ ok(count == 3, "Wrong format: count = %d, should be 3\n", count);
+}
+static void test_wstrtime(void)
+{
+ wchar_t time[16], * result;
+ int hour, minute, second, count, len;
+ wchar_t format[] = {
'%','0','2','d',':','%','0','2','d',':','%','0','2','d',0
};
+
+ result = _wstrtime(time);
+ ok(result == time, "Wrong return value\n");
+ len = wcslen(time);
+ ok(len == 8, "Wrong length: returned %d, should be 8\n", len);
+ count = swscanf(time, format, &hour, &minute, &second);
+ ok(count == 3, "Wrong format: count = %d, should be 3\n", count);
+}
START_TEST(time)
{
test_gmtime();
test_mktime();
test_localtime();
-}
+ test_strdate();
+ test_strtime();
+ test_wstrdate();
+ test_wstrtime();
+}