Commit 02fb99e6 authored by Peter Oberndorfer's avatar Peter Oberndorfer Committed by Alexandre Julliard

msvcrt: Add a test for scanf %p.

parent c0661fdb
......@@ -28,6 +28,7 @@ static void test_sscanf( void )
char format[20];
int result, ret;
char c;
void *ptr;
float res1= -82.6267f, res2= 27.76f, res11, res12;
static const char pname[]=" St. Petersburg, Florida\n";
int hour=21,min=59,sec=20;
......@@ -39,6 +40,34 @@ static void test_sscanf( void )
ret = sscanf(buffer, "%d", &result);
ok( ret == EOF,"sscanf returns %x instead of %x\n", ret, EOF );
/* check %p */
todo_wine {
ok( sscanf("000000000046F170", "%p", &ptr) == 1, "sscanf failed\n" );
ok( ptr == (void *)0x46F170,"sscanf reads %p instead of %x\n", ptr, 0x46F170 );
ok( sscanf("0046F171", "%p", &ptr) == 1, "sscanf failed\n" );
ok( ptr == (void *)0x46F171,"sscanf reads %p instead of %x\n", ptr, 0x46F171 );
ok( sscanf("46F172", "%p", &ptr) == 1, "sscanf failed\n" );
ok( ptr == (void *)0x46F172,"sscanf reads %p instead of %x\n", ptr, 0x46F172 );
ok( sscanf("0x46F173", "%p", &ptr) == 1, "sscanf failed\n" );
ok( ptr == (void *)0,"sscanf reads %p instead of %x\n", ptr, 0 );
ok( sscanf("-46F174", "%p", &ptr) == 1, "sscanf failed\n" );
ok( ptr == (void *)0xFFB90E8C,"sscanf reads %p instead of %x\n", ptr, 0xFFB90E8C );
ok( sscanf("+46F175", "%p", &ptr) == 1, "sscanf failed\n" );
ok( ptr == (void *)0x46F175,"sscanf reads %p instead of %x\n", ptr, 0x46F175 );
/* check %p with no hex digits */
ok( sscanf("1233", "%p", &ptr) == 1, "sscanf failed\n" );
ok( ptr == (void *)0x1233,"sscanf reads %p instead of %x\n", ptr, 0x1233 );
ok( sscanf("1234", "%P", &ptr) == 1, "sscanf failed\n" );
ok( ptr == (void *)0x1234,"sscanf reads %p instead of %x\n", ptr, 0x1234 );
}
/* check %x */
strcpy(buffer,"0x519");
ok( sscanf(buffer, "%x", &result) == 1, "sscanf failed\n" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment