OSDN Git Service

70eb9d6e31478151a86ebacf1c058f4756ab7b53
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / testsuite / 27_io / ios_base / state / 1.cc
1 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2009
2 // Free Software Foundation, Inc.
3 //
4 // This file is part of the GNU ISO C++ Library.  This library is free
5 // software; you can redistribute it and/or modify it under the
6 // terms of the GNU General Public License as published by the
7 // Free Software Foundation; either version 3, or (at your option)
8 // any later version.
9
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14
15 // You should have received a copy of the GNU General Public License along
16 // with this library; see the file COPYING3.  If not see
17 // <http://www.gnu.org/licenses/>.
18
19
20 #include <sstream>
21 #include <locale>
22 #include <testsuite_hooks.h>
23
24 void
25 test02()
26 {
27   bool test __attribute__((unused)) = true;
28   const std::string strue("true");
29   const std::string sfalse("false");
30   std::string str01;
31   std::string str02;
32
33   std::locale loc_c = std::locale::classic();
34   std::ostringstream ostr01;
35   ostr01.imbue(loc_c);
36   ostr01.flags(std::ios_base::boolalpha);
37
38   ostr01 << true;
39   str02 = ostr01.str();
40   VERIFY( str02 == strue );
41
42   ostr01.str(str01);
43   ostr01 << false;
44   str02 = ostr01.str();
45   VERIFY( str02 == sfalse );
46 }
47
48 int 
49 main() 
50 {
51   test02();
52   return 0;
53 }