diff --git a/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp b/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp --- a/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp +++ b/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp @@ -12,9 +12,6 @@ // iter_type put(iter_type s, ios_base& iob, char_type fill, long double v) const; -// TODO GLIBC uses a different string for positive and negative NAN numbers. -// XFAIL: target={{.*}}-linux-gnu{{.*}} - // XFAIL: LIBCXX-WINDOWS-FIXME // XFAIL: LIBCXX-AIX-FIXME @@ -10725,6 +10722,17 @@ std::locale lc = std::locale::classic(); std::locale lg(lc, new my_numpunct); const my_facet f(1); +#ifdef TEST_HAS_GLIBC + std::string pnan = "+nan"; + std::string PNAN = "+NAN"; + std::string pnan_sign = "+"; + std::string pnan_padding25 = "*********************"; +#else + std::string pnan = "nan"; + std::string PNAN = "NAN"; + std::string pnan_sign = ""; + std::string pnan_padding25 = "**********************"; +#endif { long double v = std::nan(""); std::ios ios(0); @@ -10889,7 +10897,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "nan"); + assert(ex == pnan); assert(ios.width() == 0); } ios.width(25); @@ -10897,7 +10905,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "nan**********************"); + assert(ex == pnan + pnan_padding25); assert(ios.width() == 0); } ios.width(25); @@ -10905,7 +10913,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "**********************nan"); + assert(ex == pnan_padding25 + pnan); assert(ios.width() == 0); } ios.width(25); @@ -10913,7 +10921,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "**********************nan"); + assert(ex == pnan_sign + pnan_padding25 + "nan"); assert(ios.width() == 0); } } @@ -10923,7 +10931,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "nan"); + assert(ex == pnan); assert(ios.width() == 0); } ios.width(25); @@ -10931,7 +10939,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "nan**********************"); + assert(ex == pnan + pnan_padding25); assert(ios.width() == 0); } ios.width(25); @@ -10939,7 +10947,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "**********************nan"); + assert(ex == pnan_padding25 + pnan); assert(ios.width() == 0); } ios.width(25); @@ -10947,7 +10955,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "**********************nan"); + assert(ex == pnan_sign + pnan_padding25 + "nan"); assert(ios.width() == 0); } } @@ -10960,7 +10968,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "nan"); + assert(ex == pnan); assert(ios.width() == 0); } ios.width(25); @@ -10968,7 +10976,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "nan**********************"); + assert(ex == pnan + pnan_padding25); assert(ios.width() == 0); } ios.width(25); @@ -10976,7 +10984,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "**********************nan"); + assert(ex == pnan_padding25 + pnan); assert(ios.width() == 0); } ios.width(25); @@ -10984,7 +10992,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "**********************nan"); + assert(ex == pnan_sign + pnan_padding25 + "nan"); assert(ios.width() == 0); } } @@ -10994,7 +11002,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "nan"); + assert(ex == pnan); assert(ios.width() == 0); } ios.width(25); @@ -11002,7 +11010,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "nan**********************"); + assert(ex == pnan + pnan_padding25); assert(ios.width() == 0); } ios.width(25); @@ -11010,7 +11018,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "**********************nan"); + assert(ex == pnan_padding25 + pnan); assert(ios.width() == 0); } ios.width(25); @@ -11018,7 +11026,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "**********************nan"); + assert(ex == pnan_sign + pnan_padding25 + "nan"); assert(ios.width() == 0); } } @@ -11182,7 +11190,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "NAN"); + assert(ex == PNAN); assert(ios.width() == 0); } ios.width(25); @@ -11190,7 +11198,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "NAN**********************"); + assert(ex == PNAN + pnan_padding25); assert(ios.width() == 0); } ios.width(25); @@ -11198,7 +11206,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "**********************NAN"); + assert(ex == pnan_padding25 + PNAN); assert(ios.width() == 0); } ios.width(25); @@ -11206,7 +11214,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "**********************NAN"); + assert(ex == pnan_sign + pnan_padding25 + "NAN"); assert(ios.width() == 0); } } @@ -11216,7 +11224,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "NAN"); + assert(ex == PNAN); assert(ios.width() == 0); } ios.width(25); @@ -11224,7 +11232,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "NAN**********************"); + assert(ex == PNAN + pnan_padding25); assert(ios.width() == 0); } ios.width(25); @@ -11232,7 +11240,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "**********************NAN"); + assert(ex == pnan_padding25 + PNAN); assert(ios.width() == 0); } ios.width(25); @@ -11240,7 +11248,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "**********************NAN"); + assert(ex == pnan_sign + pnan_padding25 + "NAN"); assert(ios.width() == 0); } } @@ -11253,7 +11261,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "NAN"); + assert(ex == PNAN); assert(ios.width() == 0); } ios.width(25); @@ -11261,7 +11269,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "NAN**********************"); + assert(ex == PNAN + pnan_padding25); assert(ios.width() == 0); } ios.width(25); @@ -11269,7 +11277,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "**********************NAN"); + assert(ex == pnan_padding25 + PNAN); assert(ios.width() == 0); } ios.width(25); @@ -11277,7 +11285,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "**********************NAN"); + assert(ex == pnan_sign + pnan_padding25 + "NAN"); assert(ios.width() == 0); } } @@ -11287,7 +11295,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "NAN"); + assert(ex == PNAN); assert(ios.width() == 0); } ios.width(25); @@ -11295,7 +11303,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "NAN**********************"); + assert(ex == PNAN + pnan_padding25); assert(ios.width() == 0); } ios.width(25); @@ -11303,7 +11311,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "**********************NAN"); + assert(ex == pnan_padding25 + PNAN); assert(ios.width() == 0); } ios.width(25); @@ -11311,7 +11319,7 @@ { iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "**********************NAN"); + assert(ex == pnan_sign + pnan_padding25 + "NAN"); assert(ios.width() == 0); } } @@ -24417,7 +24425,7 @@ { std::locale lc = std::locale::classic(); std::locale lg(lc, new my_numpunct); -#if defined(__APPLE__) && defined(__x86_64__) +#if (defined(__APPLE__) || defined(TEST_HAS_GLIBC)) && defined(__x86_64__) // This test is failing on FreeBSD, possibly due to different representations // of the floating point numbers. output_iterator iter;