Localisation test fixes to make the tests pass on FreeBSD, which does not provide shortened forms of the various locales (e.g. en_US, rather than en_US.UTF-8 / en_US.ISO{whatever}).

Reviewed by Howard Hinnant.

llvm-svn: 140242
This commit is contained in:
David Chisnall 2011-09-21 08:19:20 +00:00
parent cbc038a6c3
commit e36a15db17
50 changed files with 297 additions and 283 deletions

View File

@ -21,6 +21,8 @@
int main() int main()
{ {
// Ensure that the default locale is not C. If it is, the second tests will fail.
setenv("LANG", "en_US", 1);
{ {
std::locale l("en_US"); std::locale l("en_US");
{ {

View File

@ -51,7 +51,7 @@ int main()
assert(r == F::ok); assert(r == F::ok);
assert(from_next - from.data() == from.size()); assert(from_next - from.data() == from.size());
assert(to_next - to.data() == from.size()); assert(to_next - to.data() == from.size());
assert(to.data() == std::string("some\0text", from.size())); assert(memcmp(to.data(), "some\0text", from.size()) == 0);
} }
{ {
std::basic_string<F::intern_type> from(L"some text"); std::basic_string<F::intern_type> from(L"some text");

View File

@ -34,7 +34,7 @@ int main()
} }
} }
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef std::ctype<wchar_t> F; typedef std::ctype<wchar_t> F;
const F& f = std::use_facet<F>(l); const F& f = std::use_facet<F>(l);

View File

@ -43,7 +43,7 @@ public:
int main() int main()
{ {
std::ios ios(0); std::ios ios(0);
std::string loc_name("en_US"); std::string loc_name("en_US.UTF-8");
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),
new std::moneypunct_byname<char, false>(loc_name))); new std::moneypunct_byname<char, false>(loc_name)));
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),

View File

@ -43,7 +43,7 @@ public:
int main() int main()
{ {
std::ios ios(0); std::ios ios(0);
std::string loc_name("fr_FR"); std::string loc_name("fr_FR.UTF-8");
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),
new std::moneypunct_byname<char, false>(loc_name))); new std::moneypunct_byname<char, false>(loc_name)));
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),

View File

@ -43,7 +43,7 @@ public:
int main() int main()
{ {
std::ios ios(0); std::ios ios(0);
std::string loc_name("ru_RU"); std::string loc_name("ru_RU.UTF-8");
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),
new std::moneypunct_byname<char, false>(loc_name))); new std::moneypunct_byname<char, false>(loc_name)));
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),
@ -196,7 +196,7 @@ int main()
noshowbase(ios); noshowbase(ios);
} }
{ // negative, showbase { // negative, showbase
std::string v = "-1 234 567,89 RUR "; std::string v = "-1 234 567,89 RUB ";
showbase(ios); showbase(ios);
typedef input_iterator<const char*> I; typedef input_iterator<const char*> I;
long double ex; long double ex;
@ -208,7 +208,7 @@ int main()
noshowbase(ios); noshowbase(ios);
} }
{ // negative, showbase { // negative, showbase
std::string v = "-1 234 567,89 RUR "; std::string v = "-1 234 567,89 RUB ";
typedef input_iterator<const char*> I; typedef input_iterator<const char*> I;
long double ex; long double ex;
std::ios_base::iostate err = std::ios_base::goodbit; std::ios_base::iostate err = std::ios_base::goodbit;
@ -278,7 +278,7 @@ int main()
assert(ex == -123456789); assert(ex == -123456789);
} }
{ // zero, showbase { // zero, showbase
std::string v = "0,00 RUR "; std::string v = "0,00 RUB ";
typedef input_iterator<const char*> I; typedef input_iterator<const char*> I;
long double ex; long double ex;
std::ios_base::iostate err = std::ios_base::goodbit; std::ios_base::iostate err = std::ios_base::goodbit;
@ -289,7 +289,7 @@ int main()
assert(ex == 0); assert(ex == 0);
} }
{ // zero, showbase { // zero, showbase
std::string v = "0,00 RUR "; std::string v = "0,00 RUB ";
showbase(ios); showbase(ios);
typedef input_iterator<const char*> I; typedef input_iterator<const char*> I;
long double ex; long double ex;
@ -302,7 +302,7 @@ int main()
noshowbase(ios); noshowbase(ios);
} }
{ // negative one, showbase { // negative one, showbase
std::string v = "-0,01 RUR "; std::string v = "-0,01 RUB ";
typedef input_iterator<const char*> I; typedef input_iterator<const char*> I;
long double ex; long double ex;
std::ios_base::iostate err = std::ios_base::goodbit; std::ios_base::iostate err = std::ios_base::goodbit;
@ -313,7 +313,7 @@ int main()
assert(ex == -1); assert(ex == -1);
} }
{ // negative one, showbase { // negative one, showbase
std::string v = "-0,01 RUR "; std::string v = "-0,01 RUB ";
showbase(ios); showbase(ios);
typedef input_iterator<const char*> I; typedef input_iterator<const char*> I;
long double ex; long double ex;
@ -326,7 +326,7 @@ int main()
noshowbase(ios); noshowbase(ios);
} }
{ // positive, showbase { // positive, showbase
std::string v = "1 234 567,89 RUR "; std::string v = "1 234 567,89 RUB ";
typedef input_iterator<const char*> I; typedef input_iterator<const char*> I;
long double ex; long double ex;
std::ios_base::iostate err = std::ios_base::goodbit; std::ios_base::iostate err = std::ios_base::goodbit;
@ -337,7 +337,7 @@ int main()
assert(ex == 123456789); assert(ex == 123456789);
} }
{ // positive, showbase { // positive, showbase
std::string v = "1 234 567,89 RUR "; std::string v = "1 234 567,89 RUB ";
showbase(ios); showbase(ios);
typedef input_iterator<const char*> I; typedef input_iterator<const char*> I;
long double ex; long double ex;
@ -350,7 +350,7 @@ int main()
noshowbase(ios); noshowbase(ios);
} }
{ // negative, showbase { // negative, showbase
std::string v = "-1 234 567,89 RUR "; std::string v = "-1 234 567,89 RUB ";
showbase(ios); showbase(ios);
typedef input_iterator<const char*> I; typedef input_iterator<const char*> I;
long double ex; long double ex;
@ -530,7 +530,7 @@ int main()
noshowbase(ios); noshowbase(ios);
} }
{ // negative, showbase { // negative, showbase
std::wstring v = L"-1 234 567,89 RUR "; std::wstring v = L"-1 234 567,89 RUB ";
showbase(ios); showbase(ios);
typedef input_iterator<const wchar_t*> I; typedef input_iterator<const wchar_t*> I;
long double ex; long double ex;
@ -542,7 +542,7 @@ int main()
noshowbase(ios); noshowbase(ios);
} }
{ // negative, showbase { // negative, showbase
std::wstring v = L"-1 234 567,89 RUR "; std::wstring v = L"-1 234 567,89 RUB ";
typedef input_iterator<const wchar_t*> I; typedef input_iterator<const wchar_t*> I;
long double ex; long double ex;
std::ios_base::iostate err = std::ios_base::goodbit; std::ios_base::iostate err = std::ios_base::goodbit;
@ -612,7 +612,7 @@ int main()
assert(ex == -123456789); assert(ex == -123456789);
} }
{ // zero, showbase { // zero, showbase
std::wstring v = L"0,00 RUR "; std::wstring v = L"0,00 RUB ";
typedef input_iterator<const wchar_t*> I; typedef input_iterator<const wchar_t*> I;
long double ex; long double ex;
std::ios_base::iostate err = std::ios_base::goodbit; std::ios_base::iostate err = std::ios_base::goodbit;
@ -623,7 +623,7 @@ int main()
assert(ex == 0); assert(ex == 0);
} }
{ // zero, showbase { // zero, showbase
std::wstring v = L"0,00 RUR "; std::wstring v = L"0,00 RUB ";
showbase(ios); showbase(ios);
typedef input_iterator<const wchar_t*> I; typedef input_iterator<const wchar_t*> I;
long double ex; long double ex;
@ -636,7 +636,7 @@ int main()
noshowbase(ios); noshowbase(ios);
} }
{ // negative one, showbase { // negative one, showbase
std::wstring v = L"-0,01 RUR "; std::wstring v = L"-0,01 RUB ";
typedef input_iterator<const wchar_t*> I; typedef input_iterator<const wchar_t*> I;
long double ex; long double ex;
std::ios_base::iostate err = std::ios_base::goodbit; std::ios_base::iostate err = std::ios_base::goodbit;
@ -647,7 +647,7 @@ int main()
assert(ex == -1); assert(ex == -1);
} }
{ // negative one, showbase { // negative one, showbase
std::wstring v = L"-0,01 RUR "; std::wstring v = L"-0,01 RUB ";
showbase(ios); showbase(ios);
typedef input_iterator<const wchar_t*> I; typedef input_iterator<const wchar_t*> I;
long double ex; long double ex;
@ -660,7 +660,7 @@ int main()
noshowbase(ios); noshowbase(ios);
} }
{ // positive, showbase { // positive, showbase
std::wstring v = L"1 234 567,89 RUR "; std::wstring v = L"1 234 567,89 RUB ";
typedef input_iterator<const wchar_t*> I; typedef input_iterator<const wchar_t*> I;
long double ex; long double ex;
std::ios_base::iostate err = std::ios_base::goodbit; std::ios_base::iostate err = std::ios_base::goodbit;
@ -671,7 +671,7 @@ int main()
assert(ex == 123456789); assert(ex == 123456789);
} }
{ // positive, showbase { // positive, showbase
std::wstring v = L"1 234 567,89 RUR "; std::wstring v = L"1 234 567,89 RUB ";
showbase(ios); showbase(ios);
typedef input_iterator<const wchar_t*> I; typedef input_iterator<const wchar_t*> I;
long double ex; long double ex;
@ -684,7 +684,7 @@ int main()
noshowbase(ios); noshowbase(ios);
} }
{ // negative, showbase { // negative, showbase
std::wstring v = L"-1 234 567,89 RUR "; std::wstring v = L"-1 234 567,89 RUB ";
showbase(ios); showbase(ios);
typedef input_iterator<const wchar_t*> I; typedef input_iterator<const wchar_t*> I;
long double ex; long double ex;

View File

@ -43,7 +43,7 @@ public:
int main() int main()
{ {
std::ios ios(0); std::ios ios(0);
std::string loc_name("zh_CN"); std::string loc_name("zh_CN.UTF-8");
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),
new std::moneypunct_byname<char, false>(loc_name))); new std::moneypunct_byname<char, false>(loc_name)));
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),

View File

@ -43,7 +43,7 @@ public:
int main() int main()
{ {
std::ios ios(0); std::ios ios(0);
std::string loc_name("en_US"); std::string loc_name("en_US.UTF-8");
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),
new std::moneypunct_byname<char, false>(loc_name))); new std::moneypunct_byname<char, false>(loc_name)));
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),

View File

@ -43,7 +43,7 @@ public:
int main() int main()
{ {
std::ios ios(0); std::ios ios(0);
std::string loc_name("en_US"); std::string loc_name("en_US.UTF-8");
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),
new std::moneypunct_byname<char, false>(loc_name))); new std::moneypunct_byname<char, false>(loc_name)));
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),

View File

@ -43,7 +43,7 @@ public:
int main() int main()
{ {
std::ios ios(0); std::ios ios(0);
std::string loc_name("fr_FR"); std::string loc_name("fr_FR.UTF-8");
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),
new std::moneypunct_byname<char, false>(loc_name))); new std::moneypunct_byname<char, false>(loc_name)));
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),

View File

@ -43,7 +43,7 @@ public:
int main() int main()
{ {
std::ios ios(0); std::ios ios(0);
std::string loc_name("ru_RU"); std::string loc_name("ru_RU.UTF-8");
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),
new std::moneypunct_byname<char, false>(loc_name))); new std::moneypunct_byname<char, false>(loc_name)));
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),
@ -202,7 +202,7 @@ int main()
output_iterator<char*> iter = f.put(output_iterator<char*>(str), output_iterator<char*> iter = f.put(output_iterator<char*>(str),
true, ios, '*', v); true, ios, '*', v);
std::string ex(str, iter.base()); std::string ex(str, iter.base());
assert(ex == "0,00 RUR "); assert(ex == "0,00 RUB ");
} }
{ // negative one, showbase { // negative one, showbase
long double v = -1; long double v = -1;
@ -211,7 +211,7 @@ int main()
output_iterator<char*> iter = f.put(output_iterator<char*>(str), output_iterator<char*> iter = f.put(output_iterator<char*>(str),
true, ios, '*', v); true, ios, '*', v);
std::string ex(str, iter.base()); std::string ex(str, iter.base());
assert(ex == "-0,01 RUR "); assert(ex == "-0,01 RUB ");
} }
{ // positive, showbase { // positive, showbase
long double v = 123456789; long double v = 123456789;
@ -220,7 +220,7 @@ int main()
output_iterator<char*> iter = f.put(output_iterator<char*>(str), output_iterator<char*> iter = f.put(output_iterator<char*>(str),
true, ios, '*', v); true, ios, '*', v);
std::string ex(str, iter.base()); std::string ex(str, iter.base());
assert(ex == "1 234 567,89 RUR "); assert(ex == "1 234 567,89 RUB ");
} }
{ // negative, showbase { // negative, showbase
long double v = -123456789; long double v = -123456789;
@ -229,7 +229,7 @@ int main()
output_iterator<char*> iter = f.put(output_iterator<char*>(str), output_iterator<char*> iter = f.put(output_iterator<char*>(str),
true, ios, '*', v); true, ios, '*', v);
std::string ex(str, iter.base()); std::string ex(str, iter.base());
assert(ex == "-1 234 567,89 RUR "); assert(ex == "-1 234 567,89 RUB ");
} }
{ // negative, showbase, left { // negative, showbase, left
long double v = -123456789; long double v = -123456789;
@ -240,7 +240,7 @@ int main()
output_iterator<char*> iter = f.put(output_iterator<char*>(str), output_iterator<char*> iter = f.put(output_iterator<char*>(str),
true, ios, ' ', v); true, ios, ' ', v);
std::string ex(str, iter.base()); std::string ex(str, iter.base());
assert(ex == "-1 234 567,89 RUR "); assert(ex == "-1 234 567,89 RUB ");
assert(ios.width() == 0); assert(ios.width() == 0);
} }
{ // negative, showbase, internal { // negative, showbase, internal
@ -252,7 +252,7 @@ int main()
output_iterator<char*> iter = f.put(output_iterator<char*>(str), output_iterator<char*> iter = f.put(output_iterator<char*>(str),
true, ios, ' ', v); true, ios, ' ', v);
std::string ex(str, iter.base()); std::string ex(str, iter.base());
assert(ex == "-1 234 567,89 RUR "); assert(ex == "-1 234 567,89 RUB ");
assert(ios.width() == 0); assert(ios.width() == 0);
} }
{ // negative, showbase, right { // negative, showbase, right
@ -264,7 +264,7 @@ int main()
output_iterator<char*> iter = f.put(output_iterator<char*>(str), output_iterator<char*> iter = f.put(output_iterator<char*>(str),
true, ios, ' ', v); true, ios, ' ', v);
std::string ex(str, iter.base()); std::string ex(str, iter.base());
assert(ex == " -1 234 567,89 RUR "); assert(ex == " -1 234 567,89 RUB ");
assert(ios.width() == 0); assert(ios.width() == 0);
} }
} }
@ -420,7 +420,7 @@ int main()
output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
true, ios, '*', v); true, ios, '*', v);
std::wstring ex(str, iter.base()); std::wstring ex(str, iter.base());
assert(ex == L"0,00 RUR "); assert(ex == L"0,00 RUB ");
} }
{ // negative one, showbase { // negative one, showbase
long double v = -1; long double v = -1;
@ -429,7 +429,7 @@ int main()
output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
true, ios, '*', v); true, ios, '*', v);
std::wstring ex(str, iter.base()); std::wstring ex(str, iter.base());
assert(ex == L"-0,01 RUR "); assert(ex == L"-0,01 RUB ");
} }
{ // positive, showbase { // positive, showbase
long double v = 123456789; long double v = 123456789;
@ -438,7 +438,7 @@ int main()
output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
true, ios, '*', v); true, ios, '*', v);
std::wstring ex(str, iter.base()); std::wstring ex(str, iter.base());
assert(ex == L"1 234 567,89 RUR "); assert(ex == L"1 234 567,89 RUB ");
} }
{ // negative, showbase { // negative, showbase
long double v = -123456789; long double v = -123456789;
@ -447,7 +447,7 @@ int main()
output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
true, ios, '*', v); true, ios, '*', v);
std::wstring ex(str, iter.base()); std::wstring ex(str, iter.base());
assert(ex == L"-1 234 567,89 RUR "); assert(ex == L"-1 234 567,89 RUB ");
} }
{ // negative, showbase, left { // negative, showbase, left
long double v = -123456789; long double v = -123456789;
@ -458,7 +458,7 @@ int main()
output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
true, ios, ' ', v); true, ios, ' ', v);
std::wstring ex(str, iter.base()); std::wstring ex(str, iter.base());
assert(ex == L"-1 234 567,89 RUR "); assert(ex == L"-1 234 567,89 RUB ");
assert(ios.width() == 0); assert(ios.width() == 0);
} }
{ // negative, showbase, internal { // negative, showbase, internal
@ -470,7 +470,7 @@ int main()
output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
true, ios, ' ', v); true, ios, ' ', v);
std::wstring ex(str, iter.base()); std::wstring ex(str, iter.base());
assert(ex == L"-1 234 567,89 RUR "); assert(ex == L"-1 234 567,89 RUB ");
assert(ios.width() == 0); assert(ios.width() == 0);
} }
{ // negative, showbase, right { // negative, showbase, right
@ -482,7 +482,7 @@ int main()
output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str), output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
true, ios, ' ', v); true, ios, ' ', v);
std::wstring ex(str, iter.base()); std::wstring ex(str, iter.base());
assert(ex == L" -1 234 567,89 RUR "); assert(ex == L" -1 234 567,89 RUB ");
assert(ios.width() == 0); assert(ios.width() == 0);
} }
} }

View File

@ -43,7 +43,7 @@ public:
int main() int main()
{ {
std::ios ios(0); std::ios ios(0);
std::string loc_name("zh_CN"); std::string loc_name("zh_CN.UTF-8");
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),
new std::moneypunct_byname<char, false>(loc_name))); new std::moneypunct_byname<char, false>(loc_name)));
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),

View File

@ -43,7 +43,7 @@ public:
int main() int main()
{ {
std::ios ios(0); std::ios ios(0);
std::string loc_name("en_US"); std::string loc_name("en_US.UTF-8");
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),
new std::moneypunct_byname<char, false>(loc_name))); new std::moneypunct_byname<char, false>(loc_name)));
ios.imbue(std::locale(ios.getloc(), ios.imbue(std::locale(ios.getloc(),

View File

@ -69,70 +69,70 @@ int main()
} }
{ {
Fnf f("en_US", 1); Fnf f("en_US.UTF-8", 1);
assert(f.curr_symbol() == "$"); assert(f.curr_symbol() == "$");
} }
{ {
Fnt f("en_US", 1); Fnt f("en_US.UTF-8", 1);
assert(f.curr_symbol() == "USD "); assert(f.curr_symbol() == "USD ");
} }
{ {
Fwf f("en_US", 1); Fwf f("en_US.UTF-8", 1);
assert(f.curr_symbol() == L"$"); assert(f.curr_symbol() == L"$");
} }
{ {
Fwt f("en_US", 1); Fwt f("en_US.UTF-8", 1);
assert(f.curr_symbol() == L"USD "); assert(f.curr_symbol() == L"USD ");
} }
{ {
Fnf f("fr_FR", 1); Fnf f("fr_FR.UTF-8", 1);
assert(f.curr_symbol() == "Eu"); assert(f.curr_symbol() == "Eu");
} }
{ {
Fnt f("fr_FR", 1); Fnt f("fr_FR.UTF-8", 1);
assert(f.curr_symbol() == "EUR "); assert(f.curr_symbol() == "EUR ");
} }
{ {
Fwf f("fr_FR", 1); Fwf f("fr_FR.UTF-8", 1);
assert(f.curr_symbol() == L"Eu"); assert(f.curr_symbol() == L"Eu");
} }
{ {
Fwt f("fr_FR", 1); Fwt f("fr_FR.UTF-8", 1);
assert(f.curr_symbol() == L"EUR "); assert(f.curr_symbol() == L"EUR ");
} }
{ {
Fnf f("ru_RU", 1); Fnf f("ru_RU.UTF-8", 1);
assert(f.curr_symbol() == "\xD1\x80\xD1\x83\xD0\xB1""."); assert(f.curr_symbol() == "\xD1\x80\xD1\x83\xD0\xB1"".");
} }
{ {
Fnt f("ru_RU", 1); Fnt f("ru_RU.UTF-8", 1);
assert(f.curr_symbol() == "RUR "); assert(f.curr_symbol() == "RUB ");
} }
{ {
Fwf f("ru_RU", 1); Fwf f("ru_RU.UTF-8", 1);
assert(f.curr_symbol() == L"\x440\x443\x431""."); assert(f.curr_symbol() == L"\x440\x443\x431"".");
} }
{ {
Fwt f("ru_RU", 1); Fwt f("ru_RU.UTF-8", 1);
assert(f.curr_symbol() == L"RUR "); assert(f.curr_symbol() == L"RUB ");
} }
{ {
Fnf f("zh_CN", 1); Fnf f("zh_CN.UTF-8", 1);
assert(f.curr_symbol() == "\xEF\xBF\xA5"); assert(f.curr_symbol() == "\xEF\xBF\xA5");
} }
{ {
Fnt f("zh_CN", 1); Fnt f("zh_CN.UTF-8", 1);
assert(f.curr_symbol() == "CNY "); assert(f.curr_symbol() == "CNY ");
} }
{ {
Fwf f("zh_CN", 1); Fwf f("zh_CN.UTF-8", 1);
assert(f.curr_symbol() == L"\xFFE5"); assert(f.curr_symbol() == L"\xFFE5");
} }
{ {
Fwt f("zh_CN", 1); Fwt f("zh_CN.UTF-8", 1);
assert(f.curr_symbol() == L"CNY "); assert(f.curr_symbol() == L"CNY ");
} }
} }

View File

@ -69,70 +69,70 @@ int main()
} }
{ {
Fnf f("en_US", 1); Fnf f("en_US.UTF-8", 1);
assert(f.decimal_point() == '.'); assert(f.decimal_point() == '.');
} }
{ {
Fnt f("en_US", 1); Fnt f("en_US.UTF-8", 1);
assert(f.decimal_point() == '.'); assert(f.decimal_point() == '.');
} }
{ {
Fwf f("en_US", 1); Fwf f("en_US.UTF-8", 1);
assert(f.decimal_point() == L'.'); assert(f.decimal_point() == L'.');
} }
{ {
Fwt f("en_US", 1); Fwt f("en_US.UTF-8", 1);
assert(f.decimal_point() == L'.'); assert(f.decimal_point() == L'.');
} }
{ {
Fnf f("fr_FR", 1); Fnf f("fr_FR.UTF-8", 1);
assert(f.decimal_point() == ','); assert(f.decimal_point() == ',');
} }
{ {
Fnt f("fr_FR", 1); Fnt f("fr_FR.UTF-8", 1);
assert(f.decimal_point() == ','); assert(f.decimal_point() == ',');
} }
{ {
Fwf f("fr_FR", 1); Fwf f("fr_FR.UTF-8", 1);
assert(f.decimal_point() == L','); assert(f.decimal_point() == L',');
} }
{ {
Fwt f("fr_FR", 1); Fwt f("fr_FR.UTF-8", 1);
assert(f.decimal_point() == L','); assert(f.decimal_point() == L',');
} }
{ {
Fnf f("ru_RU", 1); Fnf f("ru_RU.UTF-8", 1);
assert(f.decimal_point() == ','); assert(f.decimal_point() == ',');
} }
{ {
Fnt f("ru_RU", 1); Fnt f("ru_RU.UTF-8", 1);
assert(f.decimal_point() == ','); assert(f.decimal_point() == ',');
} }
{ {
Fwf f("ru_RU", 1); Fwf f("ru_RU.UTF-8", 1);
assert(f.decimal_point() == L','); assert(f.decimal_point() == L',');
} }
{ {
Fwt f("ru_RU", 1); Fwt f("ru_RU.UTF-8", 1);
assert(f.decimal_point() == L','); assert(f.decimal_point() == L',');
} }
{ {
Fnf f("zh_CN", 1); Fnf f("zh_CN.UTF-8", 1);
assert(f.decimal_point() == '.'); assert(f.decimal_point() == '.');
} }
{ {
Fnt f("zh_CN", 1); Fnt f("zh_CN.UTF-8", 1);
assert(f.decimal_point() == '.'); assert(f.decimal_point() == '.');
} }
{ {
Fwf f("zh_CN", 1); Fwf f("zh_CN.UTF-8", 1);
assert(f.decimal_point() == L'.'); assert(f.decimal_point() == L'.');
} }
{ {
Fwt f("zh_CN", 1); Fwt f("zh_CN.UTF-8", 1);
assert(f.decimal_point() == L'.'); assert(f.decimal_point() == L'.');
} }
} }

View File

@ -69,70 +69,70 @@ int main()
} }
{ {
Fnf f("en_US", 1); Fnf f("en_US.UTF-8", 1);
assert(f.frac_digits() == 2); assert(f.frac_digits() == 2);
} }
{ {
Fnt f("en_US", 1); Fnt f("en_US.UTF-8", 1);
assert(f.frac_digits() == 2); assert(f.frac_digits() == 2);
} }
{ {
Fwf f("en_US", 1); Fwf f("en_US.UTF-8", 1);
assert(f.frac_digits() == 2); assert(f.frac_digits() == 2);
} }
{ {
Fwt f("en_US", 1); Fwt f("en_US.UTF-8", 1);
assert(f.frac_digits() == 2); assert(f.frac_digits() == 2);
} }
{ {
Fnf f("fr_FR", 1); Fnf f("fr_FR.UTF-8", 1);
assert(f.frac_digits() == 2); assert(f.frac_digits() == 2);
} }
{ {
Fnt f("fr_FR", 1); Fnt f("fr_FR.UTF-8", 1);
assert(f.frac_digits() == 2); assert(f.frac_digits() == 2);
} }
{ {
Fwf f("fr_FR", 1); Fwf f("fr_FR.UTF-8", 1);
assert(f.frac_digits() == 2); assert(f.frac_digits() == 2);
} }
{ {
Fwt f("fr_FR", 1); Fwt f("fr_FR.UTF-8", 1);
assert(f.frac_digits() == 2); assert(f.frac_digits() == 2);
} }
{ {
Fnf f("ru_RU", 1); Fnf f("ru_RU.UTF-8", 1);
assert(f.frac_digits() == 2); assert(f.frac_digits() == 2);
} }
{ {
Fnt f("ru_RU", 1); Fnt f("ru_RU.UTF-8", 1);
assert(f.frac_digits() == 2); assert(f.frac_digits() == 2);
} }
{ {
Fwf f("ru_RU", 1); Fwf f("ru_RU.UTF-8", 1);
assert(f.frac_digits() == 2); assert(f.frac_digits() == 2);
} }
{ {
Fwt f("ru_RU", 1); Fwt f("ru_RU.UTF-8", 1);
assert(f.frac_digits() == 2); assert(f.frac_digits() == 2);
} }
{ {
Fnf f("zh_CN", 1); Fnf f("zh_CN.UTF-8", 1);
assert(f.frac_digits() == 2); assert(f.frac_digits() == 2);
} }
{ {
Fnt f("zh_CN", 1); Fnt f("zh_CN.UTF-8", 1);
assert(f.frac_digits() == 2); assert(f.frac_digits() == 2);
} }
{ {
Fwf f("zh_CN", 1); Fwf f("zh_CN.UTF-8", 1);
assert(f.frac_digits() == 2); assert(f.frac_digits() == 2);
} }
{ {
Fwt f("zh_CN", 1); Fwt f("zh_CN.UTF-8", 1);
assert(f.frac_digits() == 2); assert(f.frac_digits() == 2);
} }
} }

View File

@ -51,88 +51,91 @@ public:
int main() int main()
{ {
// Monetary grouping strings may be terminated with 0 or CHAR_MAX, defining
// how the grouping is repeated.
std::string s = std::string(1, CHAR_MAX);
{ {
Fnf f("C", 1); Fnf f("C", 1);
assert(f.grouping() == ""); assert(f.grouping() == s || f.grouping() == "");
} }
{ {
Fnt f("C", 1); Fnt f("C", 1);
assert(f.grouping() == ""); assert(f.grouping() == s || f.grouping() == "");
} }
{ {
Fwf f("C", 1); Fwf f("C", 1);
assert(f.grouping() == ""); assert(f.grouping() == s || f.grouping() == "");
} }
{ {
Fwt f("C", 1); Fwt f("C", 1);
assert(f.grouping() == ""); assert(f.grouping() == s || f.grouping() == "");
} }
{ {
Fnf f("en_US", 1); Fnf f("en_US.UTF-8", 1);
assert(f.grouping() == "\3\3"); assert(f.grouping() == "\3\3");
} }
{ {
Fnt f("en_US", 1); Fnt f("en_US.UTF-8", 1);
assert(f.grouping() == "\3\3"); assert(f.grouping() == "\3\3");
} }
{ {
Fwf f("en_US", 1); Fwf f("en_US.UTF-8", 1);
assert(f.grouping() == "\3\3"); assert(f.grouping() == "\3\3");
} }
{ {
Fwt f("en_US", 1); Fwt f("en_US.UTF-8", 1);
assert(f.grouping() == "\3\3"); assert(f.grouping() == "\3\3");
} }
{ {
Fnf f("fr_FR", 1); Fnf f("fr_FR.UTF-8", 1);
assert(f.grouping() == "\3\3"); assert(f.grouping() == "\3\3");
} }
{ {
Fnt f("fr_FR", 1); Fnt f("fr_FR.UTF-8", 1);
assert(f.grouping() == "\3\3"); assert(f.grouping() == "\3\3");
} }
{ {
Fwf f("fr_FR", 1); Fwf f("fr_FR.UTF-8", 1);
assert(f.grouping() == "\3\3"); assert(f.grouping() == "\3\3");
} }
{ {
Fwt f("fr_FR", 1); Fwt f("fr_FR.UTF-8", 1);
assert(f.grouping() == "\3\3"); assert(f.grouping() == "\3\3");
} }
{ {
Fnf f("ru_RU", 1); Fnf f("ru_RU.UTF-8", 1);
assert(f.grouping() == "\3\3"); assert(f.grouping() == "\3\3");
} }
{ {
Fnt f("ru_RU", 1); Fnt f("ru_RU.UTF-8", 1);
assert(f.grouping() == "\3\3"); assert(f.grouping() == "\3\3");
} }
{ {
Fwf f("ru_RU", 1); Fwf f("ru_RU.UTF-8", 1);
assert(f.grouping() == "\3\3"); assert(f.grouping() == "\3\3");
} }
{ {
Fwt f("ru_RU", 1); Fwt f("ru_RU.UTF-8", 1);
assert(f.grouping() == "\3\3"); assert(f.grouping() == "\3\3");
} }
{ {
Fnf f("zh_CN", 1); Fnf f("zh_CN.UTF-8", 1);
assert(f.grouping() == "\3\3"); assert(f.grouping() == "\3\3");
} }
{ {
Fnt f("zh_CN", 1); Fnt f("zh_CN.UTF-8", 1);
assert(f.grouping() == "\3\3"); assert(f.grouping() == "\3\3");
} }
{ {
Fwf f("zh_CN", 1); Fwf f("zh_CN.UTF-8", 1);
assert(f.grouping() == "\3\3"); assert(f.grouping() == "\3\3");
} }
{ {
Fwt f("zh_CN", 1); Fwt f("zh_CN.UTF-8", 1);
assert(f.grouping() == "\3\3"); assert(f.grouping() == "\3\3");
} }
} }

View File

@ -85,7 +85,7 @@ int main()
} }
{ {
Fnf f("en_US", 1); Fnf f("en_US.UTF-8", 1);
std::money_base::pattern p = f.neg_format(); std::money_base::pattern p = f.neg_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::symbol); assert(p.field[1] == std::money_base::symbol);
@ -93,7 +93,7 @@ int main()
assert(p.field[3] == std::money_base::value); assert(p.field[3] == std::money_base::value);
} }
{ {
Fnt f("en_US", 1); Fnt f("en_US.UTF-8", 1);
std::money_base::pattern p = f.neg_format(); std::money_base::pattern p = f.neg_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::symbol); assert(p.field[1] == std::money_base::symbol);
@ -101,7 +101,7 @@ int main()
assert(p.field[3] == std::money_base::value); assert(p.field[3] == std::money_base::value);
} }
{ {
Fwf f("en_US", 1); Fwf f("en_US.UTF-8", 1);
std::money_base::pattern p = f.neg_format(); std::money_base::pattern p = f.neg_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::symbol); assert(p.field[1] == std::money_base::symbol);
@ -109,7 +109,7 @@ int main()
assert(p.field[3] == std::money_base::value); assert(p.field[3] == std::money_base::value);
} }
{ {
Fwt f("en_US", 1); Fwt f("en_US.UTF-8", 1);
std::money_base::pattern p = f.neg_format(); std::money_base::pattern p = f.neg_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::symbol); assert(p.field[1] == std::money_base::symbol);
@ -118,7 +118,7 @@ int main()
} }
{ {
Fnf f("fr_FR", 1); Fnf f("fr_FR.UTF-8", 1);
std::money_base::pattern p = f.neg_format(); std::money_base::pattern p = f.neg_format();
assert(p.field[0] == std::money_base::value); assert(p.field[0] == std::money_base::value);
assert(p.field[1] == std::money_base::space); assert(p.field[1] == std::money_base::space);
@ -126,7 +126,7 @@ int main()
assert(p.field[3] == std::money_base::sign); assert(p.field[3] == std::money_base::sign);
} }
{ {
Fnt f("fr_FR", 1); Fnt f("fr_FR.UTF-8", 1);
std::money_base::pattern p = f.neg_format(); std::money_base::pattern p = f.neg_format();
assert(p.field[0] == std::money_base::value); assert(p.field[0] == std::money_base::value);
assert(p.field[1] == std::money_base::space); assert(p.field[1] == std::money_base::space);
@ -134,7 +134,7 @@ int main()
assert(p.field[3] == std::money_base::sign); assert(p.field[3] == std::money_base::sign);
} }
{ {
Fwf f("fr_FR", 1); Fwf f("fr_FR.UTF-8", 1);
std::money_base::pattern p = f.neg_format(); std::money_base::pattern p = f.neg_format();
assert(p.field[0] == std::money_base::value); assert(p.field[0] == std::money_base::value);
assert(p.field[1] == std::money_base::space); assert(p.field[1] == std::money_base::space);
@ -142,7 +142,7 @@ int main()
assert(p.field[3] == std::money_base::sign); assert(p.field[3] == std::money_base::sign);
} }
{ {
Fwt f("fr_FR", 1); Fwt f("fr_FR.UTF-8", 1);
std::money_base::pattern p = f.neg_format(); std::money_base::pattern p = f.neg_format();
assert(p.field[0] == std::money_base::value); assert(p.field[0] == std::money_base::value);
assert(p.field[1] == std::money_base::space); assert(p.field[1] == std::money_base::space);
@ -151,7 +151,7 @@ int main()
} }
{ {
Fnf f("ru_RU", 1); Fnf f("ru_RU.UTF-8", 1);
std::money_base::pattern p = f.neg_format(); std::money_base::pattern p = f.neg_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::value); assert(p.field[1] == std::money_base::value);
@ -159,7 +159,7 @@ int main()
assert(p.field[3] == std::money_base::symbol); assert(p.field[3] == std::money_base::symbol);
} }
{ {
Fnt f("ru_RU", 1); Fnt f("ru_RU.UTF-8", 1);
std::money_base::pattern p = f.neg_format(); std::money_base::pattern p = f.neg_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::value); assert(p.field[1] == std::money_base::value);
@ -167,7 +167,7 @@ int main()
assert(p.field[3] == std::money_base::symbol); assert(p.field[3] == std::money_base::symbol);
} }
{ {
Fwf f("ru_RU", 1); Fwf f("ru_RU.UTF-8", 1);
std::money_base::pattern p = f.neg_format(); std::money_base::pattern p = f.neg_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::value); assert(p.field[1] == std::money_base::value);
@ -175,7 +175,7 @@ int main()
assert(p.field[3] == std::money_base::symbol); assert(p.field[3] == std::money_base::symbol);
} }
{ {
Fwt f("ru_RU", 1); Fwt f("ru_RU.UTF-8", 1);
std::money_base::pattern p = f.neg_format(); std::money_base::pattern p = f.neg_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::value); assert(p.field[1] == std::money_base::value);
@ -184,7 +184,7 @@ int main()
} }
{ {
Fnf f("zh_CN", 1); Fnf f("zh_CN.UTF-8", 1);
std::money_base::pattern p = f.neg_format(); std::money_base::pattern p = f.neg_format();
assert(p.field[0] == std::money_base::symbol); assert(p.field[0] == std::money_base::symbol);
assert(p.field[1] == std::money_base::sign); assert(p.field[1] == std::money_base::sign);
@ -192,7 +192,7 @@ int main()
assert(p.field[3] == std::money_base::value); assert(p.field[3] == std::money_base::value);
} }
{ {
Fnt f("zh_CN", 1); Fnt f("zh_CN.UTF-8", 1);
std::money_base::pattern p = f.neg_format(); std::money_base::pattern p = f.neg_format();
assert(p.field[0] == std::money_base::symbol); assert(p.field[0] == std::money_base::symbol);
assert(p.field[1] == std::money_base::sign); assert(p.field[1] == std::money_base::sign);
@ -200,7 +200,7 @@ int main()
assert(p.field[3] == std::money_base::value); assert(p.field[3] == std::money_base::value);
} }
{ {
Fwf f("zh_CN", 1); Fwf f("zh_CN.UTF-8", 1);
std::money_base::pattern p = f.neg_format(); std::money_base::pattern p = f.neg_format();
assert(p.field[0] == std::money_base::symbol); assert(p.field[0] == std::money_base::symbol);
assert(p.field[1] == std::money_base::sign); assert(p.field[1] == std::money_base::sign);
@ -208,7 +208,7 @@ int main()
assert(p.field[3] == std::money_base::value); assert(p.field[3] == std::money_base::value);
} }
{ {
Fwt f("zh_CN", 1); Fwt f("zh_CN.UTF-8", 1);
std::money_base::pattern p = f.neg_format(); std::money_base::pattern p = f.neg_format();
assert(p.field[0] == std::money_base::symbol); assert(p.field[0] == std::money_base::symbol);
assert(p.field[1] == std::money_base::sign); assert(p.field[1] == std::money_base::sign);

View File

@ -69,70 +69,70 @@ int main()
} }
{ {
Fnf f("en_US", 1); Fnf f("en_US.UTF-8", 1);
assert(f.negative_sign() == "-"); assert(f.negative_sign() == "-");
} }
{ {
Fnt f("en_US", 1); Fnt f("en_US.UTF-8", 1);
assert(f.negative_sign() == "-"); assert(f.negative_sign() == "-");
} }
{ {
Fwf f("en_US", 1); Fwf f("en_US.UTF-8", 1);
assert(f.negative_sign() == L"-"); assert(f.negative_sign() == L"-");
} }
{ {
Fwt f("en_US", 1); Fwt f("en_US.UTF-8", 1);
assert(f.negative_sign() == L"-"); assert(f.negative_sign() == L"-");
} }
{ {
Fnf f("fr_FR", 1); Fnf f("fr_FR.UTF-8", 1);
assert(f.negative_sign() == "-"); assert(f.negative_sign() == "-");
} }
{ {
Fnt f("fr_FR", 1); Fnt f("fr_FR.UTF-8", 1);
assert(f.negative_sign() == "-"); assert(f.negative_sign() == "-");
} }
{ {
Fwf f("fr_FR", 1); Fwf f("fr_FR.UTF-8", 1);
assert(f.negative_sign() == L"-"); assert(f.negative_sign() == L"-");
} }
{ {
Fwt f("fr_FR", 1); Fwt f("fr_FR.UTF-8", 1);
assert(f.negative_sign() == L"-"); assert(f.negative_sign() == L"-");
} }
{ {
Fnf f("ru_RU", 1); Fnf f("ru_RU.UTF-8", 1);
assert(f.negative_sign() == "-"); assert(f.negative_sign() == "-");
} }
{ {
Fnt f("ru_RU", 1); Fnt f("ru_RU.UTF-8", 1);
assert(f.negative_sign() == "-"); assert(f.negative_sign() == "-");
} }
{ {
Fwf f("ru_RU", 1); Fwf f("ru_RU.UTF-8", 1);
assert(f.negative_sign() == L"-"); assert(f.negative_sign() == L"-");
} }
{ {
Fwt f("ru_RU", 1); Fwt f("ru_RU.UTF-8", 1);
assert(f.negative_sign() == L"-"); assert(f.negative_sign() == L"-");
} }
{ {
Fnf f("zh_CN", 1); Fnf f("zh_CN.UTF-8", 1);
assert(f.negative_sign() == "-"); assert(f.negative_sign() == "-");
} }
{ {
Fnt f("zh_CN", 1); Fnt f("zh_CN.UTF-8", 1);
assert(f.negative_sign() == "-"); assert(f.negative_sign() == "-");
} }
{ {
Fwf f("zh_CN", 1); Fwf f("zh_CN.UTF-8", 1);
assert(f.negative_sign() == L"-"); assert(f.negative_sign() == L"-");
} }
{ {
Fwt f("zh_CN", 1); Fwt f("zh_CN.UTF-8", 1);
assert(f.negative_sign() == L"-"); assert(f.negative_sign() == L"-");
} }
} }

View File

@ -85,7 +85,7 @@ int main()
} }
{ {
Fnf f("en_US", 1); Fnf f("en_US.UTF-8", 1);
std::money_base::pattern p = f.pos_format(); std::money_base::pattern p = f.pos_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::symbol); assert(p.field[1] == std::money_base::symbol);
@ -93,7 +93,7 @@ int main()
assert(p.field[3] == std::money_base::value); assert(p.field[3] == std::money_base::value);
} }
{ {
Fnt f("en_US", 1); Fnt f("en_US.UTF-8", 1);
std::money_base::pattern p = f.pos_format(); std::money_base::pattern p = f.pos_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::symbol); assert(p.field[1] == std::money_base::symbol);
@ -101,7 +101,7 @@ int main()
assert(p.field[3] == std::money_base::value); assert(p.field[3] == std::money_base::value);
} }
{ {
Fwf f("en_US", 1); Fwf f("en_US.UTF-8", 1);
std::money_base::pattern p = f.pos_format(); std::money_base::pattern p = f.pos_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::symbol); assert(p.field[1] == std::money_base::symbol);
@ -109,7 +109,7 @@ int main()
assert(p.field[3] == std::money_base::value); assert(p.field[3] == std::money_base::value);
} }
{ {
Fwt f("en_US", 1); Fwt f("en_US.UTF-8", 1);
std::money_base::pattern p = f.pos_format(); std::money_base::pattern p = f.pos_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::symbol); assert(p.field[1] == std::money_base::symbol);
@ -118,7 +118,7 @@ int main()
} }
{ {
Fnf f("fr_FR", 1); Fnf f("fr_FR.UTF-8", 1);
std::money_base::pattern p = f.pos_format(); std::money_base::pattern p = f.pos_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::value); assert(p.field[1] == std::money_base::value);
@ -126,7 +126,7 @@ int main()
assert(p.field[3] == std::money_base::symbol); assert(p.field[3] == std::money_base::symbol);
} }
{ {
Fnt f("fr_FR", 1); Fnt f("fr_FR.UTF-8", 1);
std::money_base::pattern p = f.pos_format(); std::money_base::pattern p = f.pos_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::value); assert(p.field[1] == std::money_base::value);
@ -134,7 +134,7 @@ int main()
assert(p.field[3] == std::money_base::symbol); assert(p.field[3] == std::money_base::symbol);
} }
{ {
Fwf f("fr_FR", 1); Fwf f("fr_FR.UTF-8", 1);
std::money_base::pattern p = f.pos_format(); std::money_base::pattern p = f.pos_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::value); assert(p.field[1] == std::money_base::value);
@ -142,7 +142,7 @@ int main()
assert(p.field[3] == std::money_base::symbol); assert(p.field[3] == std::money_base::symbol);
} }
{ {
Fwt f("fr_FR", 1); Fwt f("fr_FR.UTF-8", 1);
std::money_base::pattern p = f.pos_format(); std::money_base::pattern p = f.pos_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::value); assert(p.field[1] == std::money_base::value);
@ -151,7 +151,7 @@ int main()
} }
{ {
Fnf f("ru_RU", 1); Fnf f("ru_RU.UTF-8", 1);
std::money_base::pattern p = f.pos_format(); std::money_base::pattern p = f.pos_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::value); assert(p.field[1] == std::money_base::value);
@ -159,7 +159,7 @@ int main()
assert(p.field[3] == std::money_base::symbol); assert(p.field[3] == std::money_base::symbol);
} }
{ {
Fnt f("ru_RU", 1); Fnt f("ru_RU.UTF-8", 1);
std::money_base::pattern p = f.pos_format(); std::money_base::pattern p = f.pos_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::value); assert(p.field[1] == std::money_base::value);
@ -167,7 +167,7 @@ int main()
assert(p.field[3] == std::money_base::symbol); assert(p.field[3] == std::money_base::symbol);
} }
{ {
Fwf f("ru_RU", 1); Fwf f("ru_RU.UTF-8", 1);
std::money_base::pattern p = f.pos_format(); std::money_base::pattern p = f.pos_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::value); assert(p.field[1] == std::money_base::value);
@ -175,7 +175,7 @@ int main()
assert(p.field[3] == std::money_base::symbol); assert(p.field[3] == std::money_base::symbol);
} }
{ {
Fwt f("ru_RU", 1); Fwt f("ru_RU.UTF-8", 1);
std::money_base::pattern p = f.pos_format(); std::money_base::pattern p = f.pos_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::value); assert(p.field[1] == std::money_base::value);
@ -184,7 +184,7 @@ int main()
} }
{ {
Fnf f("zh_CN", 1); Fnf f("zh_CN.UTF-8", 1);
std::money_base::pattern p = f.pos_format(); std::money_base::pattern p = f.pos_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::symbol); assert(p.field[1] == std::money_base::symbol);
@ -192,7 +192,7 @@ int main()
assert(p.field[3] == std::money_base::value); assert(p.field[3] == std::money_base::value);
} }
{ {
Fnt f("zh_CN", 1); Fnt f("zh_CN.UTF-8", 1);
std::money_base::pattern p = f.pos_format(); std::money_base::pattern p = f.pos_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::symbol); assert(p.field[1] == std::money_base::symbol);
@ -200,7 +200,7 @@ int main()
assert(p.field[3] == std::money_base::value); assert(p.field[3] == std::money_base::value);
} }
{ {
Fwf f("zh_CN", 1); Fwf f("zh_CN.UTF-8", 1);
std::money_base::pattern p = f.pos_format(); std::money_base::pattern p = f.pos_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::symbol); assert(p.field[1] == std::money_base::symbol);
@ -208,7 +208,7 @@ int main()
assert(p.field[3] == std::money_base::value); assert(p.field[3] == std::money_base::value);
} }
{ {
Fwt f("zh_CN", 1); Fwt f("zh_CN.UTF-8", 1);
std::money_base::pattern p = f.pos_format(); std::money_base::pattern p = f.pos_format();
assert(p.field[0] == std::money_base::sign); assert(p.field[0] == std::money_base::sign);
assert(p.field[1] == std::money_base::symbol); assert(p.field[1] == std::money_base::symbol);

View File

@ -69,70 +69,70 @@ int main()
} }
{ {
Fnf f("en_US", 1); Fnf f("en_US.UTF-8", 1);
assert(f.positive_sign() == ""); assert(f.positive_sign() == "");
} }
{ {
Fnt f("en_US", 1); Fnt f("en_US.UTF-8", 1);
assert(f.positive_sign() == ""); assert(f.positive_sign() == "");
} }
{ {
Fwf f("en_US", 1); Fwf f("en_US.UTF-8", 1);
assert(f.positive_sign() == L""); assert(f.positive_sign() == L"");
} }
{ {
Fwt f("en_US", 1); Fwt f("en_US.UTF-8", 1);
assert(f.positive_sign() == L""); assert(f.positive_sign() == L"");
} }
{ {
Fnf f("fr_FR", 1); Fnf f("fr_FR.UTF-8", 1);
assert(f.positive_sign() == ""); assert(f.positive_sign() == "");
} }
{ {
Fnt f("fr_FR", 1); Fnt f("fr_FR.UTF-8", 1);
assert(f.positive_sign() == ""); assert(f.positive_sign() == "");
} }
{ {
Fwf f("fr_FR", 1); Fwf f("fr_FR.UTF-8", 1);
assert(f.positive_sign() == L""); assert(f.positive_sign() == L"");
} }
{ {
Fwt f("fr_FR", 1); Fwt f("fr_FR.UTF-8", 1);
assert(f.positive_sign() == L""); assert(f.positive_sign() == L"");
} }
{ {
Fnf f("ru_RU", 1); Fnf f("ru_RU.UTF-8", 1);
assert(f.positive_sign() == ""); assert(f.positive_sign() == "");
} }
{ {
Fnt f("ru_RU", 1); Fnt f("ru_RU.UTF-8", 1);
assert(f.positive_sign() == ""); assert(f.positive_sign() == "");
} }
{ {
Fwf f("ru_RU", 1); Fwf f("ru_RU.UTF-8", 1);
assert(f.positive_sign() == L""); assert(f.positive_sign() == L"");
} }
{ {
Fwt f("ru_RU", 1); Fwt f("ru_RU.UTF-8", 1);
assert(f.positive_sign() == L""); assert(f.positive_sign() == L"");
} }
{ {
Fnf f("zh_CN", 1); Fnf f("zh_CN.UTF-8", 1);
assert(f.positive_sign() == ""); assert(f.positive_sign() == "");
} }
{ {
Fnt f("zh_CN", 1); Fnt f("zh_CN.UTF-8", 1);
assert(f.positive_sign() == ""); assert(f.positive_sign() == "");
} }
{ {
Fwf f("zh_CN", 1); Fwf f("zh_CN.UTF-8", 1);
assert(f.positive_sign() == L""); assert(f.positive_sign() == L"");
} }
{ {
Fwt f("zh_CN", 1); Fwt f("zh_CN.UTF-8", 1);
assert(f.positive_sign() == L""); assert(f.positive_sign() == L"");
} }
} }

View File

@ -69,70 +69,70 @@ int main()
} }
{ {
Fnf f("en_US", 1); Fnf f("en_US.UTF-8", 1);
assert(f.thousands_sep() == ','); assert(f.thousands_sep() == ',');
} }
{ {
Fnt f("en_US", 1); Fnt f("en_US.UTF-8", 1);
assert(f.thousands_sep() == ','); assert(f.thousands_sep() == ',');
} }
{ {
Fwf f("en_US", 1); Fwf f("en_US.UTF-8", 1);
assert(f.thousands_sep() == L','); assert(f.thousands_sep() == L',');
} }
{ {
Fwt f("en_US", 1); Fwt f("en_US.UTF-8", 1);
assert(f.thousands_sep() == L','); assert(f.thousands_sep() == L',');
} }
{ {
Fnf f("fr_FR", 1); Fnf f("fr_FR.UTF-8", 1);
assert(f.thousands_sep() == ' '); assert(f.thousands_sep() == ' ');
} }
{ {
Fnt f("fr_FR", 1); Fnt f("fr_FR.UTF-8", 1);
assert(f.thousands_sep() == ' '); assert(f.thousands_sep() == ' ');
} }
{ {
Fwf f("fr_FR", 1); Fwf f("fr_FR.UTF-8", 1);
assert(f.thousands_sep() == L' '); assert(f.thousands_sep() == L' ');
} }
{ {
Fwt f("fr_FR", 1); Fwt f("fr_FR.UTF-8", 1);
assert(f.thousands_sep() == L' '); assert(f.thousands_sep() == L' ');
} }
{ {
Fnf f("ru_RU", 1); Fnf f("ru_RU.UTF-8", 1);
assert(f.thousands_sep() == ' '); assert(f.thousands_sep() == ' ');
} }
{ {
Fnt f("ru_RU", 1); Fnt f("ru_RU.UTF-8", 1);
assert(f.thousands_sep() == ' '); assert(f.thousands_sep() == ' ');
} }
{ {
Fwf f("ru_RU", 1); Fwf f("ru_RU.UTF-8", 1);
assert(f.thousands_sep() == L' '); assert(f.thousands_sep() == L' ');
} }
{ {
Fwt f("ru_RU", 1); Fwt f("ru_RU.UTF-8", 1);
assert(f.thousands_sep() == L' '); assert(f.thousands_sep() == L' ');
} }
{ {
Fnf f("zh_CN", 1); Fnf f("zh_CN.UTF-8", 1);
assert(f.thousands_sep() == ','); assert(f.thousands_sep() == ',');
} }
{ {
Fnt f("zh_CN", 1); Fnt f("zh_CN.UTF-8", 1);
assert(f.thousands_sep() == ','); assert(f.thousands_sep() == ',');
} }
{ {
Fwf f("zh_CN", 1); Fwf f("zh_CN.UTF-8", 1);
assert(f.thousands_sep() == L','); assert(f.thousands_sep() == L',');
} }
{ {
Fwt f("zh_CN", 1); Fwt f("zh_CN.UTF-8", 1);
assert(f.thousands_sep() == L','); assert(f.thousands_sep() == L',');
} }
} }

View File

@ -24413,6 +24413,9 @@ void test12()
output_iterator<char*> iter; output_iterator<char*> iter;
std::locale lc = std::locale::classic(); std::locale lc = std::locale::classic();
std::locale lg(lc, new my_numpunct); std::locale lg(lc, new my_numpunct);
#if __APPLE__
// This test is failing on FreeBSD, possibly due to different representations
// of the floating point numbers.
const my_facet f(1); const my_facet f(1);
{ {
long double v = 1234567890.125; long double v = 1234567890.125;
@ -24428,9 +24431,9 @@ void test12()
{ {
noshowpoint(ios); noshowpoint(ios);
{ {
ios.width(0);
ios.imbue(lc); ios.imbue(lc);
{ {
ios.width(0);
{ {
iter = f.put(output_iterator<char*>(str), ios, '*', v); iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base()); std::string ex(str, iter.base());
@ -26195,6 +26198,7 @@ void test12()
} }
} }
} }
#endif
} }
int main() int main()

View File

@ -30,19 +30,19 @@ public:
int main() int main()
{ {
{ {
const my_facet f("en_US", 1); const my_facet f("en_US.UTF-8", 1);
assert(f.date_order() == std::time_base::mdy); assert(f.date_order() == std::time_base::mdy);
} }
{ {
const my_facet f("fr_FR", 1); const my_facet f("fr_FR.UTF-8", 1);
assert(f.date_order() == std::time_base::dmy); assert(f.date_order() == std::time_base::dmy);
} }
{ {
const my_facet f("ru_RU", 1); const my_facet f("ru_RU.UTF-8", 1);
assert(f.date_order() == std::time_base::dmy); assert(f.date_order() == std::time_base::dmy);
} }
{ {
const my_facet f("zh_CN", 1); const my_facet f("zh_CN.UTF-8", 1);
assert(f.date_order() == std::time_base::ymd); assert(f.date_order() == std::time_base::ymd);
} }
} }

View File

@ -30,19 +30,19 @@ public:
int main() int main()
{ {
{ {
const my_facet f("en_US", 1); const my_facet f("en_US.UTF-8", 1);
assert(f.date_order() == std::time_base::mdy); assert(f.date_order() == std::time_base::mdy);
} }
{ {
const my_facet f("fr_FR", 1); const my_facet f("fr_FR.UTF-8", 1);
assert(f.date_order() == std::time_base::dmy); assert(f.date_order() == std::time_base::dmy);
} }
{ {
const my_facet f("ru_RU", 1); const my_facet f("ru_RU.UTF-8", 1);
assert(f.date_order() == std::time_base::dmy); assert(f.date_order() == std::time_base::dmy);
} }
{ {
const my_facet f("zh_CN", 1); const my_facet f("zh_CN.UTF-8", 1);
assert(f.date_order() == std::time_base::ymd); assert(f.date_order() == std::time_base::ymd);
} }
} }

View File

@ -37,7 +37,7 @@ int main()
std::ios_base::iostate err; std::ios_base::iostate err;
std::tm t; std::tm t;
{ {
const my_facet f("en_US", 1); const my_facet f("en_US.UTF-8", 1);
const char in[] = "06/10/2009"; const char in[] = "06/10/2009";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -49,7 +49,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("fr_FR", 1); const my_facet f("fr_FR.UTF-8", 1);
const char in[] = "10.06.2009"; const char in[] = "10.06.2009";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -61,7 +61,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("ru_RU", 1); const my_facet f("ru_RU.UTF-8", 1);
const char in[] = "10.06.2009"; const char in[] = "10.06.2009";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -73,7 +73,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("zh_CN", 1); const my_facet f("zh_CN.UTF-8", 1);
const char in[] = "2009/06/10"; const char in[] = "2009/06/10";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();

View File

@ -37,7 +37,7 @@ int main()
std::ios_base::iostate err; std::ios_base::iostate err;
std::tm t; std::tm t;
{ {
const my_facet f("en_US", 1); const my_facet f("en_US.UTF-8", 1);
const wchar_t in[] = L"06/10/2009"; const wchar_t in[] = L"06/10/2009";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -49,7 +49,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("fr_FR", 1); const my_facet f("fr_FR.UTF-8", 1);
const wchar_t in[] = L"10.06.2009"; const wchar_t in[] = L"10.06.2009";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -61,7 +61,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("ru_RU", 1); const my_facet f("ru_RU.UTF-8", 1);
const wchar_t in[] = L"10.06.2009"; const wchar_t in[] = L"10.06.2009";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -73,7 +73,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("zh_CN", 1); const my_facet f("zh_CN.UTF-8", 1);
const wchar_t in[] = L"2009/06/10"; const wchar_t in[] = L"2009/06/10";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();

View File

@ -37,7 +37,7 @@ int main()
std::ios_base::iostate err; std::ios_base::iostate err;
std::tm t; std::tm t;
{ {
const my_facet f("en_US", 1); const my_facet f("en_US.UTF-8", 1);
const char in[] = "June"; const char in[] = "June";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -47,7 +47,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("fr_FR", 1); const my_facet f("fr_FR.UTF-8", 1);
const char in[] = "juin"; const char in[] = "juin";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -57,7 +57,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("ru_RU", 1); const my_facet f("ru_RU.UTF-8", 1);
const char in[] = "\xD0\xB8\xD1\x8E\xD0\xBD\xD1\x8F"; const char in[] = "\xD0\xB8\xD1\x8E\xD0\xBD\xD1\x8F";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -67,7 +67,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("zh_CN", 1); const my_facet f("zh_CN.UTF-8", 1);
const char in[] = "\xE5\x85\xAD\xE6\x9C\x88"; const char in[] = "\xE5\x85\xAD\xE6\x9C\x88";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();

View File

@ -46,7 +46,7 @@ int main()
std::ios_base::iostate err; std::ios_base::iostate err;
std::tm t; std::tm t;
{ {
const my_facet f("en_US", 1); const my_facet f("en_US.UTF-8", 1);
const wchar_t in[] = L"June"; const wchar_t in[] = L"June";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -56,7 +56,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("fr_FR", 1); const my_facet f("fr_FR.UTF-8", 1);
const wchar_t in[] = L"juin"; const wchar_t in[] = L"juin";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -66,7 +66,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("ru_RU", 1); const my_facet f("ru_RU.UTF-8", 1);
const wchar_t in[] = L"\x438\x44E\x43D\x44F"; const wchar_t in[] = L"\x438\x44E\x43D\x44F";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -76,7 +76,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("zh_CN", 1); const my_facet f("zh_CN.UTF-8", 1);
const wchar_t in[] = L"\x516D\x6708"; const wchar_t in[] = L"\x516D\x6708";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();

View File

@ -36,7 +36,7 @@ int main()
std::ios_base::iostate err; std::ios_base::iostate err;
std::tm t; std::tm t;
{ {
const my_facet f("en_US", 1); const my_facet f("en_US.UTF-8", 1);
const char in[] = "Sat Dec 31 23:55:59 2061"; const char in[] = "Sat Dec 31 23:55:59 2061";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -52,7 +52,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("en_US", 1); const my_facet f("en_US.UTF-8", 1);
const char in[] = "23:55:59"; const char in[] = "23:55:59";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -64,7 +64,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("fr_FR", 1); const my_facet f("fr_FR.UTF-8", 1);
const char in[] = "Sam 31 d""\xC3\xA9""c 23:55:59 2061"; const char in[] = "Sam 31 d""\xC3\xA9""c 23:55:59 2061";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -80,7 +80,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("fr_FR", 1); const my_facet f("fr_FR.UTF-8", 1);
const char in[] = "23:55:59"; const char in[] = "23:55:59";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -92,7 +92,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("ru_RU", 1); const my_facet f("ru_RU.UTF-8", 1);
const char in[] = "\xD1\x81\xD1\x83\xD0\xB1\xD0\xB1" const char in[] = "\xD1\x81\xD1\x83\xD0\xB1\xD0\xB1"
"\xD0\xBE\xD1\x82\xD0\xB0" "\xD0\xBE\xD1\x82\xD0\xB0"
", 31 " ", 31 "
@ -115,7 +115,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("ru_RU", 1); const my_facet f("ru_RU.UTF-8", 1);
const char in[] = "23:55:59"; const char in[] = "23:55:59";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -127,7 +127,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("zh_CN", 1); const my_facet f("zh_CN.UTF-8", 1);
const char in[] = "\xE5\x85\xAD" const char in[] = "\xE5\x85\xAD"
" 12/31 23:55:59 2061"; " 12/31 23:55:59 2061";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
@ -144,7 +144,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("zh_CN", 1); const my_facet f("zh_CN.UTF-8", 1);
const char in[] = "23""\xE6\x97\xB6""55""\xE5\x88\x86""59""\xE7\xA7\x92"; const char in[] = "23""\xE6\x97\xB6""55""\xE5\x88\x86""59""\xE7\xA7\x92";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();

View File

@ -36,7 +36,7 @@ int main()
std::ios_base::iostate err; std::ios_base::iostate err;
std::tm t; std::tm t;
{ {
const my_facet f("en_US", 1); const my_facet f("en_US.UTF-8", 1);
const wchar_t in[] = L"Sat Dec 31 23:55:59 2061"; const wchar_t in[] = L"Sat Dec 31 23:55:59 2061";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -52,7 +52,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("en_US", 1); const my_facet f("en_US.UTF-8", 1);
const wchar_t in[] = L"23:55:59"; const wchar_t in[] = L"23:55:59";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -64,7 +64,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("fr_FR", 1); const my_facet f("fr_FR.UTF-8", 1);
const wchar_t in[] = L"Sam 31 d""\xE9""c 23:55:59 2061"; const wchar_t in[] = L"Sam 31 d""\xE9""c 23:55:59 2061";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -80,7 +80,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("fr_FR", 1); const my_facet f("fr_FR.UTF-8", 1);
const wchar_t in[] = L"23:55:59"; const wchar_t in[] = L"23:55:59";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -91,6 +91,7 @@ int main()
assert(t.tm_hour == 23); assert(t.tm_hour == 23);
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
#if __APPLE__
{ {
const my_facet f("ru_RU", 1); const my_facet f("ru_RU", 1);
const wchar_t in[] = L"\x441\x443\x431\x431\x43E\x442\x430" const wchar_t in[] = L"\x441\x443\x431\x431\x43E\x442\x430"
@ -112,8 +113,9 @@ int main()
assert(t.tm_wday == 6); assert(t.tm_wday == 6);
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
#endif
{ {
const my_facet f("ru_RU", 1); const my_facet f("ru_RU.UTF-8", 1);
const wchar_t in[] = L"23:55:59"; const wchar_t in[] = L"23:55:59";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -124,6 +126,7 @@ int main()
assert(t.tm_hour == 23); assert(t.tm_hour == 23);
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
#if __APPLE__
{ {
const my_facet f("zh_CN", 1); const my_facet f("zh_CN", 1);
const wchar_t in[] = L"\x516D" const wchar_t in[] = L"\x516D"
@ -142,7 +145,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("zh_CN", 1); const my_facet f("zh_CN.UTF-8", 1);
const wchar_t in[] = L"23""\x65F6""55""\x5206""59""\x79D2"; const wchar_t in[] = L"23""\x65F6""55""\x5206""59""\x79D2";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -153,4 +156,5 @@ int main()
assert(t.tm_hour == 23); assert(t.tm_hour == 23);
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
#endif
} }

View File

@ -37,7 +37,7 @@ int main()
std::ios_base::iostate err; std::ios_base::iostate err;
std::tm t; std::tm t;
{ {
const my_facet f("en_US", 1); const my_facet f("en_US.UTF-8", 1);
const char in[] = "13:14:15"; const char in[] = "13:14:15";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -49,7 +49,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("fr_FR", 1); const my_facet f("fr_FR.UTF-8", 1);
const char in[] = "13:14:15"; const char in[] = "13:14:15";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -61,7 +61,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("ru_RU", 1); const my_facet f("ru_RU.UTF-8", 1);
const char in[] = "13:14:15"; const char in[] = "13:14:15";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -73,7 +73,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("zh_CN", 1); const my_facet f("zh_CN.UTF-8", 1);
const char in[] = "13:14:15"; const char in[] = "13:14:15";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();

View File

@ -37,7 +37,7 @@ int main()
std::ios_base::iostate err; std::ios_base::iostate err;
std::tm t; std::tm t;
{ {
const my_facet f("en_US", 1); const my_facet f("en_US.UTF-8", 1);
const wchar_t in[] = L"13:14:15"; const wchar_t in[] = L"13:14:15";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -49,7 +49,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("fr_FR", 1); const my_facet f("fr_FR.UTF-8", 1);
const wchar_t in[] = L"13:14:15"; const wchar_t in[] = L"13:14:15";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -61,7 +61,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("ru_RU", 1); const my_facet f("ru_RU.UTF-8", 1);
const wchar_t in[] = L"13:14:15"; const wchar_t in[] = L"13:14:15";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -73,7 +73,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("zh_CN", 1); const my_facet f("zh_CN.UTF-8", 1);
const wchar_t in[] = L"13:14:15"; const wchar_t in[] = L"13:14:15";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();

View File

@ -37,7 +37,7 @@ int main()
std::ios_base::iostate err; std::ios_base::iostate err;
std::tm t; std::tm t;
{ {
const my_facet f("en_US", 1); const my_facet f("en_US.UTF-8", 1);
const char in[] = "Monday"; const char in[] = "Monday";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -47,7 +47,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("fr_FR", 1); const my_facet f("fr_FR.UTF-8", 1);
const char in[] = "Lundi"; const char in[] = "Lundi";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -57,7 +57,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("ru_RU", 1); const my_facet f("ru_RU.UTF-8", 1);
const char in[] = "\xD0\xBF\xD0\xBE\xD0\xBD\xD0\xB5" const char in[] = "\xD0\xBF\xD0\xBE\xD0\xBD\xD0\xB5"
"\xD0\xB4\xD0\xB5\xD0\xBB\xD1\x8C" "\xD0\xB4\xD0\xB5\xD0\xBB\xD1\x8C"
"\xD0\xBD\xD0\xB8\xD0\xBA"; "\xD0\xBD\xD0\xB8\xD0\xBA";
@ -69,7 +69,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("zh_CN", 1); const my_facet f("zh_CN.UTF-8", 1);
const char in[] = "\xE6\x98\x9F\xE6\x9C\x9F\xE4\xB8\x80"; const char in[] = "\xE6\x98\x9F\xE6\x9C\x9F\xE4\xB8\x80";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();

View File

@ -37,7 +37,7 @@ int main()
std::ios_base::iostate err; std::ios_base::iostate err;
std::tm t; std::tm t;
{ {
const my_facet f("en_US", 1); const my_facet f("en_US.UTF-8", 1);
const wchar_t in[] = L"Monday"; const wchar_t in[] = L"Monday";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -47,7 +47,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("fr_FR", 1); const my_facet f("fr_FR.UTF-8", 1);
const wchar_t in[] = L"Lundi"; const wchar_t in[] = L"Lundi";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -57,7 +57,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("ru_RU", 1); const my_facet f("ru_RU.UTF-8", 1);
const wchar_t in[] = L"\x43F\x43E\x43D\x435\x434\x435\x43B\x44C\x43D\x438\x43A"; const wchar_t in[] = L"\x43F\x43E\x43D\x435\x434\x435\x43B\x44C\x43D\x438\x43A";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -67,7 +67,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("zh_CN", 1); const my_facet f("zh_CN.UTF-8", 1);
const wchar_t in[] = L"\x661F\x671F\x4E00"; const wchar_t in[] = L"\x661F\x671F\x4E00";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();

View File

@ -36,7 +36,7 @@ int main()
std::ios_base::iostate err; std::ios_base::iostate err;
std::tm t; std::tm t;
{ {
const my_facet f("en_US", 1); const my_facet f("en_US.UTF-8", 1);
const char in[] = "2009"; const char in[] = "2009";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -46,7 +46,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("fr_FR", 1); const my_facet f("fr_FR.UTF-8", 1);
const char in[] = "2009"; const char in[] = "2009";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -56,7 +56,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("ru_RU", 1); const my_facet f("ru_RU.UTF-8", 1);
const char in[] = "2009"; const char in[] = "2009";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -66,7 +66,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("zh_CN", 1); const my_facet f("zh_CN.UTF-8", 1);
const char in[] = "2009"; const char in[] = "2009";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();

View File

@ -36,7 +36,7 @@ int main()
std::ios_base::iostate err; std::ios_base::iostate err;
std::tm t; std::tm t;
{ {
const my_facet f("en_US", 1); const my_facet f("en_US.UTF-8", 1);
const wchar_t in[] = L"2009"; const wchar_t in[] = L"2009";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -46,7 +46,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("fr_FR", 1); const my_facet f("fr_FR.UTF-8", 1);
const wchar_t in[] = L"2009"; const wchar_t in[] = L"2009";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -56,7 +56,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("ru_RU", 1); const my_facet f("ru_RU.UTF-8", 1);
const wchar_t in[] = L"2009"; const wchar_t in[] = L"2009";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();
@ -66,7 +66,7 @@ int main()
assert(err == std::ios_base::eofbit); assert(err == std::ios_base::eofbit);
} }
{ {
const my_facet f("zh_CN", 1); const my_facet f("zh_CN.UTF-8", 1);
const wchar_t in[] = L"2009"; const wchar_t in[] = L"2009";
err = std::ios_base::goodbit; err = std::ios_base::goodbit;
t = std::tm(); t = std::tm();

View File

@ -51,7 +51,7 @@ int main()
t.tm_isdst = 1; t.tm_isdst = 1;
std::ios ios(0); std::ios ios(0);
{ {
const my_facet f("en_US", 1); const my_facet f("en_US.UTF-8", 1);
std::string pat("Today is %A which is abreviated %a."); std::string pat("Today is %A which is abreviated %a.");
iter = f.put(output_iterator<char*>(str), ios, '*', &t, iter = f.put(output_iterator<char*>(str), ios, '*', &t,
pat.data(), pat.data() + pat.size()); pat.data(), pat.data() + pat.size());
@ -59,11 +59,12 @@ int main()
assert(ex == "Today is Saturday which is abreviated Sat."); assert(ex == "Today is Saturday which is abreviated Sat.");
} }
{ {
const my_facet f("fr_FR", 1); const my_facet f("fr_FR.UTF-8", 1);
std::string pat("Today is %A which is abreviated %a."); std::string pat("Today is %A which is abreviated %a.");
iter = f.put(output_iterator<char*>(str), ios, '*', &t, iter = f.put(output_iterator<char*>(str), ios, '*', &t,
pat.data(), pat.data() + pat.size()); pat.data(), pat.data() + pat.size());
std::string ex(str, iter.base()); std::string ex(str, iter.base());
assert(ex == "Today is Samedi which is abreviated Sam."); assert((ex == "Today is Samedi which is abreviated Sam.")||
(ex == "Today is samedi which is abreviated sam." ));
} }
} }

View File

@ -32,7 +32,7 @@ int main()
} }
} }
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef char C; typedef char C;
const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l); const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
@ -45,7 +45,7 @@ int main()
} }
} }
{ {
std::locale l("fr_FR"); std::locale l("fr_FR.UTF-8");
{ {
typedef char C; typedef char C;
const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l); const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);

View File

@ -32,7 +32,7 @@ int main()
} }
} }
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef char C; typedef char C;
const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l); const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
@ -45,7 +45,7 @@ int main()
} }
} }
{ {
std::locale l("fr_FR"); std::locale l("fr_FR.UTF-8");
{ {
typedef char C; typedef char C;
const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l); const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);

View File

@ -32,7 +32,7 @@ int main()
} }
} }
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef char C; typedef char C;
const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l); const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
@ -45,7 +45,7 @@ int main()
} }
} }
{ {
std::locale l("fr_FR"); std::locale l("fr_FR.UTF-8");
{ {
typedef char C; typedef char C;
const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l); const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);

View File

@ -67,7 +67,7 @@ void check(const std::locale& loc)
int main() int main()
{ {
{ {
std::locale loc("ru_RU"); std::locale loc("ru_RU.UTF-8");
std::locale loc2; std::locale loc2;
loc2 = loc; loc2 = loc;
assert(loc == loc2); assert(loc == loc2);

View File

@ -67,12 +67,12 @@ void check(const std::locale& loc)
int main() int main()
{ {
{ {
std::locale loc("ru_RU"); std::locale loc("ru_RU.UTF-8");
check(loc); check(loc);
std::locale loc2("ru_RU"); std::locale loc2("ru_RU.UTF-8");
check(loc2); check(loc2);
assert(loc == loc2); assert(loc == loc2);
std::locale loc3("zh_CN"); std::locale loc3("zh_CN.UTF-8");
check(loc3); check(loc3);
assert(!(loc == loc3)); assert(!(loc == loc3));
assert(loc != loc3); assert(loc != loc3);

View File

@ -67,7 +67,7 @@ void check(const std::locale& loc)
int main() int main()
{ {
{ {
std::locale loc("fr_FR"); std::locale loc("fr_FR.UTF-8");
std::locale loc2 = loc; std::locale loc2 = loc;
assert(loc == loc2); assert(loc == loc2);
check(loc); check(loc);

View File

@ -74,13 +74,13 @@ int main()
assert(new_called == 0); assert(new_called == 0);
check(loc); check(loc);
assert(new_called == 0); assert(new_called == 0);
assert(std::locale::global(std::locale("en_US")) == loc); assert(std::locale::global(std::locale("en_US.UTF-8")) == loc);
ok = new_called; ok = new_called;
std::locale loc2; std::locale loc2;
assert(new_called == ok); assert(new_called == ok);
check(loc2); check(loc2);
assert(new_called == ok); assert(new_called == ok);
assert(loc2 == std::locale("en_US")); assert(loc2 == std::locale("en_US.UTF-8"));
assert(new_called == ok); assert(new_called == ok);
} }
assert(new_called == ok); assert(new_called == ok);

View File

@ -67,9 +67,9 @@ void check(const std::locale& loc)
int main() int main()
{ {
{ {
std::locale loc("ru_RU"); std::locale loc("ru_RU.UTF-8");
check(loc); check(loc);
std::locale loc2(loc, "en_US", std::locale::monetary); std::locale loc2(loc, "en_US.UTF-8", std::locale::monetary);
check(loc2); check(loc2);
} }
assert(new_called == 0); assert(new_called == 0);

View File

@ -78,7 +78,7 @@ int main()
{ {
{ {
{ {
std::locale loc("ru_RU"); std::locale loc("ru_RU.UTF-8");
check(loc); check(loc);
std::locale loc2(loc, new my_facet); std::locale loc2(loc, new my_facet);
check(loc2); check(loc2);

View File

@ -67,9 +67,9 @@ void check(const std::locale& loc)
int main() int main()
{ {
{ {
std::locale loc("ru_RU"); std::locale loc("ru_RU.UTF-8");
check(loc); check(loc);
std::locale loc2(loc, std::locale("en_US"), std::locale::monetary); std::locale loc2(loc, std::locale("en_US.UTF-8"), std::locale::monetary);
check(loc2); check(loc2);
} }
assert(new_called == 0); assert(new_called == 0);

View File

@ -67,9 +67,9 @@ void check(const std::locale& loc)
int main() int main()
{ {
{ {
std::locale loc("ru_RU"); std::locale loc("ru_RU.UTF-8");
check(loc); check(loc);
std::locale loc2(loc, std::string("en_US"), std::locale::monetary); std::locale loc2(loc, std::string("en_US.UTF-8"), std::locale::monetary);
check(loc2); check(loc2);
} }
assert(new_called == 0); assert(new_called == 0);

View File

@ -67,12 +67,12 @@ void check(const std::locale& loc)
int main() int main()
{ {
{ {
std::locale loc(std::string("ru_RU")); std::locale loc(std::string("ru_RU.UTF-8"));
check(loc); check(loc);
std::locale loc2(std::string("ru_RU")); std::locale loc2(std::string("ru_RU.UTF-8"));
check(loc2); check(loc2);
assert(loc == loc2); assert(loc == loc2);
std::locale loc3(std::string("zh_CN")); std::locale loc3(std::string("zh_CN.UTF-8"));
check(loc3); check(loc3);
assert(!(loc == loc3)); assert(!(loc == loc3));
assert(loc != loc3); assert(loc != loc3);