[libcxx-commits] [libcxx] 865c7ab - [libcxx] [test] Fix moneypunct grouping tests on Windows

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 21 13:09:33 PST 2022


Author: Martin Storsjö
Date: 2022-02-21T23:08:56+02:00
New Revision: 865c7ab421a6620e3ae7a45943db4eebc7717daa

URL: https://github.com/llvm/llvm-project/commit/865c7ab421a6620e3ae7a45943db4eebc7717daa
DIFF: https://github.com/llvm/llvm-project/commit/865c7ab421a6620e3ae7a45943db4eebc7717daa.diff

LOG: [libcxx] [test] Fix moneypunct grouping tests on Windows

For grouping strings, "\3" and "\3\3" are equivalent.

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

Added: 
    

Modified: 
    libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp
    libcxx/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp

Removed: 
    


################################################################################
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 3dae97f873dd8..dc1e3424553a5 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
@@ -11,8 +11,6 @@
 // NetBSD does not support LC_MONETARY at the moment
 // XFAIL: netbsd
 
-// XFAIL: LIBCXX-WINDOWS-FIXME
-
 // REQUIRES: locale.en_US.UTF-8
 // REQUIRES: locale.fr_FR.UTF-8
 // REQUIRES: locale.ru_RU.UTF-8
@@ -89,22 +87,27 @@ int main(int, char**)
     }
 #endif
 
+#ifdef _WIN32
+    std::string us_grouping = "\3";
+#else
+    std::string us_grouping = "\3\3";
+#endif
     {
         Fnf f(LOCALE_en_US_UTF_8, 1);
-        assert(f.grouping() == "\3\3");
+        assert(f.grouping() == us_grouping);
     }
     {
         Fnt f(LOCALE_en_US_UTF_8, 1);
-        assert(f.grouping() == "\3\3");
+        assert(f.grouping() == us_grouping);
     }
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
     {
         Fwf f(LOCALE_en_US_UTF_8, 1);
-        assert(f.grouping() == "\3\3");
+        assert(f.grouping() == us_grouping);
     }
     {
         Fwt f(LOCALE_en_US_UTF_8, 1);
-        assert(f.grouping() == "\3\3");
+        assert(f.grouping() == us_grouping);
     }
 #endif
 
@@ -127,22 +130,27 @@ int main(int, char**)
     }
 #endif
 
+#ifdef _WIN32
+    std::string ru_grouping = "\3";
+#else
+    std::string ru_grouping = "\3\3";
+#endif
     {
         Fnf f(LOCALE_ru_RU_UTF_8, 1);
-        assert(f.grouping() == "\3\3");
+        assert(f.grouping() == ru_grouping);
     }
     {
         Fnt f(LOCALE_ru_RU_UTF_8, 1);
-        assert(f.grouping() == "\3\3");
+        assert(f.grouping() == ru_grouping);
     }
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
     {
         Fwf f(LOCALE_ru_RU_UTF_8, 1);
-        assert(f.grouping() == "\3\3");
+        assert(f.grouping() == ru_grouping);
     }
     {
         Fwt f(LOCALE_ru_RU_UTF_8, 1);
-        assert(f.grouping() == "\3\3");
+        assert(f.grouping() == ru_grouping);
     }
 #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 b7223ebcb68a1..7f9dbc9ded618 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
@@ -9,7 +9,6 @@
 // NetBSD does not support LC_NUMERIC at the moment
 // XFAIL: netbsd
 
-// XFAIL: LIBCXX-WINDOWS-FIXME
 // XFAIL: LIBCXX-AIX-FIXME
 
 // REQUIRES: locale.en_US.UTF-8
@@ -49,19 +48,27 @@ int main(int, char**)
         {
             typedef char C;
             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+#ifdef _WIN32
+            assert(np.grouping() == "\3");
+#else
             assert(np.grouping() == "\3\3");
+#endif
         }
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
         {
             typedef wchar_t C;
             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+#ifdef _WIN32
+            assert(np.grouping() == "\3");
+#else
             assert(np.grouping() == "\3\3");
+#endif
         }
 #endif
     }
     {
         std::locale l(LOCALE_fr_FR_UTF_8);
-#if defined(TEST_HAS_GLIBC)
+#if defined(TEST_HAS_GLIBC) || defined(_WIN32)
         const char* const group = "\3";
 #else
         const char* const group = "\x7f";


        


More information about the libcxx-commits mailing list