Commit 0be27b59 by Paolo Carlini Committed by Paolo Carlini

1.cc: New.

2004-08-27  Paolo Carlini  <pcarlini@suse.de>

	* testsuite/27_io/manipulators/adjustfield/wchar_t/1.cc: New.
	* testsuite/27_io/manipulators/adjustfield/wchar_t/2.cc: Likewise.
	* testsuite/27_io/manipulators/basefield/wchar_t/1.cc: Likewise.
	* testsuite/27_io/manipulators/standard/wchar_t/1.cc: Likewise.
	* testsuite/27_io/manipulators/standard/wchar_t/2.cc: Likewise.

	* testsuite/27_io/manipulators/adjustfield/char/1.cc: Minor
	formatting fixes.
	* testsuite/27_io/manipulators/adjustfield/char/2.cc: Likewise.
	* testsuite/27_io/manipulators/basefield/char/1.cc: Likewise.
	* testsuite/27_io/manipulators/standard/char/1.cc: Likewise.
	* testsuite/27_io/manipulators/standard/char/2.cc: Likewise.

From-SVN: r86661
parent e041cc5a
2004-08-27 Paolo Carlini <pcarlini@suse.de>
* testsuite/27_io/manipulators/adjustfield/wchar_t/1.cc: New.
* testsuite/27_io/manipulators/adjustfield/wchar_t/2.cc: Likewise.
* testsuite/27_io/manipulators/basefield/wchar_t/1.cc: Likewise.
* testsuite/27_io/manipulators/standard/wchar_t/1.cc: Likewise.
* testsuite/27_io/manipulators/standard/wchar_t/2.cc: Likewise.
* testsuite/27_io/manipulators/adjustfield/char/1.cc: Minor
formatting fixes.
* testsuite/27_io/manipulators/adjustfield/char/2.cc: Likewise.
* testsuite/27_io/manipulators/basefield/char/1.cc: Likewise.
* testsuite/27_io/manipulators/standard/char/1.cc: Likewise.
* testsuite/27_io/manipulators/standard/char/2.cc: Likewise.
2004-08-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/17038 (partial)
......
......@@ -39,13 +39,15 @@ struct MyNP : std::numpunct<char>
std::string do_falsename() const;
};
std::string MyNP::do_truename() const
std::string
MyNP::do_truename() const
{
std::string s("yea");
return s;
}
std::string MyNP::do_falsename() const
std::string
MyNP::do_falsename() const
{
std::string s("nay");
return s;
......@@ -55,8 +57,19 @@ void
test01()
{
bool test __attribute__((unused)) = true;
const char lit[] = "1 0\ntrue false\n: true:\n:true :\n: false:\n: 1:"
"\n:1 :\n: 0:\nyea nay\n: yea:\n:yea :\n: nay:\n";
const char lit[] = "1 0\n"
"true false\n"
": true:\n"
":true :\n"
": false:\n"
": 1:\n"
":1 :\n"
": 0:\n"
"yea nay\n"
": yea:\n"
":yea :\n"
": nay:\n";
std::ostringstream oss;
oss << true << " " << false << std::endl;
oss << std::boolalpha;
......@@ -70,7 +83,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::classic(), new MyNP);
std::locale loc = std::locale(std::locale::classic(), new MyNP);
oss.imbue(loc);
oss << std::boolalpha;
......@@ -90,19 +103,3 @@ main()
test01();
return 0;
}
// Projected output:
/*
1 0
true false
: true:
:true :
: false:
: 1:
:1 :
: 0:
yea nay
: yea:
:yea :
: nay:
*/
// Copyright (C) 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
// Copyright (C) 1997, 1998, 1999, 2002, 2004
// 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
......@@ -34,19 +35,19 @@ void test02()
{
bool test __attribute__((unused)) = true;
const std::string str_blank;
std::string str_tmp;
std::string str_tmp;
std::stringbuf strbuf;
std::ostream o(&strbuf);
std::ostream o(&strbuf);
o << std::setw(6) << std::right << "san";
o << std::setw(6) << std::right << "san";
VERIFY( strbuf.str() == " san" );
strbuf.str(str_blank);
o << std::setw(6) << std::internal << "fran";
o << std::setw(6) << std::internal << "fran";
VERIFY( strbuf.str() == " fran" );
strbuf.str(str_blank);
o << std::setw(6) << std::left << "cisco";
o << std::setw(6) << std::left << "cisco";
VERIFY( strbuf.str() == "cisco " );
strbuf.str(str_blank);
}
......
// Copyright (C) 2004 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.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#include <sstream>
#include <locale>
#include <iomanip>
#include <testsuite_hooks.h>
struct MyNP : std::numpunct<wchar_t>
{
std::wstring do_truename() const;
std::wstring do_falsename() const;
};
std::wstring
MyNP::do_truename() const
{
std::wstring s(L"yea");
return s;
}
std::wstring
MyNP::do_falsename() const
{
std::wstring s(L"nay");
return s;
}
void
test01()
{
bool test __attribute__((unused)) = true;
const wchar_t lit[] = L"1 0\n"
L"true false\n"
L": true:\n"
L":true :\n"
L": false:\n"
L": 1:\n"
L":1 :\n"
L": 0:\n"
L"yea nay\n"
L": yea:\n"
L":yea :\n"
L": nay:\n";
std::wostringstream oss;
oss << true << L" " << false << std::endl;
oss << std::boolalpha;
oss << true << L" " << false << std::endl;
oss << L":" << std::setw(6) << std::internal << true << L":" << std::endl;
oss << L":" << std::setw(6) << std::left << true << L":" << std::endl;
oss << L":" << std::setw(6) << std::right << false << L":" << std::endl;
oss << std::noboolalpha;
oss << L":" << std::setw(3) << std::internal << true << L":" << std::endl;
oss << L":" << std::setw(3) << std::left << true << L":" << std::endl;
oss << L":" << std::setw(3) << std::right << false << L":" << std::endl;
std::locale loc = std::locale(std::locale::classic(), new MyNP);
oss.imbue(loc);
oss << std::boolalpha;
oss << true << L" " << false << std::endl;
oss << L":" << std::setw(6) << std::internal << true << L":" << std::endl;
oss << L":" << std::setw(6) << std::left << true << L":" << std::endl;
oss << L":" << std::setw(6) << std::right << false << L":" << std::endl;
VERIFY( oss.good() );
VERIFY( oss.str() == lit );
}
int
main()
{
test01();
return 0;
}
// Copyright (C) 2004 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.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#include <sstream>
#include <locale>
#include <iomanip>
#include <testsuite_hooks.h>
void test02()
{
bool test __attribute__((unused)) = true;
const std::wstring str_blank;
std::wstring str_tmp;
std::wstringbuf strbuf;
std::wostream o(&strbuf);
o << std::setw(6) << std::right << L"san";
VERIFY( strbuf.str() == L" san" );
strbuf.str(str_blank);
o << std::setw(6) << std::internal << L"fran";
VERIFY( strbuf.str() == L" fran" );
strbuf.str(str_blank);
o << std::setw(6) << std::left << L"cisco";
VERIFY( strbuf.str() == L"cisco " );
strbuf.str(str_blank);
}
int
main()
{
test02();
return 0;
}
......@@ -35,22 +35,37 @@
struct MyNP : std::numpunct<char>
{
std::string do_grouping() const;
char do_thousands_sep() const;
char do_thousands_sep() const;
};
std::string MyNP::do_grouping() const { std::string s("\3"); return s; }
char MyNP::do_thousands_sep() const { return ' '; }
std::string
MyNP::do_grouping() const
{
std::string s("\3");
return s;
}
char
MyNP::do_thousands_sep() const
{ return ' '; }
void test01()
{
bool test __attribute__((unused)) = true;
const char lit[] = "0123 456\n: 01 234 567:\n:0123 456 :\n"
": 012 345:\n: 01 234:\n:0726 746 425:\n"
":04 553 207 :\n: 0361 100:\n: 0173:\n"
"0x12 345 678\n|0x000012 345 678|\n|0x12 345 6780000|\n"
"|00000x12 345 678|\n|0x000012 345 678|\n";
const char lit[] = "0123 456\n"
": 01 234 567:\n"
":0123 456 :\n"
": 012 345:\n"
": 01 234:\n"
":0726 746 425:\n"
":04 553 207 :\n"
": 0361 100:\n"
": 0173:\n"
"0x12 345 678\n"
"|0x000012 345 678|\n"
"|0x12 345 6780000|\n"
"|00000x12 345 678|\n"
"|0x000012 345 678|\n";
std::ostringstream oss;
oss.imbue(std::locale(std::locale(), new MyNP));
......@@ -102,27 +117,10 @@ void test01()
VERIFY( oss.good() );
VERIFY( oss.str() == lit );
}
int
main()
{
test01();
return 0;
}
// Projected output:
/*
0123 456
: 01 234 567:
:0123 456 :
: 012 345:
: 01 234:
:0726 746 425:
:04 553 207 :
: 0361 100:
: 0173:
0x12 345 678
|0x000012 345 678|
|0x12 345 6780000|
|00000x12 345 678|
|0x000012 345 678|
*/
// Copyright (C) 2004 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.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#include <sstream>
#include <locale>
#include <iomanip>
#include <testsuite_hooks.h>
struct MyNP : std::numpunct<wchar_t>
{
std::string do_grouping() const;
wchar_t do_thousands_sep() const;
};
std::string
MyNP::do_grouping() const
{
std::string s("\3");
return s;
}
wchar_t
MyNP::do_thousands_sep() const
{ return L' '; }
void test01()
{
bool test __attribute__((unused)) = true;
const wchar_t lit[] = L"0123 456\n"
L": 01 234 567:\n"
L":0123 456 :\n"
L": 012 345:\n"
L": 01 234:\n"
L":0726 746 425:\n"
L":04 553 207 :\n"
L": 0361 100:\n"
L": 0173:\n"
L"0x12 345 678\n"
L"|0x000012 345 678|\n"
L"|0x12 345 6780000|\n"
L"|00000x12 345 678|\n"
L"|0x000012 345 678|\n";
std::wostringstream oss;
oss.imbue(std::locale(std::locale(), new MyNP));
// Octals
oss << std::oct << std::showbase;
oss << 0123456l << std::endl;
oss << L":" << std::setw(11);
oss << 01234567l << L":" << std::endl;
oss << L":" << std::setw(11) << std::left;
oss << 0123456l << L":" << std::endl;
oss << L":" << std::setw(11) << std::right;
oss << 012345l << L":" << std::endl;
oss << L":" << std::setw(11) << std::internal;
oss << 01234l << L":" << std::endl;
oss << L":" << std::setw(11);
oss << 123456789l << L":" << std::endl;
oss << L":" << std::setw(11) << std::left;
oss << 1234567l << L":" << std::endl;
oss << L":" << std::setw(11) << std::right;
oss << 123456l << L":" << std::endl;
oss << L":" << std::setw(11) << std::internal;
oss << 123l << L":" << std::endl;
// Hexadecimals
oss << std::hex << std::setfill(L'0');
oss << 0x12345678l << std::endl;
oss << L"|" << std::setw(16);
oss << 0x12345678l << L"|" << std::endl;
oss << L"|" << std::setw(16) << std::left;
oss << 0x12345678l << L"|" << std::endl;
oss << L"|" << std::setw(16) << std::right;
oss << 0x12345678l << L"|" << std::endl;
oss << L"|" << std::setw(16) << std::internal;
oss << 0x12345678l << L"|" << std::endl;
VERIFY( oss.good() );
VERIFY( oss.str() == lit );
}
int
main()
{
test01();
return 0;
}
// Copyright (C) 2002 Free Software Foundation, Inc.
// Copyright (C) 2002, 2004 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
......@@ -55,7 +55,7 @@ test01()
// setfil
setfill('a');
iss >> setfill('a');
iss >> setfill('a');
VERIFY(iss.good());
oss << setfill('a');
VERIFY(oss.good());
......@@ -75,7 +75,6 @@ test01()
VERIFY(oss.good());
}
int
main()
{
......
......@@ -22,14 +22,12 @@
// their own code with -fno-implicit-templates and not suffer from a zillion
// link errors.
#include <fstream>
#include <istream>
#include <ostream>
#include <sstream>
#include <iomanip>
#include <testsuite_hooks.h>
// PR libstdc++/3829
void
test01()
......@@ -37,7 +35,7 @@ test01()
using namespace std;
bool test __attribute__((unused)) = true;
string x (" this is text");
istringstream sin (x);
istringstream sin(x);
ostringstream sout;
// same order as in bits/std_iomanip.h
......@@ -60,7 +58,6 @@ test01()
VERIFY(sout.good());
}
int
main()
{
......
// Copyright (C) 2004 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 __attribute__((unused)) = true;
wstring s(L"john coltrane, a love supreme");
wistringstream iss(s);
wostringstream 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(L'a');
iss >> setfill(L'a');
VERIFY(iss.good());
oss << setfill(L'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;
}
// { dg-options "-fno-implicit-templates" }
// Copyright (C) 2004 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.
// Some members need to be explicitly instantiated, so that users can build
// their own code with -fno-implicit-templates and not suffer from a zillion
// link errors.
#include <istream>
#include <ostream>
#include <sstream>
#include <iomanip>
#include <testsuite_hooks.h>
// PR libstdc++/3829
void
test01()
{
using namespace std;
bool test __attribute__((unused)) = true;
wstring x(L" this is text");
wistringstream sin(x);
wostringstream sout;
// same order as in bits/std_iomanip.h
sin >> resetiosflags(ios_base::dec)
>> setiosflags(ios_base::dec)
>> setbase(ios_base::dec)
>> setfill(L'c')
>> setprecision(5)
>> setw(20)
>> ws;
VERIFY(sin.good());
sout << resetiosflags(ios_base::dec)
<< setiosflags(ios_base::dec)
<< setbase(ios_base::dec)
<< setfill(L'c')
<< setprecision(5)
<< setw(20)
<< ends << flush << endl;
VERIFY(sout.good());
}
int
main()
{
test01();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment