#include <locale>
#include <sstream>
#include <testsuite_hooks.h>
void test02()
{
using namespace std;
typedef ostreambuf_iterator<wchar_t> iterator_type;
bool test __attribute__((unused)) = true;
locale loc_c = locale::classic();
locale loc_hk = __gnu_test::try_named_locale("en_HK");
VERIFY( loc_c != loc_hk );
const wstring empty;
const wstring digits1(L"720000000000");
const wstring digits2(L"-10000000000000");
const wstring digits3(L"-A");
const wstring digits4(L"-1");
wostringstream oss;
oss.imbue(loc_hk);
const money_put<wchar_t>& mon_put =
use_facet<money_put<wchar_t> >(oss.getloc());
oss.setf(ios_base::showbase);
oss.str(empty);
iterator_type os_it05 = mon_put.put(oss.rdbuf(), false, oss, L' ', digits1);
wstring result5 = oss.str();
VERIFY( result5 == L"HK$7,200,000,000.00" );
oss.str(empty);
iterator_type os_it06 = mon_put.put(oss.rdbuf(), true, oss, L' ', digits2);
wstring result6 = oss.str();
VERIFY( result6 == L"(HKD 100,000,000,000.00)" );
oss.imbue(loc_c);
oss.str(empty);
const money_put<wchar_t>& mon_put2 =
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();
VERIFY( result7 == L"1" );
oss.imbue(loc_hk);
oss.str(empty);
const money_put<wchar_t>& mon_put3 =
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();
VERIFY( result8 == L"(HKD .01)" );
oss.unsetf(ios_base::showbase);
oss.str(empty);
iterator_type os_it09 = mon_put.put(oss.rdbuf(), true, oss, L' ', digits3);
wstring result9 = oss.str();
VERIFY( result9 == L"" );
}
int main()
{
test02();
return 0;
}