Skip to content

[libc++][locale] Update grouping tests #119463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 16, 2024

Conversation

vitalybuka
Copy link
Collaborator

@vitalybuka vitalybuka commented Dec 10, 2024

I am not sure when it happen, but these tests started to fail.
Checkout to 6 month back does not help, but I am sure it worked then.

I believe it can be related to some update, e.g. gcc:

gcc --version
gcc (Debian 14.2.0-3+build3) 14.2.0

Fixes #119047.

Created using spr 1.3.4
@vitalybuka vitalybuka requested a review from a team as a code owner December 10, 2024 22:11
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Dec 10, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 10, 2024

@llvm/pr-subscribers-libcxx

Author: Vitaly Buka (vitalybuka)

Changes

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 --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
     }

@philnik777
Copy link
Contributor

#119047 is probably the issue.

Copy link
Contributor

@rprichard rprichard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but I believe someone in reviewers-libcxx needs to approve it.

Copy link
Member

@MaskRay MaskRay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but someone in reviewers-libcxx needs to approve

@ldionne ldionne merged commit 31272e4 into main Dec 16, 2024
60 of 62 checks passed
@ldionne ldionne deleted the users/vitalybuka/spr/libclocale-update-grouping-tests branch December 16, 2024 17:51
@ldionne ldionne restored the users/vitalybuka/spr/libclocale-update-grouping-tests branch December 16, 2024 17:51
@ldionne ldionne deleted the users/vitalybuka/spr/libclocale-update-grouping-tests branch December 16, 2024 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[libc++] locale.numpunct.byname/grouping.pass.cpp tests fail with glibc 2.39
6 participants