ReactOS  0.4.14-dev-384-g5b37caa
time.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS CRT regression tests
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: rostests/regtests/crt/time.c
5  * PURPOSE: Tests for time functions of the CRT
6  * PROGRAMMERS: Gregor Schneider
7  */
8 
9 #include <stdio.h>
10 #include <time.h>
11 #include <wine/test.h>
12 
14 {
15  /* Test asctime */
16  struct tm time;
17  char* timestr;
18  char explowtime[] = "Mon Jun 04 00:30:20 1909\n"; /* XP's crt returns new line after the string */
19 
20  time.tm_hour = 0;
21  time.tm_mday = 4;
22  time.tm_min = 30;
23  time.tm_mon = 5;
24  time.tm_sec = 20;
25  time.tm_wday = 1;
26  time.tm_yday = 200;
27  time.tm_year = 9;
28 
29  timestr = asctime(&time);
30  ok(!strcmp(timestr, explowtime), "Wrong time returned, got %s\n", timestr);
31 }
32 
33 void Test_ctime()
34 {
35  /* Test border ctime cases */
36  time_t time;
37  time = -15;
38  ok(ctime(&time) == NULL, "ctime doesn't return NULL for invalid parameters\n");
39  time = -5000000;
40  ok(ctime(&time) == NULL, "ctime doesn't return NULL for invalid parameters\n");
41 }
42 
44 {
45  Test_asctime();
46  Test_ctime();
47 }
48 
__u16 time
Definition: mkdosfs.c:366
_Check_return_ _CRTIMP char *__cdecl asctime(_In_ const struct tm *_Tm)
START_TEST(time)
Definition: time.c:43
smooth NULL
Definition: ftsmooth.c:416
void Test_asctime()
Definition: time.c:13
__u16 ctime
Definition: mkdosfs.c:362
Definition: time.h:76
void Test_ctime()
Definition: time.c:33
__kernel_time_t time_t
Definition: linux.h:252
#define ok(value,...)
Definition: atltest.h:57
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469