1.cc: Use proper wchar_t type for the fill argument; minor formatting tweaks.
2004-08-21 Paolo Carlini <pcarlini@suse.de> * testsuite/22_locale/money_put/put/wchar_t/1.cc: Use proper wchar_t type for the fill argument; minor formatting tweaks. * testsuite/22_locale/money_put/put/wchar_t/12971.cc: Likewise. * testsuite/22_locale/money_put/put/wchar_t/2.cc: Likewise. * testsuite/22_locale/money_put/put/wchar_t/3.cc: Likewise. * testsuite/22_locale/money_put/put/wchar_t/4.cc: Likewise. * testsuite/22_locale/money_put/put/wchar_t/5.cc: Likewise. * testsuite/22_locale/money_put/put/wchar_t/6.cc: Likewise. From-SVN: r86362
This commit is contained in:
parent
0fa1b65cad
commit
82507bc996
@ -1,3 +1,14 @@
|
|||||||
|
2004-08-21 Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
|
* testsuite/22_locale/money_put/put/wchar_t/1.cc: Use proper
|
||||||
|
wchar_t type for the fill argument; minor formatting tweaks.
|
||||||
|
* testsuite/22_locale/money_put/put/wchar_t/12971.cc: Likewise.
|
||||||
|
* testsuite/22_locale/money_put/put/wchar_t/2.cc: Likewise.
|
||||||
|
* testsuite/22_locale/money_put/put/wchar_t/3.cc: Likewise.
|
||||||
|
* testsuite/22_locale/money_put/put/wchar_t/4.cc: Likewise.
|
||||||
|
* testsuite/22_locale/money_put/put/wchar_t/5.cc: Likewise.
|
||||||
|
* testsuite/22_locale/money_put/put/wchar_t/6.cc: Likewise.
|
||||||
|
|
||||||
2004-08-21 Paolo Carlini <pcarlini@suse.de>
|
2004-08-21 Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
* include/bits/basic_ios.tcc (basic_ios<>::copyfmt): Don't deal
|
* include/bits/basic_ios.tcc (basic_ios<>::copyfmt): Don't deal
|
||||||
|
@ -49,16 +49,17 @@ void test01()
|
|||||||
// cache the money_put facet
|
// cache the money_put facet
|
||||||
wostringstream oss;
|
wostringstream oss;
|
||||||
oss.imbue(loc_de);
|
oss.imbue(loc_de);
|
||||||
const money_put<wchar_t>& mon_put = use_facet<money_put<wchar_t> >(oss.getloc());
|
const money_put<wchar_t>& mon_put =
|
||||||
|
use_facet<money_put<wchar_t> >(oss.getloc());
|
||||||
|
|
||||||
iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
|
iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, L' ', digits1);
|
||||||
wstring result1 = oss.str();
|
wstring result1 = oss.str();
|
||||||
VERIFY( result1 == L"7.200.000.000,00 ");
|
VERIFY( result1 == L"7.200.000.000,00 " );
|
||||||
|
|
||||||
oss.str(empty);
|
oss.str(empty);
|
||||||
iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
|
iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, L' ', digits1);
|
||||||
wstring result2 = oss.str();
|
wstring result2 = oss.str();
|
||||||
VERIFY( result2 == L"7.200.000.000,00 ");
|
VERIFY( result2 == L"7.200.000.000,00 " );
|
||||||
|
|
||||||
// intl and non-intl versions should be the same.
|
// intl and non-intl versions should be the same.
|
||||||
VERIFY( result1 == result2 );
|
VERIFY( result1 == result2 );
|
||||||
@ -67,14 +68,14 @@ void test01()
|
|||||||
oss.setf(ios_base::showbase);
|
oss.setf(ios_base::showbase);
|
||||||
|
|
||||||
oss.str(empty);
|
oss.str(empty);
|
||||||
iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
|
iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, L' ', digits1);
|
||||||
wstring result3 = oss.str();
|
wstring result3 = oss.str();
|
||||||
VERIFY( result3 == L"7.200.000.000,00 EUR ");
|
VERIFY( result3 == L"7.200.000.000,00 EUR " );
|
||||||
|
|
||||||
oss.str(empty);
|
oss.str(empty);
|
||||||
iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
|
iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, L' ', digits1);
|
||||||
wstring result4 = oss.str();
|
wstring result4 = oss.str();
|
||||||
VERIFY( result4 == L"7.200.000.000,00 \x20ac");
|
VERIFY( result4 == L"7.200.000.000,00 \x20ac" );
|
||||||
|
|
||||||
// intl and non-intl versions should be different.
|
// intl and non-intl versions should be different.
|
||||||
VERIFY( result3 != result4 );
|
VERIFY( result3 != result4 );
|
||||||
@ -87,16 +88,16 @@ void test01()
|
|||||||
// test various fill strategies
|
// test various fill strategies
|
||||||
oss.str(empty);
|
oss.str(empty);
|
||||||
oss.width(20);
|
oss.width(20);
|
||||||
iterator_type os_it10 = mon_put.put(oss.rdbuf(), true, oss, '*', digits2);
|
iterator_type os_it10 = mon_put.put(oss.rdbuf(), true, oss, L'*', digits2);
|
||||||
wstring result10 = oss.str();
|
wstring result10 = oss.str();
|
||||||
VERIFY( result10 == L"***************-,01*");
|
VERIFY( result10 == L"***************-,01*" );
|
||||||
|
|
||||||
oss.str(empty);
|
oss.str(empty);
|
||||||
oss.width(20);
|
oss.width(20);
|
||||||
oss.setf(ios_base::internal);
|
oss.setf(ios_base::internal);
|
||||||
iterator_type os_it11 = mon_put.put(oss.rdbuf(), true, oss, '*', digits2);
|
iterator_type os_it11 = mon_put.put(oss.rdbuf(), true, oss, L'*', digits2);
|
||||||
wstring result11 = oss.str();
|
wstring result11 = oss.str();
|
||||||
VERIFY( result11 == L"-,01****************");
|
VERIFY( result11 == L"-,01****************" );
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// 2003-11-09 Paolo Carlini <pcarlini@suse.de>
|
// 2003-11-09 Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
// Copyright (C) 2003 Free Software Foundation
|
// Copyright (C) 2003, 2004 Free Software Foundation
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
// software; you can redistribute it and/or modify it under the
|
// software; you can redistribute it and/or modify it under the
|
||||||
@ -36,7 +36,8 @@ void test01()
|
|||||||
|
|
||||||
// cache the money_put facet
|
// cache the money_put facet
|
||||||
wostringstream oss;
|
wostringstream oss;
|
||||||
const money_put<wchar_t>& mon_put = use_facet<money_put<wchar_t> >(oss.getloc());
|
const money_put<wchar_t>& mon_put =
|
||||||
|
use_facet<money_put<wchar_t> >(oss.getloc());
|
||||||
|
|
||||||
iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, L' ', amount);
|
iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, L' ', amount);
|
||||||
wstring result = oss.str();
|
wstring result = oss.str();
|
||||||
|
@ -55,45 +55,48 @@ void test02()
|
|||||||
// cache the money_put facet
|
// cache the money_put facet
|
||||||
wostringstream oss;
|
wostringstream oss;
|
||||||
oss.imbue(loc_hk);
|
oss.imbue(loc_hk);
|
||||||
const money_put<wchar_t>& mon_put = use_facet<money_put<wchar_t> >(oss.getloc());
|
const money_put<wchar_t>& mon_put =
|
||||||
|
use_facet<money_put<wchar_t> >(oss.getloc());
|
||||||
|
|
||||||
// now try with showbase, to get currency symbol in format
|
// now try with showbase, to get currency symbol in format
|
||||||
oss.setf(ios_base::showbase);
|
oss.setf(ios_base::showbase);
|
||||||
|
|
||||||
// test sign of more than one digit, say hong kong.
|
// test sign of more than one digit, say hong kong.
|
||||||
oss.str(empty);
|
oss.str(empty);
|
||||||
iterator_type os_it05 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
|
iterator_type os_it05 = mon_put.put(oss.rdbuf(), false, oss, L' ', digits1);
|
||||||
wstring result5 = oss.str();
|
wstring result5 = oss.str();
|
||||||
VERIFY( result5 == L"HK$7,200,000,000.00");
|
VERIFY( result5 == L"HK$7,200,000,000.00" );
|
||||||
|
|
||||||
oss.str(empty);
|
oss.str(empty);
|
||||||
iterator_type os_it06 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits2);
|
iterator_type os_it06 = mon_put.put(oss.rdbuf(), true, oss, L' ', digits2);
|
||||||
wstring result6 = oss.str();
|
wstring result6 = oss.str();
|
||||||
VERIFY( result6 == L"(HKD 100,000,000,000.00)");
|
VERIFY( result6 == L"(HKD 100,000,000,000.00)" );
|
||||||
|
|
||||||
// test one-digit formats without zero padding
|
// test one-digit formats without zero padding
|
||||||
oss.imbue(loc_c);
|
oss.imbue(loc_c);
|
||||||
oss.str(empty);
|
oss.str(empty);
|
||||||
const money_put<wchar_t>& mon_put2 = use_facet<money_put<wchar_t> >(oss.getloc());
|
const money_put<wchar_t>& mon_put2 =
|
||||||
iterator_type os_it07 = mon_put2.put(oss.rdbuf(), true, oss, ' ', digits4);
|
use_facet<money_put<wchar_t> >(oss.getloc());
|
||||||
|
iterator_type os_it07 = mon_put2.put(oss.rdbuf(), true, oss, L' ', digits4);
|
||||||
wstring result7 = oss.str();
|
wstring result7 = oss.str();
|
||||||
VERIFY( result7 == L"1");
|
VERIFY( result7 == L"1" );
|
||||||
|
|
||||||
// test one-digit formats with zero padding, zero frac widths
|
// test one-digit formats with zero padding, zero frac widths
|
||||||
oss.imbue(loc_hk);
|
oss.imbue(loc_hk);
|
||||||
oss.str(empty);
|
oss.str(empty);
|
||||||
const money_put<wchar_t>& mon_put3 = use_facet<money_put<wchar_t> >(oss.getloc());
|
const money_put<wchar_t>& mon_put3 =
|
||||||
iterator_type os_it08 = mon_put3.put(oss.rdbuf(), true, oss, ' ', digits4);
|
use_facet<money_put<wchar_t> >(oss.getloc());
|
||||||
|
iterator_type os_it08 = mon_put3.put(oss.rdbuf(), true, oss, L' ', digits4);
|
||||||
wstring result8 = oss.str();
|
wstring result8 = oss.str();
|
||||||
VERIFY( result8 == L"(HKD .01)");
|
VERIFY( result8 == L"(HKD .01)" );
|
||||||
|
|
||||||
oss.unsetf(ios_base::showbase);
|
oss.unsetf(ios_base::showbase);
|
||||||
|
|
||||||
// test bunk input
|
// test bunk input
|
||||||
oss.str(empty);
|
oss.str(empty);
|
||||||
iterator_type os_it09 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits3);
|
iterator_type os_it09 = mon_put.put(oss.rdbuf(), true, oss, L' ', digits3);
|
||||||
wstring result9 = oss.str();
|
wstring result9 = oss.str();
|
||||||
VERIFY( result9 == L"");
|
VERIFY( result9 == L"" );
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
@ -46,16 +46,17 @@ void test03()
|
|||||||
// cache the money_put facet
|
// cache the money_put facet
|
||||||
wostringstream oss;
|
wostringstream oss;
|
||||||
oss.imbue(loc_de);
|
oss.imbue(loc_de);
|
||||||
const money_put<wchar_t>& mon_put = use_facet<money_put<wchar_t> >(oss.getloc());
|
const money_put<wchar_t>& mon_put =
|
||||||
|
use_facet<money_put<wchar_t> >(oss.getloc());
|
||||||
|
|
||||||
iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
|
iterator_type os_it01 = mon_put.put(oss.rdbuf(), true, oss, L' ', digits1);
|
||||||
wstring result1 = oss.str();
|
wstring result1 = oss.str();
|
||||||
VERIFY( result1 == L"7.200.000.000,00 ");
|
VERIFY( result1 == L"7.200.000.000,00 " );
|
||||||
|
|
||||||
oss.str(empty);
|
oss.str(empty);
|
||||||
iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
|
iterator_type os_it02 = mon_put.put(oss.rdbuf(), false, oss, L' ', digits1);
|
||||||
wstring result2 = oss.str();
|
wstring result2 = oss.str();
|
||||||
VERIFY( result2 == L"7.200.000.000,00 ");
|
VERIFY( result2 == L"7.200.000.000,00 " );
|
||||||
|
|
||||||
// intl and non-intl versions should be the same.
|
// intl and non-intl versions should be the same.
|
||||||
VERIFY( result1 == result2 );
|
VERIFY( result1 == result2 );
|
||||||
@ -64,14 +65,14 @@ void test03()
|
|||||||
oss.setf(ios_base::showbase);
|
oss.setf(ios_base::showbase);
|
||||||
|
|
||||||
oss.str(empty);
|
oss.str(empty);
|
||||||
iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, ' ', digits1);
|
iterator_type os_it03 = mon_put.put(oss.rdbuf(), true, oss, L' ', digits1);
|
||||||
wstring result3 = oss.str();
|
wstring result3 = oss.str();
|
||||||
VERIFY( result3 == L"7.200.000.000,00 EUR ");
|
VERIFY( result3 == L"7.200.000.000,00 EUR " );
|
||||||
|
|
||||||
oss.str(empty);
|
oss.str(empty);
|
||||||
iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
|
iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, L' ', digits1);
|
||||||
wstring result4 = oss.str();
|
wstring result4 = oss.str();
|
||||||
VERIFY( result4 == L"7.200.000.000,00 \x20ac");
|
VERIFY( result4 == L"7.200.000.000,00 \x20ac" );
|
||||||
|
|
||||||
// intl and non-intl versions should be different.
|
// intl and non-intl versions should be different.
|
||||||
VERIFY( result3 != result4 );
|
VERIFY( result3 != result4 );
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
|
// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
// Copyright (C) 2001, 2002, 2003 Free Software Foundation
|
// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
// software; you can redistribute it and/or modify it under the
|
// software; you can redistribute it and/or modify it under the
|
||||||
@ -50,7 +50,7 @@ void test04()
|
|||||||
|
|
||||||
// 01 wstring
|
// 01 wstring
|
||||||
res = x;
|
res = x;
|
||||||
iter_type ret1 = mp.put(res.begin(), false, oss, ' ', str);
|
iter_type ret1 = mp.put(res.begin(), false, oss, L' ', str);
|
||||||
wstring sanity1(res.begin(), ret1);
|
wstring sanity1(res.begin(), ret1);
|
||||||
VERIFY( err == goodbit );
|
VERIFY( err == goodbit );
|
||||||
VERIFY( res == L"1943xxxxxxxxxxxxx" );
|
VERIFY( res == L"1943xxxxxxxxxxxxx" );
|
||||||
@ -58,7 +58,7 @@ void test04()
|
|||||||
|
|
||||||
// 02 long double
|
// 02 long double
|
||||||
res = x;
|
res = x;
|
||||||
iter_type ret2 = mp.put(res.begin(), false, oss, ' ', ld);
|
iter_type ret2 = mp.put(res.begin(), false, oss, L' ', ld);
|
||||||
wstring sanity2(res.begin(), ret2);
|
wstring sanity2(res.begin(), ret2);
|
||||||
VERIFY( err == goodbit );
|
VERIFY( err == goodbit );
|
||||||
VERIFY( res == L"1943xxxxxxxxxxxxx" );
|
VERIFY( res == L"1943xxxxxxxxxxxxx" );
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
|
// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
// Copyright (C) 2001, 2002, 2003 Free Software Foundation
|
// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
// software; you can redistribute it and/or modify it under the
|
// software; you can redistribute it and/or modify it under the
|
||||||
@ -26,8 +26,8 @@
|
|||||||
|
|
||||||
struct My_money_io : public std::moneypunct<wchar_t,false>
|
struct My_money_io : public std::moneypunct<wchar_t,false>
|
||||||
{
|
{
|
||||||
char_type do_decimal_point() const { return '.'; }
|
char_type do_decimal_point() const { return L'.'; }
|
||||||
char_type do_thousands_sep() const { return ','; }
|
char_type do_thousands_sep() const { return L','; }
|
||||||
std::string do_grouping() const { return "\003"; }
|
std::string do_grouping() const { return "\003"; }
|
||||||
|
|
||||||
std::wstring do_negative_sign() const { return L"()"; }
|
std::wstring do_negative_sign() const { return L"()"; }
|
||||||
@ -53,13 +53,13 @@ void test05()
|
|||||||
bool intl = false;
|
bool intl = false;
|
||||||
|
|
||||||
wstring val(L"-123456");
|
wstring val(L"-123456");
|
||||||
const money_put<wchar_t,OutIt>& mp =
|
const money_put<wchar_t, OutIt>& mp =
|
||||||
use_facet<money_put<wchar_t, OutIt> >(loc);
|
use_facet<money_put<wchar_t, OutIt> >(loc);
|
||||||
|
|
||||||
wostringstream fmt;
|
wostringstream fmt;
|
||||||
fmt.imbue(loc);
|
fmt.imbue(loc);
|
||||||
OutIt out(fmt);
|
OutIt out(fmt);
|
||||||
mp.put(out,intl,fmt,'*',val);
|
mp.put(out, intl, fmt, L'*', val);
|
||||||
VERIFY( fmt.str() == L"*(1,234.56)" );
|
VERIFY( fmt.str() == L"*(1,234.56)" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
|
// 2001-08-27 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
// Copyright (C) 2001, 2002, 2003 Free Software Foundation
|
// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
// software; you can redistribute it and/or modify it under the
|
// software; you can redistribute it and/or modify it under the
|
||||||
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
struct My_money_io_2 : public std::moneypunct<wchar_t,false>
|
struct My_money_io_2 : public std::moneypunct<wchar_t,false>
|
||||||
{
|
{
|
||||||
char_type do_thousands_sep() const { return ','; }
|
char_type do_thousands_sep() const { return L','; }
|
||||||
std::string do_grouping() const { return "\001"; }
|
std::string do_grouping() const { return "\001"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -42,13 +42,13 @@ void test06()
|
|||||||
bool intl = false;
|
bool intl = false;
|
||||||
|
|
||||||
long double val = 1.0e50L;
|
long double val = 1.0e50L;
|
||||||
const money_put<wchar_t,OutIt>& mp =
|
const money_put<wchar_t, OutIt>& mp =
|
||||||
use_facet<money_put<wchar_t, OutIt> >(loc);
|
use_facet<money_put<wchar_t, OutIt> >(loc);
|
||||||
|
|
||||||
wostringstream fmt;
|
wostringstream fmt;
|
||||||
fmt.imbue(loc);
|
fmt.imbue(loc);
|
||||||
OutIt out(fmt);
|
OutIt out(fmt);
|
||||||
mp.put(out,intl,fmt,'*',val);
|
mp.put(out, intl, fmt, L'*', val);
|
||||||
VERIFY( fmt.good() );
|
VERIFY( fmt.good() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user