[libcxx-commits] [libcxx] 5333732 - [libcxx] [test] Fix the get/put long_double_ru_RU tests on Apple platforms

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Thu Feb 24 00:23:31 PST 2022


Author: Martin Storsjö
Date: 2022-02-24T10:21:36+02:00
New Revision: 5333732fce96a376ada2941c11e5cf01de5caa63

URL: https://github.com/llvm/llvm-project/commit/5333732fce96a376ada2941c11e5cf01de5caa63
DIFF: https://github.com/llvm/llvm-project/commit/5333732fce96a376ada2941c11e5cf01de5caa63.diff

LOG: [libcxx] [test] Fix the get/put long_double_ru_RU tests on Apple platforms

This fixes issue #45084 (https://llvm.org/PR45739).

Remove unnecessary trailing spaces after the "RUB" international
currency symbol (and after the plain number in some parts of the
put_long_double test).

Both of these test files are
`XFAIL: netbsd || linux || LIBCXX-WINDOWS-FIXME`, and then have some of
their test cases commented out when `__APPLE__`. This patch comments-in
those test cases and adjusts them all to work on Apple, while leaving the
test `XFAIL`ed on NetBSD, Linux, and Windows.

Differential Revision: https://reviews.llvm.org/D120316

Added: 
    

Modified: 
    libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
    libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
index 03b33effb7a5f..f4644ab2df242 100644
--- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
@@ -35,19 +35,6 @@
 
 #include "platform_support.h" // locale name macros
 
-// TODO:
-// Some of the assertions in this test are failing on Apple platforms.
-// Until we figure out the problem and fix it, disable these tests on
-// Apple platforms. Note that we're not using XFAIL or UNSUPPORTED markup
-// here, because this test would otherwise be disabled on all platforms
-// we test. To avoid this test becoming entirely stale, we just disable
-// the parts that fail.
-//
-// See https://llvm.org/PR45739 for the bug tracking this.
-#if defined(__APPLE__)
-#   define APPLE_FIXME
-#endif
-
 typedef std::money_get<char, cpp17_input_iterator<const char*> > Fn;
 
 class my_facet
@@ -228,7 +215,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // negative, showbase
-            std::string v = "-1 234 567,89 RUB ";
+            std::string v = "-1 234 567,89 RUB";
             std::showbase(ios);
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
@@ -240,7 +227,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // negative, showbase
-            std::string v = "-1 234 567,89 RUB ";
+            std::string v = "-1 234 567,89 RUB";
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -310,7 +297,7 @@ int main(int, char**)
             assert(ex == -123456789);
         }
         {   // zero, showbase
-            std::string v = "0,00 RUB ";
+            std::string v = "0,00 RUB";
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -320,9 +307,8 @@ int main(int, char**)
             assert(err == std::ios_base::goodbit);
             assert(ex == 0);
         }
-#if !defined(APPLE_FIXME)
         {   // zero, showbase
-            std::string v = "0,00 RUB ";
+            std::string v = "0,00 RUB";
             std::showbase(ios);
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
@@ -334,9 +320,8 @@ int main(int, char**)
             assert(ex == 0);
             std::noshowbase(ios);
         }
-#endif
         {   // negative one, showbase
-            std::string v = "-0,01 RUB ";
+            std::string v = "-0,01 RUB";
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -346,9 +331,8 @@ int main(int, char**)
             assert(err == std::ios_base::goodbit);
             assert(ex == -1);
         }
-#if !defined(APPLE_FIXME)
         {   // negative one, showbase
-            std::string v = "-0,01 RUB ";
+            std::string v = "-0,01 RUB";
             std::showbase(ios);
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
@@ -360,9 +344,8 @@ int main(int, char**)
             assert(ex == -1);
             std::noshowbase(ios);
         }
-#endif
         {   // positive, showbase
-            std::string v = "1 234 567,89 RUB ";
+            std::string v = "1 234 567,89 RUB";
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -372,9 +355,8 @@ int main(int, char**)
             assert(err == std::ios_base::goodbit);
             assert(ex == 123456789);
         }
-#if !defined(APPLE_FIXME)
         {   // positive, showbase
-            std::string v = "1 234 567,89 RUB ";
+            std::string v = "1 234 567,89 RUB";
             std::showbase(ios);
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
@@ -386,10 +368,8 @@ int main(int, char**)
             assert(ex == 123456789);
             std::noshowbase(ios);
         }
-#endif
-#if !defined(APPLE_FIXME)
         {   // negative, showbase
-            std::string v = "-1 234 567,89 RUB ";
+            std::string v = "-1 234 567,89 RUB";
             std::showbase(ios);
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
@@ -401,7 +381,6 @@ int main(int, char**)
             assert(ex == -123456789);
             std::noshowbase(ios);
         }
-#endif
         {   // negative, showbase
             std::string v = "-1 234 567,89 \xD1\x80\xD1\x83\xD0\xB1"".";
             std::showbase(ios);
@@ -571,7 +550,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // negative, showbase
-            std::wstring v = L"-1 234 567,89 RUB ";
+            std::wstring v = L"-1 234 567,89 RUB";
             std::showbase(ios);
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
@@ -583,7 +562,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // negative, showbase
-            std::wstring v = L"-1 234 567,89 RUB ";
+            std::wstring v = L"-1 234 567,89 RUB";
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -653,7 +632,7 @@ int main(int, char**)
             assert(ex == -123456789);
         }
         {   // zero, showbase
-            std::wstring v = L"0,00 RUB ";
+            std::wstring v = L"0,00 RUB";
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -663,9 +642,8 @@ int main(int, char**)
             assert(err == std::ios_base::goodbit);
             assert(ex == 0);
         }
-#if !defined(APPLE_FIXME)
         {   // zero, showbase
-            std::wstring v = L"0,00 RUB ";
+            std::wstring v = L"0,00 RUB";
             std::showbase(ios);
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
@@ -677,9 +655,8 @@ int main(int, char**)
             assert(ex == 0);
             std::noshowbase(ios);
         }
-#endif
         {   // negative one, showbase
-            std::wstring v = L"-0,01 RUB ";
+            std::wstring v = L"-0,01 RUB";
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -689,9 +666,8 @@ int main(int, char**)
             assert(err == std::ios_base::goodbit);
             assert(ex == -1);
         }
-#if !defined(APPLE_FIXME)
         {   // negative one, showbase
-            std::wstring v = L"-0,01 RUB ";
+            std::wstring v = L"-0,01 RUB";
             std::showbase(ios);
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
@@ -703,9 +679,8 @@ int main(int, char**)
             assert(ex == -1);
             std::noshowbase(ios);
         }
-#endif
         {   // positive, showbase
-            std::wstring v = L"1 234 567,89 RUB ";
+            std::wstring v = L"1 234 567,89 RUB";
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -715,9 +690,8 @@ int main(int, char**)
             assert(err == std::ios_base::goodbit);
             assert(ex == 123456789);
         }
-#if !defined(APPLE_FIXME)
         {   // positive, showbase
-            std::wstring v = L"1 234 567,89 RUB ";
+            std::wstring v = L"1 234 567,89 RUB";
             std::showbase(ios);
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
@@ -729,10 +703,8 @@ int main(int, char**)
             assert(ex == 123456789);
             std::noshowbase(ios);
         }
-#endif
-#if !defined(APPLE_FIXME)
         {   // negative, showbase
-            std::wstring v = L"-1 234 567,89 RUB ";
+            std::wstring v = L"-1 234 567,89 RUB";
             std::showbase(ios);
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
@@ -744,7 +716,6 @@ int main(int, char**)
             assert(ex == -123456789);
             std::noshowbase(ios);
         }
-#endif
         {   // negative, showbase
             std::wstring v = L"-1 234 567,89 \x440\x443\x431"".";
             std::showbase(ios);

diff  --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
index 7d97c2f3b09f5..975b9ed156486 100644
--- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
@@ -35,19 +35,6 @@
 
 #include "platform_support.h" // locale name macros
 
-// TODO:
-// Some of the assertions in this test are failing on Apple platforms.
-// Until we figure out the problem and fix it, disable these tests on
-// Apple platforms. Note that we're not using XFAIL or UNSUPPORTED markup
-// here, because this test would otherwise be disabled on all platforms
-// we test. To avoid this test becoming entirely stale, we just disable
-// the parts that fail.
-//
-// See https://llvm.org/PR45739 for the bug tracking this.
-#if defined(__APPLE__)
-#   define APPLE_FIXME
-#endif
-
 typedef std::money_put<char, cpp17_output_iterator<char*> > Fn;
 
 class my_facet
@@ -87,36 +74,34 @@ int main(int, char**)
 {
     const my_facet f(1);
     // char, national
-#if !defined(APPLE_FIXME)
     {   // zero
         long double v = 0;
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), false, ios, '*', v);
         std::string ex(str, iter.base());
-        assert(ex == "0,00 ");
+        assert(ex == "0,00");
     }
     {   // negative one
         long double v = -1;
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), false, ios, '*', v);
         std::string ex(str, iter.base());
-        assert(ex == "-0,01 ");
+        assert(ex == "-0,01");
     }
     {   // positive
         long double v = 123456789;
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), false, ios, '*', v);
         std::string ex(str, iter.base());
-        assert(ex == "1 234 567,89 ");
+        assert(ex == "1 234 567,89");
     }
     {   // negative
         long double v = -123456789;
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), false, ios, '*', v);
         std::string ex(str, iter.base());
-        assert(ex == "-1 234 567,89 ");
+        assert(ex == "-1 234 567,89");
     }
-#endif // APPLE_FIXME
     {   // zero, showbase
         long double v = 0;
         std::showbase(ios);
@@ -186,34 +171,33 @@ int main(int, char**)
     // char, international
     std::noshowbase(ios);
     ios.unsetf(std::ios_base::adjustfield);
-#if !defined(APPLE_FIXME)
     {   // zero
         long double v = 0;
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, '*', v);
         std::string ex(str, iter.base());
-        assert(ex == "0,00 ");
+        assert(ex == "0,00");
     }
     {   // negative one
         long double v = -1;
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, '*', v);
         std::string ex(str, iter.base());
-        assert(ex == "-0,01 ");
+        assert(ex == "-0,01");
     }
     {   // positive
         long double v = 123456789;
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, '*', v);
         std::string ex(str, iter.base());
-        assert(ex == "1 234 567,89 ");
+        assert(ex == "1 234 567,89");
     }
     {   // negative
         long double v = -123456789;
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, '*', v);
         std::string ex(str, iter.base());
-        assert(ex == "-1 234 567,89 ");
+        assert(ex == "-1 234 567,89");
     }
     {   // zero, showbase
         long double v = 0;
@@ -221,7 +205,7 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, '*', v);
         std::string ex(str, iter.base());
-        assert(ex == "0,00 RUB ");
+        assert(ex == "0,00 RUB");
     }
     {   // negative one, showbase
         long double v = -1;
@@ -229,7 +213,7 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, '*', v);
         std::string ex(str, iter.base());
-        assert(ex == "-0,01 RUB ");
+        assert(ex == "-0,01 RUB");
     }
     {   // positive, showbase
         long double v = 123456789;
@@ -237,7 +221,7 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, '*', v);
         std::string ex(str, iter.base());
-        assert(ex == "1 234 567,89 RUB ");
+        assert(ex == "1 234 567,89 RUB");
     }
     {   // negative, showbase
         long double v = -123456789;
@@ -245,9 +229,8 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, '*', v);
         std::string ex(str, iter.base());
-        assert(ex == "-1 234 567,89 RUB ");
+        assert(ex == "-1 234 567,89 RUB");
     }
-#endif // APPLE_FIXME
     {   // negative, showbase, left
         long double v = -123456789;
         std::showbase(ios);
@@ -259,7 +242,6 @@ int main(int, char**)
         assert(ex == "-1 234 567,89 RUB   ");
         assert(ios.width() == 0);
     }
-#if !defined(APPLE_FIXME)
     {   // negative, showbase, internal
         long double v = -123456789;
         std::showbase(ios);
@@ -268,7 +250,7 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, ' ', v);
         std::string ex(str, iter.base());
-        assert(ex == "-1 234 567,89   RUB ");
+        assert(ex == "-1 234 567,89    RUB");
         assert(ios.width() == 0);
     }
     {   // negative, showbase, right
@@ -279,10 +261,9 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, ' ', v);
         std::string ex(str, iter.base());
-        assert(ex == "  -1 234 567,89 RUB ");
+        assert(ex == "   -1 234 567,89 RUB");
         assert(ios.width() == 0);
     }
-#endif // APPLE_FIXME
 }
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
 {
@@ -290,36 +271,34 @@ int main(int, char**)
     // wchar_t, national
     std::noshowbase(ios);
     ios.unsetf(std::ios_base::adjustfield);
-#if !defined(APPLE_FIXME)
     {   // zero
         long double v = 0;
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, '*', v);
         std::wstring ex(str, iter.base());
-        assert(ex == L"0,00 ");
+        assert(ex == L"0,00");
     }
     {   // negative one
         long double v = -1;
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, '*', v);
         std::wstring ex(str, iter.base());
-        assert(ex == L"-0,01 ");
+        assert(ex == L"-0,01");
     }
     {   // positive
         long double v = 123456789;
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, '*', v);
         std::wstring ex(str, iter.base());
-        assert(ex == L"1 234 567,89 ");
+        assert(ex == L"1 234 567,89");
     }
     {   // negative
         long double v = -123456789;
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, '*', v);
         std::wstring ex(str, iter.base());
-        assert(ex == L"-1 234 567,89 ");
+        assert(ex == L"-1 234 567,89");
     }
-#endif // APPLE_FIXME
     {   // zero, showbase
         long double v = 0;
         std::showbase(ios);
@@ -389,34 +368,33 @@ int main(int, char**)
     // wchar_t, international
     std::noshowbase(ios);
     ios.unsetf(std::ios_base::adjustfield);
-#if !defined(APPLE_FIXME)
     {   // zero
         long double v = 0;
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, '*', v);
         std::wstring ex(str, iter.base());
-        assert(ex == L"0,00 ");
+        assert(ex == L"0,00");
     }
     {   // negative one
         long double v = -1;
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, '*', v);
         std::wstring ex(str, iter.base());
-        assert(ex == L"-0,01 ");
+        assert(ex == L"-0,01");
     }
     {   // positive
         long double v = 123456789;
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, '*', v);
         std::wstring ex(str, iter.base());
-        assert(ex == L"1 234 567,89 ");
+        assert(ex == L"1 234 567,89");
     }
     {   // negative
         long double v = -123456789;
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, '*', v);
         std::wstring ex(str, iter.base());
-        assert(ex == L"-1 234 567,89 ");
+        assert(ex == L"-1 234 567,89");
     }
     {   // zero, showbase
         long double v = 0;
@@ -424,7 +402,7 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, '*', v);
         std::wstring ex(str, iter.base());
-        assert(ex == L"0,00 RUB ");
+        assert(ex == L"0,00 RUB");
     }
     {   // negative one, showbase
         long double v = -1;
@@ -432,7 +410,7 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, '*', v);
         std::wstring ex(str, iter.base());
-        assert(ex == L"-0,01 RUB ");
+        assert(ex == L"-0,01 RUB");
     }
     {   // positive, showbase
         long double v = 123456789;
@@ -440,7 +418,7 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, '*', v);
         std::wstring ex(str, iter.base());
-        assert(ex == L"1 234 567,89 RUB ");
+        assert(ex == L"1 234 567,89 RUB");
     }
     {   // negative, showbase
         long double v = -123456789;
@@ -448,9 +426,8 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, '*', v);
         std::wstring ex(str, iter.base());
-        assert(ex == L"-1 234 567,89 RUB ");
+        assert(ex == L"-1 234 567,89 RUB");
     }
-#endif // APPLE_FIXME
     {   // negative, showbase, left
         long double v = -123456789;
         std::showbase(ios);
@@ -462,7 +439,6 @@ int main(int, char**)
         assert(ex == L"-1 234 567,89 RUB   ");
         assert(ios.width() == 0);
     }
-#if !defined(APPLE_FIXME)
     {   // negative, showbase, internal
         long double v = -123456789;
         std::showbase(ios);
@@ -471,7 +447,7 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, ' ', v);
         std::wstring ex(str, iter.base());
-        assert(ex == L"-1 234 567,89   RUB ");
+        assert(ex == L"-1 234 567,89    RUB");
         assert(ios.width() == 0);
     }
     {   // negative, showbase, right
@@ -482,10 +458,9 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, ' ', v);
         std::wstring ex(str, iter.base());
-        assert(ex == L"  -1 234 567,89 RUB ");
+        assert(ex == L"   -1 234 567,89 RUB");
         assert(ios.width() == 0);
     }
-#endif // APPLE_FIXME
 }
 #endif // TEST_HAS_NO_WIDE_CHARACTERS
 


        


More information about the libcxx-commits mailing list