[PATCH] D25811: [libcxx] Fix toupper/tolower tests for UTF-8 locale

Krzysztof Parzyszek via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 19 18:54:55 PDT 2016


kparzysz created this revision.
kparzysz added a reviewer: EricWF.
kparzysz added a subscriber: cfe-commits.
kparzysz set the repository for this revision to rL LLVM.

The characters like '\xDA' or '\xFA' are not valid representations of anything in UTF-8, so toupper and tolower return the character itself in that locale.


Repository:
  rL LLVM

https://reviews.llvm.org/D25811

Files:
  test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
  test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
  test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
  test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp


Index: test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
===================================================================
--- test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
+++ test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
@@ -35,7 +35,7 @@
             std::string in("\xFA A\x07.a1");
 
             assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size());
-            assert(in[0] == '\xDA');
+            assert(in[0] == '\xFA');
             assert(in[1] == ' ');
             assert(in[2] == 'A');
             assert(in[3] == '\x07');
Index: test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
===================================================================
--- test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
+++ test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
@@ -39,7 +39,7 @@
             assert(f.toupper('a') == 'A');
             assert(f.toupper('1') == '1');
             assert(f.toupper('\xDA') == '\xDA');
-            assert(f.toupper('\xFA') == '\xDA');
+            assert(f.toupper('\xFA') == '\xFA');
         }
     }
     {
Index: test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
===================================================================
--- test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
+++ test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
@@ -35,7 +35,7 @@
             std::string in("\xDA A\x07.a1");
 
             assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size());
-            assert(in[0] == '\xFA');
+            assert(in[0] == '\xDA');
             assert(in[1] == ' ');
             assert(in[2] == 'a');
             assert(in[3] == '\x07');
Index: test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
===================================================================
--- test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
+++ test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
@@ -38,7 +38,7 @@
             assert(f.tolower('.') == '.');
             assert(f.tolower('a') == 'a');
             assert(f.tolower('1') == '1');
-            assert(f.tolower('\xDA') == '\xFA');
+            assert(f.tolower('\xDA') == '\xDA');
             assert(f.tolower('\xFA') == '\xFA');
         }
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25811.75263.patch
Type: text/x-patch
Size: 2753 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161020/2c8de880/attachment-0001.bin>


More information about the cfe-commits mailing list