mirror of
https://github.com/reactos/reactos.git
synced 2025-06-06 09:50:43 +00:00
[USER32_APITEST]
- Handle some wsprintf-specific cases in the CRT sprintf test svn path=/trunk/; revision=56862
This commit is contained in:
parent
84b02d3d64
commit
20d01189db
1 changed files with 41 additions and 8 deletions
|
@ -151,9 +151,11 @@ START_TEST(sprintf)
|
||||||
ok_str(Buffer, "hello");
|
ok_str(Buffer, "hello");
|
||||||
ok_int(Length, 5);
|
ok_int(Length, 5);
|
||||||
|
|
||||||
/* TODO: wsprintf can't do * */
|
|
||||||
#ifndef TEST_USER32
|
|
||||||
Length = sprintf(Buffer, "%*s", -8, "hello");
|
Length = sprintf(Buffer, "%*s", -8, "hello");
|
||||||
|
#ifdef TEST_USER32
|
||||||
|
ok_str(Buffer, "*s");
|
||||||
|
ok_int(Length, 2);
|
||||||
|
#else
|
||||||
ok_str(Buffer, "hello ");
|
ok_str(Buffer, "hello ");
|
||||||
ok_int(Length, 8);
|
ok_int(Length, 8);
|
||||||
#endif
|
#endif
|
||||||
|
@ -179,13 +181,16 @@ START_TEST(sprintf)
|
||||||
ok_str(Buffer, "hell");
|
ok_str(Buffer, "hell");
|
||||||
ok_int(Length, 4);
|
ok_int(Length, 4);
|
||||||
|
|
||||||
#ifndef TEST_USER32
|
|
||||||
StartSeh()
|
StartSeh()
|
||||||
Length = sprintf(Buffer, "%.*s", -1, "hello");
|
Length = sprintf(Buffer, "%.*s", -1, "hello");
|
||||||
|
#ifdef TEST_USER32
|
||||||
|
ok_str(Buffer, "*s");
|
||||||
|
ok_int(Length, 2);
|
||||||
|
#else
|
||||||
ok_str(Buffer, "hello");
|
ok_str(Buffer, "hello");
|
||||||
ok_int(Length, 5);
|
ok_int(Length, 5);
|
||||||
EndSeh(STATUS_SUCCESS);
|
|
||||||
#endif
|
#endif
|
||||||
|
EndSeh(STATUS_SUCCESS);
|
||||||
|
|
||||||
String = AllocateGuarded(6);
|
String = AllocateGuarded(6);
|
||||||
if (!String)
|
if (!String)
|
||||||
|
@ -219,32 +224,47 @@ START_TEST(sprintf)
|
||||||
ok_int(Length, 4);
|
ok_int(Length, 4);
|
||||||
EndSeh(STATUS_SUCCESS);
|
EndSeh(STATUS_SUCCESS);
|
||||||
|
|
||||||
/* TODO: wsprintf can't do *, and also seems to use strlen despite a
|
|
||||||
* precision being given */
|
|
||||||
#ifndef TEST_USER32
|
|
||||||
String[5] = '!';
|
String[5] = '!';
|
||||||
StartSeh()
|
StartSeh()
|
||||||
Length = sprintf(Buffer, "%.5s", String);
|
Length = sprintf(Buffer, "%.5s", String);
|
||||||
ok_str(Buffer, "hello");
|
ok_str(Buffer, "hello");
|
||||||
ok_int(Length, 5);
|
ok_int(Length, 5);
|
||||||
|
#ifdef TEST_USER32
|
||||||
|
EndSeh(STATUS_ACCESS_VIOLATION);
|
||||||
|
#else
|
||||||
EndSeh(STATUS_SUCCESS);
|
EndSeh(STATUS_SUCCESS);
|
||||||
|
#endif
|
||||||
|
|
||||||
StartSeh()
|
StartSeh()
|
||||||
Length = sprintf(Buffer, "%.6s", String);
|
Length = sprintf(Buffer, "%.6s", String);
|
||||||
ok_str(Buffer, "hello!");
|
ok_str(Buffer, "hello!");
|
||||||
ok_int(Length, 6);
|
ok_int(Length, 6);
|
||||||
|
#ifdef TEST_USER32
|
||||||
|
EndSeh(STATUS_ACCESS_VIOLATION);
|
||||||
|
#else
|
||||||
EndSeh(STATUS_SUCCESS);
|
EndSeh(STATUS_SUCCESS);
|
||||||
|
#endif
|
||||||
|
|
||||||
StartSeh()
|
StartSeh()
|
||||||
Length = sprintf(Buffer, "%.*s", 5, String);
|
Length = sprintf(Buffer, "%.*s", 5, String);
|
||||||
|
#ifdef TEST_USER32
|
||||||
|
ok_str(Buffer, "*s");
|
||||||
|
ok_int(Length, 2);
|
||||||
|
#else
|
||||||
ok_str(Buffer, "hello");
|
ok_str(Buffer, "hello");
|
||||||
ok_int(Length, 5);
|
ok_int(Length, 5);
|
||||||
|
#endif
|
||||||
EndSeh(STATUS_SUCCESS);
|
EndSeh(STATUS_SUCCESS);
|
||||||
|
|
||||||
StartSeh()
|
StartSeh()
|
||||||
Length = sprintf(Buffer, "%.*s", 6, String);
|
Length = sprintf(Buffer, "%.*s", 6, String);
|
||||||
|
#ifdef TEST_USER32
|
||||||
|
ok_str(Buffer, "*s");
|
||||||
|
ok_int(Length, 2);
|
||||||
|
#else
|
||||||
ok_str(Buffer, "hello!");
|
ok_str(Buffer, "hello!");
|
||||||
ok_int(Length, 6);
|
ok_int(Length, 6);
|
||||||
|
#endif
|
||||||
EndSeh(STATUS_SUCCESS);
|
EndSeh(STATUS_SUCCESS);
|
||||||
|
|
||||||
/* both field width and precision */
|
/* both field width and precision */
|
||||||
|
@ -252,20 +272,33 @@ START_TEST(sprintf)
|
||||||
Length = sprintf(Buffer, "%8.5s", String);
|
Length = sprintf(Buffer, "%8.5s", String);
|
||||||
ok_str(Buffer, " hello");
|
ok_str(Buffer, " hello");
|
||||||
ok_int(Length, 8);
|
ok_int(Length, 8);
|
||||||
|
#ifdef TEST_USER32
|
||||||
|
EndSeh(STATUS_ACCESS_VIOLATION);
|
||||||
|
#else
|
||||||
EndSeh(STATUS_SUCCESS);
|
EndSeh(STATUS_SUCCESS);
|
||||||
|
#endif
|
||||||
|
|
||||||
StartSeh()
|
StartSeh()
|
||||||
Length = sprintf(Buffer, "%-*.6s", -8, String);
|
Length = sprintf(Buffer, "%-*.6s", -8, String);
|
||||||
|
#ifdef TEST_USER32
|
||||||
|
ok_str(Buffer, "*.6s");
|
||||||
|
ok_int(Length, 4);
|
||||||
|
#else
|
||||||
ok_str(Buffer, "hello! ");
|
ok_str(Buffer, "hello! ");
|
||||||
ok_int(Length, 8);
|
ok_int(Length, 8);
|
||||||
|
#endif
|
||||||
EndSeh(STATUS_SUCCESS);
|
EndSeh(STATUS_SUCCESS);
|
||||||
|
|
||||||
StartSeh()
|
StartSeh()
|
||||||
Length = sprintf(Buffer, "%*.*s", -8, 6, String);
|
Length = sprintf(Buffer, "%*.*s", -8, 6, String);
|
||||||
|
#ifdef TEST_USER32
|
||||||
|
ok_str(Buffer, "*.*s");
|
||||||
|
ok_int(Length, 4);
|
||||||
|
#else
|
||||||
ok_str(Buffer, "hello! ");
|
ok_str(Buffer, "hello! ");
|
||||||
ok_int(Length, 8);
|
ok_int(Length, 8);
|
||||||
EndSeh(STATUS_SUCCESS);
|
|
||||||
#endif
|
#endif
|
||||||
|
EndSeh(STATUS_SUCCESS);
|
||||||
|
|
||||||
FreeGuarded(String);
|
FreeGuarded(String);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue