]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Renames, namespaces for testsuite utilities.
authorBenjamin Kosnik <bkoz@redhat.com>
Tue, 14 Jan 2003 04:56:56 +0000 (04:56 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Tue, 14 Jan 2003 04:56:56 +0000 (04:56 +0000)
2003-01-12  Benjamin Kosnik  <bkoz@redhat.com>

Renames, namespaces for testsuite utilities.
* testsuite/testsuite_hooks.h: Put into namespace __gnu_cxx_test.
(gnu_allocator_tracker): Rename to allocation_tracker.
(gnu_new_allocator): Rename to tracker_alloc.
(__set_testsuite_memlimit): Rename to set_memory_limits.
(gnu_assignment_operator): Rename to assignment_operator.
(gnu_destructor): Rename to destructor.
(gnu_copy_tracker): Rename to copy_tracker.
(gnu_char, gnu_int, gnu_long): Rename to pod_char, pod_int, pod_long.
(run_tests_wrapped_locale): New.
(run_tests_wrapped_env): New.
* testsuite/testsuite_hooks.cc: Same.
(class locale_data): Add.
(class enviornment_variable): Add.
(class not_found): Add.
* testsuite/testsuite_allocator.h: Same.
* testsuite/testsuite_allocator.cc: Same.
* testsuite/23_containers/deque_ctor.cc
(test_copy_ctor_exception_safety): Change gnu_allocator_tracker to
allocation_tracker.
Change gnu_new_allocator to tracker_alloc.
Change gnu_counting_struct to counter.
Change gnu_copy_tracker to copy_tracker.
Change gnu_copy_constructor to copy_constructor.
Change gnu_assignment_operator to assignment_operator.
Inject.
* testsuite/23_containers/vector_capacity.cc: Same.
* testsuite/23_containers/vector_ctor.cc (test01): Same.
* testsuite/23_containers/list_modifiers.cc: Change
gnu_copy_tracker to copy_tracker.
* testsuite/21_strings/ctor_copy_dtor.cc (main): Change
__set_testsuite_memlimit to set_memory_limits.
* testsuite/21_strings/insert.cc (main): Same.
* testsuite/27_io/filebuf.cc: Change gnu_char to pod_char.
* testsuite/27_io/stringstream.cc: Same.
* testsuite/27_io/stringbuf.cc: Same.
* testsuite/27_io/streambuf.cc: Same.
* testsuite/27_io/ostream.cc: Same.
* testsuite/27_io/istream.cc: Same.
* testsuite/27_io/fstream.cc: Same.
* testsuite/lib/libstdc++-v3-dg.exp
(libstdc++-v3-list-sourcefiles): Additionally handle files two and
three levels deeper in glob patterns.

From-SVN: r61261

19 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/21_strings/ctor_copy_dtor.cc
libstdc++-v3/testsuite/21_strings/insert.cc
libstdc++-v3/testsuite/23_containers/deque_ctor.cc
libstdc++-v3/testsuite/23_containers/list_modifiers.cc
libstdc++-v3/testsuite/23_containers/vector_capacity.cc
libstdc++-v3/testsuite/23_containers/vector_ctor.cc
libstdc++-v3/testsuite/27_io/filebuf.cc
libstdc++-v3/testsuite/27_io/fstream.cc
libstdc++-v3/testsuite/27_io/istream.cc
libstdc++-v3/testsuite/27_io/ostream.cc
libstdc++-v3/testsuite/27_io/streambuf.cc
libstdc++-v3/testsuite/27_io/stringbuf.cc
libstdc++-v3/testsuite/27_io/stringstream.cc
libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp
libstdc++-v3/testsuite/testsuite_allocator.cc
libstdc++-v3/testsuite/testsuite_allocator.h
libstdc++-v3/testsuite/testsuite_hooks.cc
libstdc++-v3/testsuite/testsuite_hooks.h

index 4111699cc7667d33bad97ff6c1cca5ab59f42d7d..d67b56e73a77f8fb79105a7c3c238f3e3360a2ea 100644 (file)
@@ -1,3 +1,49 @@
+2003-01-12  Benjamin Kosnik  <bkoz@redhat.com>
+
+       Renames, namespaces for testsuite utilities.    
+       * testsuite/testsuite_hooks.h: Put into namespace __gnu_cxx_test.
+       (gnu_allocator_tracker): Rename to allocation_tracker.
+       (gnu_new_allocator): Rename to tracker_alloc.
+       (__set_testsuite_memlimit): Rename to set_memory_limits.
+       (gnu_assignment_operator): Rename to assignment_operator.
+       (gnu_destructor): Rename to destructor.
+       (gnu_copy_tracker): Rename to copy_tracker.
+       (gnu_char, gnu_int, gnu_long): Rename to pod_char, pod_int, pod_long.
+       (run_tests_wrapped_locale): New.
+       (run_tests_wrapped_env): New.
+       * testsuite/testsuite_hooks.cc: Same.
+       (class locale_data): Add.
+       (class enviornment_variable): Add.
+       (class not_found): Add.
+       * testsuite/testsuite_allocator.h: Same.
+       * testsuite/testsuite_allocator.cc: Same.
+       * testsuite/23_containers/deque_ctor.cc
+       (test_copy_ctor_exception_safety): Change gnu_allocator_tracker to
+       allocation_tracker. 
+       Change gnu_new_allocator to tracker_alloc.
+       Change gnu_counting_struct to counter.
+       Change gnu_copy_tracker to copy_tracker.
+       Change gnu_copy_constructor to copy_constructor.
+       Change gnu_assignment_operator to assignment_operator.  
+       Inject.
+       * testsuite/23_containers/vector_capacity.cc: Same.
+       * testsuite/23_containers/vector_ctor.cc (test01): Same.
+       * testsuite/23_containers/list_modifiers.cc: Change
+       gnu_copy_tracker to copy_tracker.
+       * testsuite/21_strings/ctor_copy_dtor.cc (main): Change
+       __set_testsuite_memlimit to set_memory_limits.
+       * testsuite/21_strings/insert.cc (main): Same.
+       * testsuite/27_io/filebuf.cc: Change gnu_char to pod_char.
+       * testsuite/27_io/stringstream.cc: Same.
+       * testsuite/27_io/stringbuf.cc: Same.
+       * testsuite/27_io/streambuf.cc: Same.
+       * testsuite/27_io/ostream.cc: Same.
+       * testsuite/27_io/istream.cc: Same.
+       * testsuite/27_io/fstream.cc: Same.
+       * testsuite/lib/libstdc++-v3-dg.exp
+       (libstdc++-v3-list-sourcefiles): Additionally handle files two and
+       three levels deeper in glob patterns.
+
 2003-01-11  Phil Edwards  <pme@gcc.gnu.org>
 
        * docs/doxygen/tables.html:  Finished now.
index c45e66a4cd44a0ed9554e29d4f4322d420196c49..28e9d8ef160ace95a2ead1c671a807700156be27 100644 (file)
@@ -1,6 +1,6 @@
 // 1999-06-04 bkoz
 
-// Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 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
@@ -230,7 +230,7 @@ void test05()
 
 int main()
 { 
-  __set_testsuite_memlimit();
+  __gnu_cxx_test::set_memory_limits();
   test01();
   test02();
   test03();
index e6140ac2e9bb24178bb14d4e4a2f3c7bfa31a840..5e1eda8695911c06150bb0b1b823bb1e4fe0a0b8 100644 (file)
@@ -1,6 +1,6 @@
 // 1999-06-03 bkoz
 
-// Copyright (C) 1999 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2003 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
@@ -246,7 +246,7 @@ int test02(void)
 
 int main()
 { 
-  __set_testsuite_memlimit();
+  __gnu_cxx_test::set_memory_limits();
   test01();
   test02();
   return 0;
index 7df103405ebd88ab3b6fcd98a173f04b4daf0891..50a813368bb722510909315910e00ceab183de17 100644 (file)
@@ -1,6 +1,6 @@
 // 2001-12-27 pme
 //
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003 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
 #include <testsuite_allocator.h>
 #include <testsuite_hooks.h>
 
-typedef std::deque<gnu_counting_struct>   gdeque;
+using __gnu_cxx_test::copy_tracker;
+using __gnu_cxx_test::allocation_tracker;
+using __gnu_cxx_test::tracker_alloc;
+using __gnu_cxx_test::copy_constructor;
+using __gnu_cxx_test::assignment_operator;
+using __gnu_cxx_test::counter;
+using __gnu_cxx_test::destructor;
+
+typedef std::deque<counter>   gdeque;
 
 bool test = true;
 
@@ -133,10 +141,10 @@ void
 defaultConstructorCheck()
 {
   // setup
-  typedef gnu_copy_tracker  T;
+  typedef copy_tracker  T;
   typedef std::deque<T>     X;
 
-  gnu_copy_tracker::reset();
+  copy_tracker::reset();
 
   // run test
   const X u;
@@ -171,7 +179,7 @@ void
 copyConstructorCheck()
 {
   // setup
-  typedef gnu_copy_tracker  T;
+  typedef copy_tracker  T;
   typedef std::deque<T>     X;
 
   const int copyBaseSize = 17;  // arbitrary
@@ -179,7 +187,7 @@ copyConstructorCheck()
   X a;
   for (int i = 0; i < copyBaseSize; ++i)
     a.push_back(i);
-  gnu_copy_tracker::reset();
+  copy_tracker::reset();
 
   // assert preconditions
   VERIFY(!a.empty());
@@ -192,7 +200,7 @@ copyConstructorCheck()
 
   // assert postconditions
   VERIFY(u == a);
-  VERIFY(copyBaseSize == gnu_copy_constructor::count());
+  VERIFY(copyBaseSize == copy_constructor::count());
 
   // teardown
 }
@@ -212,20 +220,20 @@ void
 fillConstructorCheck()
 {
   // setup
-  typedef gnu_copy_tracker  T;
+  typedef copy_tracker  T;
   typedef std::deque<T>   X;
 
   const X::size_type  n(23);  
   const X::value_type t(111);
 
-  gnu_copy_tracker::reset();
+  copy_tracker::reset();
 
   // run test
   X a(n, t);
 
   // assert postconditions
   VERIFY(n == a.size());
-  VERIFY(n == gnu_copy_constructor::count());
+  VERIFY(n == copy_constructor::count());
 
   // teardown
 }
@@ -239,18 +247,18 @@ fillConstructorCheck()
 void
 fillConstructorCheck2()
 {
-  typedef gnu_copy_tracker  T;
+  typedef copy_tracker  T;
   typedef std::deque<T>   X;
 
   const int f = 23;  
   const int l = 111;
 
-  gnu_copy_tracker::reset();
+  copy_tracker::reset();
 
   X a(f, l);
 
   VERIFY(f == a.size());
-  VERIFY(f == gnu_copy_constructor::count());
+  VERIFY(f == copy_constructor::count());
 }
 
 
@@ -265,7 +273,7 @@ void
 rangeConstructorCheckForwardIterator()
 {
   // setup
-  typedef gnu_copy_tracker  T;
+  typedef copy_tracker  T;
   typedef std::deque<T>   X;
 
   const X::size_type  n(726); 
@@ -275,14 +283,14 @@ rangeConstructorCheckForwardIterator()
   X::iterator j = source.end();
   X::size_type rangeSize = std::distance(i, j);
 
-  gnu_copy_tracker::reset();
+  copy_tracker::reset();
 
   // test
   X a(i, j);
 
   // assert postconditions
   VERIFY(rangeSize == a.size());
-  VERIFY(gnu_copy_constructor::count() <= rangeSize);
+  VERIFY(copy_constructor::count() <= rangeSize);
 }
 
 
@@ -295,7 +303,7 @@ rangeConstructorCheckForwardIterator()
 void
 rangeConstructorCheckInputIterator()
 {
-  typedef gnu_copy_tracker  T;
+  typedef copy_tracker  T;
   typedef std::deque<T>     X;
 
   std::istringstream ibuf("1234567890123456789");
@@ -303,12 +311,12 @@ rangeConstructorCheckInputIterator()
   std::istream_iterator<char>  i(ibuf);
   std::istream_iterator<char>  j;
 
-  gnu_copy_tracker::reset();
+  copy_tracker::reset();
 
   X a(i, j);
 
   VERIFY(rangeSize == a.size());
-  VERIFY(gnu_copy_constructor::count() <= (2 * rangeSize));
+  VERIFY(copy_constructor::count() <= (2 * rangeSize));
 }
 
 
@@ -316,7 +324,7 @@ rangeConstructorCheckInputIterator()
 void
 copyAssignmentCheck()
 {
-  typedef gnu_copy_tracker  T;
+  typedef copy_tracker  T;
   typedef std::deque<T>     X;
 
   const X::size_type  n(18);  
@@ -324,12 +332,12 @@ copyAssignmentCheck()
   X a(n, t);
   X r;
 
-  gnu_copy_tracker::reset();
+  copy_tracker::reset();
 
   r = a;
 
   VERIFY(r == a);
-  VERIFY(n == gnu_copy_constructor::count());
+  VERIFY(n == copy_constructor::count());
 }
 
 
@@ -343,7 +351,7 @@ copyAssignmentCheck()
 void
 fillAssignmentCheck()
 {
-  typedef gnu_copy_tracker  T;
+  typedef copy_tracker  T;
   typedef std::deque<T>   X;
 
   const X::size_type  starting_size(10);  
@@ -352,7 +360,7 @@ fillAssignmentCheck()
   const X::value_type t(111);
 
   X a(starting_size, starting_value);
-  gnu_copy_tracker::reset();
+  copy_tracker::reset();
 
   // preconditions
   VERIFY(starting_size == a.size());
@@ -362,8 +370,8 @@ fillAssignmentCheck()
 
   // postconditions
   VERIFY(n == a.size());
-  VERIFY(n == (gnu_copy_constructor::count() + gnu_assignment_operator::count()));
-  VERIFY(starting_size == (gnu_destructor::count() + gnu_assignment_operator::count()));
+  VERIFY(n == (copy_constructor::count() + assignment_operator::count()));
+  VERIFY(starting_size == (destructor::count() + assignment_operator::count()));
 }
 
 
@@ -391,7 +399,7 @@ fillAssignmentCheck()
 void
 rangeAssignmentCheck()
 {
-  typedef gnu_copy_tracker  T;
+  typedef copy_tracker  T;
   typedef std::deque<T>   X;
 
   const X::size_type  source_size(726); 
@@ -407,13 +415,13 @@ rangeAssignmentCheck()
   X a(starting_size, starting_value);
   VERIFY(starting_size == a.size());
 
-  gnu_copy_tracker::reset();
+  copy_tracker::reset();
 
   a.assign(i, j);
 
   VERIFY(source == a);
-  VERIFY(rangeSize == (gnu_copy_constructor::count() + gnu_assignment_operator::count()));
-  VERIFY(starting_size == (gnu_destructor::count() + gnu_assignment_operator::count()));
+  VERIFY(rangeSize == (copy_constructor::count() + assignment_operator::count()));
+  VERIFY(starting_size == (destructor::count() + assignment_operator::count()));
 }
 
 
@@ -423,7 +431,7 @@ void
 rangeAssignmentCheckWithException()
 {
   // setup
-  typedef gnu_copy_tracker T;
+  typedef copy_tracker T;
   typedef std::deque<T>    X;
 
   // test
@@ -436,7 +444,7 @@ void
 fillAssignmentCheck2()
 {
   // setup
-  typedef gnu_copy_tracker T;
+  typedef copy_tracker T;
   typedef std::deque<T>    X;
 
   // test
@@ -449,12 +457,12 @@ void
 test_default_ctor_exception_safety()
 {
   // setup
-  typedef gnu_copy_tracker T;
-  typedef std::deque<T, gnu_new_allocator<T> > X;
+  typedef copy_tracker T;
+  typedef std::deque<T, tracker_alloc<T> > X;
 
   T::reset();
-  gnu_copy_constructor::throw_on(3);
-  gnu_allocator_tracker::resetCounts();
+  copy_constructor::throw_on(3);
+  allocation_tracker::resetCounts();
 
   // test
   try
@@ -467,7 +475,7 @@ test_default_ctor_exception_safety()
   }
 
   // assert postconditions
-  VERIFY(gnu_allocator_tracker::allocationTotal() == gnu_allocator_tracker::deallocationTotal());
+  VERIFY(allocation_tracker::allocationTotal() == allocation_tracker::deallocationTotal());
 
   // teardown
 }
@@ -477,14 +485,14 @@ void
 test_copy_ctor_exception_safety()
 {
   // setup
-  typedef gnu_copy_tracker T;
-  typedef std::deque<T, gnu_new_allocator<T> > X;
+  typedef copy_tracker T;
+  typedef std::deque<T, tracker_alloc<T> > X;
 
-  gnu_allocator_tracker::resetCounts();
+  allocation_tracker::resetCounts();
   {
     X a(7);
     T::reset();
-    gnu_copy_constructor::throw_on(3);
+    copy_constructor::throw_on(3);
 
 
     // test
@@ -499,7 +507,7 @@ test_copy_ctor_exception_safety()
   }
 
   // assert postconditions
-  VERIFY(gnu_allocator_tracker::allocationTotal() == gnu_allocator_tracker::deallocationTotal());
+  VERIFY(allocation_tracker::allocationTotal() == allocation_tracker::deallocationTotal());
 
   // teardown
 }
index 14b53657e0596d59441be608b0e19be510913cb2..213fc41f17ddff9de8ddf13db1c1bc76c5489178 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2003 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
@@ -21,7 +21,7 @@
 #include <list>
 #include <testsuite_hooks.h>
 
-typedef gnu_copy_tracker  T;
+typedef __gnu_cxx_test::copy_tracker  T;
 
 bool test = true;
 
index 50740ba59677f8c33df15bd0521670e19b419ed0..b6e347de3099450fd63df7641dc59e0c62f84a8e 100644 (file)
@@ -1,7 +1,7 @@
 // 1999-05-07
 // bkoz 
 
-// Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2002, 2003 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
 #include <testsuite_allocator.h>
 #include <testsuite_hooks.h>
 
+using __gnu_cxx_test::copy_tracker;
+using __gnu_cxx_test::allocation_tracker;
+using __gnu_cxx_test::tracker_alloc;
+using __gnu_cxx_test::copy_constructor;
+using __gnu_cxx_test::assignment_operator;
+using __gnu_cxx_test::destructor;
 template<typename T>
   struct A { };
 
@@ -58,7 +65,6 @@ void test01()
 void test02()
 {
   bool test = true;
-
   {
     std::vector<int>  array;
     const std::size_t size = array.max_size();
@@ -104,10 +110,11 @@ void test02()
 void
 test_reserve()
 {
-  typedef gnu_copy_tracker T;
-  typedef std::vector<T, gnu_new_allocator<T> > X;
+  bool test = true;
+  typedef copy_tracker T;
+  typedef std::vector<T, tracker_alloc<T> > X;
 
-  gnu_allocator_tracker::resetCounts();
+  allocation_tracker::resetCounts();
   {
     X a(3);
     const X::size_type old_size     = a.size();
@@ -121,11 +128,11 @@ test_reserve()
     VERIFY(new_capacity <= a.capacity());
     // [23.2.4.1 (3)]
     VERIFY(old_size == a.size());
-    VERIFY(gnu_copy_constructor::count() <= old_size);
-    VERIFY(gnu_destructor::count() <= old_size);
+    VERIFY(copy_constructor::count() <= old_size);
+    VERIFY(destructor::count() <= old_size);
   }
   // check for memory leaks
-  VERIFY(gnu_allocator_tracker::allocationTotal() == gnu_allocator_tracker::deallocationTotal());
+  VERIFY(allocation_tracker::allocationTotal() == allocation_tracker::deallocationTotal());
 }
 
 // Verifies that reserve() with reallocation offers the strong
@@ -133,17 +140,18 @@ test_reserve()
 void
 test_reserve_exception_guarantee()
 {
-  typedef gnu_copy_tracker T;
-  typedef std::vector<T, gnu_new_allocator<T> > X;
+  bool test = true;
+  typedef copy_tracker T;
+  typedef std::vector<T, tracker_alloc<T> > X;
 
-  gnu_allocator_tracker::resetCounts();
+  allocation_tracker::resetCounts();
   {
     X a(7);
     const X::size_type old_size     = a.size();
     const X::size_type old_capacity = a.capacity();
     const X::size_type new_capacity = old_capacity + 10;
     T::reset();
-    gnu_copy_constructor::throw_on(3);
+    copy_constructor::throw_on(3);
     
     try
     {
@@ -155,9 +163,9 @@ test_reserve_exception_guarantee()
     }
 
     VERIFY(old_capacity == a.capacity());
-    VERIFY(gnu_copy_constructor::count() == gnu_destructor::count()+1);
+    VERIFY(copy_constructor::count() == destructor::count()+1);
   }
-  VERIFY(gnu_allocator_tracker::allocationTotal() == gnu_allocator_tracker::deallocationTotal());
+  VERIFY(allocation_tracker::allocationTotal() == allocation_tracker::deallocationTotal());
 }
 
 int main()
index d8789f57146de35846940c4d811d5b0befea02db..8b93207606e13b67600d2169e2fdac2512a83adb 100644 (file)
@@ -1,6 +1,6 @@
 // 1999-06-29 bkoz
 
-// Copyright (C) 1999-2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1999-2001, 2002, 2003 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
 #include <testsuite_allocator.h>
 #include <testsuite_hooks.h>
 
+using __gnu_cxx_test::copy_tracker;
+using __gnu_cxx_test::allocation_tracker;
+using __gnu_cxx_test::tracker_alloc;
+using __gnu_cxx_test::copy_constructor;
+using __gnu_cxx_test::assignment_operator;
 template<typename T>
   struct A { };
 
@@ -32,7 +38,6 @@ struct B { };
 
 void test01()
 {
-
   // 1
   bool test = true;
   std::vector< A<B> > vec01;
@@ -62,22 +67,22 @@ void test02()
 void
 test03()
 {
-    const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
-    const int B[] = {7, 7, 7, 7, 7};
-    const int N = sizeof(A) / sizeof(int);
-    const int M = sizeof(B) / sizeof(int);
-    bool test = true;
-
-    std::vector<int> v3(A, A + N);
-    VERIFY(std::equal(v3.begin(), v3.end(), A));
-
-    std::vector<int> v4(v3.begin(), v3.end());
-    VERIFY(std::equal(v4.begin(), v4.end(), A));
-
-    std::vector<int> v5(M, 7);
-    VERIFY(std::equal(v5.begin(), v5.end(), B));
-    VERIFY(std::equal(B, B + M, v5.begin()));
-
+  bool test = true;
+  const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
+  const int B[] = {7, 7, 7, 7, 7};
+  const int N = sizeof(A) / sizeof(int);
+  const int M = sizeof(B) / sizeof(int);
+  
+  std::vector<int> v3(A, A + N);
+  VERIFY(std::equal(v3.begin(), v3.end(), A));
+  
+  std::vector<int> v4(v3.begin(), v3.end());
+  VERIFY(std::equal(v4.begin(), v4.end(), A));
+  
+  std::vector<int> v5(M, 7);
+  VERIFY(std::equal(v5.begin(), v5.end(), B));
+  VERIFY(std::equal(B, B + M, v5.begin()));
+  
 #ifdef DEBUG_ASSERT
   assert(test);
 #endif
@@ -105,12 +110,13 @@ void
 test_default_ctor_exception_gurantee()
 {
   // setup
-  typedef gnu_copy_tracker T;
-  typedef std::vector<T, gnu_new_allocator<T> > X;
+  bool test = true;
+  typedef copy_tracker T;
+  typedef std::vector<T, tracker_alloc<T> > X;
 
-  gnu_copy_tracker::reset();
-  gnu_copy_constructor::throw_on(3);
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  copy_constructor::throw_on(3);
+  allocation_tracker::resetCounts();
 
   // run test
   try
@@ -124,7 +130,7 @@ test_default_ctor_exception_gurantee()
 
   // assert postconditions
   VERIFY(("memory leak detected:",
-          gnu_allocator_tracker::allocationTotal() == gnu_allocator_tracker::deallocationTotal()));
+          allocation_tracker::allocationTotal() == allocation_tracker::deallocationTotal()));
 
   // teardown
 }
@@ -137,14 +143,15 @@ void
 test_copy_ctor_exception_gurantee()
 {
   // setup
-  typedef gnu_copy_tracker T;
-  typedef std::vector<T, gnu_new_allocator<T> > X;
+  bool test = true;
+  typedef copy_tracker T;
+  typedef std::vector<T, tracker_alloc<T> > X;
 
-  gnu_allocator_tracker::resetCounts();
+  allocation_tracker::resetCounts();
   {
     X a(7);
-    gnu_copy_tracker::reset();
-    gnu_copy_constructor::throw_on(3);
+    copy_tracker::reset();
+    copy_constructor::throw_on(3);
 
     // run test
     try
@@ -158,11 +165,11 @@ test_copy_ctor_exception_gurantee()
   }
 
   // assert postconditions
-  VERIFY(gnu_allocator_tracker::allocationTotal() == gnu_allocator_tracker::deallocationTotal());
+  VERIFY(allocation_tracker::allocationTotal() == allocation_tracker::deallocationTotal());
 
   // teardown
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 }
 
 // operator=()
@@ -175,13 +182,14 @@ void
 test_assignment_operator_1()
 {
   // setup
-  typedef gnu_copy_tracker T;
-  typedef std::vector<T, gnu_new_allocator<T> > X;
+  bool test = true;
+  typedef copy_tracker T;
+  typedef std::vector<T, tracker_alloc<T> > X;
 
   X r(9);
   X a(r.size() - 2);
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 
   // preconditions
   VERIFY(r.size() > a.size());
@@ -191,25 +199,26 @@ test_assignment_operator_1()
 
   // assert postconditions
   VERIFY(r == a);
-  VERIFY(gnu_allocator_tracker::allocationTotal() == 0);
+  VERIFY(allocation_tracker::allocationTotal() == 0);
 
   // teardown
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 }
 
 void
 test_assignment_operator_2()
 {
   // setup
-  typedef gnu_copy_tracker T;
-  typedef std::vector<T, gnu_new_allocator<T> > X;
+  bool test = true;
+  typedef copy_tracker T;
+  typedef std::vector<T, tracker_alloc<T> > X;
 
   X r(1);
   r.reserve(17);
   X a(r.size() + 7);
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 
   // preconditions
   VERIFY(r.size() < a.size());
@@ -220,25 +229,26 @@ test_assignment_operator_2()
 
   // assert postconditions
   VERIFY(r == a);
-  VERIFY(gnu_allocator_tracker::allocationTotal() == 0);
+  VERIFY(allocation_tracker::allocationTotal() == 0);
 
   // teardown
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 }
 
 void
 test_assignment_operator_3()
 {
   // setup
-  typedef gnu_copy_tracker T;
-  typedef std::vector<T, gnu_new_allocator<T> > X;
+  bool test = true;
+  typedef copy_tracker T;
+  typedef std::vector<T, tracker_alloc<T> > X;
 
-  gnu_allocator_tracker::resetCounts();
+  allocation_tracker::resetCounts();
   {
     X r(1);
     X a(r.capacity() + 7);
-    gnu_copy_tracker::reset();
+    copy_tracker::reset();
 
     // preconditions
     VERIFY(r.capacity() < a.size());
@@ -249,26 +259,27 @@ test_assignment_operator_3()
     // assert postconditions
     VERIFY(r == a);
   }
-  VERIFY(gnu_allocator_tracker::allocationTotal() == gnu_allocator_tracker::deallocationTotal());
+  VERIFY(allocation_tracker::allocationTotal() == allocation_tracker::deallocationTotal());
 
   // teardown
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 }
 
 void
 test_assignment_operator_3_exception_guarantee()
 {
   // setup
-  typedef gnu_copy_tracker T;
-  typedef std::vector<T, gnu_new_allocator<T> > X;
+  bool test = true;
+  typedef copy_tracker T;
+  typedef std::vector<T, tracker_alloc<T> > X;
 
-  gnu_allocator_tracker::resetCounts();
+  allocation_tracker::resetCounts();
   {
     X r(1);
     X a(r.capacity() + 7);
-    gnu_copy_tracker::reset();
-    gnu_copy_constructor::throw_on(3);
+    copy_tracker::reset();
+    copy_constructor::throw_on(3);
 
     // preconditions
     VERIFY(r.capacity() < a.size());
@@ -285,11 +296,11 @@ test_assignment_operator_3_exception_guarantee()
   }
 
   // assert postconditions
-  VERIFY(gnu_allocator_tracker::allocationTotal() == gnu_allocator_tracker::deallocationTotal());
+  VERIFY(allocation_tracker::allocationTotal() == allocation_tracker::deallocationTotal());
 
   // teardown
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 }
 
 // fill assign()
@@ -304,35 +315,37 @@ void
 test_fill_assign_1()
 {
   // setup
-  typedef gnu_copy_tracker T;
-  typedef std::vector<T, gnu_new_allocator<T> > X;
+  bool test = true;
+  typedef copy_tracker T;
+  typedef std::vector<T, tracker_alloc<T> > X;
 
   X a(7);
   X::size_type old_size = a.size();
   X::size_type new_size = old_size - 2;
   const T t;
 
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 
   // run test
   a.assign(new_size, t);
 
   // assert postconditions
   VERIFY(a.size() == new_size);
-  VERIFY(gnu_allocator_tracker::allocationTotal() == 0);
+  VERIFY(allocation_tracker::allocationTotal() == 0);
 
   // teardown
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 }
 
 void
 test_fill_assign_2()
 {
   // setup
-  typedef gnu_copy_tracker T;
-  typedef std::vector<T, gnu_new_allocator<T> > X;
+  bool test = true;
+  typedef copy_tracker T;
+  typedef std::vector<T, tracker_alloc<T> > X;
 
   X a(7);
   a.reserve(11);
@@ -341,8 +354,8 @@ test_fill_assign_2()
   X::size_type new_size     = old_size + 2;
   const T t;
 
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 
   // assert preconditions
   VERIFY(old_size < new_size);
@@ -353,21 +366,22 @@ test_fill_assign_2()
 
   // assert postconditions
   VERIFY(a.size() == new_size);
-  VERIFY(gnu_allocator_tracker::allocationTotal() == 0);
+  VERIFY(allocation_tracker::allocationTotal() == 0);
 
   // teardown
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 }
 
 void
 test_fill_assign_3()
 {
   // setup
-  typedef gnu_copy_tracker T;
-  typedef std::vector<T, gnu_new_allocator<T> > X;
+  bool test = true;
+  typedef copy_tracker T;
+  typedef std::vector<T, tracker_alloc<T> > X;
 
-  gnu_allocator_tracker::resetCounts();
+  allocation_tracker::resetCounts();
   {
     X a(7);
     X::size_type old_size     = a.size();
@@ -375,7 +389,7 @@ test_fill_assign_3()
     X::size_type new_size     = old_capacity + 4;
     const T t;
 
-    gnu_copy_tracker::reset();
+    copy_tracker::reset();
 
     // assert preconditions
     VERIFY(new_size > old_capacity);
@@ -387,22 +401,23 @@ test_fill_assign_3()
     VERIFY(a.size() == new_size);
   }
 
-  VERIFY(gnu_allocator_tracker::allocationTotal() > 0);
-  VERIFY(gnu_allocator_tracker::allocationTotal() == gnu_allocator_tracker::deallocationTotal());
+  VERIFY(allocation_tracker::allocationTotal() > 0);
+  VERIFY(allocation_tracker::allocationTotal() == allocation_tracker::deallocationTotal());
 
   // teardown
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 }
 
 void
 test_fill_assign_3_exception_guarantee()
 {
   // setup
-  typedef gnu_copy_tracker T;
-  typedef std::vector<T, gnu_new_allocator<T> > X;
+  bool test = true;
+  typedef copy_tracker T;
+  typedef std::vector<T, tracker_alloc<T> > X;
 
-  gnu_allocator_tracker::resetCounts();
+  allocation_tracker::resetCounts();
   {
     X a(7);
     X::size_type old_size     = a.size();
@@ -410,8 +425,8 @@ test_fill_assign_3_exception_guarantee()
     X::size_type new_size     = old_capacity + 4;
     const T t;
 
-    gnu_copy_tracker::reset();
-    gnu_copy_constructor::throw_on(3);
+    copy_tracker::reset();
+    copy_constructor::throw_on(3);
 
     // assert preconditions
     VERIFY(new_size > old_capacity);
@@ -431,39 +446,40 @@ test_fill_assign_3_exception_guarantee()
     VERIFY(a.capacity() == old_capacity);
   }
 
-  VERIFY(gnu_allocator_tracker::allocationTotal() > 0);
-  VERIFY(gnu_allocator_tracker::allocationTotal() == gnu_allocator_tracker::deallocationTotal());
+  VERIFY(allocation_tracker::allocationTotal() > 0);
+  VERIFY(allocation_tracker::allocationTotal() == allocation_tracker::deallocationTotal());
 
   // teardown
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 }
 
 void
 test_fill_assign_4()
 {
   // setup
-  typedef gnu_copy_tracker T;
-  typedef std::vector<T, gnu_new_allocator<T> > X;
+  bool test = true;
+  typedef copy_tracker T;
+  typedef std::vector<T, tracker_alloc<T> > X;
 
   X a(7);
   X::size_type old_size  = a.size();
   X::size_type new_size  = old_size - 2;
   X::size_type new_value = 117;
 
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 
   // run test
   a.assign(new_size, new_value);
 
   // assert postconditions
   VERIFY(a.size() == new_size);
-  VERIFY(gnu_allocator_tracker::allocationTotal() == 0);
+  VERIFY(allocation_tracker::allocationTotal() == 0);
 
   // teardown
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 }
 
 // range assign()
@@ -486,15 +502,16 @@ void
 test_range_assign_2()
 {
   // setup
-  typedef gnu_copy_tracker T;
-  typedef std::vector<T, gnu_new_allocator<T> > X;
+  bool test = true;
+  typedef copy_tracker T;
+  typedef std::vector<T, tracker_alloc<T> > X;
 
   X a(7);
   X b(3);
   X::size_type old_size = a.size();
 
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 
   // assert preconditions
   VERIFY(b.size() < a.capacity());
@@ -505,27 +522,28 @@ test_range_assign_2()
   // assert postconditions
   VERIFY(a.size() == b.size());
   VERIFY(a == b);
-  VERIFY(gnu_allocator_tracker::allocationTotal() == 0);
+  VERIFY(allocation_tracker::allocationTotal() == 0);
 
   // teardown
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 }
 
 void
 test_range_assign_3()
 {
   // setup
-  typedef gnu_copy_tracker T;
-  typedef std::vector<T, gnu_new_allocator<T> > X;
+  bool test = true;
+  typedef copy_tracker T;
+  typedef std::vector<T, tracker_alloc<T> > X;
 
   X a(7);
   a.reserve(a.size() + 7);
   X b(a.size() + 3);
   X::size_type old_size = a.size();
 
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 
   // assert preconditions
   VERIFY(a.size() < b.size());
@@ -537,27 +555,28 @@ test_range_assign_3()
   // assert postconditions
   VERIFY(a.size() == b.size());
   VERIFY(a == b);
-  VERIFY(gnu_allocator_tracker::allocationTotal() == 0);
+  VERIFY(allocation_tracker::allocationTotal() == 0);
 
   // teardown
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 }
 
 void
 test_range_assign_4()
 {
   // setup
-  typedef gnu_copy_tracker T;
-  typedef std::vector<T, gnu_new_allocator<T> > X;
+  bool test = true;
+  typedef copy_tracker T;
+  typedef std::vector<T, tracker_alloc<T> > X;
 
-  gnu_allocator_tracker::resetCounts();
+  allocation_tracker::resetCounts();
   {
     X a(7);
     X b(a.capacity() + 7);
     X::size_type old_size = a.size();
 
-    gnu_copy_tracker::reset();
+    copy_tracker::reset();
 
     // assert preconditions
     VERIFY(b.size() > a.capacity());
@@ -569,29 +588,30 @@ test_range_assign_4()
     VERIFY(a.size() == b.size());
     VERIFY(a == b);
   }
-  VERIFY(gnu_allocator_tracker::allocationTotal() > 0);
-  VERIFY(gnu_allocator_tracker::allocationTotal() == gnu_allocator_tracker::deallocationTotal());
+  VERIFY(allocation_tracker::allocationTotal() > 0);
+  VERIFY(allocation_tracker::allocationTotal() == allocation_tracker::deallocationTotal());
 
   // teardown
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 }
 
 void
 test_range_assign_4_exception_guarantee()
 {
   // setup
-  typedef gnu_copy_tracker T;
-  typedef std::vector<T, gnu_new_allocator<T> > X;
+  bool test = true;
+  typedef copy_tracker T;
+  typedef std::vector<T, tracker_alloc<T> > X;
 
-  gnu_allocator_tracker::resetCounts();
+  allocation_tracker::resetCounts();
   {
     X a(7);
     X b(a.capacity() + 7);
     X::size_type old_size = a.size();
 
-    gnu_copy_tracker::reset();
-    gnu_copy_constructor::throw_on(3);
+    copy_tracker::reset();
+    copy_constructor::throw_on(3);
 
     // assert preconditions
     VERIFY(b.size() > a.capacity());
@@ -608,12 +628,12 @@ test_range_assign_4_exception_guarantee()
   }
 
   // assert postconditions
-  VERIFY(gnu_allocator_tracker::allocationTotal() > 0);
-  VERIFY(gnu_allocator_tracker::allocationTotal() == gnu_allocator_tracker::deallocationTotal());
+  VERIFY(allocation_tracker::allocationTotal() > 0);
+  VERIFY(allocation_tracker::allocationTotal() == allocation_tracker::deallocationTotal());
 
   // teardown
-  gnu_copy_tracker::reset();
-  gnu_allocator_tracker::resetCounts();
+  copy_tracker::reset();
+  allocation_tracker::resetCounts();
 }
 
 
index e72f2ca8f6f78493b15081b682469fc215b65cb0..ab873be82b5fb41b97f54f5e9fe4340cdb1be509 100644 (file)
@@ -1,6 +1,6 @@
 // 1999-01-17 bkoz test functionality of basic_filebuf for char_type == char
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -45,9 +45,10 @@ void test01()
 namespace test 
 {
   using namespace std;
+  using __gnu_cxx_test::pod_char;
   typedef short type_t;
   template class basic_filebuf<type_t, char_traits<type_t> >;
-  template class basic_filebuf<gnu_char, char_traits<gnu_char> >;
+  template class basic_filebuf<pod_char, char_traits<pod_char> >;
 } // test
 
 
index 276294d9c9d4c2c6b424cb370153657ae380e0b6..c37be6bbfcb77d17b8dd5f3ef666c22c89c7e175 100644 (file)
@@ -1,6 +1,6 @@
 // 2002-07-25 Benjamin Kosnik <bkoz@redhat.com>
 
-// Copyright (C) 2002 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2003 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
@@ -50,9 +50,10 @@ void test01()
 namespace test 
 {
   using namespace std;
+  using __gnu_cxx_test::pod_char;
   typedef short type_t;
   template class basic_fstream<type_t, char_traits<type_t> >;
-  template class basic_fstream<gnu_char, char_traits<gnu_char> >;
+  template class basic_fstream<pod_char, char_traits<pod_char> >;
 } // test
 
 int main() 
index 6cec904eb67a50009d4365fe2467166767b79c3b..c8146ea923660bd9bd7f879e996988e380ec105b 100644 (file)
@@ -1,6 +1,6 @@
 // 1999-09-20 bkoz
 
-// Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 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
@@ -50,9 +50,10 @@ void test01()
 namespace test 
 {
   using namespace std;
+  using __gnu_cxx_test::pod_char;
   typedef short type_t;
   template class basic_istream<type_t, char_traits<type_t> >;
-  template class basic_istream<gnu_char, char_traits<gnu_char> >;
+  template class basic_istream<pod_char, char_traits<pod_char> >;
 } // test
 
 int main() 
index ee764f9d69769624c6224c02c7a00c889dd73d4b..7efd65381a3183deacc8bc3e0b98682263936d8c 100644 (file)
@@ -1,6 +1,6 @@
 // 1999-09-20 bkoz
 
-// Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 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
@@ -50,9 +50,10 @@ void test01()
 namespace test 
 {
   using namespace std;
+  using __gnu_cxx_test::pod_char;
   typedef short type_t;
   template class basic_ostream<type_t, char_traits<type_t> >;
-  template class basic_ostream<gnu_char, char_traits<gnu_char> >;
+  template class basic_ostream<pod_char, char_traits<pod_char> >;
 } // test
 
 int main() 
index 102ff60c260acd54c92a55ffd754f008f1a30532..29c771b9074646eb781dcc15f844317530e7d6c6 100644 (file)
@@ -1,6 +1,6 @@
 // 2002-07-25 Benjamin Kosnik <bkoz@redhat.com>
 
-// Copyright (C) 2002 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2003 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
@@ -50,9 +50,10 @@ void test01()
 namespace test 
 {
   using namespace std;
+  using __gnu_cxx_test::pod_char;
   typedef short type_t;
   template class basic_streambuf<type_t, char_traits<type_t> >;
-  template class basic_streambuf<gnu_char, char_traits<gnu_char> >;
+  template class basic_streambuf<pod_char, char_traits<pod_char> >;
 } // test
 
 int main() 
index 3cfd5af605c2ccc892aa6d307f53489f66a7fcfb..a91deab2f1d8f6768c1e41253c44198a0fece7b7 100644 (file)
@@ -1,6 +1,6 @@
 // 2002-07-25 Benjamin Kosnik <bkoz@redhat.com>
 
-// Copyright (C) 2002 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2003 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
@@ -50,9 +50,10 @@ void test01()
 namespace test 
 {
   using namespace std;
+  using __gnu_cxx_test::pod_char;
   typedef short type_t;
   template class basic_stringbuf<type_t, char_traits<type_t> >;
-  template class basic_stringbuf<gnu_char, char_traits<gnu_char> >;
+  template class basic_stringbuf<pod_char, char_traits<pod_char> >;
 } // test
 
 int main() 
index cb9e39d9588df9c02d684f31e8571408691b7bd0..576b72d5282f0a29b9f1cdd32a1d3181935d1d72 100644 (file)
@@ -1,6 +1,6 @@
 // 2002-07-25 Benjamin Kosnik <bkoz@redhat.com>
 
-// Copyright (C) 2002 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2003 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
@@ -50,9 +50,10 @@ void test01()
 namespace test 
 {
   using namespace std;
+  using __gnu_cxx_test::pod_char;
   typedef short type_t;
   template class basic_stringstream<type_t, char_traits<type_t> >;
-  template class basic_stringstream<gnu_char, char_traits<gnu_char> >;
+  template class basic_stringstream<pod_char, char_traits<pod_char> >;
 } // test
 
 int main() 
index 92f3d2f83cc67872b80e69ecb47a7e40537e32bb..89cb34942d675aad36818338ff49f13ea1cc7157 100644 (file)
@@ -233,7 +233,7 @@ proc libstdc++-v3-list-sourcefiles { } {
        set f [open $files_file "w"]
        set where_we_were [pwd]
        cd $srcdir
-       foreach s [lsort [glob -nocomplain "{,*/}*/*.cc"]] {
+       foreach s [lsort [glob -nocomplain "*/*.cc" "*/*/*.cc" "{,*/}*/*/*/*.cc" ]] {
            lappend sfiles ${srcdir}/${s}
            puts $f $s
        }
index a4f287e008b4bb81c57aab31cd1845cf9d5dc42f..775b253502666cec71ae2d26e9339e89a3169fe0 100644 (file)
@@ -1,5 +1,7 @@
+// -*- C++ -*-
+// Testing allocator for the C++ library testsuite.
 //
-// Copyright (C) 2002 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2003 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
 
 #include <testsuite_allocator.h>
 
-gnu_allocator_tracker::size_type gnu_allocator_tracker::allocationTotal_   = 0;
-gnu_allocator_tracker::size_type gnu_allocator_tracker::deallocationTotal_ = 0;
-int                              gnu_allocator_tracker::constructCount_    = 0;
-int                              gnu_allocator_tracker::destructCount_     = 0;
+namespace __gnu_cxx_test
+{
+  allocation_tracker::size_type allocation_tracker::allocationTotal_   = 0;
+  allocation_tracker::size_type allocation_tracker::deallocationTotal_ = 0;
+  int allocation_tracker::constructCount_    = 0;
+  int allocation_tracker::destructCount_     = 0;
+}; // namespace __cxx_test
 
index 1387b5af0ec804b09ff14c5df0dfcdd047aa528a..3c77260f5d50420dc709ad3adf0e5c03f8c46e77 100644 (file)
@@ -1,6 +1,7 @@
+// -*- C++ -*-
 // Testing allocator for the C++ library testsuite.
 //
-// Copyright (C) 2002 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2003 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
 #include <cstddef>
 #include <limits>
 
-class gnu_allocator_tracker
+namespace __gnu_cxx_test
 {
- public:
-  typedef std::size_t    size_type; 
-  
-  static void*
-  allocate(size_type blocksize)
+  class allocation_tracker
   {
-    allocationTotal_ += blocksize;
-    return ::operator new(blocksize);
-  }
-
-  static void
-  construct()
-  { constructCount_++; }
-
-  static void
-  destroy()
-  { destructCount_++; }
-
-  static void
-  deallocate(void* p, size_type blocksize)
-  {
-    ::operator delete(p);
-    deallocationTotal_ += blocksize;
-  }
-
-  static size_type
-  allocationTotal() 
-  { return allocationTotal_; }
+  public:
+    typedef std::size_t    size_type; 
+    
+    static void*
+    allocate(size_type blocksize)
+    {
+      allocationTotal_ += blocksize;
+      return ::operator new(blocksize);
+    }
+    
+    static void
+    construct() { constructCount_++; }
 
-  static size_type
-  deallocationTotal()
-  { return deallocationTotal_; }
+    static void
+    destroy() { destructCount_++; }
 
-  static int
-  constructCount() 
-  { return constructCount_; }
+    static void
+    deallocate(void* p, size_type blocksize)
+    {
+      ::operator delete(p);
+      deallocationTotal_ += blocksize;
+    }
+    
+    static size_type
+    allocationTotal() { return allocationTotal_; }
+    
+    static size_type
+    deallocationTotal() { return deallocationTotal_; }
+    
+    static int
+    constructCount() { return constructCount_; }
 
-  static int
-  destructCount() 
-  { return destructCount_; }
+    static int
+    destructCount() { return destructCount_; }
     
-  static void
-  resetCounts()
-  {
-    allocationTotal_ = 0;
-    deallocationTotal_ = 0;
-    constructCount_ = 0;
+    static void
+    resetCounts()
+    {
+      allocationTotal_ = 0;
+      deallocationTotal_ = 0;
+      constructCount_ = 0;
     destructCount_ = 0;
-  }
+    }
 
  private:
-  static size_type  allocationTotal_;
-  static size_type  deallocationTotal_;
-  static int        constructCount_;
-  static int        destructCount_;
-};
-
-// A simple basic allocator that just forwards to the
-// gnu_allocator_tracker to fulfill memory requests.  This class is
-// templated on the target object type, but gnu_allocator_tracker
-// isn't.
-template<class T>
-  class gnu_new_allocator
+    static size_type  allocationTotal_;
+    static size_type  deallocationTotal_;
+    static int        constructCount_;
+    static int        destructCount_;
+  };
+
+  // A simple basic allocator that just forwards to the
+  // allocation_tracker to fulfill memory requests.  This class is
+  // templated on the target object type, but tracker isn't.
+  template<class T>
+  class tracker_alloc
   {
   public:
     typedef T              value_type;
@@ -112,7 +108,7 @@ template<class T>
     typedef std::size_t    size_type; 
     typedef std::ptrdiff_t difference_type; 
     
-    template<class U> struct rebind { typedef gnu_new_allocator<U> other; };
+    template<class U> struct rebind { typedef tracker_alloc<U> other; };
     
     pointer
     address(reference value) const
@@ -122,17 +118,17 @@ template<class T>
     address(const_reference value) const
     { return &value; }
     
-    gnu_new_allocator() throw()
+    tracker_alloc() throw()
     { }
 
-    gnu_new_allocator(const gnu_new_allocator&) throw()
+    tracker_alloc(const tracker_alloc&) throw()
     { }
 
     template<class U>
-      gnu_new_allocator(const gnu_new_allocator<U>&) throw()
+      tracker_alloc(const tracker_alloc<U>&) throw()
       { }
 
-    ~gnu_new_allocator() throw()
+    ~tracker_alloc() throw()
     { }
 
     size_type
@@ -140,42 +136,40 @@ template<class T>
     { return std::numeric_limits<std::size_t>::max() / sizeof(T); }
 
     pointer
-    allocate(size_type num, const void* = 0)
+    allocate(size_type n, const void* = 0)
     { 
-      return static_cast<pointer>(gnu_allocator_tracker::allocate(num * 
-                                                                 sizeof(T))); 
+      return static_cast<pointer>(allocation_tracker::allocate(n * sizeof(T)));
     }
 
     void
     construct(pointer p, const T& value)
     {
       new (p) T(value);
-      gnu_allocator_tracker::construct();
+      allocation_tracker::construct();
     }
 
     void
     destroy(pointer p)
     {
       p->~T();
-      gnu_allocator_tracker::destroy();
+      allocation_tracker::destroy();
     }
 
     void
     deallocate(pointer p, size_type num)
-    { gnu_allocator_tracker::deallocate(p, num * sizeof(T)); }
+    { allocation_tracker::deallocate(p, num * sizeof(T)); }
   };
 
-template<class T1, class T2>
-  bool
-  operator==(const gnu_new_allocator<T1>&, 
-            const gnu_new_allocator<T2>&) throw()
-  { return true; }
-
-template<class T1, class T2>
-  bool
-  operator!=(const gnu_new_allocator<T1>&, 
-            const gnu_new_allocator<T2>&) throw()
-  { return false; }
+  template<class T1, class T2>
+    bool
+    operator==(const tracker_alloc<T1>&, const tracker_alloc<T2>&) throw()
+    { return true; }
+
+  template<class T1, class T2>
+    bool
+    operator!=(const tracker_alloc<T1>&, const tracker_alloc<T2>&) throw()
+    { return false; }
+}; // namespace __gnu_cxx_test
 
 #endif // _GLIBCPP_TESTSUITE_ALLOCATOR_H
 
index 931dd378193019a59277943b3c379f79e4b38a76..4e714fa6cbaf501c238c79fc99cb7432f58c07f2 100644 (file)
@@ -1,6 +1,7 @@
-// Utility subroutines for the C++ library testsuite.
+// -*- C++ -*-
+// Utility subroutines for the C++ library testsuite. 
 //
-// Copyright (C) 2002 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2003 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
 #include <unistd.h>
 #include <sys/time.h>
 #include <sys/resource.h>
+#endif
+#include <list>
+#include <string>
+#include <stdexcept>
+#include <clocale>
+#include <locale>
 
-void
-__set_testsuite_memlimit(float __size)
+namespace __gnu_cxx_test
 {
+#ifdef _GLIBCPP_MEM_LIMITS
+  void 
+  set_memory_limits(float size)
+  {
     struct rlimit r;
     // Cater to the absence of rlim_t.
-    __typeof__ (r.rlim_cur) limit
-      = (__typeof__ (r.rlim_cur))(__size * 1048576);
+    __typeof__ (r.rlim_cur) limit = (__typeof__ (r.rlim_cur))(size * 1048576);
 
     // Heap size, seems to be common.
 #if _GLIBCPP_HAVE_MEMLIMIT_DATA
@@ -69,19 +78,90 @@ __set_testsuite_memlimit(float __size)
     r.rlim_cur = limit;
     setrlimit(RLIMIT_AS, &r);
 #endif
-}
+  }
+
 #else
-void
-__set_testsuite_memlimit(float) { }
-#endif /* _GLIBCPP_MEM_LIMITS */
+  void
+  set_memory_limits(float) { }
+#endif 
+
+  // Useful exceptions.
+  class locale_data : public std::runtime_error 
+  {
+  public:
+    explicit 
+    locale_data(const std::string&  __arg) : runtime_error(__arg) { }
+  };
 
+  class environment_variable: public std::runtime_error 
+  {
+  public:
+    explicit 
+    environment_variable(const std::string&  __arg) : runtime_error(__arg) { }
+  };
 
-gnu_counting_struct::size_type  gnu_counting_struct::count = 0;
+  class not_found : public std::runtime_error 
+  {
+  public:
+    explicit 
+    not_found(const std::string&  __arg) : runtime_error(__arg) { }
+  };
 
-unsigned int gnu_copy_constructor::count_ = 0;
-unsigned int gnu_copy_constructor::throw_on_ = 0;
-unsigned int gnu_assignment_operator::count_ = 0;
-unsigned int gnu_assignment_operator::throw_on_ = 0;
-unsigned int gnu_destructor::count_ = 0;
-int gnu_copy_tracker::next_id_ = 0;
+  void 
+  run_tests_wrapped_locale(const char* name, const func_callback& l)
+  {
+    using namespace std;
+    bool test = true;
+    
+    // Set the global locale. 
+    locale loc_name(name);
+    locale orig = locale::global(loc_name);
+    
+    const char* res = setlocale(LC_ALL, name);
+    if (res != NULL)
+      {
+       string preLC_ALL = res;
+       for (func_callback::const_iterator i = l.begin(); i != l.end(); ++i)
+         (*i)();
+       string postLC_ALL= setlocale(LC_ALL, NULL);
+       VERIFY( preLC_ALL == postLC_ALL );
+      }
+    else
+      throw environment_variable(string("LC_ALL for") + string(name));
+  }
+  
+  void 
+  run_tests_wrapped_env(const char* name, const char* env,
+                       const func_callback& l)
+  {
+    using namespace std;
+    bool test = true;
+    
+#ifdef _GLIBCPP_HAVE_SETENV 
+    // Set the global locale. 
+    locale loc_name(name);
+    locale orig = locale::global(loc_name);
+
+    // Set environment variable env to value in name. 
+    const char* oldENV = getenv(env);
+    if (!setenv(env, name, 1))
+      {
+       for (func_callback::const_iterator i = l.begin(); i != l.end(); ++i)
+         (*i)();
+       setenv(env, oldENV ? oldENV : "", 1);
+      }
+    else
+      throw environment_variable(string(env) + string(" to ") + string(name));
+#else
+    throw not_found("setenv");
+#endif
+  }
 
+  counter::size_type  counter::count = 0;
+  unsigned int copy_constructor::count_ = 0;
+  unsigned int copy_constructor::throw_on_ = 0;
+  unsigned int assignment_operator::count_ = 0;
+  unsigned int assignment_operator::throw_on_ = 0;
+  unsigned int destructor::_M_count = 0;
+  int copy_tracker::next_id_ = 0;
+}; // namespace __cxx_test
index 9f89b03a77200a5f4b97c47611c4b2a781d608be..cd05443dacd33a8b6e8dd399365031e72dda532b 100644 (file)
@@ -1,6 +1,7 @@
-// Utility subroutines for the C++ library testsuite.
+// -*- C++ -*-
+// Utility subroutines for the C++ library testsuite. 
 //
-// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001, 2002, 2003 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
 //   #define(able) assert() behavior for debugging/testing. It may be
 //   a suitable location for other furry woodland creatures as well.
 //
-// 2)  __set_testsuite_memlimit()
-//   __set_testsuite_memlimit() uses setrlimit() to restrict dynamic memory
+// 2)  set_memory_limits()
+//   set_memory_limits() uses setrlimit() to restrict dynamic memory
 //   allocation.  We provide a default memory limit if none is passed by the
-//   calling application.  The argument to __set_testsuite_memlimit() is the
+//   calling application.  The argument to set_memory_limits() is the
 //   limit in megabytes (a floating-point number).  If _GLIBCPP_MEM_LIMITS is
 //   not #defined before including this header, then no limiting is attempted.
 //
-// 3)  gnu_counting_struct
+// 3)  counter
 //   This is a POD with a static data member, gnu_counting_struct::count,
 //   which starts at zero, increments on instance construction, and decrements
 //   on instance destruction.  "assert_count(n)" can be called to VERIFY()
 //   that the count equals N.
 //
-// 4)  gnu_copy_tracker, from Stephen M. Webb <stephen@bregmasoft.com>.
+// 4)  copy_tracker, from Stephen M. Webb <stephen@bregmasoft.com>.
 //   A class with nontrivial ctor/dtor that provides the ability to track the
 //   number of copy ctors and dtors, and will throw on demand during copy.
 //
-// 5) gnu_char, gnu_char_traits, abstract character classes and
-// char_traits specializations for testing instantiations.
+// 5) pod_char, pod_int, , abstract character classes and
+//   char_traits specializations for testing instantiations.
 
 #ifndef _GLIBCPP_TESTSUITE_HOOKS_H
 #define _GLIBCPP_TESTSUITE_HOOKS_H
 #include <bits/c++config.h>
 #include <bits/functexcept.h>
 #include <cstddef>
-
 #ifdef DEBUG_ASSERT
 # include <cassert>
 # define VERIFY(fn) assert(fn)
 #else
 # define VERIFY(fn) test &= (fn)
 #endif
+#include <list>
 
-// Defined in GLIBCPP_CONFIGURE_TESTSUITE.
-#ifndef _GLIBCPP_MEM_LIMITS
-// Don't do memory limits.
-extern void
-__set_testsuite_memlimit(float x = 0);
+namespace __gnu_cxx_test
+{
+  // All macros are defined in GLIBCPP_CONFIGURE_TESTSUITE and imported
+  // from c++config.h
 
+  // Set memory limits if possible, if not set to 0.
+#ifndef _GLIBCPP_MEM_LIMITS
+#  define MEMLIMIT_MB 0
 #else
-
-// Do memory limits.
-#ifndef MEMLIMIT_MB
-#define MEMLIMIT_MB 16.0
+# ifndef MEMLIMIT_MB
+#  define MEMLIMIT_MB 16.0
+# endif
 #endif
+  extern void
+  set_memory_limits(float __size = MEMLIMIT_MB);
 
-extern void
-__set_testsuite_memlimit(float __size = MEMLIMIT_MB);
-#endif
+  // Simple callback structure for variable numbers of tests (all with
+  // same signature).  Assume all unit tests are of the signature
+  // void test01(); 
+  typedef void (*test_func) (void);
+  typedef std::list<test_func> func_callback;
 
+  // Run select unit tests after setting global locale.
+  void 
+  run_tests_wrapped_locale(const char*, const func_callback&);
 
-struct gnu_counting_struct
-{
+  // Run select unit tests after setting environment variables.
+  void 
+  run_tests_wrapped_env(const char*, const char*, const func_callback&);
+
+  // Test data types.
+  struct pod_char
+  {
+    unsigned char c;
+  };
+  
+  struct pod_int
+  {
+    int i;
+  };
+  
+  struct pod_unsigned_int
+  {
+    unsigned int i;
+  };
+  
+  struct pod_long
+  {
+    unsigned long i;
+  };
+  
+  struct state
+  {
+    unsigned long l;
+    unsigned long l2;
+  };
+
+  // Counting.
+  struct counter
+  {
     // Specifically and glaringly-obviously marked 'signed' so that when
     // COUNT mistakenly goes negative, we can track the patterns of
     // deletions more easily.
     typedef  signed int     size_type;
     static size_type   count;
-    gnu_counting_struct() { ++count; }
-    gnu_counting_struct (const gnu_counting_struct&) { ++count; }
-    ~gnu_counting_struct() { --count; }
-};
-
-#define assert_count(n)   VERIFY(gnu_counting_struct::count == n)
-
-// A (static) class for counting copy constructors and possibly throwing an
-// exception on a desired count.
-class gnu_copy_constructor
-{
-public:
-  static unsigned int
-  count()
-  { return count_; }
-
-  static void
-  mark_call()
+    counter() { ++count; }
+    counter (const counter&) { ++count; }
+    ~counter() { --count; }
+  };
+  
+#define assert_count(n)   VERIFY(__gnu_cxx_test::counter::count == n)
+  
+  // A (static) class for counting copy constructors and possibly throwing an
+  // exception on a desired count.
+  class copy_constructor
   {
-    count_++;
-    if (count_ == throw_on_)
+  public:
+    static unsigned int
+    count() { return count_; }
+    
+    static void
+    mark_call()
     {
-      __throw_exception_again "copy constructor exception";
+      count_++;
+      if (count_ == throw_on_)
+       __throw_exception_again "copy constructor exception";
     }
-  }
+      
+    static void
+    reset()
+    {
+      count_ = 0;
+      throw_on_ = 0;
+    }
+      
+    static void
+    throw_on(unsigned int count) { throw_on_ = count; }
 
-  static void
-  reset()
+  private:
+    static unsigned int count_;
+    static unsigned int throw_on_;
+  };
+  
+  // A (static) class for counting assignment operator calls and
+  // possibly throwing an exception on a desired count.
+  class assignment_operator
   {
-    count_ = 0;
-    throw_on_ = 0;
-  }
-
-  static void
-  throw_on(unsigned int count)
-  { throw_on_ = count; }
-
-private:
-  static unsigned int count_;
-  static unsigned int throw_on_;
-};
-
-// A (static) class for counting assignment operator calls and possibly
-// throwing an exception on a desired count.
-class gnu_assignment_operator
-{
-public:
-  static unsigned int
-  count()
-  { return count_; }
+  public:
+    static unsigned int
+    count() { return count_; }
+    
+    static void
+    mark_call()
+    {
+      count_++;
+      if (count_ == throw_on_)
+       __throw_exception_again "assignment operator exception";
+    }
 
-  static void
-  mark_call()
-  {
-    count_++;
-    if (count_ == throw_on_)
+    static void
+    reset()
     {
-      __throw_exception_again "assignment operator exception";
+      count_ = 0;
+      throw_on_ = 0;
     }
-  }
 
-  static void
-  reset()
-  {
-    count_ = 0;
-    throw_on_ = 0;
-  }
+    static void
+    throw_on(unsigned int count) { throw_on_ = count; }
 
-  static void
-  throw_on(unsigned int count)
-  { throw_on_ = count; }
+  private:
+    static unsigned int count_;
+    static unsigned int throw_on_;
+  };
+  
+  // A (static) class for tracking calls to an object's destructor.
+  class destructor
+  {
+  public:
+    static unsigned int
+    count() { return _M_count; }
+    
+    static void
+    mark_call() { _M_count++; }
 
-private:
-  static unsigned int count_;
-  static unsigned int throw_on_;
-};
+    static void
+    reset() { _M_count = 0; }
 
-// A (static) class for tracking calls to an object's destructor.
-class gnu_destructor
-{
-public:
-  static unsigned int
-  count()
-  { return count_; }
-
-  static void
-  mark_call()
-  { count_++; }
-
-  static void
-  reset()
-  { count_ = 0; }
-
-private:
-  static unsigned int count_;
-};
-
-// An class of objects that can be used for validating various behaviours and
-// guarantees of containers and algorithms defined in the standard library.
-class gnu_copy_tracker
-{
+  private:
+    static unsigned int _M_count;
+  };
+  
+  // An class of objects that can be used for validating various
+  // behaviours and guarantees of containers and algorithms defined in
+  // the standard library.
+  class copy_tracker
+  {
   public:
-    // Creates a copy-tracking object with the given ID number.
-    // If "throw_on_copy" is set, an exception will be thrown if
-    // an attempt is made to copy this object.
-    gnu_copy_tracker(int id = next_id_--, bool throw_on_copy = false)
-    : id_(id)
-    , throw_on_copy_(throw_on_copy)
-    {
-    }
+    // Creates a copy-tracking object with the given ID number.  If
+    // "throw_on_copy" is set, an exception will be thrown if an
+    // attempt is made to copy this object.
+    copy_tracker(int id = next_id_--, bool throw_on_copy = false)
+    : id_(id) , throw_on_copy_(throw_on_copy) { }
 
     // Copy-constructs the object, marking a call to the copy
     // constructor and forcing an exception if indicated.
-    gnu_copy_tracker(const gnu_copy_tracker& rhs)
+    copy_tracker(const copy_tracker& rhs)
     : id_(rhs.id()), throw_on_copy_(rhs.throw_on_copy_)
     {
       int kkk = throw_on_copy_;
       if (throw_on_copy_)
-      {
-        gnu_copy_constructor::throw_on(gnu_copy_constructor::count() + 1);
-      }
-      gnu_copy_constructor::mark_call();
+       copy_constructor::throw_on(copy_constructor::count() + 1);
+      copy_constructor::mark_call();
     }
 
     // Assigns the value of another object to this one, tracking the
     // number of times this member function has been called and if the
     // other object is supposed to throw an exception when it is
     // copied, well, make it so.
-    gnu_copy_tracker&
-    operator=(const gnu_copy_tracker& rhs)
+    copy_tracker&
+    operator=(const copy_tracker& rhs)
     { 
       id_ = rhs.id();
       if (rhs.throw_on_copy_)
-      {
-        gnu_assignment_operator::throw_on(gnu_assignment_operator::count() 
-                                         + 1);
-      }
-      gnu_assignment_operator::mark_call();
+        assignment_operator::throw_on(assignment_operator::count() + 1);
+      assignment_operator::mark_call();
     }
 
-    ~gnu_copy_tracker()
-    { gnu_destructor::mark_call(); }
+    ~copy_tracker()
+    { destructor::mark_call(); }
 
     int
-    id() const
-    { return id_; }
+    id() const { return id_; }
 
   private:
     int   id_;
@@ -248,59 +270,44 @@ class gnu_copy_tracker
     static void
     reset()
     {
-      gnu_copy_constructor::reset();
-      gnu_assignment_operator::reset();
-      gnu_destructor::reset();
+      copy_constructor::reset();
+      assignment_operator::reset();
+      destructor::reset();
     }
 
     // for backwards-compatibility
     static int
     copyCount() 
-    { return gnu_copy_constructor::count(); }
+    { return copy_constructor::count(); }
 
     // for backwards-compatibility
     static int
     dtorCount() 
-    { return gnu_destructor::count(); }
+    { return destructor::count(); }
 
   private:
     static int next_id_;
-};
-
-inline bool
-operator==(const gnu_copy_tracker& lhs, const gnu_copy_tracker& rhs)
-{ return lhs.id() == rhs.id(); }
-
-struct gnu_char
-{
-  unsigned long c;
-};
+  };
 
-struct gnu_int
-{
-  unsigned long i;
-};
-
-struct gnu_state
-{
-  unsigned long l;
-  unsigned long l2;
-};
+  inline bool
+  operator==(const copy_tracker& lhs, const copy_tracker& rhs)
+  { return lhs.id() == rhs.id(); }
+}; // namespace __gnu_cxx_test
 
-// char_traits specialization
 namespace std
 {
   template<class _CharT>
     struct char_traits;
 
+  // char_traits specialization
   template<>
-    struct char_traits<gnu_char>
+    struct char_traits<__gnu_cxx_test::pod_char>
     {
-      typedef gnu_char                 char_type;
-      typedef gnu_int                  int_type;
-      typedef long             pos_type;
-      typedef unsigned long    off_type;
-      typedef gnu_state        state_type;
+      typedef __gnu_cxx_test::pod_char char_type;
+      typedef __gnu_cxx_test::pod_int          int_type;
+      typedef long                     pos_type;
+      typedef unsigned long            off_type;
+      typedef __gnu_cxx_test::state    state_type;
       
       static void 
       assign(char_type& __c1, const char_type& __c2);