1// 2001-05-23 Benjamin Kosnik <bkoz@redhat.com> 2 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. 10 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. 15 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. 20 21// 27.7.3.2 member functions (ostringstream_members) 22 23#include <sstream> 24#include <testsuite_hooks.h> 25 26// 03: sanity checks for strings, stringbufs 27void 28test03() 29{ 30 bool test __attribute__((unused)) = false; 31 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 ); 39 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 ); 48 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 ); 58} 59 60int main() 61{ 62 test03(); 63 return 0; 64} 65