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 @@ -10717,6 +10717,17 @@ std::locale lc = std::locale::classic(); std::locale lg(lc, new my_numpunct); const my_facet f(1); +#if defined(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); @@ -10881,11 +10892,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+nan"); -#else - assert(ex == "nan"); -#endif + assert(ex == pnan); assert(ios.width() == 0); } ios.width(25); @@ -10893,11 +10900,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+nan*********************"); -#else - assert(ex == "nan**********************"); -#endif + assert(ex == pnan + pnan_padding25); assert(ios.width() == 0); } ios.width(25); @@ -10905,11 +10908,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "*********************+nan"); -#else - assert(ex == "**********************nan"); -#endif + assert(ex == pnan_padding25 + pnan); assert(ios.width() == 0); } ios.width(25); @@ -10917,11 +10916,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+*********************nan"); -#else - assert(ex == "**********************nan"); -#endif + assert(ex == pnan_sign + pnan_padding25 + "nan"); assert(ios.width() == 0); } } @@ -10931,11 +10926,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+nan"); -#else - assert(ex == "nan"); -#endif + assert(ex == pnan); assert(ios.width() == 0); } ios.width(25); @@ -10943,11 +10934,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+nan*********************"); -#else - assert(ex == "nan**********************"); -#endif + assert(ex == pnan + pnan_padding25); assert(ios.width() == 0); } ios.width(25); @@ -10955,11 +10942,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "*********************+nan"); -#else - assert(ex == "**********************nan"); -#endif + assert(ex == pnan_padding25 + pnan); assert(ios.width() == 0); } ios.width(25); @@ -10967,11 +10950,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+*********************nan"); -#else - assert(ex == "**********************nan"); -#endif + assert(ex == pnan_sign + pnan_padding25 + "nan"); assert(ios.width() == 0); } } @@ -10984,11 +10963,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+nan"); -#else - assert(ex == "nan"); -#endif + assert(ex == pnan); assert(ios.width() == 0); } ios.width(25); @@ -10996,11 +10971,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+nan*********************"); -#else - assert(ex == "nan**********************"); -#endif + assert(ex == pnan + pnan_padding25); assert(ios.width() == 0); } ios.width(25); @@ -11008,11 +10979,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "*********************+nan"); -#else - assert(ex == "**********************nan"); -#endif + assert(ex == pnan_padding25 + pnan); assert(ios.width() == 0); } ios.width(25); @@ -11020,11 +10987,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+*********************nan"); -#else - assert(ex == "**********************nan"); -#endif + assert(ex == pnan_sign + pnan_padding25 + "nan"); assert(ios.width() == 0); } } @@ -11034,11 +10997,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+nan"); -#else - assert(ex == "nan"); -#endif + assert(ex == pnan); assert(ios.width() == 0); } ios.width(25); @@ -11046,11 +11005,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+nan*********************"); -#else - assert(ex == "nan**********************"); -#endif + assert(ex == pnan + pnan_padding25); assert(ios.width() == 0); } ios.width(25); @@ -11058,11 +11013,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "*********************+nan"); -#else - assert(ex == "**********************nan"); -#endif + assert(ex == pnan_padding25 + pnan); assert(ios.width() == 0); } ios.width(25); @@ -11070,11 +11021,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+*********************nan"); -#else - assert(ex == "**********************nan"); -#endif + assert(ex == pnan_sign + pnan_padding25 + "nan"); assert(ios.width() == 0); } } @@ -11238,11 +11185,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+NAN"); -#else - assert(ex == "NAN"); -#endif + assert(ex == PNAN); assert(ios.width() == 0); } ios.width(25); @@ -11250,11 +11193,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+NAN*********************"); -#else - assert(ex == "NAN**********************"); -#endif + assert(ex == PNAN + pnan_padding25); assert(ios.width() == 0); } ios.width(25); @@ -11262,11 +11201,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "*********************+NAN"); -#else - assert(ex == "**********************NAN"); -#endif + assert(ex == pnan_padding25 + PNAN); assert(ios.width() == 0); } ios.width(25); @@ -11274,11 +11209,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+*********************NAN"); -#else - assert(ex == "**********************NAN"); -#endif + assert(ex == pnan_sign + pnan_padding25 + "NAN"); assert(ios.width() == 0); } } @@ -11288,11 +11219,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+NAN"); -#else - assert(ex == "NAN"); -#endif + assert(ex == PNAN); assert(ios.width() == 0); } ios.width(25); @@ -11300,11 +11227,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+NAN*********************"); -#else - assert(ex == "NAN**********************"); -#endif + assert(ex == PNAN + pnan_padding25); assert(ios.width() == 0); } ios.width(25); @@ -11312,11 +11235,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "*********************+NAN"); -#else - assert(ex == "**********************NAN"); -#endif + assert(ex == pnan_padding25 + PNAN); assert(ios.width() == 0); } ios.width(25); @@ -11324,11 +11243,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+*********************NAN"); -#else - assert(ex == "**********************NAN"); -#endif + assert(ex == pnan_sign + pnan_padding25 + "NAN"); assert(ios.width() == 0); } } @@ -11341,11 +11256,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+NAN"); -#else - assert(ex == "NAN"); -#endif + assert(ex == PNAN); assert(ios.width() == 0); } ios.width(25); @@ -11353,11 +11264,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+NAN*********************"); -#else - assert(ex == "NAN**********************"); -#endif + assert(ex == PNAN + pnan_padding25); assert(ios.width() == 0); } ios.width(25); @@ -11365,11 +11272,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "*********************+NAN"); -#else - assert(ex == "**********************NAN"); -#endif + assert(ex == pnan_padding25 + PNAN); assert(ios.width() == 0); } ios.width(25); @@ -11377,11 +11280,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+*********************NAN"); -#else - assert(ex == "**********************NAN"); -#endif + assert(ex == pnan_sign + pnan_padding25 + "NAN"); assert(ios.width() == 0); } } @@ -11391,11 +11290,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+NAN"); -#else - assert(ex == "NAN"); -#endif + assert(ex == PNAN); assert(ios.width() == 0); } ios.width(25); @@ -11403,11 +11298,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+NAN*********************"); -#else - assert(ex == "NAN**********************"); -#endif + assert(ex == PNAN + pnan_padding25); assert(ios.width() == 0); } ios.width(25); @@ -11415,11 +11306,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "*********************+NAN"); -#else - assert(ex == "**********************NAN"); -#endif + assert(ex == pnan_padding25 + PNAN); assert(ios.width() == 0); } ios.width(25); @@ -11427,11 +11314,7 @@ { cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); -#if defined(TEST_HAS_GLIBC) - assert(ex == "+*********************NAN"); -#else - assert(ex == "**********************NAN"); -#endif + assert(ex == pnan_sign + pnan_padding25 + "NAN"); assert(ios.width() == 0); } } @@ -24531,7 +24414,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. const my_facet f(1);