1010#include " test/UnitTest/Test.h"
1111
1212TEST (LlvmLibcLocaltimeR, ValidUnixTimestamp0) {
13- struct tm *input = nullptr ;
13+ struct tm input = {
14+ .tm_sec = 0 ,
15+ .tm_min = 0 ,
16+ .tm_hour = 0 ,
17+ .tm_mday = 0 ,
18+ .tm_mon = 0 ,
19+ .tm_year = 0 ,
20+ .tm_wday = 0 ,
21+ .tm_yday = 0 ,
22+ .tm_isdst = 0
23+ };
1424 const time_t timer = 0 ;
1525
16- struct tm *result = LIBC_NAMESPACE::localtime_r (&timer, input);
26+ struct tm *result = LIBC_NAMESPACE::localtime_r (&timer, & input);
1727
1828 ASSERT_EQ (70 , result->tm_year );
1929 ASSERT_EQ (0 , result->tm_mon );
@@ -32,9 +42,19 @@ TEST(LlvmLibcLocaltimeR, ValidUnixTimestamp0) {
3242// This will be resolved a new pull request.
3343
3444TEST (LlvmLibcLocaltimeR, ValidUnixTimestamp) {
35- struct tm *input = nullptr ;
45+ struct tm input = {
46+ .tm_sec = 0 ,
47+ .tm_min = 0 ,
48+ .tm_hour = 0 ,
49+ .tm_mday = 0 ,
50+ .tm_mon = 0 ,
51+ .tm_year = 0 ,
52+ .tm_wday = 0 ,
53+ .tm_yday = 0 ,
54+ .tm_isdst = 0
55+ };
3656 const time_t timer = 1756595338 ;
37- struct tm *result = LIBC_NAMESPACE::localtime_r (&timer, input);
57+ struct tm *result = LIBC_NAMESPACE::localtime_r (&timer, & input);
3858
3959 ASSERT_EQ (125 , result->tm_year );
4060 ASSERT_EQ (7 , result->tm_mon );
@@ -48,9 +68,19 @@ TEST(LlvmLibcLocaltimeR, ValidUnixTimestamp) {
4868}
4969
5070TEST (LlvmLibcLocaltimeR, ValidUnixTimestampNegative) {
51- struct tm *input = nullptr ;
71+ struct tm input = {
72+ .tm_sec = 0 ,
73+ .tm_min = 0 ,
74+ .tm_hour = 0 ,
75+ .tm_mday = 0 ,
76+ .tm_mon = 0 ,
77+ .tm_year = 0 ,
78+ .tm_wday = 0 ,
79+ .tm_yday = 0 ,
80+ .tm_isdst = 0
81+ };
5282 const time_t timer = -1756595338 ;
53- struct tm *result = LIBC_NAMESPACE::localtime_r (&timer, input);
83+ struct tm *result = LIBC_NAMESPACE::localtime_r (&timer, & input);
5484
5585 ASSERT_EQ (14 , result->tm_year );
5686 ASSERT_EQ (4 , result->tm_mon );
0 commit comments