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