66//
77// ===----------------------------------------------------------------------===//
88
9- #include " src/__support/libc_errno .h"
9+ #include " hdr/errno_macros .h"
1010#include " src/time/asctime.h"
11+ #include " test/UnitTest/ErrnoCheckingTest.h"
1112#include " test/UnitTest/Test.h"
1213#include " test/src/time/TmHelper.h"
1314
15+ using LlvmLibcAsctime = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
16+
1417static inline char *call_asctime (struct tm *tm_data, int year, int month,
1518 int mday, int hour, int min, int sec, int wday,
1619 int yday) {
@@ -19,15 +22,15 @@ static inline char *call_asctime(struct tm *tm_data, int year, int month,
1922 return LIBC_NAMESPACE::asctime (tm_data);
2023}
2124
22- TEST (LlvmLibcAsctime, Nullptr) {
25+ TEST_F (LlvmLibcAsctime, Nullptr) {
2326 char *result;
2427 result = LIBC_NAMESPACE::asctime (nullptr );
2528 ASSERT_ERRNO_EQ (EINVAL);
2629 ASSERT_STREQ (nullptr , result);
2730}
2831
2932// Weekdays are in the range 0 to 6. Test passing invalid value in wday.
30- TEST (LlvmLibcAsctime, InvalidWday) {
33+ TEST_F (LlvmLibcAsctime, InvalidWday) {
3134 struct tm tm_data;
3235
3336 // Test with wday = -1.
@@ -56,7 +59,7 @@ TEST(LlvmLibcAsctime, InvalidWday) {
5659}
5760
5861// Months are from January to December. Test passing invalid value in month.
59- TEST (LlvmLibcAsctime, InvalidMonth) {
62+ TEST_F (LlvmLibcAsctime, InvalidMonth) {
6063 struct tm tm_data;
6164
6265 // Test with month = 0.
@@ -84,7 +87,7 @@ TEST(LlvmLibcAsctime, InvalidMonth) {
8487 ASSERT_ERRNO_EQ (EINVAL);
8588}
8689
87- TEST (LlvmLibcAsctime, ValidWeekdays) {
90+ TEST_F (LlvmLibcAsctime, ValidWeekdays) {
8891 struct tm tm_data;
8992 char *result;
9093 // 1970-01-01 00:00:00.
@@ -124,7 +127,7 @@ TEST(LlvmLibcAsctime, ValidWeekdays) {
124127 ASSERT_STREQ (" Sun Jan 4 00:00:00 1970\n " , result);
125128}
126129
127- TEST (LlvmLibcAsctime, ValidMonths) {
130+ TEST_F (LlvmLibcAsctime, ValidMonths) {
128131 struct tm tm_data;
129132 char *result;
130133 // 1970-01-01 00:00:00.
@@ -164,7 +167,7 @@ TEST(LlvmLibcAsctime, ValidMonths) {
164167 ASSERT_STREQ (" Thu Dec 31 23:59:59 1970\n " , result);
165168}
166169
167- TEST (LlvmLibcAsctime, EndOf32BitEpochYear) {
170+ TEST_F (LlvmLibcAsctime, EndOf32BitEpochYear) {
168171 struct tm tm_data;
169172 char *result;
170173 // Test for maximum value of a signed 32-bit integer.
@@ -181,7 +184,7 @@ TEST(LlvmLibcAsctime, EndOf32BitEpochYear) {
181184 ASSERT_STREQ (" Tue Jan 19 03:14:07 2038\n " , result);
182185}
183186
184- TEST (LlvmLibcAsctime, Max64BitYear) {
187+ TEST_F (LlvmLibcAsctime, Max64BitYear) {
185188 if (sizeof (time_t ) == 4 )
186189 return ;
187190 // Mon Jan 1 12:50:50 2170 (200 years from 1970),
0 commit comments