money_put_members_char.cc: Fix.

2002-02-20  Benjamin Kosnik  <bkoz@redhat.com>

	* testsuite/22_locale/money_put_members_char.cc: Fix.
	* testsuite/22_locale/money_put_members_wchar_t.cc: Fix.

	* testsuite/27_io/standard_manipulators.cc: New file.

	* testsuite/27_io/ios_manip_basefield.cc: Check results, now failing.
	* testsuite/27_io/ios_manip_fmtflags.cc: Use locale::classic().

From-SVN: r49910
This commit is contained in:
Benjamin Kosnik 2002-02-20 21:06:42 +00:00 committed by Benjamin Kosnik
parent 9fe2cc0556
commit 04fc13943f
6 changed files with 129 additions and 30 deletions

View File

@ -1,3 +1,13 @@
2002-02-20 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/22_locale/money_put_members_char.cc: Fix.
* testsuite/22_locale/money_put_members_wchar_t.cc: Fix.
* testsuite/27_io/standard_manipulators.cc: New file.
* testsuite/27_io/ios_manip_basefield.cc: Check results, now failing.
* testsuite/27_io/ios_manip_fmtflags.cc: Use locale::classic().
2002-02-20 Danny Smith <dannysmith@users.sourceforge.net>
* config/os/mingw32/bits/ctype_noninline.h

View File

@ -315,7 +315,7 @@ struct My_money_io : public std::moneypunct<char,false>
pattern do_neg_format() const
{
static pattern pat = { { symbol, space, sign, value } };
pattern pat = { { symbol, space, sign, value } };
return pat;
}
};

View File

@ -315,7 +315,7 @@ struct My_money_io : public std::moneypunct<wchar_t,false>
pattern do_neg_format() const
{
static pattern pat = { { symbol, space, sign, value } };
pattern pat = { { symbol, space, sign, value } };
return pat;
}
};

View File

@ -1,6 +1,6 @@
// 981027 ncm work with libstdc++v3
// Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
// Copyright (C) 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
//
// 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
@ -27,7 +27,6 @@
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#include <iostream>
#include <sstream>
#include <locale>
#include <iomanip>
@ -45,31 +44,36 @@ char MyNP::do_thousands_sep() const { return ' '; }
int
test01()
{
std::cout.imbue(std::locale(std::locale(), new MyNP));
std::cout << std::oct << std::showbase;
std::cout << -0123456l << std::endl;
bool test = true;
const char lit[] = "-0 123 456\n:-01 234 567:\n:-0 123 456 :"
"\n: -012 345:\n:- 01 234:\n0x000012 345 678";
std::ostringstream oss;
oss.imbue(std::locale(std::locale(), new MyNP));
oss << std::oct << std::showbase;
oss << -0123456l << std::endl;
std::cout << ":" << std::setw(11);
std::cout << -01234567l << ":" << std::endl;
oss << ":" << std::setw(11);
oss << -01234567l << ":" << std::endl;
std::cout << ":" << std::setw(11) << std::left;
std::cout << -0123456l << ":" << std::endl;
oss << ":" << std::setw(11) << std::left;
oss << -0123456l << ":" << std::endl;
std::cout << ":" << std::setw(11) << std::right;
std::cout << -012345l << ":" << std::endl;
oss << ":" << std::setw(11) << std::right;
oss << -012345l << ":" << std::endl;
std::cout << ":" << std::setw(11) << std::internal;
std::cout << -01234l << ":" << std::endl;
oss << ":" << std::setw(11) << std::internal;
oss << -01234l << ":" << std::endl;
oss << std::hex;
oss << std::setfill('0');
oss << std::internal;
oss << std::showbase;
oss << std::setw(16);
oss << 0x12345678l << std::endl;
VERIFY( oss.good() );
VERIFY( oss.str() == lit );
std::cout << std::hex;
std::cout << std::setfill('0');
std::cout << std::internal;
std::cout << std::showbase;
std::cout << std::setw(16);
std::cout << 0x12345678l << std::endl;
#ifdef DEBUG_ASSERT
assert (std::cout.good());
#endif
return 0;
}
@ -94,14 +98,13 @@ test02()
VERIFY( strbuf.str() == "cisco " );
strbuf.str(str_blank);
#ifdef DEBUG_ASSERT
assert (test);
#endif
VERIFY( test );
return 0;
}
int
main() {
main()
{
test01();
test02();
return 0;
@ -116,3 +119,4 @@ main() {
:- 01 234:
0x000012 345 678
*/

View File

@ -1,6 +1,7 @@
// 981027 ncm work with libstdc++v3
// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
// Free Software Foundation, Inc.
//
// 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
@ -69,7 +70,7 @@ test01()
oss << ":" << std::setw(3) << std::left << true << ":" << std::endl;
oss << ":" << std::setw(3) << std::right << false << ":" << std::endl;
std::locale loc = std::locale (std::locale(), new MyNP);
std::locale loc = std::locale (std::locale::classic(), new MyNP);
oss.imbue(loc);
oss << std::boolalpha;

View File

@ -0,0 +1,84 @@
// Copyright (C) 2002 Free Software Foundation, Inc.
//
// 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
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 27.6.3 - Standard manipulators
#include <sstream>
#include <iomanip>
#include <testsuite_hooks.h>
void
test01()
{
using namespace std;
bool test = true;
string s("john coltrane, a love supreme");
istringstream iss(s);
ostringstream oss;
// resetiosflags
resetiosflags(ios_base::boolalpha);
iss >> resetiosflags(ios_base::boolalpha);
VERIFY(iss.good());
oss << resetiosflags(ios_base::boolalpha);
VERIFY(oss.good());
// setiosflags
setiosflags(ios_base::skipws);
iss >> setiosflags(ios_base::skipws);
VERIFY(iss.good());
oss << setiosflags(ios_base::skipws);
VERIFY(oss.good());
// setbase
setbase(8);
iss >> setbase(8);
VERIFY(iss.good());
oss << setbase(8);
VERIFY(oss.good());
// setfil
setfill('a');
iss >> setfill('a');
VERIFY(iss.good());
oss << setfill('a');
VERIFY(oss.good());
// setprecision
setprecision(4);
iss >> setprecision(4);
VERIFY(iss.good());
oss << setprecision(4);
VERIFY(oss.good());
// setprecision
setw(7);
iss >> setw(7);
VERIFY(iss.good());
oss << setw(7);
VERIFY(oss.good());
}
int
main()
{
test01();
return 0;
}