Skip to content

Commit 8f01029

Browse files
committed
[libc++][chrono] Fixes FreeBSD tests.
This adjusts the output of the tests to match reality. Reviewed By: emaste, #libc, dim, philnik Differential Revision: https://reviews.llvm.org/D157778
1 parent ab14844 commit 8f01029

24 files changed

+634
-288
lines changed

libcxx/test/std/time/time.cal/time.cal.mdlast/ostream.pass.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// XFAIL: LIBCXX-FREEBSD-FIXME
10-
119
// UNSUPPORTED: c++03, c++11, c++14, c++17
1210
// UNSUPPORTED: no-localization
1311
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
@@ -108,7 +106,7 @@ static void test() {
108106
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_day_last{std::chrono::month{1}}), SV("janv./last"));
109107
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_day_last{std::chrono::month{2}}), SV("févr./last"));
110108
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_day_last{std::chrono::month{3}}), SV("mars/last"));
111-
# if defined(_WIN32) || defined(_AIX)
109+
# if defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__)
112110
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_day_last{std::chrono::month{4}}), SV("avr./last"));
113111
# else
114112
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_day_last{std::chrono::month{4}}), SV("avril/last"));

libcxx/test/std/time/time.cal/time.cal.month/time.cal.month.nonmembers/ostream.pass.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// XFAIL: LIBCXX-FREEBSD-FIXME
10-
119
// UNSUPPORTED: c++03, c++11, c++14, c++17
1210
// UNSUPPORTED: no-localization
1311
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
@@ -104,7 +102,7 @@ static void test() {
104102
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month{1}), SV("janv."));
105103
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month{2}), SV("févr."));
106104
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month{3}), SV("mars"));
107-
# if defined(_WIN32) || defined(_AIX)
105+
# if defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__)
108106
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month{4}), SV("avr."));
109107
# else
110108
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month{4}), SV("avril"));

libcxx/test/std/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/ostream.pass.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// XFAIL: LIBCXX-FREEBSD-FIXME
10-
119
// UNSUPPORTED: c++03, c++11, c++14, c++17
1210
// UNSUPPORTED: no-localization
1311
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
@@ -175,7 +173,7 @@ static void test() {
175173
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday{
176174
std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}),
177175
SV("mars/mer.[3]"));
178-
# if defined(_WIN32) || defined(_AIX)
176+
# if defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__)
179177
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday{
180178
std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}),
181179
SV("avr./jeu.[4]"));

libcxx/test/std/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/ostream.pass.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// XFAIL: LIBCXX-FREEBSD-FIXME
10-
119
// UNSUPPORTED: c++03, c++11, c++14, c++17
1210
// UNSUPPORTED: no-localization
1311
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
@@ -172,15 +170,15 @@ static void test() {
172170
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{
173171
std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}),
174172
SV("mars/mar.[last]"));
175-
# if defined(_WIN32) || defined(_AIX)
173+
# if defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__)
176174
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{
177175
std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}),
178176
SV("avr./mer.[last]"));
179-
# else // defined(_WIN32) || defined(_AIX)
177+
# else // defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__)
180178
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{
181179
std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}),
182180
SV("avril/mer.[last]"));
183-
# endif // defined(_WIN32) || defined(_AIX)
181+
# endif // defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__)
184182
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{
185183
std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}),
186184
SV("mai/jeu.[last]"));

libcxx/test/std/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/ostream.pass.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// XFAIL: LIBCXX-FREEBSD-FIXME
10-
119
// UNSUPPORTED: c++03, c++11, c++14, c++17
1210
// UNSUPPORTED: no-localization
1311
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
@@ -135,13 +133,13 @@ static void test() {
135133
SV("-32767/févr."));
136134
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}),
137135
SV("0000/mars"));
138-
# if defined(_WIN32) || defined(_AIX)
136+
# if defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__)
139137
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}),
140138
SV("1970/avr."));
141-
# else // defined(_WIN32) || defined(_AIX)
139+
# else // defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__)
142140
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}),
143141
SV("1970/avril"));
144-
# endif // defined(_WIN32) || defined(_AIX)
142+
# endif // defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__)
145143
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}),
146144
SV("32767/mai"));
147145
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}),

libcxx/test/std/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/ostream.pass.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// XFAIL: LIBCXX-FREEBSD-FIXME
10-
119
// UNSUPPORTED: c++03, c++11, c++14, c++17
1210
// UNSUPPORTED: no-localization
1311
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
@@ -166,15 +164,15 @@ static void test() {
166164
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::year_month_day_last{
167165
std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}),
168166
SV("0000/mars/last"));
169-
# if defined(_WIN32) || defined(_AIX)
167+
# if defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__)
170168
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::year_month_day_last{
171169
std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}),
172170
SV("1970/avr./last"));
173-
# else // defined(_WIN32) || defined(_AIX)
171+
# else // defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__)
174172
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::year_month_day_last{
175173
std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}),
176174
SV("1970/avril/last"));
177-
# endif // defined(_WIN32) || defined(_AIX)
175+
# endif // defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__)
178176
TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::year_month_day_last{
179177
std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}),
180178
SV("32767/mai/last"));

libcxx/test/std/time/time.syn/formatter.day.pass.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
//
66
//===----------------------------------------------------------------------===//
77

8-
// XFAIL: LIBCXX-FREEBSD-FIXME
9-
108
// UNSUPPORTED: c++03, c++11, c++14, c++17
119
// UNSUPPORTED: no-localization
1210
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
@@ -96,7 +94,7 @@ static void test_valid_values() {
9694
#endif
9795

9896
// Use supplied locale (ja_JP). This locale has a different alternate on some platforms.
99-
#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32)
97+
#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) || defined(__FreeBSD__)
10098
# if defined(_WIN32)
10199
check(loc, SV("%d=''\t%Od=''\t%e=''\t%Oe=''\n"), lfmt, 0d);
102100
# else
@@ -111,12 +109,12 @@ static void test_valid_values() {
111109
# else
112110
check(SV("%d='255'\t%Od='255'\t%e='255'\t%Oe='255'\n"), fmt, 255d);
113111
# endif
114-
#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32)
112+
#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) || defined(__FreeBSD__)
115113
check(loc, SV("%d='00'\t%Od='〇'\t%e=' 0'\t%Oe='〇'\n"), lfmt, 0d);
116114
check(loc, SV("%d='01'\t%Od='一'\t%e=' 1'\t%Oe='一'\n"), lfmt, 1d);
117115
check(loc, SV("%d='31'\t%Od='三十一'\t%e='31'\t%Oe='三十一'\n"), lfmt, 31d);
118116
check(loc, SV("%d='255'\t%Od='255'\t%e='255'\t%Oe='255'\n"), lfmt, 255d);
119-
#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32)
117+
#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) || defined(__FreeBSD__)
120118

121119
std::locale::global(std::locale::classic());
122120
}

libcxx/test/std/time/time.syn/formatter.duration.pass.cpp

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
//
66
//===----------------------------------------------------------------------===//
77

8-
// XFAIL: LIBCXX-FREEBSD-FIXME
9-
108
// UNSUPPORTED: c++03, c++11, c++14, c++17
119
// UNSUPPORTED: no-localization
1210
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
@@ -247,7 +245,7 @@ static void test_valid_positive_integral_values() {
247245
"%r='00:00:00'\t"
248246
#elif defined(_AIX)
249247
"%r='12:00:00 AM'\t"
250-
#elif defined(__APPLE__)
248+
#elif defined(__APPLE__) || defined(__FreeBSD__)
251249
"%r=''\t"
252250
#else
253251
"%r='12:00:00 '\t"
@@ -280,7 +278,7 @@ static void test_valid_positive_integral_values() {
280278
"%r='11:59:59'\t"
281279
#elif defined(_AIX)
282280
"%r='11:59:59 AM'\t"
283-
#elif defined(__APPLE__)
281+
#elif defined(__APPLE__) || defined(__FreeBSD__)
284282
"%r=''\t"
285283
#else
286284
"%r='11:59:59 '\t"
@@ -313,7 +311,7 @@ static void test_valid_positive_integral_values() {
313311
"%r='12:00:00'\t"
314312
#elif defined(_AIX)
315313
"%r='12:00:00 PM'\t"
316-
#elif defined(__APPLE__)
314+
#elif defined(__APPLE__) || defined(__FreeBSD__)
317315
"%r=''\t"
318316
#else
319317
"%r='12:00:00 '\t"
@@ -344,7 +342,7 @@ static void test_valid_positive_integral_values() {
344342
"%T='23:59:59'\t"
345343
#if defined(_AIX)
346344
"%r='11:59:59 PM'\t"
347-
#elif defined(__APPLE__)
345+
#elif defined(__APPLE__) || defined(__FreeBSD__)
348346
"%r=''\t"
349347
#elif defined(_WIN32)
350348
"%r='23:59:59'\t"
@@ -379,7 +377,7 @@ static void test_valid_positive_integral_values() {
379377
"%r='00:00:00'\t"
380378
#elif defined(_AIX)
381379
"%r='12:00:00 AM'\t"
382-
#elif defined(__APPLE__)
380+
#elif defined(__APPLE__) || defined(__FreeBSD__)
383381
"%r=''\t"
384382
#elif defined(_WIN32)
385383
"%r='12:00:00'\t"
@@ -396,7 +394,7 @@ static void test_valid_positive_integral_values() {
396394
std::chrono::duration<int, std::ratio<86400>>(7));
397395

398396
// Use supplied locale (ja_JP). This locale has a different alternate.
399-
#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32)
397+
#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) || defined(__FreeBSD__)
400398
check(loc,
401399
SV("%H='00'\t"
402400
"%OH='00'\t"
@@ -413,8 +411,12 @@ static void test_valid_positive_integral_values() {
413411
# endif
414412
"%R='00:00'\t"
415413
"%T='00:00:00'\t"
416-
# if defined(__APPLE__)
414+
# if defined(__APPLE__) || defined(__FreeBSD__)
415+
# if defined(__APPLE__)
417416
"%r='12:00:00 AM'\t"
417+
# else
418+
"%r='12:00:00 午前'\t"
419+
# endif
418420
"%X='00時00分00秒'\t"
419421
"%EX='00時00分00秒'\t"
420422
# elif defined(_WIN32)
@@ -449,8 +451,12 @@ static void test_valid_positive_integral_values() {
449451
# endif
450452
"%R='11:59'\t"
451453
"%T='11:59:59'\t"
452-
# if defined(__APPLE__)
454+
# if defined(__APPLE__) || defined(__FreeBSD__)
455+
# if defined(__APPLE__)
453456
"%r='11:59:59 AM'\t"
457+
# else
458+
"%r='11:59:59 午前'\t"
459+
# endif
454460
"%X='11時59分59秒'\t"
455461
"%EX='11時59分59秒'\t"
456462
# elif defined(_WIN32)
@@ -485,8 +491,12 @@ static void test_valid_positive_integral_values() {
485491
# endif
486492
"%R='12:00'\t"
487493
"%T='12:00:00'\t"
488-
# if defined(__APPLE__)
494+
# if defined(__APPLE__) || defined(__FreeBSD__)
495+
# if defined(__APPLE__)
489496
"%r='12:00:00 PM'\t"
497+
# else
498+
"%r='12:00:00 午後'\t"
499+
# endif
490500
"%X='12時00分00秒'\t"
491501
"%EX='12時00分00秒'\t"
492502
# else
@@ -521,8 +531,12 @@ static void test_valid_positive_integral_values() {
521531
# endif
522532
"%R='23:59'\t"
523533
"%T='23:59:59'\t"
524-
# if defined(__APPLE__)
534+
# if defined(__APPLE__) || defined(__FreeBSD__)
535+
# if defined(__APPLE__)
525536
"%r='11:59:59 PM'\t"
537+
# else
538+
"%r='11:59:59 午後'\t"
539+
# endif
526540
"%X='23時59分59秒'\t"
527541
"%EX='23時59分59秒'\t"
528542
# else
@@ -557,8 +571,12 @@ static void test_valid_positive_integral_values() {
557571
# endif
558572
"%R='00:00'\t"
559573
"%T='00:00:00'\t"
560-
# if defined(__APPLE__)
574+
# if defined(__APPLE__) || defined(__FreeBSD__)
575+
# if defined(__APPLE__)
561576
"%r='12:00:00 AM'\t"
577+
# else
578+
"%r='12:00:00 午前'\t"
579+
# endif
562580
"%X='00時00分00秒'\t"
563581
"%EX='00時00分00秒'\t"
564582
# elif defined(_WIN32)
@@ -786,7 +804,7 @@ static void test_valid_negative_integral_values() {
786804
"%T='23:59:59'\t"
787805
#if defined(_AIX)
788806
"%r='11:59:59 PM'\t"
789-
#elif defined(__APPLE__)
807+
#elif defined(__APPLE__) || defined(__FreeBSD__)
790808
"%r=''\t"
791809
#elif defined(_WIN32)
792810
"%r='23:59:59'\t"
@@ -803,7 +821,7 @@ static void test_valid_negative_integral_values() {
803821
-(23h + 59min + 59s));
804822

805823
// Use supplied locale (ja_JP). This locale has a different alternate.
806-
#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32)
824+
#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) || defined(__FreeBSD__)
807825
check(loc,
808826
SV("-%H='23'\t"
809827
"%OH='23'\t"
@@ -820,8 +838,12 @@ static void test_valid_negative_integral_values() {
820838
# endif
821839
"%R='23:59'\t"
822840
"%T='23:59:59'\t"
823-
# if defined(__APPLE__)
841+
# if defined(__APPLE__) || defined(__FreeBSD__)
842+
# if defined(__APPLE__)
824843
"%r='11:59:59 PM'\t"
844+
# else
845+
"%r='11:59:59 午後'\t"
846+
# endif
825847
"%X='23時59分59秒'\t"
826848
"%EX='23時59分59秒'\t"
827849
# elif defined(_WIN32)
@@ -839,7 +861,7 @@ static void test_valid_negative_integral_values() {
839861
"\n"),
840862
lfmt,
841863
-(23h + 59min + 59s));
842-
#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32)
864+
#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32)|| defined(__FreeBSD__)
843865
check(loc,
844866
SV("-%H='23'\t"
845867
"%OH='二十三'\t"
@@ -861,7 +883,7 @@ static void test_valid_negative_integral_values() {
861883
"\n"),
862884
lfmt,
863885
-(23h + 59min + 59s));
864-
#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32)
886+
#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32)|| defined(__FreeBSD__)
865887
std::locale::global(std::locale::classic());
866888
}
867889

@@ -1014,7 +1036,8 @@ static void test_valid_fractional_values() {
10141036
check(loc, SV("00.011"), SV("{:L%S}"), std::chrono::duration<double, std::milli>(11.123456789));
10151037
check(loc, SV("01"), SV("{:L%S}"), std::chrono::duration<long double>(61.123456789));
10161038

1017-
#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32)
1039+
#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) || defined(__FreeBSD__)
1040+
10181041
check(SV("00.000000001"), SV("{:%OS}"), 1ns);
10191042
check(SV("00.000000501"), SV("{:%OS}"), 501ns);
10201043
check(SV("00.000001000"), SV("{:%OS}"), 1000ns);
@@ -1030,7 +1053,8 @@ static void test_valid_fractional_values() {
10301053
check(SV("00.001"), SV("{:%OS}"), std::chrono::duration<float, std::milli>(1.123456789));
10311054
check(SV("00.011"), SV("{:%OS}"), std::chrono::duration<double, std::milli>(11.123456789));
10321055
check(SV("01"), SV("{:%OS}"), std::chrono::duration<long double>(61.123456789));
1033-
#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32)
1056+
#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32)|| defined(__FreeBSD__)
1057+
10341058
check(loc, SV("〇.000000001"), SV("{:L%OS}"), 1ns);
10351059
check(loc, SV("〇.000000501"), SV("{:L%OS}"), 501ns);
10361060
check(loc, SV("〇.000001000"), SV("{:L%OS}"), 1000ns);
@@ -1046,7 +1070,7 @@ static void test_valid_fractional_values() {
10461070
check(loc, SV("〇.001"), SV("{:L%OS}"), std::chrono::duration<float, std::milli>(1.123456789));
10471071
check(loc, SV("〇.011"), SV("{:L%OS}"), std::chrono::duration<double, std::milli>(11.123456789));
10481072
check(loc, SV(""), SV("{:L%OS}"), std::chrono::duration<long double>(61.123456789));
1049-
#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32)
1073+
#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32)|| defined(__FreeBSD__)
10501074

10511075
check(loc, SV("01:05:06.000000001"), SV("{:L%T}"), 1h + 5min + 6s + 1ns);
10521076
check(loc, SV("01:05:06.000000501"), SV("{:L%T}"), 1h + 5min + 6s + 501ns);

0 commit comments

Comments
 (0)