]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
Import libc++ 3.7.0 release (r246257).
[FreeBSD/FreeBSD.git] / test / std / localization / locale.categories / facet.numpunct / locale.numpunct.byname / grouping.pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // REQUIRES: locale.en_US.UTF-8
11 // REQUIRES: locale.fr_FR.UTF-8
12
13 // <locale>
14
15 // template <class charT> class numpunct_byname;
16
17 // string grouping() const;
18
19 // TODO: investigation needed
20 // XFAIL: linux-gnu
21
22 #include <locale>
23 #include <cassert>
24
25 #include "platform_support.h" // locale name macros
26
27 int main()
28 {
29     {
30         std::locale l("C");
31         {
32             typedef char C;
33             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
34             assert(np.grouping() == "");
35         }
36         {
37             typedef wchar_t C;
38             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
39             assert(np.grouping() == "");
40         }
41     }
42     {
43         std::locale l(LOCALE_en_US_UTF_8);
44         {
45             typedef char C;
46             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
47             assert(np.grouping() == "\3\3");
48         }
49         {
50             typedef wchar_t C;
51             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
52             assert(np.grouping() == "\3\3");
53         }
54     }
55     {
56         std::locale l(LOCALE_fr_FR_UTF_8);
57         {
58             typedef char C;
59             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
60             assert(np.grouping() == "\x7F");
61         }
62         {
63             typedef wchar_t C;
64             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
65             assert(np.grouping() == "\x7F");
66         }
67     }
68 }