money_put_members_char.cc: Fix.
authorBenjamin Kosnik <bkoz@redhat.com>
Wed, 20 Feb 2002 21:06:42 +0000 (21:06 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Wed, 20 Feb 2002 21:06:42 +0000 (21:06 +0000)
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

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/22_locale/money_put_members_char.cc
libstdc++-v3/testsuite/22_locale/money_put_members_wchar_t.cc
libstdc++-v3/testsuite/27_io/ios_manip_basefield.cc
libstdc++-v3/testsuite/27_io/ios_manip_fmtflags.cc
libstdc++-v3/testsuite/27_io/standard_manipulators.cc [new file with mode: 0644]

index c024609de8a510f0aa73c3f6cd746d529d8085aa..2e92e2d764ed550386136aa1cccbf4c68586c03b 100644 (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
index 72915dbc07dea4838bf6cc20b8a368cdad797c37..c894b1851ac004f68392fee93b1c842fc4949e12 100644 (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;
   }
 };
index 0688a65e8d0ade1c1bfa463cdb433112f121a246..09feadd7a9df4eecf5fa39cc819694db9a2c2735 100644 (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;
   }
 };
index 013a0153c72c87d58cf0c4b6be31b2b7eeb3a4ac..e84d2e6705cfab0bf1873a9a37ea441e18bda59e 100644 (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;
-
-  std::cout << ":" << std::setw(11);
-  std::cout << -01234567l << ":" << std::endl;
-
-  std::cout << ":" << std::setw(11) << std::left;
-  std::cout << -0123456l << ":" << std::endl;
-
-  std::cout << ":" << std::setw(11) << std::right;
-  std::cout << -012345l << ":" << std::endl;
-
-  std::cout << ":" << std::setw(11) << std::internal;
-  std::cout << -01234l << ":" << std::endl;
-
-  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
+  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;
+
+  oss << ":" << std::setw(11);
+  oss << -01234567l << ":" << std::endl;
+
+  oss << ":" << std::setw(11) << std::left;
+  oss << -0123456l << ":" << std::endl;
+
+  oss << ":" << std::setw(11) << std::right;
+  oss << -012345l << ":" << 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 );
+
   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
 */
+
index 3af4d11f48d08e44fc8f6fbb24bc8c5a021a8806..64b1b85f6d26ce804a09d4d6fb689d509641f6a0 100644 (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;
diff --git a/libstdc++-v3/testsuite/27_io/standard_manipulators.cc b/libstdc++-v3/testsuite/27_io/standard_manipulators.cc
new file mode 100644 (file)
index 0000000..7182237
--- /dev/null
@@ -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;
+}