[BTRFS]
[reactos.git] / rostests / regtests / crt / time.c
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
13 void Test_asctime()
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
43 START_TEST(time)
44 {
45 Test_asctime();
46 Test_ctime();
47 }
48