2007-03-06 11:59:18 +00:00
|
|
|
/* Unit test suite for the wsprintf functions
|
|
|
|
*
|
|
|
|
* Copyright 2002 Bill Medland
|
|
|
|
*
|
|
|
|
* 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
|
2008-05-09 17:35:45 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2007-03-06 11:59:18 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
2008-05-09 17:35:45 +00:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
static void wsprintfATest(void)
|
|
|
|
{
|
|
|
|
char buf[25];
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc=wsprintfA(buf, "%010ld", -1);
|
2008-05-09 17:35:45 +00:00
|
|
|
ok(rc == 10, "wsPrintfA length failure: rc=%d error=%d\n",rc,GetLastError());
|
2007-03-06 11:59:18 +00:00
|
|
|
ok((lstrcmpA(buf, "-000000001") == 0),
|
|
|
|
"wsprintfA zero padded negative value failure: buf=[%s]\n",buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void wsprintfWTest(void)
|
|
|
|
{
|
|
|
|
static const WCHAR fmt[] = {'%','0','1','0','l','d','\0'};
|
|
|
|
static const WCHAR target[] = {'-','0','0','0','0','0','0','0','0','1', '\0'};
|
|
|
|
WCHAR buf[25];
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc=wsprintfW(buf, fmt, -1);
|
|
|
|
if (rc==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
|
2008-05-09 17:35:45 +00:00
|
|
|
{
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
win_skip("wsprintfW is not implemented\n");
|
2007-03-06 11:59:18 +00:00
|
|
|
return;
|
2008-05-09 17:35:45 +00:00
|
|
|
}
|
|
|
|
ok(rc == 10, "wsPrintfW length failure: rc=%d error=%d\n",rc,GetLastError());
|
2007-03-06 11:59:18 +00:00
|
|
|
ok((lstrcmpW(buf, target) == 0),
|
|
|
|
"wsprintfW zero padded negative value failure\n");
|
|
|
|
}
|
|
|
|
|
2008-05-09 17:35:45 +00:00
|
|
|
/* Test if the CharUpper / CharLower functions return true 16 bit results,
|
|
|
|
if the input is a 16 bit input value. Up to Wine 11-2003 the input value
|
|
|
|
0xff returns 0xffffffff. */
|
|
|
|
|
|
|
|
static void CharUpperTest(void)
|
|
|
|
{
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
INT_PTR i,out,failed;
|
2008-05-09 17:35:45 +00:00
|
|
|
|
|
|
|
failed = 0;
|
|
|
|
for (i=0;i<256;i++)
|
|
|
|
{
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
out = (INT_PTR)CharUpper((LPTSTR)i);
|
2008-05-09 17:35:45 +00:00
|
|
|
/* printf("%0x ",out); */
|
|
|
|
if ((out >> 16) != 0)
|
|
|
|
{
|
|
|
|
failed = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
ok(!failed,"CharUpper failed - 16bit input (0x%0lx) returned 32bit result (0x%0lx)\n",i,out);
|
2008-05-09 17:35:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void CharLowerTest(void)
|
|
|
|
{
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
INT_PTR i,out,failed;
|
2008-05-09 17:35:45 +00:00
|
|
|
|
|
|
|
failed = 0;
|
|
|
|
for (i=0;i<256;i++)
|
|
|
|
{
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
out = (INT_PTR)CharLower((LPTSTR)i);
|
2008-05-09 17:35:45 +00:00
|
|
|
/* printf("%0x ",out); */
|
|
|
|
if ((out >> 16) != 0)
|
|
|
|
{
|
|
|
|
failed = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
ok(!failed,"CharLower failed - 16bit input (0x%0lx) returned 32bit result (0x%0lx)\n",i,out);
|
2008-05-09 17:35:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
START_TEST(wsprintf)
|
|
|
|
{
|
|
|
|
wsprintfATest();
|
|
|
|
wsprintfWTest();
|
2008-05-09 17:35:45 +00:00
|
|
|
CharUpperTest();
|
|
|
|
CharLowerTest();
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|