OSDN Git Service

2010-09-15 Paolo Carlini <paolo.carlini@oracle.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / testsuite / 22_locale / num_get / get / wchar_t / 1.cc
index ef055b3..0c6f450 100644 (file)
@@ -1,11 +1,14 @@
+// { dg-require-namedlocale "de_DE" }
+
 // 2001-11-21 Benjamin Kosnik  <bkoz@redhat.com>
 
-// Copyright (C) 2001, 2002, 2003 Free Software Foundation
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation
 //
 // 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)
+// Free Software Foundation; either version 3, or (at your option)
 // any later version.
 
 // This library is distributed in the hope that it will be useful,
@@ -14,9 +17,8 @@
 // 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.
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
 
 // 22.2.2.1.1  num_get members
 
@@ -29,43 +31,26 @@ void test01()
   using namespace std;
   typedef istreambuf_iterator<wchar_t> iterator_type;
 
-  bool test = true;
+  bool test __attribute__((unused)) = true;
 
   // basic construction
   locale loc_c = locale::classic();
-  locale loc_hk = __gnu_cxx_test::try_named_locale("en_HK");
-  locale loc_fr = __gnu_cxx_test::try_named_locale("fr_FR@euro");
-  locale loc_de = __gnu_cxx_test::try_named_locale("de_DE");
+  locale loc_de = locale("de_DE");
   VERIFY( loc_c != loc_de );
-  VERIFY( loc_hk != loc_fr );
-  VERIFY( loc_hk != loc_de );
-  VERIFY( loc_de != loc_fr );
-
-  // cache the numpunct facets
-  const numpunct<wchar_t>& numpunct_c = use_facet<numpunct<wchar_t> >(loc_c); 
-  const numpunct<wchar_t>& numpunct_de = use_facet<numpunct<wchar_t> >(loc_de); 
-  const numpunct<wchar_t>& numpunct_hk = use_facet<numpunct<wchar_t> >(loc_hk); 
 
   // sanity check the data is correct.
   const wstring empty;
-  char c;
 
   bool b1 = true;
   bool b0 = false;
-  long l1 = 2147483647;
-  long l2 = -2147483647;
-  long l;
   unsigned long ul1 = 1294967294;
-  unsigned long ul2 = 0;
   unsigned long ul;
   double d1 =  1.02345e+308;
   double d2 = 3.15e-308;
   double d;
   long double ld1 = 6.630025e+4;
-  long double ld2 = 0.0;
   long double ld;
-  void* v;
-  const void* cv = &ul2;
+  void* v = 0;
 
   // cache the num_get facet
   wistringstream iss;
@@ -78,7 +63,7 @@ void test01()
   // bool, simple
   iss.str(L"1");
   iterator_type os_it00 = iss.rdbuf();
-  iterator_type os_it01 = ng.get(os_it00, 0, iss, err, b1);
+  ng.get(os_it00, 0, iss, err, b1);
   VERIFY( b1 == true );
   VERIFY( err & ios_base::eofbit );
 
@@ -137,17 +122,16 @@ void test01()
   VERIFY( ld == 0 );
   VERIFY( err == goodbit );
 
-  // const void
+  // void*
   iss.str(L"0xbffff74c,");
   iss.clear();
   err = goodbit;
   ng.get(iss.rdbuf(), 0, iss, err, v);
-  VERIFY( &v != &cv );
+  VERIFY( v != 0 );
   VERIFY( err == goodbit );
 
-#ifdef _GLIBCPP_USE_LONG_LONG
+#ifdef _GLIBCXX_USE_LONG_LONG
   long long ll1 = 9223372036854775807LL;
-  long long ll2 = -9223372036854775807LL;
   long long ll;
 
   iss.str(L"9.223.372.036.854.775.807");