[libcxx-commits] [libcxx] [libc++][locale] Update grouping tests (PR #119463)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 10 14:11:45 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Vitaly Buka (vitalybuka)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/119463.diff


2 Files Affected:

- (modified) libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp (+9-18) 
- (modified) libcxx/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp (+2-10) 


``````````diff
diff --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp
index ca5b6736f32726..6f23d444f2fe9d 100644
--- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp
@@ -24,6 +24,7 @@
 
 // string grouping() const;
 
+#include <iostream>
 #include <locale>
 #include <limits>
 #include <cassert>
@@ -89,27 +90,22 @@ int main(int, char**)
     }
 #endif
 
-#if defined( _WIN32) || defined(_AIX)
-    std::string us_grouping = "\3";
-#else
-    std::string us_grouping = "\3\3";
-#endif
     {
         Fnf f(LOCALE_en_US_UTF_8, 1);
-        assert(f.grouping() == us_grouping);
+        assert(f.grouping() == "\3" || f.grouping() == "\3\3");
     }
     {
         Fnt f(LOCALE_en_US_UTF_8, 1);
-        assert(f.grouping() == us_grouping);
+        assert(f.grouping() == "\3" || f.grouping() == "\3\3");
     }
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
     {
         Fwf f(LOCALE_en_US_UTF_8, 1);
-        assert(f.grouping() == us_grouping);
+        assert(f.grouping() == "\3" || f.grouping() == "\3\3");
     }
     {
         Fwt f(LOCALE_en_US_UTF_8, 1);
-        assert(f.grouping() == us_grouping);
+        assert(f.grouping() == "\3" || f.grouping() == "\3\3");
     }
 #endif
 
@@ -132,27 +128,22 @@ int main(int, char**)
     }
 #endif
 
-#if defined( _WIN32) || defined(_AIX)
-    std::string ru_grouping = "\3";
-#else
-    std::string ru_grouping = "\3\3";
-#endif
     {
         Fnf f(LOCALE_ru_RU_UTF_8, 1);
-        assert(f.grouping() == ru_grouping);
+        assert(f.grouping() == "\3" || f.grouping() == "\3\3");
     }
     {
         Fnt f(LOCALE_ru_RU_UTF_8, 1);
-        assert(f.grouping() == ru_grouping);
+        assert(f.grouping() == "\3" || f.grouping() == "\3\3");
     }
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
     {
         Fwf f(LOCALE_ru_RU_UTF_8, 1);
-        assert(f.grouping() == ru_grouping);
+        assert(f.grouping() == "\3" || f.grouping() == "\3\3");
     }
     {
         Fwt f(LOCALE_ru_RU_UTF_8, 1);
-        assert(f.grouping() == ru_grouping);
+        assert(f.grouping() == "\3" || f.grouping() == "\3\3");
     }
 #endif
 
diff --git a/libcxx/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp b/libcxx/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
index 86c447d400aaae..1e68bb3967f0f3 100644
--- a/libcxx/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
@@ -48,21 +48,13 @@ int main(int, char**)
         {
             typedef char C;
             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
-#if defined(_WIN32) || defined(_AIX)
-            assert(np.grouping() == "\3");
-#else
-            assert(np.grouping() == "\3\3");
-#endif
+            assert(np.grouping() == "\3" || np.grouping() == "\3\3");
         }
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
         {
             typedef wchar_t C;
             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
-#  if defined(_WIN32) || defined(_AIX)
-            assert(np.grouping() == "\3");
-#  else
-            assert(np.grouping() == "\3\3");
-#  endif
+            assert(np.grouping() == "\3" || np.grouping() == "\3\3");
         }
 #endif
     }

``````````

</details>


https://github.com/llvm/llvm-project/pull/119463


More information about the libcxx-commits mailing list