Fix moneypunct_byname algorithm to more accurately represent C locales in C++.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@152501 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -3060,6 +3060,9 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
|
|||||||
string_type __sym;
|
string_type __sym;
|
||||||
string_type __psn;
|
string_type __psn;
|
||||||
string_type __nsn;
|
string_type __nsn;
|
||||||
|
// Capture the spaces read into money_base::{space,none} so they
|
||||||
|
// can be compared to initial spaces in __sym.
|
||||||
|
string_type __spaces;
|
||||||
int __fd;
|
int __fd;
|
||||||
__money_get<_CharT>::__gather_info(__intl, __loc, __pat, __dp, __ts, __grp,
|
__money_get<_CharT>::__gather_info(__intl, __loc, __pat, __dp, __ts, __grp,
|
||||||
__sym, __psn, __nsn, __fd);
|
__sym, __psn, __nsn, __fd);
|
||||||
@@ -3073,7 +3076,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
|
|||||||
if (__p != 3)
|
if (__p != 3)
|
||||||
{
|
{
|
||||||
if (__ct.is(ctype_base::space, *__b))
|
if (__ct.is(ctype_base::space, *__b))
|
||||||
++__b;
|
__spaces.push_back(*__b++);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__err |= ios_base::failbit;
|
__err |= ios_base::failbit;
|
||||||
@@ -3085,7 +3088,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
|
|||||||
if (__p != 3)
|
if (__p != 3)
|
||||||
{
|
{
|
||||||
while (__b != __e && __ct.is(ctype_base::space, *__b))
|
while (__b != __e && __ct.is(ctype_base::space, *__b))
|
||||||
++__b;
|
__spaces.push_back(*__b++);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case money_base::sign:
|
case money_base::sign:
|
||||||
@@ -3144,9 +3147,31 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
|
|||||||
if (__sb || __more_needed)
|
if (__sb || __more_needed)
|
||||||
{
|
{
|
||||||
ios_base::iostate __et = ios_base::goodbit;
|
ios_base::iostate __et = ios_base::goodbit;
|
||||||
string_type* __k = __scan_keyword(__b, __e, &__sym, &__sym+1,
|
typename string_type::const_iterator __sym_space_end = __sym.begin();
|
||||||
__ct, __et);
|
if (__p > 0 && (__pat.field[__p - 1] == money_base::none ||
|
||||||
if (__sb && __k != &__sym)
|
__pat.field[__p - 1] == money_base::space)) {
|
||||||
|
// Match spaces we've already read against spaces at
|
||||||
|
// the beginning of __sym.
|
||||||
|
while (__sym_space_end != __sym.end() &&
|
||||||
|
__ct.is(ctype_base::space, *__sym_space_end))
|
||||||
|
++__sym_space_end;
|
||||||
|
const size_t __num_spaces = __sym_space_end - __sym.begin();
|
||||||
|
if (__num_spaces > __spaces.size() ||
|
||||||
|
!equal(__spaces.end() - __num_spaces, __spaces.end(),
|
||||||
|
__sym.begin())) {
|
||||||
|
// No match. Put __sym_space_end back at the
|
||||||
|
// beginning of __sym, which will prevent a
|
||||||
|
// match in the next loop.
|
||||||
|
__sym_space_end = __sym.begin();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
typename string_type::const_iterator __sym_curr_char = __sym_space_end;
|
||||||
|
while (__sym_curr_char != __sym.end() && __b != __e &&
|
||||||
|
*__b == *__sym_curr_char) {
|
||||||
|
++__b;
|
||||||
|
++__sym_curr_char;
|
||||||
|
}
|
||||||
|
if (__sb && __sym_curr_char != __sym.end())
|
||||||
{
|
{
|
||||||
__err |= ios_base::failbit;
|
__err |= ios_base::failbit;
|
||||||
return false;
|
return false;
|
||||||
|
302
src/locale.cpp
302
src/locale.cpp
@@ -5275,116 +5275,200 @@ __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm,
|
|||||||
|
|
||||||
// moneypunct_byname
|
// moneypunct_byname
|
||||||
|
|
||||||
|
template <class charT>
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
__init_pat(money_base::pattern& pat, char cs_precedes, char sep_by_space, char sign_posn)
|
__init_pat(money_base::pattern& pat, basic_string<charT>& __curr_symbol_,
|
||||||
|
bool intl, char cs_precedes, char sep_by_space, char sign_posn,
|
||||||
|
charT space_char)
|
||||||
{
|
{
|
||||||
const char sign = static_cast<char>(money_base::sign);
|
const char sign = static_cast<char>(money_base::sign);
|
||||||
const char space = static_cast<char>(money_base::space);
|
const char space = static_cast<char>(money_base::space);
|
||||||
const char none = static_cast<char>(money_base::none);
|
const char none = static_cast<char>(money_base::none);
|
||||||
const char symbol = static_cast<char>(money_base::symbol);
|
const char symbol = static_cast<char>(money_base::symbol);
|
||||||
const char value = static_cast<char>(money_base::value);
|
const char value = static_cast<char>(money_base::value);
|
||||||
|
const bool symbol_contains_sep = intl && __curr_symbol_.size() == 4;
|
||||||
|
|
||||||
|
// Comments on case branches reflect 'C11 7.11.2.1 The localeconv
|
||||||
|
// function'. "Space between sign and symbol or value" means that
|
||||||
|
// if the sign is adjacent to the symbol, there's a space between
|
||||||
|
// them, and otherwise there's a space between the sign and value.
|
||||||
|
//
|
||||||
|
// C11's localeconv specifies that the fourth character of an
|
||||||
|
// international curr_symbol is used to separate the sign and
|
||||||
|
// value when sep_by_space says to do so. C++ can't represent
|
||||||
|
// that, so we just use a space. When sep_by_space says to
|
||||||
|
// separate the symbol and value-or-sign with a space, we rearrange the
|
||||||
|
// curr_symbol to put its spacing character on the correct side of
|
||||||
|
// the symbol.
|
||||||
|
//
|
||||||
|
// We also need to avoid adding an extra space between the sign
|
||||||
|
// and value when the currency symbol is suppressed (by not
|
||||||
|
// setting showbase). We match glibc's strfmon by interpreting
|
||||||
|
// sep_by_space==1 as "omit the space when the currency symbol is
|
||||||
|
// absent".
|
||||||
|
//
|
||||||
|
// Users who want to get this right should use ICU instead.
|
||||||
|
|
||||||
switch (cs_precedes)
|
switch (cs_precedes)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: // value before curr_symbol
|
||||||
|
if (symbol_contains_sep) {
|
||||||
|
// Move the separator to before the symbol, to place it
|
||||||
|
// between the value and symbol.
|
||||||
|
rotate(__curr_symbol_.begin(), __curr_symbol_.begin() + 3,
|
||||||
|
__curr_symbol_.end());
|
||||||
|
}
|
||||||
switch (sign_posn)
|
switch (sign_posn)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: // Parentheses surround the quantity and currency symbol.
|
||||||
pat.field[0] = sign;
|
pat.field[0] = sign;
|
||||||
pat.field[1] = value;
|
pat.field[1] = value;
|
||||||
|
pat.field[2] = none; // Any space appears in the symbol.
|
||||||
pat.field[3] = symbol;
|
pat.field[3] = symbol;
|
||||||
switch (sep_by_space)
|
switch (sep_by_space)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: // No space separates the currency symbol and value.
|
||||||
pat.field[2] = none;
|
// This case may have changed between C99 and C11;
|
||||||
|
// assume the currency symbol matches the intention.
|
||||||
|
case 2: // Space between sign and currency or value.
|
||||||
|
// The "sign" is two parentheses, so no space here either.
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1: // Space between currency-and-sign or currency and value.
|
||||||
case 2:
|
if (!symbol_contains_sep) {
|
||||||
pat.field[2] = space;
|
// We insert the space into the symbol instead of
|
||||||
|
// setting pat.field[2]=space so that when
|
||||||
|
// showbase is not set, the space goes away too.
|
||||||
|
__curr_symbol_.insert(0, 1, space_char);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1: // The sign string precedes the quantity and currency symbol.
|
||||||
pat.field[0] = sign;
|
pat.field[0] = sign;
|
||||||
pat.field[3] = symbol;
|
pat.field[3] = symbol;
|
||||||
switch (sep_by_space)
|
switch (sep_by_space)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: // No space separates the currency symbol and value.
|
||||||
pat.field[1] = value;
|
pat.field[1] = value;
|
||||||
pat.field[2] = none;
|
pat.field[2] = none;
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1: // Space between currency-and-sign or currency and value.
|
||||||
pat.field[1] = value;
|
pat.field[1] = value;
|
||||||
pat.field[2] = space;
|
pat.field[2] = none;
|
||||||
|
if (!symbol_contains_sep) {
|
||||||
|
// We insert the space into the symbol instead of
|
||||||
|
// setting pat.field[2]=space so that when
|
||||||
|
// showbase is not set, the space goes away too.
|
||||||
|
__curr_symbol_.insert(0, 1, space_char);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
case 2:
|
case 2: // Space between sign and currency or value.
|
||||||
pat.field[1] = space;
|
pat.field[1] = space;
|
||||||
pat.field[2] = value;
|
pat.field[2] = value;
|
||||||
|
if (symbol_contains_sep) {
|
||||||
|
// Remove the separator from the symbol, since it
|
||||||
|
// has already appeared after the sign.
|
||||||
|
__curr_symbol_.erase(__curr_symbol_.begin());
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2: // The sign string succeeds the quantity and currency symbol.
|
||||||
pat.field[0] = value;
|
pat.field[0] = value;
|
||||||
pat.field[3] = sign;
|
pat.field[3] = sign;
|
||||||
switch (sep_by_space)
|
switch (sep_by_space)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: // No space separates the currency symbol and value.
|
||||||
pat.field[1] = none;
|
pat.field[1] = none;
|
||||||
pat.field[2] = symbol;
|
pat.field[2] = symbol;
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1: // Space between currency-and-sign or currency and value.
|
||||||
pat.field[1] = space;
|
if (!symbol_contains_sep) {
|
||||||
|
// We insert the space into the symbol instead of
|
||||||
|
// setting pat.field[1]=space so that when
|
||||||
|
// showbase is not set, the space goes away too.
|
||||||
|
__curr_symbol_.insert(0, 1, space_char);
|
||||||
|
}
|
||||||
|
pat.field[1] = none;
|
||||||
pat.field[2] = symbol;
|
pat.field[2] = symbol;
|
||||||
return;
|
return;
|
||||||
case 2:
|
case 2: // Space between sign and currency or value.
|
||||||
pat.field[1] = symbol;
|
pat.field[1] = symbol;
|
||||||
pat.field[2] = space;
|
pat.field[2] = space;
|
||||||
|
if (symbol_contains_sep) {
|
||||||
|
// Remove the separator from the symbol, since it
|
||||||
|
// should not be removed if showbase is absent.
|
||||||
|
__curr_symbol_.erase(__curr_symbol_.begin());
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3: // The sign string immediately precedes the currency symbol.
|
||||||
pat.field[0] = value;
|
pat.field[0] = value;
|
||||||
pat.field[3] = symbol;
|
pat.field[3] = symbol;
|
||||||
switch (sep_by_space)
|
switch (sep_by_space)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: // No space separates the currency symbol and value.
|
||||||
pat.field[1] = none;
|
pat.field[1] = none;
|
||||||
pat.field[2] = sign;
|
pat.field[2] = sign;
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1: // Space between currency-and-sign or currency and value.
|
||||||
pat.field[1] = space;
|
pat.field[1] = space;
|
||||||
pat.field[2] = sign;
|
pat.field[2] = sign;
|
||||||
|
if (symbol_contains_sep) {
|
||||||
|
// Remove the separator from the symbol, since it
|
||||||
|
// has already appeared before the sign.
|
||||||
|
__curr_symbol_.erase(__curr_symbol_.begin());
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
case 2:
|
case 2: // Space between sign and currency or value.
|
||||||
pat.field[1] = sign;
|
pat.field[1] = sign;
|
||||||
pat.field[2] = space;
|
pat.field[2] = none;
|
||||||
|
if (!symbol_contains_sep) {
|
||||||
|
// We insert the space into the symbol instead of
|
||||||
|
// setting pat.field[2]=space so that when
|
||||||
|
// showbase is not set, the space goes away too.
|
||||||
|
__curr_symbol_.insert(0, 1, space_char);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4: // The sign string immediately succeeds the currency symbol.
|
||||||
pat.field[0] = value;
|
pat.field[0] = value;
|
||||||
pat.field[3] = sign;
|
pat.field[3] = sign;
|
||||||
switch (sep_by_space)
|
switch (sep_by_space)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: // No space separates the currency symbol and value.
|
||||||
pat.field[1] = none;
|
pat.field[1] = none;
|
||||||
pat.field[2] = symbol;
|
pat.field[2] = symbol;
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1: // Space between currency-and-sign or currency and value.
|
||||||
pat.field[1] = space;
|
pat.field[1] = none;
|
||||||
pat.field[2] = symbol;
|
pat.field[2] = symbol;
|
||||||
|
if (!symbol_contains_sep) {
|
||||||
|
// We insert the space into the symbol instead of
|
||||||
|
// setting pat.field[1]=space so that when
|
||||||
|
// showbase is not set, the space goes away too.
|
||||||
|
__curr_symbol_.insert(0, 1, space_char);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
case 2:
|
case 2: // Space between sign and currency or value.
|
||||||
pat.field[1] = symbol;
|
pat.field[1] = symbol;
|
||||||
pat.field[2] = space;
|
pat.field[2] = space;
|
||||||
|
if (symbol_contains_sep) {
|
||||||
|
// Remove the separator from the symbol, since it
|
||||||
|
// should not disappear when showbase is absent.
|
||||||
|
__curr_symbol_.erase(__curr_symbol_.begin());
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -5394,105 +5478,157 @@ __init_pat(money_base::pattern& pat, char cs_precedes, char sep_by_space, char s
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1: // curr_symbol before value
|
||||||
switch (sign_posn)
|
switch (sign_posn)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: // Parentheses surround the quantity and currency symbol.
|
||||||
pat.field[0] = sign;
|
pat.field[0] = sign;
|
||||||
pat.field[1] = symbol;
|
pat.field[1] = symbol;
|
||||||
|
pat.field[2] = none; // Any space appears in the symbol.
|
||||||
pat.field[3] = value;
|
pat.field[3] = value;
|
||||||
switch (sep_by_space)
|
switch (sep_by_space)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: // No space separates the currency symbol and value.
|
||||||
pat.field[2] = none;
|
// This case may have changed between C99 and C11;
|
||||||
|
// assume the currency symbol matches the intention.
|
||||||
|
case 2: // Space between sign and currency or value.
|
||||||
|
// The "sign" is two parentheses, so no space here either.
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1: // Space between currency-and-sign or currency and value.
|
||||||
case 2:
|
if (!symbol_contains_sep) {
|
||||||
pat.field[2] = space;
|
// We insert the space into the symbol instead of
|
||||||
|
// setting pat.field[2]=space so that when
|
||||||
|
// showbase is not set, the space goes away too.
|
||||||
|
__curr_symbol_.insert(0, 1, space_char);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1: // The sign string precedes the quantity and currency symbol.
|
||||||
pat.field[0] = sign;
|
pat.field[0] = sign;
|
||||||
pat.field[3] = value;
|
pat.field[3] = value;
|
||||||
switch (sep_by_space)
|
switch (sep_by_space)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: // No space separates the currency symbol and value.
|
||||||
pat.field[1] = symbol;
|
pat.field[1] = symbol;
|
||||||
pat.field[2] = none;
|
pat.field[2] = none;
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1: // Space between currency-and-sign or currency and value.
|
||||||
pat.field[1] = symbol;
|
pat.field[1] = symbol;
|
||||||
pat.field[2] = space;
|
pat.field[2] = none;
|
||||||
|
if (!symbol_contains_sep) {
|
||||||
|
// We insert the space into the symbol instead of
|
||||||
|
// setting pat.field[2]=space so that when
|
||||||
|
// showbase is not set, the space goes away too.
|
||||||
|
__curr_symbol_.push_back(space_char);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
case 2:
|
case 2: // Space between sign and currency or value.
|
||||||
pat.field[1] = space;
|
pat.field[1] = space;
|
||||||
pat.field[2] = symbol;
|
pat.field[2] = symbol;
|
||||||
|
if (symbol_contains_sep) {
|
||||||
|
// Remove the separator from the symbol, since it
|
||||||
|
// has already appeared after the sign.
|
||||||
|
__curr_symbol_.pop_back();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2: // The sign string succeeds the quantity and currency symbol.
|
||||||
pat.field[0] = symbol;
|
pat.field[0] = symbol;
|
||||||
pat.field[3] = sign;
|
pat.field[3] = sign;
|
||||||
switch (sep_by_space)
|
switch (sep_by_space)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: // No space separates the currency symbol and value.
|
||||||
pat.field[1] = none;
|
pat.field[1] = none;
|
||||||
pat.field[2] = value;
|
pat.field[2] = value;
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1: // Space between currency-and-sign or currency and value.
|
||||||
pat.field[1] = space;
|
pat.field[1] = none;
|
||||||
pat.field[2] = value;
|
pat.field[2] = value;
|
||||||
|
if (!symbol_contains_sep) {
|
||||||
|
// We insert the space into the symbol instead of
|
||||||
|
// setting pat.field[1]=space so that when
|
||||||
|
// showbase is not set, the space goes away too.
|
||||||
|
__curr_symbol_.push_back(space_char);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
case 2:
|
case 2: // Space between sign and currency or value.
|
||||||
pat.field[1] = value;
|
pat.field[1] = value;
|
||||||
pat.field[2] = space;
|
pat.field[2] = space;
|
||||||
|
if (symbol_contains_sep) {
|
||||||
|
// Remove the separator from the symbol, since it
|
||||||
|
// will appear before the sign.
|
||||||
|
__curr_symbol_.pop_back();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3: // The sign string immediately precedes the currency symbol.
|
||||||
pat.field[0] = sign;
|
pat.field[0] = sign;
|
||||||
pat.field[3] = value;
|
pat.field[3] = value;
|
||||||
switch (sep_by_space)
|
switch (sep_by_space)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: // No space separates the currency symbol and value.
|
||||||
pat.field[1] = symbol;
|
pat.field[1] = symbol;
|
||||||
pat.field[2] = none;
|
pat.field[2] = none;
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1: // Space between currency-and-sign or currency and value.
|
||||||
pat.field[1] = symbol;
|
pat.field[1] = symbol;
|
||||||
pat.field[2] = space;
|
pat.field[2] = none;
|
||||||
|
if (!symbol_contains_sep) {
|
||||||
|
// We insert the space into the symbol instead of
|
||||||
|
// setting pat.field[2]=space so that when
|
||||||
|
// showbase is not set, the space goes away too.
|
||||||
|
__curr_symbol_.push_back(space_char);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
case 2:
|
case 2: // Space between sign and currency or value.
|
||||||
pat.field[1] = space;
|
pat.field[1] = space;
|
||||||
pat.field[2] = symbol;
|
pat.field[2] = symbol;
|
||||||
|
if (symbol_contains_sep) {
|
||||||
|
// Remove the separator from the symbol, since it
|
||||||
|
// has already appeared after the sign.
|
||||||
|
__curr_symbol_.pop_back();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4: // The sign string immediately succeeds the currency symbol.
|
||||||
pat.field[0] = symbol;
|
pat.field[0] = symbol;
|
||||||
pat.field[3] = value;
|
pat.field[3] = value;
|
||||||
switch (sep_by_space)
|
switch (sep_by_space)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: // No space separates the currency symbol and value.
|
||||||
pat.field[1] = sign;
|
pat.field[1] = sign;
|
||||||
pat.field[2] = none;
|
pat.field[2] = none;
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1: // Space between currency-and-sign or currency and value.
|
||||||
pat.field[1] = sign;
|
pat.field[1] = sign;
|
||||||
pat.field[2] = space;
|
pat.field[2] = space;
|
||||||
|
if (symbol_contains_sep) {
|
||||||
|
// Remove the separator from the symbol, since it
|
||||||
|
// should not disappear when showbase is absent.
|
||||||
|
__curr_symbol_.pop_back();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
case 2:
|
case 2: // Space between sign and currency or value.
|
||||||
pat.field[1] = space;
|
pat.field[1] = none;
|
||||||
pat.field[2] = sign;
|
pat.field[2] = sign;
|
||||||
|
if (!symbol_contains_sep) {
|
||||||
|
// We insert the space into the symbol instead of
|
||||||
|
// setting pat.field[1]=space so that when
|
||||||
|
// showbase is not set, the space goes away too.
|
||||||
|
__curr_symbol_.push_back(space_char);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -5549,8 +5685,14 @@ moneypunct_byname<char, false>::init(const char* nm)
|
|||||||
__negative_sign_ = "()";
|
__negative_sign_ = "()";
|
||||||
else
|
else
|
||||||
__negative_sign_ = lc->negative_sign;
|
__negative_sign_ = lc->negative_sign;
|
||||||
__init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn);
|
// Assume the positive and negative formats will want spaces in
|
||||||
__init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn);
|
// the same places in curr_symbol since there's no way to
|
||||||
|
// represent anything else.
|
||||||
|
string_type __dummy_curr_symbol = __curr_symbol_;
|
||||||
|
__init_pat(__pos_format_, __dummy_curr_symbol, false,
|
||||||
|
lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, ' ');
|
||||||
|
__init_pat(__neg_format_, __curr_symbol_, false,
|
||||||
|
lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
@@ -5599,12 +5741,22 @@ moneypunct_byname<char, true>::init(const char* nm)
|
|||||||
__negative_sign_ = "()";
|
__negative_sign_ = "()";
|
||||||
else
|
else
|
||||||
__negative_sign_ = lc->negative_sign;
|
__negative_sign_ = lc->negative_sign;
|
||||||
|
// Assume the positive and negative formats will want spaces in
|
||||||
|
// the same places in curr_symbol since there's no way to
|
||||||
|
// represent anything else.
|
||||||
|
string_type __dummy_curr_symbol = __curr_symbol_;
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
__init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn);
|
__init_pat(__pos_format_, __dummy_curr_symbol, true,
|
||||||
__init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn);
|
lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, ' ');
|
||||||
|
__init_pat(__neg_format_, __curr_symbol_, true,
|
||||||
|
lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, ' ');
|
||||||
#else
|
#else
|
||||||
__init_pat(__pos_format_, lc->int_p_cs_precedes, lc->int_p_sep_by_space, lc->int_p_sign_posn);
|
__init_pat(__pos_format_, __dummy_curr_symbol, true,
|
||||||
__init_pat(__neg_format_, lc->int_n_cs_precedes, lc->int_n_sep_by_space, lc->int_n_sign_posn);
|
lc->int_p_cs_precedes, lc->int_p_sep_by_space,
|
||||||
|
lc->int_p_sign_posn, ' ');
|
||||||
|
__init_pat(__neg_format_, __curr_symbol_, true,
|
||||||
|
lc->int_n_cs_precedes, lc->int_n_sep_by_space,
|
||||||
|
lc->int_n_sign_posn, ' ');
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5681,8 +5833,14 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
|
|||||||
wbe = wbuf + j;
|
wbe = wbuf + j;
|
||||||
__negative_sign_.assign(wbuf, wbe);
|
__negative_sign_.assign(wbuf, wbe);
|
||||||
}
|
}
|
||||||
__init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn);
|
// Assume the positive and negative formats will want spaces in
|
||||||
__init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn);
|
// the same places in curr_symbol since there's no way to
|
||||||
|
// represent anything else.
|
||||||
|
string_type __dummy_curr_symbol = __curr_symbol_;
|
||||||
|
__init_pat(__pos_format_, __dummy_curr_symbol, false,
|
||||||
|
lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, L' ');
|
||||||
|
__init_pat(__neg_format_, __curr_symbol_, false,
|
||||||
|
lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, L' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
@@ -5766,12 +5924,22 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
|
|||||||
wbe = wbuf + j;
|
wbe = wbuf + j;
|
||||||
__negative_sign_.assign(wbuf, wbe);
|
__negative_sign_.assign(wbuf, wbe);
|
||||||
}
|
}
|
||||||
|
// Assume the positive and negative formats will want spaces in
|
||||||
|
// the same places in curr_symbol since there's no way to
|
||||||
|
// represent anything else.
|
||||||
|
string_type __dummy_curr_symbol = __curr_symbol_;
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
__init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn);
|
__init_pat(__pos_format_, __dummy_curr_symbol, true,
|
||||||
__init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn);
|
lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, L' ');
|
||||||
|
__init_pat(__neg_format_, __curr_symbol_, true,
|
||||||
|
lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, L' ');
|
||||||
#else // _WIN32
|
#else // _WIN32
|
||||||
__init_pat(__pos_format_, lc->int_p_cs_precedes, lc->int_p_sep_by_space, lc->int_p_sign_posn);
|
__init_pat(__pos_format_, __dummy_curr_symbol, true,
|
||||||
__init_pat(__neg_format_, lc->int_n_cs_precedes, lc->int_n_sep_by_space, lc->int_n_sign_posn);
|
lc->int_p_cs_precedes, lc->int_p_sep_by_space,
|
||||||
|
lc->int_p_sign_posn, L' ');
|
||||||
|
__init_pat(__neg_format_, __curr_symbol_, true,
|
||||||
|
lc->int_n_cs_precedes, lc->int_n_sep_by_space,
|
||||||
|
lc->int_n_sign_posn, L' ');
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -69,7 +69,7 @@ int main()
|
|||||||
assert(ex == 0);
|
assert(ex == 0);
|
||||||
}
|
}
|
||||||
{ // negative one
|
{ // negative one
|
||||||
std::string v = "0,01 -";
|
std::string v = "-0,01";
|
||||||
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;
|
||||||
@@ -91,7 +91,7 @@ int main()
|
|||||||
assert(ex == 123456789);
|
assert(ex == 123456789);
|
||||||
}
|
}
|
||||||
{ // negative
|
{ // negative
|
||||||
std::string v = "1 234 567,89 -";
|
std::string v = "-1 234 567,89";
|
||||||
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;
|
||||||
@@ -102,7 +102,7 @@ int main()
|
|||||||
assert(ex == -123456789);
|
assert(ex == -123456789);
|
||||||
}
|
}
|
||||||
{ // negative
|
{ // negative
|
||||||
std::string v = "1234567,89 -";
|
std::string v = "-1234567,89";
|
||||||
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;
|
||||||
@@ -113,7 +113,8 @@ int main()
|
|||||||
assert(ex == -123456789);
|
assert(ex == -123456789);
|
||||||
}
|
}
|
||||||
{ // zero, showbase
|
{ // zero, showbase
|
||||||
std::string v = "0,00 Eu";
|
std::string v = "0,00 \u20ac"; // €
|
||||||
|
showbase(ios);
|
||||||
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;
|
||||||
@@ -124,7 +125,7 @@ int main()
|
|||||||
assert(ex == 0);
|
assert(ex == 0);
|
||||||
}
|
}
|
||||||
{ // zero, showbase
|
{ // zero, showbase
|
||||||
std::string v = "0,00 Eu";
|
std::string v = "0,00 \u20ac"; // €
|
||||||
showbase(ios);
|
showbase(ios);
|
||||||
typedef input_iterator<const char*> I;
|
typedef input_iterator<const char*> I;
|
||||||
long double ex;
|
long double ex;
|
||||||
@@ -134,10 +135,9 @@ int main()
|
|||||||
assert(iter.base() == v.data() + v.size());
|
assert(iter.base() == v.data() + v.size());
|
||||||
assert(err == std::ios_base::eofbit);
|
assert(err == std::ios_base::eofbit);
|
||||||
assert(ex == 0);
|
assert(ex == 0);
|
||||||
noshowbase(ios);
|
|
||||||
}
|
}
|
||||||
{ // negative one, showbase
|
{ // negative one, showbase
|
||||||
std::string v = "0,01 Eu-";
|
std::string v = "-0,01 \u20ac";
|
||||||
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;
|
||||||
@@ -148,7 +148,7 @@ int main()
|
|||||||
assert(ex == -1);
|
assert(ex == -1);
|
||||||
}
|
}
|
||||||
{ // negative one, showbase
|
{ // negative one, showbase
|
||||||
std::string v = "0,01 Eu-";
|
std::string v = "-0,01 \u20ac";
|
||||||
showbase(ios);
|
showbase(ios);
|
||||||
typedef input_iterator<const char*> I;
|
typedef input_iterator<const char*> I;
|
||||||
long double ex;
|
long double ex;
|
||||||
@@ -158,10 +158,9 @@ int main()
|
|||||||
assert(iter.base() == v.data() + v.size());
|
assert(iter.base() == v.data() + v.size());
|
||||||
assert(err == std::ios_base::eofbit);
|
assert(err == std::ios_base::eofbit);
|
||||||
assert(ex == -1);
|
assert(ex == -1);
|
||||||
noshowbase(ios);
|
|
||||||
}
|
}
|
||||||
{ // positive, showbase
|
{ // positive, showbase
|
||||||
std::string v = "1 234 567,89 Eu";
|
std::string v = "1 234 567,89 \u20ac";
|
||||||
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;
|
||||||
@@ -172,7 +171,7 @@ int main()
|
|||||||
assert(ex == 123456789);
|
assert(ex == 123456789);
|
||||||
}
|
}
|
||||||
{ // positive, showbase
|
{ // positive, showbase
|
||||||
std::string v = "1 234 567,89 Eu";
|
std::string v = "1 234 567,89 \u20ac";
|
||||||
showbase(ios);
|
showbase(ios);
|
||||||
typedef input_iterator<const char*> I;
|
typedef input_iterator<const char*> I;
|
||||||
long double ex;
|
long double ex;
|
||||||
@@ -185,7 +184,7 @@ int main()
|
|||||||
noshowbase(ios);
|
noshowbase(ios);
|
||||||
}
|
}
|
||||||
{ // negative, showbase
|
{ // negative, showbase
|
||||||
std::string v = "1 234 567,89 Eu-";
|
std::string v = "-1 234 567,89 \u20ac";
|
||||||
showbase(ios);
|
showbase(ios);
|
||||||
typedef input_iterator<const char*> I;
|
typedef input_iterator<const char*> I;
|
||||||
long double ex;
|
long double ex;
|
||||||
@@ -205,7 +204,7 @@ int main()
|
|||||||
std::ios_base::iostate err = std::ios_base::goodbit;
|
std::ios_base::iostate err = std::ios_base::goodbit;
|
||||||
I iter = f.get(I(v.data()), I(v.data() + v.size()),
|
I iter = f.get(I(v.data()), I(v.data() + v.size()),
|
||||||
false, ios, err, ex);
|
false, ios, err, ex);
|
||||||
assert(iter.base() == v.data() + 14);
|
assert(iter.base() == v.data() + 13);
|
||||||
assert(err == std::ios_base::failbit);
|
assert(err == std::ios_base::failbit);
|
||||||
noshowbase(ios);
|
noshowbase(ios);
|
||||||
}
|
}
|
||||||
@@ -216,10 +215,11 @@ int main()
|
|||||||
std::ios_base::iostate err = std::ios_base::goodbit;
|
std::ios_base::iostate err = std::ios_base::goodbit;
|
||||||
I iter = f.get(I(v.data()), I(v.data() + v.size()),
|
I iter = f.get(I(v.data()), I(v.data() + v.size()),
|
||||||
false, ios, err, ex);
|
false, ios, err, ex);
|
||||||
assert(iter.base() == v.data() + 14);
|
assert(iter.base() == v.data() + 13);
|
||||||
assert(err == std::ios_base::goodbit);
|
assert(err == std::ios_base::goodbit);
|
||||||
assert(ex == 123456789);
|
assert(ex == 123456789);
|
||||||
}
|
}
|
||||||
|
noshowbase(ios);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const my_facet f(1);
|
const my_facet f(1);
|
||||||
@@ -236,7 +236,7 @@ int main()
|
|||||||
assert(ex == 0);
|
assert(ex == 0);
|
||||||
}
|
}
|
||||||
{ // negative one
|
{ // negative one
|
||||||
std::string v = "0,01 -";
|
std::string v = "-0,01";
|
||||||
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;
|
||||||
@@ -258,7 +258,7 @@ int main()
|
|||||||
assert(ex == 123456789);
|
assert(ex == 123456789);
|
||||||
}
|
}
|
||||||
{ // negative
|
{ // negative
|
||||||
std::string v = "1 234 567,89 -";
|
std::string v = "-1 234 567,89";
|
||||||
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;
|
||||||
@@ -269,7 +269,7 @@ int main()
|
|||||||
assert(ex == -123456789);
|
assert(ex == -123456789);
|
||||||
}
|
}
|
||||||
{ // negative
|
{ // negative
|
||||||
std::string v = "1234567,89 -";
|
std::string v = "-1234567,89";
|
||||||
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;
|
||||||
@@ -280,7 +280,8 @@ int main()
|
|||||||
assert(ex == -123456789);
|
assert(ex == -123456789);
|
||||||
}
|
}
|
||||||
{ // zero, showbase
|
{ // zero, showbase
|
||||||
std::string v = "0,00 EUR ";
|
std::string v = "0,00 EUR";
|
||||||
|
showbase(ios);
|
||||||
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;
|
||||||
@@ -291,7 +292,7 @@ int main()
|
|||||||
assert(ex == 0);
|
assert(ex == 0);
|
||||||
}
|
}
|
||||||
{ // zero, showbase
|
{ // zero, showbase
|
||||||
std::string v = "0,00 EUR ";
|
std::string v = "0,00 EUR";
|
||||||
showbase(ios);
|
showbase(ios);
|
||||||
typedef input_iterator<const char*> I;
|
typedef input_iterator<const char*> I;
|
||||||
long double ex;
|
long double ex;
|
||||||
@@ -301,10 +302,9 @@ int main()
|
|||||||
assert(iter.base() == v.data() + v.size());
|
assert(iter.base() == v.data() + v.size());
|
||||||
assert(err == std::ios_base::eofbit);
|
assert(err == std::ios_base::eofbit);
|
||||||
assert(ex == 0);
|
assert(ex == 0);
|
||||||
noshowbase(ios);
|
|
||||||
}
|
}
|
||||||
{ // negative one, showbase
|
{ // negative one, showbase
|
||||||
std::string v = "0,01 EUR -";
|
std::string v = "-0,01 EUR";
|
||||||
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;
|
||||||
@@ -315,7 +315,7 @@ int main()
|
|||||||
assert(ex == -1);
|
assert(ex == -1);
|
||||||
}
|
}
|
||||||
{ // negative one, showbase
|
{ // negative one, showbase
|
||||||
std::string v = "0,01 EUR -";
|
std::string v = "-0,01 EUR";
|
||||||
showbase(ios);
|
showbase(ios);
|
||||||
typedef input_iterator<const char*> I;
|
typedef input_iterator<const char*> I;
|
||||||
long double ex;
|
long double ex;
|
||||||
@@ -325,10 +325,9 @@ int main()
|
|||||||
assert(iter.base() == v.data() + v.size());
|
assert(iter.base() == v.data() + v.size());
|
||||||
assert(err == std::ios_base::eofbit);
|
assert(err == std::ios_base::eofbit);
|
||||||
assert(ex == -1);
|
assert(ex == -1);
|
||||||
noshowbase(ios);
|
|
||||||
}
|
}
|
||||||
{ // positive, showbase
|
{ // positive, showbase
|
||||||
std::string v = "1 234 567,89 EUR ";
|
std::string v = "1 234 567,89 EUR";
|
||||||
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;
|
||||||
@@ -339,7 +338,7 @@ int main()
|
|||||||
assert(ex == 123456789);
|
assert(ex == 123456789);
|
||||||
}
|
}
|
||||||
{ // positive, showbase
|
{ // positive, showbase
|
||||||
std::string v = "1 234 567,89 EUR ";
|
std::string v = "1 234 567,89 EUR";
|
||||||
showbase(ios);
|
showbase(ios);
|
||||||
typedef input_iterator<const char*> I;
|
typedef input_iterator<const char*> I;
|
||||||
long double ex;
|
long double ex;
|
||||||
@@ -352,7 +351,7 @@ int main()
|
|||||||
noshowbase(ios);
|
noshowbase(ios);
|
||||||
}
|
}
|
||||||
{ // negative, showbase
|
{ // negative, showbase
|
||||||
std::string v = "1 234 567,89 EUR -";
|
std::string v = "-1 234 567,89 EUR";
|
||||||
showbase(ios);
|
showbase(ios);
|
||||||
typedef input_iterator<const char*> I;
|
typedef input_iterator<const char*> I;
|
||||||
long double ex;
|
long double ex;
|
||||||
@@ -383,7 +382,7 @@ int main()
|
|||||||
std::ios_base::iostate err = std::ios_base::goodbit;
|
std::ios_base::iostate err = std::ios_base::goodbit;
|
||||||
I iter = f.get(I(v.data()), I(v.data() + v.size()),
|
I iter = f.get(I(v.data()), I(v.data() + v.size()),
|
||||||
true, ios, err, ex);
|
true, ios, err, ex);
|
||||||
assert(iter.base() == v.data() + 14);
|
assert(iter.base() == v.data() + 13);
|
||||||
assert(err == std::ios_base::goodbit);
|
assert(err == std::ios_base::goodbit);
|
||||||
assert(ex == 123456789);
|
assert(ex == 123456789);
|
||||||
}
|
}
|
||||||
@@ -403,7 +402,7 @@ int main()
|
|||||||
assert(ex == 0);
|
assert(ex == 0);
|
||||||
}
|
}
|
||||||
{ // negative one
|
{ // negative one
|
||||||
std::wstring v = L"0,01 -";
|
std::wstring v = L"-0,01";
|
||||||
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;
|
||||||
@@ -425,7 +424,7 @@ int main()
|
|||||||
assert(ex == 123456789);
|
assert(ex == 123456789);
|
||||||
}
|
}
|
||||||
{ // negative
|
{ // negative
|
||||||
std::wstring v = L"1 234 567,89 -";
|
std::wstring v = L"-1 234 567,89";
|
||||||
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;
|
||||||
@@ -436,7 +435,7 @@ int main()
|
|||||||
assert(ex == -123456789);
|
assert(ex == -123456789);
|
||||||
}
|
}
|
||||||
{ // negative
|
{ // negative
|
||||||
std::wstring v = L"1234567,89 -";
|
std::wstring v = L"-1234567,89";
|
||||||
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;
|
||||||
@@ -447,7 +446,8 @@ int main()
|
|||||||
assert(ex == -123456789);
|
assert(ex == -123456789);
|
||||||
}
|
}
|
||||||
{ // zero, showbase
|
{ // zero, showbase
|
||||||
std::wstring v = L"0,00 Eu";
|
std::wstring v = L"0,00 \u20ac";
|
||||||
|
showbase(ios);
|
||||||
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;
|
||||||
@@ -458,7 +458,7 @@ int main()
|
|||||||
assert(ex == 0);
|
assert(ex == 0);
|
||||||
}
|
}
|
||||||
{ // zero, showbase
|
{ // zero, showbase
|
||||||
std::wstring v = L"0,00 Eu";
|
std::wstring v = L"0,00 \u20ac";
|
||||||
showbase(ios);
|
showbase(ios);
|
||||||
typedef input_iterator<const wchar_t*> I;
|
typedef input_iterator<const wchar_t*> I;
|
||||||
long double ex;
|
long double ex;
|
||||||
@@ -468,10 +468,9 @@ int main()
|
|||||||
assert(iter.base() == v.data() + v.size());
|
assert(iter.base() == v.data() + v.size());
|
||||||
assert(err == std::ios_base::eofbit);
|
assert(err == std::ios_base::eofbit);
|
||||||
assert(ex == 0);
|
assert(ex == 0);
|
||||||
noshowbase(ios);
|
|
||||||
}
|
}
|
||||||
{ // negative one, showbase
|
{ // negative one, showbase
|
||||||
std::wstring v = L"0,01 Eu-";
|
std::wstring v = L"-0,01 \u20ac";
|
||||||
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;
|
||||||
@@ -482,7 +481,7 @@ int main()
|
|||||||
assert(ex == -1);
|
assert(ex == -1);
|
||||||
}
|
}
|
||||||
{ // negative one, showbase
|
{ // negative one, showbase
|
||||||
std::wstring v = L"0,01 Eu-";
|
std::wstring v = L"-0,01 \u20ac";
|
||||||
showbase(ios);
|
showbase(ios);
|
||||||
typedef input_iterator<const wchar_t*> I;
|
typedef input_iterator<const wchar_t*> I;
|
||||||
long double ex;
|
long double ex;
|
||||||
@@ -492,10 +491,9 @@ int main()
|
|||||||
assert(iter.base() == v.data() + v.size());
|
assert(iter.base() == v.data() + v.size());
|
||||||
assert(err == std::ios_base::eofbit);
|
assert(err == std::ios_base::eofbit);
|
||||||
assert(ex == -1);
|
assert(ex == -1);
|
||||||
noshowbase(ios);
|
|
||||||
}
|
}
|
||||||
{ // positive, showbase
|
{ // positive, showbase
|
||||||
std::wstring v = L"1 234 567,89 Eu";
|
std::wstring v = L"1 234 567,89 \u20ac";
|
||||||
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;
|
||||||
@@ -506,7 +504,7 @@ int main()
|
|||||||
assert(ex == 123456789);
|
assert(ex == 123456789);
|
||||||
}
|
}
|
||||||
{ // positive, showbase
|
{ // positive, showbase
|
||||||
std::wstring v = L"1 234 567,89 Eu";
|
std::wstring v = L"1 234 567,89 \u20ac";
|
||||||
showbase(ios);
|
showbase(ios);
|
||||||
typedef input_iterator<const wchar_t*> I;
|
typedef input_iterator<const wchar_t*> I;
|
||||||
long double ex;
|
long double ex;
|
||||||
@@ -519,7 +517,7 @@ int main()
|
|||||||
noshowbase(ios);
|
noshowbase(ios);
|
||||||
}
|
}
|
||||||
{ // negative, showbase
|
{ // negative, showbase
|
||||||
std::wstring v = L"1 234 567,89 Eu-";
|
std::wstring v = L"-1 234 567,89 \u20ac";
|
||||||
showbase(ios);
|
showbase(ios);
|
||||||
typedef input_iterator<const wchar_t*> I;
|
typedef input_iterator<const wchar_t*> I;
|
||||||
long double ex;
|
long double ex;
|
||||||
@@ -539,7 +537,7 @@ int main()
|
|||||||
std::ios_base::iostate err = std::ios_base::goodbit;
|
std::ios_base::iostate err = std::ios_base::goodbit;
|
||||||
I iter = f.get(I(v.data()), I(v.data() + v.size()),
|
I iter = f.get(I(v.data()), I(v.data() + v.size()),
|
||||||
false, ios, err, ex);
|
false, ios, err, ex);
|
||||||
assert(iter.base() == v.data() + 14);
|
assert(iter.base() == v.data() + 13);
|
||||||
assert(err == std::ios_base::failbit);
|
assert(err == std::ios_base::failbit);
|
||||||
noshowbase(ios);
|
noshowbase(ios);
|
||||||
}
|
}
|
||||||
@@ -550,7 +548,7 @@ int main()
|
|||||||
std::ios_base::iostate err = std::ios_base::goodbit;
|
std::ios_base::iostate err = std::ios_base::goodbit;
|
||||||
I iter = f.get(I(v.data()), I(v.data() + v.size()),
|
I iter = f.get(I(v.data()), I(v.data() + v.size()),
|
||||||
false, ios, err, ex);
|
false, ios, err, ex);
|
||||||
assert(iter.base() == v.data() + 14);
|
assert(iter.base() == v.data() + 13);
|
||||||
assert(err == std::ios_base::goodbit);
|
assert(err == std::ios_base::goodbit);
|
||||||
assert(ex == 123456789);
|
assert(ex == 123456789);
|
||||||
}
|
}
|
||||||
@@ -570,7 +568,7 @@ int main()
|
|||||||
assert(ex == 0);
|
assert(ex == 0);
|
||||||
}
|
}
|
||||||
{ // negative one
|
{ // negative one
|
||||||
std::wstring v = L"0,01 -";
|
std::wstring v = L"-0,01";
|
||||||
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;
|
||||||
@@ -592,7 +590,7 @@ int main()
|
|||||||
assert(ex == 123456789);
|
assert(ex == 123456789);
|
||||||
}
|
}
|
||||||
{ // negative
|
{ // negative
|
||||||
std::wstring v = L"1 234 567,89 -";
|
std::wstring v = L"-1 234 567,89";
|
||||||
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;
|
||||||
@@ -603,7 +601,7 @@ int main()
|
|||||||
assert(ex == -123456789);
|
assert(ex == -123456789);
|
||||||
}
|
}
|
||||||
{ // negative
|
{ // negative
|
||||||
std::wstring v = L"1234567,89 -";
|
std::wstring v = L"-1234567,89";
|
||||||
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;
|
||||||
@@ -614,7 +612,8 @@ int main()
|
|||||||
assert(ex == -123456789);
|
assert(ex == -123456789);
|
||||||
}
|
}
|
||||||
{ // zero, showbase
|
{ // zero, showbase
|
||||||
std::wstring v = L"0,00 EUR ";
|
std::wstring v = L"0,00 EUR";
|
||||||
|
showbase(ios);
|
||||||
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;
|
||||||
@@ -625,7 +624,7 @@ int main()
|
|||||||
assert(ex == 0);
|
assert(ex == 0);
|
||||||
}
|
}
|
||||||
{ // zero, showbase
|
{ // zero, showbase
|
||||||
std::wstring v = L"0,00 EUR ";
|
std::wstring v = L"0,00 EUR";
|
||||||
showbase(ios);
|
showbase(ios);
|
||||||
typedef input_iterator<const wchar_t*> I;
|
typedef input_iterator<const wchar_t*> I;
|
||||||
long double ex;
|
long double ex;
|
||||||
@@ -635,10 +634,9 @@ int main()
|
|||||||
assert(iter.base() == v.data() + v.size());
|
assert(iter.base() == v.data() + v.size());
|
||||||
assert(err == std::ios_base::eofbit);
|
assert(err == std::ios_base::eofbit);
|
||||||
assert(ex == 0);
|
assert(ex == 0);
|
||||||
noshowbase(ios);
|
|
||||||
}
|
}
|
||||||
{ // negative one, showbase
|
{ // negative one, showbase
|
||||||
std::wstring v = L"0,01 EUR -";
|
std::wstring v = L"-0,01 EUR";
|
||||||
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;
|
||||||
@@ -649,7 +647,7 @@ int main()
|
|||||||
assert(ex == -1);
|
assert(ex == -1);
|
||||||
}
|
}
|
||||||
{ // negative one, showbase
|
{ // negative one, showbase
|
||||||
std::wstring v = L"0,01 EUR -";
|
std::wstring v = L"-0,01 EUR";
|
||||||
showbase(ios);
|
showbase(ios);
|
||||||
typedef input_iterator<const wchar_t*> I;
|
typedef input_iterator<const wchar_t*> I;
|
||||||
long double ex;
|
long double ex;
|
||||||
@@ -659,10 +657,9 @@ int main()
|
|||||||
assert(iter.base() == v.data() + v.size());
|
assert(iter.base() == v.data() + v.size());
|
||||||
assert(err == std::ios_base::eofbit);
|
assert(err == std::ios_base::eofbit);
|
||||||
assert(ex == -1);
|
assert(ex == -1);
|
||||||
noshowbase(ios);
|
|
||||||
}
|
}
|
||||||
{ // positive, showbase
|
{ // positive, showbase
|
||||||
std::wstring v = L"1 234 567,89 EUR ";
|
std::wstring v = L"1 234 567,89 EUR";
|
||||||
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;
|
||||||
@@ -673,7 +670,7 @@ int main()
|
|||||||
assert(ex == 123456789);
|
assert(ex == 123456789);
|
||||||
}
|
}
|
||||||
{ // positive, showbase
|
{ // positive, showbase
|
||||||
std::wstring v = L"1 234 567,89 EUR ";
|
std::wstring v = L"1 234 567,89 EUR";
|
||||||
showbase(ios);
|
showbase(ios);
|
||||||
typedef input_iterator<const wchar_t*> I;
|
typedef input_iterator<const wchar_t*> I;
|
||||||
long double ex;
|
long double ex;
|
||||||
@@ -686,7 +683,7 @@ int main()
|
|||||||
noshowbase(ios);
|
noshowbase(ios);
|
||||||
}
|
}
|
||||||
{ // negative, showbase
|
{ // negative, showbase
|
||||||
std::wstring v = L"1 234 567,89 EUR -";
|
std::wstring v = L"-1 234 567,89 EUR";
|
||||||
showbase(ios);
|
showbase(ios);
|
||||||
typedef input_iterator<const wchar_t*> I;
|
typedef input_iterator<const wchar_t*> I;
|
||||||
long double ex;
|
long double ex;
|
||||||
@@ -717,7 +714,7 @@ int main()
|
|||||||
std::ios_base::iostate err = std::ios_base::goodbit;
|
std::ios_base::iostate err = std::ios_base::goodbit;
|
||||||
I iter = f.get(I(v.data()), I(v.data() + v.size()),
|
I iter = f.get(I(v.data()), I(v.data() + v.size()),
|
||||||
true, ios, err, ex);
|
true, ios, err, ex);
|
||||||
assert(iter.base() == v.data() + 14);
|
assert(iter.base() == v.data() + 13);
|
||||||
assert(err == std::ios_base::goodbit);
|
assert(err == std::ios_base::goodbit);
|
||||||
assert(ex == 123456789);
|
assert(ex == 123456789);
|
||||||
}
|
}
|
||||||
|
@@ -63,7 +63,7 @@ int main()
|
|||||||
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
||||||
false, ios, '*', v);
|
false, ios, '*', v);
|
||||||
std::string ex(str, iter.base());
|
std::string ex(str, iter.base());
|
||||||
assert(ex == "0,00 ");
|
assert(ex == "0,00");
|
||||||
}
|
}
|
||||||
{ // negative one
|
{ // negative one
|
||||||
long double v = -1;
|
long double v = -1;
|
||||||
@@ -71,7 +71,7 @@ int main()
|
|||||||
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
||||||
false, ios, '*', v);
|
false, ios, '*', v);
|
||||||
std::string ex(str, iter.base());
|
std::string ex(str, iter.base());
|
||||||
assert(ex == "0,01 -");
|
assert(ex == "-0,01");
|
||||||
}
|
}
|
||||||
{ // positive
|
{ // positive
|
||||||
long double v = 123456789;
|
long double v = 123456789;
|
||||||
@@ -79,7 +79,7 @@ int main()
|
|||||||
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
||||||
false, ios, '*', v);
|
false, ios, '*', v);
|
||||||
std::string ex(str, iter.base());
|
std::string ex(str, iter.base());
|
||||||
assert(ex == "1 234 567,89 ");
|
assert(ex == "1 234 567,89");
|
||||||
}
|
}
|
||||||
{ // negative
|
{ // negative
|
||||||
long double v = -123456789;
|
long double v = -123456789;
|
||||||
@@ -87,7 +87,7 @@ int main()
|
|||||||
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
||||||
false, ios, '*', v);
|
false, ios, '*', v);
|
||||||
std::string ex(str, iter.base());
|
std::string ex(str, iter.base());
|
||||||
assert(ex == "1 234 567,89 -");
|
assert(ex == "-1 234 567,89");
|
||||||
}
|
}
|
||||||
{ // zero, showbase
|
{ // zero, showbase
|
||||||
long double v = 0;
|
long double v = 0;
|
||||||
@@ -96,7 +96,7 @@ int main()
|
|||||||
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
||||||
false, ios, '*', v);
|
false, ios, '*', v);
|
||||||
std::string ex(str, iter.base());
|
std::string ex(str, iter.base());
|
||||||
assert(ex == "0,00 Eu");
|
assert(ex == "0,00 \u20ac");
|
||||||
}
|
}
|
||||||
{ // negative one, showbase
|
{ // negative one, showbase
|
||||||
long double v = -1;
|
long double v = -1;
|
||||||
@@ -105,7 +105,7 @@ int main()
|
|||||||
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
||||||
false, ios, '*', v);
|
false, ios, '*', v);
|
||||||
std::string ex(str, iter.base());
|
std::string ex(str, iter.base());
|
||||||
assert(ex == "0,01 Eu-");
|
assert(ex == "-0,01 \u20ac");
|
||||||
}
|
}
|
||||||
{ // positive, showbase
|
{ // positive, showbase
|
||||||
long double v = 123456789;
|
long double v = 123456789;
|
||||||
@@ -114,7 +114,7 @@ int main()
|
|||||||
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
||||||
false, ios, '*', v);
|
false, ios, '*', v);
|
||||||
std::string ex(str, iter.base());
|
std::string ex(str, iter.base());
|
||||||
assert(ex == "1 234 567,89 Eu");
|
assert(ex == "1 234 567,89 \u20ac");
|
||||||
}
|
}
|
||||||
{ // negative, showbase
|
{ // negative, showbase
|
||||||
long double v = -123456789;
|
long double v = -123456789;
|
||||||
@@ -123,7 +123,7 @@ int main()
|
|||||||
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
||||||
false, ios, '*', v);
|
false, ios, '*', v);
|
||||||
std::string ex(str, iter.base());
|
std::string ex(str, iter.base());
|
||||||
assert(ex == "1 234 567,89 Eu-");
|
assert(ex == "-1 234 567,89 \u20ac");
|
||||||
}
|
}
|
||||||
{ // negative, showbase, left
|
{ // negative, showbase, left
|
||||||
long double v = -123456789;
|
long double v = -123456789;
|
||||||
@@ -134,7 +134,7 @@ int main()
|
|||||||
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
||||||
false, ios, ' ', v);
|
false, ios, ' ', v);
|
||||||
std::string ex(str, iter.base());
|
std::string ex(str, iter.base());
|
||||||
assert(ex == "1 234 567,89 Eu- ");
|
assert(ex == "-1 234 567,89 \u20ac ");
|
||||||
assert(ios.width() == 0);
|
assert(ios.width() == 0);
|
||||||
}
|
}
|
||||||
{ // negative, showbase, internal
|
{ // negative, showbase, internal
|
||||||
@@ -146,7 +146,7 @@ int main()
|
|||||||
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
||||||
false, ios, ' ', v);
|
false, ios, ' ', v);
|
||||||
std::string ex(str, iter.base());
|
std::string ex(str, iter.base());
|
||||||
assert(ex == "1 234 567,89 Eu-");
|
assert(ex == "-1 234 567,89 \u20ac");
|
||||||
assert(ios.width() == 0);
|
assert(ios.width() == 0);
|
||||||
}
|
}
|
||||||
{ // negative, showbase, right
|
{ // negative, showbase, right
|
||||||
@@ -158,7 +158,7 @@ int main()
|
|||||||
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
|
||||||
false, ios, ' ', v);
|
false, ios, ' ', v);
|
||||||
std::string ex(str, iter.base());
|
std::string ex(str, iter.base());
|
||||||
assert(ex == " 1 234 567,89 Eu-");
|
assert(ex == " -1 234 567,89 \u20ac");
|
||||||
assert(ios.width() == 0);
|
assert(ios.width() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +171,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 ");
|
assert(ex == "0,00");
|
||||||
}
|
}
|
||||||
{ // negative one
|
{ // negative one
|
||||||
long double v = -1;
|
long double v = -1;
|
||||||
@@ -179,7 +179,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 -");
|
assert(ex == "-0,01");
|
||||||
}
|
}
|
||||||
{ // positive
|
{ // positive
|
||||||
long double v = 123456789;
|
long double v = 123456789;
|
||||||
@@ -187,7 +187,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 ");
|
assert(ex == "1 234 567,89");
|
||||||
}
|
}
|
||||||
{ // negative
|
{ // negative
|
||||||
long double v = -123456789;
|
long double v = -123456789;
|
||||||
@@ -195,7 +195,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 -");
|
assert(ex == "-1 234 567,89");
|
||||||
}
|
}
|
||||||
{ // zero, showbase
|
{ // zero, showbase
|
||||||
long double v = 0;
|
long double v = 0;
|
||||||
@@ -204,7 +204,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 EUR ");
|
assert(ex == "0,00 EUR");
|
||||||
}
|
}
|
||||||
{ // negative one, showbase
|
{ // negative one, showbase
|
||||||
long double v = -1;
|
long double v = -1;
|
||||||
@@ -213,7 +213,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 EUR -");
|
assert(ex == "-0,01 EUR");
|
||||||
}
|
}
|
||||||
{ // positive, showbase
|
{ // positive, showbase
|
||||||
long double v = 123456789;
|
long double v = 123456789;
|
||||||
@@ -222,7 +222,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 EUR ");
|
assert(ex == "1 234 567,89 EUR");
|
||||||
}
|
}
|
||||||
{ // negative, showbase
|
{ // negative, showbase
|
||||||
long double v = -123456789;
|
long double v = -123456789;
|
||||||
@@ -231,7 +231,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 EUR -");
|
assert(ex == "-1 234 567,89 EUR");
|
||||||
}
|
}
|
||||||
{ // negative, showbase, left
|
{ // negative, showbase, left
|
||||||
long double v = -123456789;
|
long double v = -123456789;
|
||||||
@@ -242,7 +242,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 EUR - ");
|
assert(ex == "-1 234 567,89 EUR ");
|
||||||
assert(ios.width() == 0);
|
assert(ios.width() == 0);
|
||||||
}
|
}
|
||||||
{ // negative, showbase, internal
|
{ // negative, showbase, internal
|
||||||
@@ -254,7 +254,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 EUR -");
|
assert(ex == "-1 234 567,89 EUR");
|
||||||
assert(ios.width() == 0);
|
assert(ios.width() == 0);
|
||||||
}
|
}
|
||||||
{ // negative, showbase, right
|
{ // negative, showbase, right
|
||||||
@@ -266,7 +266,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 EUR -");
|
assert(ex == " -1 234 567,89 EUR");
|
||||||
assert(ios.width() == 0);
|
assert(ios.width() == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -281,7 +281,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),
|
||||||
false, ios, '*', v);
|
false, ios, '*', v);
|
||||||
std::wstring ex(str, iter.base());
|
std::wstring ex(str, iter.base());
|
||||||
assert(ex == L"0,00 ");
|
assert(ex == L"0,00");
|
||||||
}
|
}
|
||||||
{ // negative one
|
{ // negative one
|
||||||
long double v = -1;
|
long double v = -1;
|
||||||
@@ -289,7 +289,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),
|
||||||
false, ios, '*', v);
|
false, ios, '*', v);
|
||||||
std::wstring ex(str, iter.base());
|
std::wstring ex(str, iter.base());
|
||||||
assert(ex == L"0,01 -");
|
assert(ex == L"-0,01");
|
||||||
}
|
}
|
||||||
{ // positive
|
{ // positive
|
||||||
long double v = 123456789;
|
long double v = 123456789;
|
||||||
@@ -297,7 +297,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),
|
||||||
false, ios, '*', v);
|
false, ios, '*', v);
|
||||||
std::wstring ex(str, iter.base());
|
std::wstring ex(str, iter.base());
|
||||||
assert(ex == L"1 234 567,89 ");
|
assert(ex == L"1 234 567,89");
|
||||||
}
|
}
|
||||||
{ // negative
|
{ // negative
|
||||||
long double v = -123456789;
|
long double v = -123456789;
|
||||||
@@ -305,7 +305,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),
|
||||||
false, ios, '*', v);
|
false, ios, '*', v);
|
||||||
std::wstring ex(str, iter.base());
|
std::wstring ex(str, iter.base());
|
||||||
assert(ex == L"1 234 567,89 -");
|
assert(ex == L"-1 234 567,89");
|
||||||
}
|
}
|
||||||
{ // zero, showbase
|
{ // zero, showbase
|
||||||
long double v = 0;
|
long double v = 0;
|
||||||
@@ -314,7 +314,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),
|
||||||
false, ios, '*', v);
|
false, ios, '*', v);
|
||||||
std::wstring ex(str, iter.base());
|
std::wstring ex(str, iter.base());
|
||||||
assert(ex == L"0,00 Eu");
|
assert(ex == L"0,00 \u20ac");
|
||||||
}
|
}
|
||||||
{ // negative one, showbase
|
{ // negative one, showbase
|
||||||
long double v = -1;
|
long double v = -1;
|
||||||
@@ -323,7 +323,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),
|
||||||
false, ios, '*', v);
|
false, ios, '*', v);
|
||||||
std::wstring ex(str, iter.base());
|
std::wstring ex(str, iter.base());
|
||||||
assert(ex == L"0,01 Eu-");
|
assert(ex == L"-0,01 \u20ac");
|
||||||
}
|
}
|
||||||
{ // positive, showbase
|
{ // positive, showbase
|
||||||
long double v = 123456789;
|
long double v = 123456789;
|
||||||
@@ -332,7 +332,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),
|
||||||
false, ios, '*', v);
|
false, ios, '*', v);
|
||||||
std::wstring ex(str, iter.base());
|
std::wstring ex(str, iter.base());
|
||||||
assert(ex == L"1 234 567,89 Eu");
|
assert(ex == L"1 234 567,89 \u20ac");
|
||||||
}
|
}
|
||||||
{ // negative, showbase
|
{ // negative, showbase
|
||||||
long double v = -123456789;
|
long double v = -123456789;
|
||||||
@@ -341,7 +341,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),
|
||||||
false, ios, '*', v);
|
false, ios, '*', v);
|
||||||
std::wstring ex(str, iter.base());
|
std::wstring ex(str, iter.base());
|
||||||
assert(ex == L"1 234 567,89 Eu-");
|
assert(ex == L"-1 234 567,89 \u20ac");
|
||||||
}
|
}
|
||||||
{ // negative, showbase, left
|
{ // negative, showbase, left
|
||||||
long double v = -123456789;
|
long double v = -123456789;
|
||||||
@@ -352,7 +352,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),
|
||||||
false, ios, ' ', v);
|
false, ios, ' ', v);
|
||||||
std::wstring ex(str, iter.base());
|
std::wstring ex(str, iter.base());
|
||||||
assert(ex == L"1 234 567,89 Eu- ");
|
assert(ex == L"-1 234 567,89 \u20ac ");
|
||||||
assert(ios.width() == 0);
|
assert(ios.width() == 0);
|
||||||
}
|
}
|
||||||
{ // negative, showbase, internal
|
{ // negative, showbase, internal
|
||||||
@@ -364,7 +364,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),
|
||||||
false, ios, ' ', v);
|
false, ios, ' ', v);
|
||||||
std::wstring ex(str, iter.base());
|
std::wstring ex(str, iter.base());
|
||||||
assert(ex == L"1 234 567,89 Eu-");
|
assert(ex == L"-1 234 567,89 \u20ac");
|
||||||
assert(ios.width() == 0);
|
assert(ios.width() == 0);
|
||||||
}
|
}
|
||||||
{ // negative, showbase, right
|
{ // negative, showbase, right
|
||||||
@@ -376,7 +376,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),
|
||||||
false, ios, ' ', v);
|
false, ios, ' ', v);
|
||||||
std::wstring ex(str, iter.base());
|
std::wstring ex(str, iter.base());
|
||||||
assert(ex == L" 1 234 567,89 Eu-");
|
assert(ex == L" -1 234 567,89 \u20ac");
|
||||||
assert(ios.width() == 0);
|
assert(ios.width() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,7 +389,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 ");
|
assert(ex == L"0,00");
|
||||||
}
|
}
|
||||||
{ // negative one
|
{ // negative one
|
||||||
long double v = -1;
|
long double v = -1;
|
||||||
@@ -397,7 +397,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 -");
|
assert(ex == L"-0,01");
|
||||||
}
|
}
|
||||||
{ // positive
|
{ // positive
|
||||||
long double v = 123456789;
|
long double v = 123456789;
|
||||||
@@ -405,7 +405,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 ");
|
assert(ex == L"1 234 567,89");
|
||||||
}
|
}
|
||||||
{ // negative
|
{ // negative
|
||||||
long double v = -123456789;
|
long double v = -123456789;
|
||||||
@@ -413,7 +413,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 -");
|
assert(ex == L"-1 234 567,89");
|
||||||
}
|
}
|
||||||
{ // zero, showbase
|
{ // zero, showbase
|
||||||
long double v = 0;
|
long double v = 0;
|
||||||
@@ -422,7 +422,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 EUR ");
|
assert(ex == L"0,00 EUR");
|
||||||
}
|
}
|
||||||
{ // negative one, showbase
|
{ // negative one, showbase
|
||||||
long double v = -1;
|
long double v = -1;
|
||||||
@@ -431,7 +431,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 EUR -");
|
assert(ex == L"-0,01 EUR");
|
||||||
}
|
}
|
||||||
{ // positive, showbase
|
{ // positive, showbase
|
||||||
long double v = 123456789;
|
long double v = 123456789;
|
||||||
@@ -440,7 +440,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 EUR ");
|
assert(ex == L"1 234 567,89 EUR");
|
||||||
}
|
}
|
||||||
{ // negative, showbase
|
{ // negative, showbase
|
||||||
long double v = -123456789;
|
long double v = -123456789;
|
||||||
@@ -449,7 +449,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 EUR -");
|
assert(ex == L"-1 234 567,89 EUR");
|
||||||
}
|
}
|
||||||
{ // negative, showbase, left
|
{ // negative, showbase, left
|
||||||
long double v = -123456789;
|
long double v = -123456789;
|
||||||
@@ -460,7 +460,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 EUR - ");
|
assert(ex == L"-1 234 567,89 EUR ");
|
||||||
assert(ios.width() == 0);
|
assert(ios.width() == 0);
|
||||||
}
|
}
|
||||||
{ // negative, showbase, internal
|
{ // negative, showbase, internal
|
||||||
@@ -472,7 +472,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 EUR -");
|
assert(ex == L"-1 234 567,89 EUR");
|
||||||
assert(ios.width() == 0);
|
assert(ios.width() == 0);
|
||||||
}
|
}
|
||||||
{ // negative, showbase, right
|
{ // negative, showbase, right
|
||||||
@@ -484,7 +484,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 EUR -");
|
assert(ex == L" -1 234 567,89 EUR");
|
||||||
assert(ios.width() == 0);
|
assert(ios.width() == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -89,36 +89,36 @@ int main()
|
|||||||
|
|
||||||
{
|
{
|
||||||
Fnf f(LOCALE_fr_FR_UTF_8, 1);
|
Fnf f(LOCALE_fr_FR_UTF_8, 1);
|
||||||
assert(f.curr_symbol() == "Eu");
|
assert(f.curr_symbol() == " \u20ac");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Fnt f(LOCALE_fr_FR_UTF_8, 1);
|
Fnt f(LOCALE_fr_FR_UTF_8, 1);
|
||||||
assert(f.curr_symbol() == "EUR ");
|
assert(f.curr_symbol() == " EUR");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Fwf f(LOCALE_fr_FR_UTF_8, 1);
|
Fwf f(LOCALE_fr_FR_UTF_8, 1);
|
||||||
assert(f.curr_symbol() == L"Eu");
|
assert(f.curr_symbol() == L" \u20ac");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Fwt f(LOCALE_fr_FR_UTF_8, 1);
|
Fwt f(LOCALE_fr_FR_UTF_8, 1);
|
||||||
assert(f.curr_symbol() == L"EUR ");
|
assert(f.curr_symbol() == L" EUR");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Fnf f(LOCALE_ru_RU_UTF_8, 1);
|
Fnf f(LOCALE_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(LOCALE_ru_RU_UTF_8, 1);
|
Fnt f(LOCALE_ru_RU_UTF_8, 1);
|
||||||
assert(f.curr_symbol() == "RUB ");
|
assert(f.curr_symbol() == " RUB");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Fwf f(LOCALE_ru_RU_UTF_8, 1);
|
Fwf f(LOCALE_ru_RU_UTF_8, 1);
|
||||||
assert(f.curr_symbol() == L"\x440\x443\x431"".");
|
assert(f.curr_symbol() == L" \x440\x443\x431");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Fwt f(LOCALE_ru_RU_UTF_8, 1);
|
Fwt f(LOCALE_ru_RU_UTF_8, 1);
|
||||||
assert(f.curr_symbol() == L"RUB ");
|
assert(f.curr_symbol() == L" RUB");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@@ -92,19 +92,19 @@ int main()
|
|||||||
|
|
||||||
{
|
{
|
||||||
Fnf f(LOCALE_fr_FR_UTF_8, 1);
|
Fnf f(LOCALE_fr_FR_UTF_8, 1);
|
||||||
assert(f.grouping() == "\3\3");
|
assert(f.grouping() == "\3");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Fnt f(LOCALE_fr_FR_UTF_8, 1);
|
Fnt f(LOCALE_fr_FR_UTF_8, 1);
|
||||||
assert(f.grouping() == "\3\3");
|
assert(f.grouping() == "\3");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Fwf f(LOCALE_fr_FR_UTF_8, 1);
|
Fwf f(LOCALE_fr_FR_UTF_8, 1);
|
||||||
assert(f.grouping() == "\3\3");
|
assert(f.grouping() == "\3");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Fwt f(LOCALE_fr_FR_UTF_8, 1);
|
Fwt f(LOCALE_fr_FR_UTF_8, 1);
|
||||||
assert(f.grouping() == "\3\3");
|
assert(f.grouping() == "\3");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -126,18 +126,18 @@ int main()
|
|||||||
|
|
||||||
{
|
{
|
||||||
Fnf f(LOCALE_zh_CN_UTF_8, 1);
|
Fnf f(LOCALE_zh_CN_UTF_8, 1);
|
||||||
assert(f.grouping() == "\3\3");
|
assert(f.grouping() == "\3");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Fnt f(LOCALE_zh_CN_UTF_8, 1);
|
Fnt f(LOCALE_zh_CN_UTF_8, 1);
|
||||||
assert(f.grouping() == "\3\3");
|
assert(f.grouping() == "\3");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Fwf f(LOCALE_zh_CN_UTF_8, 1);
|
Fwf f(LOCALE_zh_CN_UTF_8, 1);
|
||||||
assert(f.grouping() == "\3\3");
|
assert(f.grouping() == "\3");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Fwt f(LOCALE_zh_CN_UTF_8, 1);
|
Fwt f(LOCALE_zh_CN_UTF_8, 1);
|
||||||
assert(f.grouping() == "\3\3");
|
assert(f.grouping() == "\3");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -122,34 +122,34 @@ int main()
|
|||||||
{
|
{
|
||||||
Fnf f(LOCALE_fr_FR_UTF_8, 1);
|
Fnf f(LOCALE_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::sign);
|
||||||
assert(p.field[1] == std::money_base::space);
|
assert(p.field[1] == std::money_base::value);
|
||||||
assert(p.field[2] == std::money_base::symbol);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::sign);
|
assert(p.field[3] == std::money_base::symbol);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Fnt f(LOCALE_fr_FR_UTF_8, 1);
|
Fnt f(LOCALE_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::sign);
|
||||||
assert(p.field[1] == std::money_base::space);
|
assert(p.field[1] == std::money_base::value);
|
||||||
assert(p.field[2] == std::money_base::symbol);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::sign);
|
assert(p.field[3] == std::money_base::symbol);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Fwf f(LOCALE_fr_FR_UTF_8, 1);
|
Fwf f(LOCALE_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::sign);
|
||||||
assert(p.field[1] == std::money_base::space);
|
assert(p.field[1] == std::money_base::value);
|
||||||
assert(p.field[2] == std::money_base::symbol);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::sign);
|
assert(p.field[3] == std::money_base::symbol);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Fwt f(LOCALE_fr_FR_UTF_8, 1);
|
Fwt f(LOCALE_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::sign);
|
||||||
assert(p.field[1] == std::money_base::space);
|
assert(p.field[1] == std::money_base::value);
|
||||||
assert(p.field[2] == std::money_base::symbol);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::sign);
|
assert(p.field[3] == std::money_base::symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -157,7 +157,7 @@ int main()
|
|||||||
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);
|
||||||
assert(p.field[2] == std::money_base::space);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::symbol);
|
assert(p.field[3] == std::money_base::symbol);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@@ -165,7 +165,7 @@ int main()
|
|||||||
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);
|
||||||
assert(p.field[2] == std::money_base::space);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::symbol);
|
assert(p.field[3] == std::money_base::symbol);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@@ -173,7 +173,7 @@ int main()
|
|||||||
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);
|
||||||
assert(p.field[2] == std::money_base::space);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::symbol);
|
assert(p.field[3] == std::money_base::symbol);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@@ -181,7 +181,7 @@ int main()
|
|||||||
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);
|
||||||
assert(p.field[2] == std::money_base::space);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::symbol);
|
assert(p.field[3] == std::money_base::symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,8 +196,8 @@ int main()
|
|||||||
{
|
{
|
||||||
Fnt f(LOCALE_zh_CN_UTF_8, 1);
|
Fnt f(LOCALE_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::sign);
|
||||||
assert(p.field[1] == std::money_base::sign);
|
assert(p.field[1] == std::money_base::symbol);
|
||||||
assert(p.field[2] == std::money_base::none);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::value);
|
assert(p.field[3] == std::money_base::value);
|
||||||
}
|
}
|
||||||
@@ -212,8 +212,8 @@ int main()
|
|||||||
{
|
{
|
||||||
Fwt f(LOCALE_zh_CN_UTF_8, 1);
|
Fwt f(LOCALE_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::sign);
|
||||||
assert(p.field[1] == std::money_base::sign);
|
assert(p.field[1] == std::money_base::symbol);
|
||||||
assert(p.field[2] == std::money_base::none);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::value);
|
assert(p.field[3] == std::money_base::value);
|
||||||
}
|
}
|
||||||
|
@@ -124,7 +124,7 @@ int main()
|
|||||||
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);
|
||||||
assert(p.field[2] == std::money_base::space);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::symbol);
|
assert(p.field[3] == std::money_base::symbol);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@@ -132,7 +132,7 @@ int main()
|
|||||||
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);
|
||||||
assert(p.field[2] == std::money_base::space);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::symbol);
|
assert(p.field[3] == std::money_base::symbol);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@@ -140,7 +140,7 @@ int main()
|
|||||||
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);
|
||||||
assert(p.field[2] == std::money_base::space);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::symbol);
|
assert(p.field[3] == std::money_base::symbol);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@@ -148,7 +148,7 @@ int main()
|
|||||||
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);
|
||||||
assert(p.field[2] == std::money_base::space);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::symbol);
|
assert(p.field[3] == std::money_base::symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ int main()
|
|||||||
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);
|
||||||
assert(p.field[2] == std::money_base::space);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::symbol);
|
assert(p.field[3] == std::money_base::symbol);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@@ -165,7 +165,7 @@ int main()
|
|||||||
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);
|
||||||
assert(p.field[2] == std::money_base::space);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::symbol);
|
assert(p.field[3] == std::money_base::symbol);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@@ -173,7 +173,7 @@ int main()
|
|||||||
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);
|
||||||
assert(p.field[2] == std::money_base::space);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::symbol);
|
assert(p.field[3] == std::money_base::symbol);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@@ -181,15 +181,15 @@ int main()
|
|||||||
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);
|
||||||
assert(p.field[2] == std::money_base::space);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::symbol);
|
assert(p.field[3] == std::money_base::symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Fnf f(LOCALE_zh_CN_UTF_8, 1);
|
Fnf f(LOCALE_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::symbol);
|
||||||
assert(p.field[1] == std::money_base::symbol);
|
assert(p.field[1] == std::money_base::sign);
|
||||||
assert(p.field[2] == std::money_base::none);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::value);
|
assert(p.field[3] == std::money_base::value);
|
||||||
}
|
}
|
||||||
@@ -204,8 +204,8 @@ int main()
|
|||||||
{
|
{
|
||||||
Fwf f(LOCALE_zh_CN_UTF_8, 1);
|
Fwf f(LOCALE_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::symbol);
|
||||||
assert(p.field[1] == std::money_base::symbol);
|
assert(p.field[1] == std::money_base::sign);
|
||||||
assert(p.field[2] == std::money_base::none);
|
assert(p.field[2] == std::money_base::none);
|
||||||
assert(p.field[3] == std::money_base::value);
|
assert(p.field[3] == std::money_base::value);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user