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// <locale>
11
12// basic_string<char> name() const;
13
14#include <locale>
15#include <cassert>
16
17#include "platform_support.h" // locale name macros
18
19int main()
20{
21    std::locale cloc;
22    std::locale copy(cloc);
23    std::locale n1(LOCALE_en_US_UTF_8);
24    std::locale n2(LOCALE_en_US_UTF_8);
25    std::locale noname1 = n1.combine<std::ctype<char> >(cloc);
26    std::locale nonamec = noname1;
27    std::locale noname2 = n1.combine<std::ctype<char> >(cloc);
28
29    assert(cloc == cloc);
30    assert(cloc == copy);
31    assert(cloc != n1);
32    assert(cloc != n2);
33    assert(cloc != noname1);
34    assert(cloc != nonamec);
35    assert(cloc != noname2);
36
37    assert(copy == cloc);
38    assert(copy == copy);
39    assert(copy != n1);
40    assert(copy != n2);
41    assert(copy != noname1);
42    assert(copy != nonamec);
43    assert(copy != noname2);
44
45    assert(n1 != cloc);
46    assert(n1 != copy);
47    assert(n1 == n1);
48    assert(n1 == n2);
49    assert(n1 != noname1);
50    assert(n1 != nonamec);
51    assert(n1 != noname2);
52
53    assert(n2 != cloc);
54    assert(n2 != copy);
55    assert(n2 == n1);
56    assert(n2 == n2);
57    assert(n2 != noname1);
58    assert(n2 != nonamec);
59    assert(n2 != noname2);
60
61    assert(noname1 != cloc);
62    assert(noname1 != copy);
63    assert(noname1 != n1);
64    assert(noname1 != n2);
65    assert(noname1 == noname1);
66    assert(noname1 == nonamec);
67    assert(noname1 != noname2);
68
69    assert(nonamec != cloc);
70    assert(nonamec != copy);
71    assert(nonamec != n1);
72    assert(nonamec != n2);
73    assert(nonamec == noname1);
74    assert(nonamec == nonamec);
75    assert(nonamec != noname2);
76
77    assert(noname2 != cloc);
78    assert(noname2 != copy);
79    assert(noname2 != n1);
80    assert(noname2 != n2);
81    assert(noname2 != noname1);
82    assert(noname2 != nonamec);
83    assert(noname2 == noname2);
84}
85