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 // class moneypunct_byname<charT, International> 13 14 // string_type positive_sign() const; 15 16 #include <locale> 17 #include <limits> 18 #include <cassert> 19 20 #include "platform_support.h" // locale name macros 21 22 class Fnf 23 : public std::moneypunct_byname<char, false> 24 { 25 public: 26 explicit Fnf(const std::string& nm, std::size_t refs = 0) 27 : std::moneypunct_byname<char, false>(nm, refs) {} 28 }; 29 30 class Fnt 31 : public std::moneypunct_byname<char, true> 32 { 33 public: 34 explicit Fnt(const std::string& nm, std::size_t refs = 0) 35 : std::moneypunct_byname<char, true>(nm, refs) {} 36 }; 37 38 class Fwf 39 : public std::moneypunct_byname<wchar_t, false> 40 { 41 public: 42 explicit Fwf(const std::string& nm, std::size_t refs = 0) 43 : std::moneypunct_byname<wchar_t, false>(nm, refs) {} 44 }; 45 46 class Fwt 47 : public std::moneypunct_byname<wchar_t, true> 48 { 49 public: 50 explicit Fwt(const std::string& nm, std::size_t refs = 0) 51 : std::moneypunct_byname<wchar_t, true>(nm, refs) {} 52 }; 53 54 int main() 55 { 56 { 57 Fnf f("C", 1); 58 assert(f.positive_sign() == std::string()); 59 } 60 { 61 Fnt f("C", 1); 62 assert(f.positive_sign() == std::string()); 63 } 64 { 65 Fwf f("C", 1); 66 assert(f.positive_sign() == std::wstring()); 67 } 68 { 69 Fwt f("C", 1); 70 assert(f.positive_sign() == std::wstring()); 71 } 72 73 { 74 Fnf f(LOCALE_en_US_UTF_8, 1); 75 assert(f.positive_sign() == ""); 76 } 77 { 78 Fnt f(LOCALE_en_US_UTF_8, 1); 79 assert(f.positive_sign() == ""); 80 } 81 { 82 Fwf f(LOCALE_en_US_UTF_8, 1); 83 assert(f.positive_sign() == L""); 84 } 85 { 86 Fwt f(LOCALE_en_US_UTF_8, 1); 87 assert(f.positive_sign() == L""); 88 } 89 90 { 91 Fnf f(LOCALE_fr_FR_UTF_8, 1); 92 assert(f.positive_sign() == ""); 93 } 94 { 95 Fnt f(LOCALE_fr_FR_UTF_8, 1); 96 assert(f.positive_sign() == ""); 97 } 98 { 99 Fwf f(LOCALE_fr_FR_UTF_8, 1); 100 assert(f.positive_sign() == L""); 101 } 102 { 103 Fwt f(LOCALE_fr_FR_UTF_8, 1); 104 assert(f.positive_sign() == L""); 105 } 106 107 { 108 Fnf f(LOCALE_ru_RU_UTF_8, 1); 109 assert(f.positive_sign() == ""); 110 } 111 { 112 Fnt f(LOCALE_ru_RU_UTF_8, 1); 113 assert(f.positive_sign() == ""); 114 } 115 { 116 Fwf f(LOCALE_ru_RU_UTF_8, 1); 117 assert(f.positive_sign() == L""); 118 } 119 { 120 Fwt f(LOCALE_ru_RU_UTF_8, 1); 121 assert(f.positive_sign() == L""); 122 } 123 124 { 125 Fnf f(LOCALE_zh_CN_UTF_8, 1); 126 assert(f.positive_sign() == ""); 127 } 128 { 129 Fnt f(LOCALE_zh_CN_UTF_8, 1); 130 assert(f.positive_sign() == ""); 131 } 132 { 133 Fwf f(LOCALE_zh_CN_UTF_8, 1); 134 assert(f.positive_sign() == L""); 135 } 136 { 137 Fwt f(LOCALE_zh_CN_UTF_8, 1); 138 assert(f.positive_sign() == L""); 139 } 140 } 141