6
6
//
7
7
// ===----------------------------------------------------------------------===//
8
8
9
- #include " src/__support/libc_errno .h"
9
+ #include " hdr/errno_macros .h"
10
10
#include " src/time/asctime.h"
11
+ #include " test/UnitTest/ErrnoCheckingTest.h"
11
12
#include " test/UnitTest/Test.h"
12
13
#include " test/src/time/TmHelper.h"
13
14
15
+ using LlvmLibcAsctime = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
16
+
14
17
static inline char *call_asctime (struct tm *tm_data, int year, int month,
15
18
int mday, int hour, int min, int sec, int wday,
16
19
int yday) {
@@ -19,15 +22,15 @@ static inline char *call_asctime(struct tm *tm_data, int year, int month,
19
22
return LIBC_NAMESPACE::asctime (tm_data);
20
23
}
21
24
22
- TEST (LlvmLibcAsctime, Nullptr) {
25
+ TEST_F (LlvmLibcAsctime, Nullptr) {
23
26
char *result;
24
27
result = LIBC_NAMESPACE::asctime (nullptr );
25
28
ASSERT_ERRNO_EQ (EINVAL);
26
29
ASSERT_STREQ (nullptr , result);
27
30
}
28
31
29
32
// Weekdays are in the range 0 to 6. Test passing invalid value in wday.
30
- TEST (LlvmLibcAsctime, InvalidWday) {
33
+ TEST_F (LlvmLibcAsctime, InvalidWday) {
31
34
struct tm tm_data;
32
35
33
36
// Test with wday = -1.
@@ -56,7 +59,7 @@ TEST(LlvmLibcAsctime, InvalidWday) {
56
59
}
57
60
58
61
// Months are from January to December. Test passing invalid value in month.
59
- TEST (LlvmLibcAsctime, InvalidMonth) {
62
+ TEST_F (LlvmLibcAsctime, InvalidMonth) {
60
63
struct tm tm_data;
61
64
62
65
// Test with month = 0.
@@ -84,7 +87,7 @@ TEST(LlvmLibcAsctime, InvalidMonth) {
84
87
ASSERT_ERRNO_EQ (EINVAL);
85
88
}
86
89
87
- TEST (LlvmLibcAsctime, ValidWeekdays) {
90
+ TEST_F (LlvmLibcAsctime, ValidWeekdays) {
88
91
struct tm tm_data;
89
92
char *result;
90
93
// 1970-01-01 00:00:00.
@@ -124,7 +127,7 @@ TEST(LlvmLibcAsctime, ValidWeekdays) {
124
127
ASSERT_STREQ (" Sun Jan 4 00:00:00 1970\n " , result);
125
128
}
126
129
127
- TEST (LlvmLibcAsctime, ValidMonths) {
130
+ TEST_F (LlvmLibcAsctime, ValidMonths) {
128
131
struct tm tm_data;
129
132
char *result;
130
133
// 1970-01-01 00:00:00.
@@ -164,7 +167,7 @@ TEST(LlvmLibcAsctime, ValidMonths) {
164
167
ASSERT_STREQ (" Thu Dec 31 23:59:59 1970\n " , result);
165
168
}
166
169
167
- TEST (LlvmLibcAsctime, EndOf32BitEpochYear) {
170
+ TEST_F (LlvmLibcAsctime, EndOf32BitEpochYear) {
168
171
struct tm tm_data;
169
172
char *result;
170
173
// Test for maximum value of a signed 32-bit integer.
@@ -181,7 +184,7 @@ TEST(LlvmLibcAsctime, EndOf32BitEpochYear) {
181
184
ASSERT_STREQ (" Tue Jan 19 03:14:07 2038\n " , result);
182
185
}
183
186
184
- TEST (LlvmLibcAsctime, Max64BitYear) {
187
+ TEST_F (LlvmLibcAsctime, Max64BitYear) {
185
188
if (sizeof (time_t ) == 4 )
186
189
return ;
187
190
// Mon Jan 1 12:50:50 2170 (200 years from 1970),
0 commit comments