Dead
[official-gcc.git] / gomp-20050608-branch / libstdc++-v3 / testsuite / 27_io / basic_ostringstream / cons / char / 3.cc
blobc59431b314ba195339c41f94f21d74ace46326ff
1 // 2001-05-23 Benjamin Kosnik <bkoz@redhat.com>
3 // Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
9 // any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19 // USA.
21 // 27.7.3.2 member functions (ostringstream_members)
23 #include <sstream>
24 #include <testsuite_hooks.h>
26 // 03: sanity checks for strings, stringbufs
27 void
28 test03()
30 bool test __attribute__((unused)) = false;
32 // Empty string sanity check.
33 std::string str01;
34 std::string::iterator __i_start = str01.begin();
35 std::string::iterator __i_end = str01.end();
36 std::string::size_type len = str01.size();
37 test = __i_start == __i_end;
38 VERIFY( len == 0 );
40 // Full string sanity check.
41 std::string str02("these golden days, i spend waiting for you:\n"
42 "Betty Carter on Verve with I'm Yours and You're Mine.");
43 __i_start = str02.begin();
44 __i_end = str02.end();
45 len = str02.size();
46 VERIFY( __i_start != __i_end );
47 VERIFY( len != 0 );
49 // Test an empty ostringstream for sanity.
50 std::ostringstream ostrstream0;
51 std::string str03 = ostrstream0.str();
52 __i_start = str03.begin();
53 __i_end = str03.end();
54 len = str03.size();
55 VERIFY( __i_start == __i_end );
56 VERIFY( len == 0 );
57 VERIFY( str01 == str03 );
60 int main()
62 test03();
63 return 0;