ucrtbase: Add a test that shows asctime() uses space-padding for day of month.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Akihiro Sagawa 2018-03-11 22:14:22 +09:00 committed by Alexandre Julliard
parent 1333206e08
commit 8b10fb8758
1 changed files with 19 additions and 0 deletions

View File

@ -26,6 +26,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <share.h> #include <share.h>
#include <fcntl.h> #include <fcntl.h>
#include <time.h>
#include <windef.h> #include <windef.h>
#include <winbase.h> #include <winbase.h>
@ -123,6 +124,7 @@ static int (CDECL *p__iswblank_l)(wint_t,_locale_t);
static int (CDECL *p_fesetround)(int); static int (CDECL *p_fesetround)(int);
static void (CDECL *p___setusermatherr)(MSVCRT_matherr_func); static void (CDECL *p___setusermatherr)(MSVCRT_matherr_func);
static int* (CDECL *p_errno)(void); static int* (CDECL *p_errno)(void);
static char* (CDECL *p_asctime)(const struct tm *);
static void test__initialize_onexit_table(void) static void test__initialize_onexit_table(void)
{ {
@ -426,6 +428,7 @@ static BOOL init(void)
p_fesetround = (void*)GetProcAddress(module, "fesetround"); p_fesetround = (void*)GetProcAddress(module, "fesetround");
p___setusermatherr = (void*)GetProcAddress(module, "__setusermatherr"); p___setusermatherr = (void*)GetProcAddress(module, "__setusermatherr");
p_errno = (void*)GetProcAddress(module, "_errno"); p_errno = (void*)GetProcAddress(module, "_errno");
p_asctime = (void*)GetProcAddress(module, "asctime");
return TRUE; return TRUE;
} }
@ -747,6 +750,21 @@ static void test_math_errors(void)
} }
} }
static void test_asctime(void)
{
const struct tm epoch = { 0, 0, 0, 1, 0, 70, 4, 0, 0 };
char *ret;
if(!p_asctime)
{
win_skip("asctime is not available\n");
return;
}
ret = p_asctime(&epoch);
todo_wine ok(!strcmp(ret, "Thu Jan 1 00:00:00 1970\n"), "asctime returned %s\n", ret);
}
START_TEST(misc) START_TEST(misc)
{ {
int arg_c; int arg_c;
@ -772,4 +790,5 @@ START_TEST(misc)
test_lldiv(); test_lldiv();
test_isblank(); test_isblank();
test_math_errors(); test_math_errors();
test_asctime();
} }