stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From far...@apache.org
Subject svn commit: r510071 [4/5] - in /incubator/stdcxx/trunk/tests: algorithms/ containers/ include/ numerics/ self/ src/ utilities/
Date Wed, 21 Feb 2007 15:58:56 GMT
Modified: incubator/stdcxx/trunk/tests/containers/23.vector.modifiers.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/containers/23.vector.modifiers.cpp?view=diff&rev=510071&r1=510070&r2=510071
==============================================================================
--- incubator/stdcxx/trunk/tests/containers/23.vector.modifiers.cpp (original)
+++ incubator/stdcxx/trunk/tests/containers/23.vector.modifiers.cpp Wed Feb 21 07:58:53 2007
@@ -6,22 +6,23 @@
  *
  ***************************************************************************
  *
- * Copyright 2006 The Apache Software Foundation or its licensors,
- * as applicable.
+ * Licensed to the Apache Software  Foundation (ASF) under one or more
+ * contributor  license agreements.  See  the NOTICE  file distributed
+ * with  this  work  for  additional information  regarding  copyright
+ * ownership.   The ASF  licenses this  file to  you under  the Apache
+ * License, Version  2.0 (the  "License"); you may  not use  this file
+ * except in  compliance with the License.   You may obtain  a copy of
+ * the License at
  *
- * Copyright 2006 Rogue Wave Software.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * distributed under the  License is distributed on an  "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+ * implied.   See  the License  for  the  specific language  governing
+ * permissions and limitations under the License.
+ *
+ * Copyright 2006 Rogue Wave Software.
  * 
  **************************************************************************/
 
@@ -32,6 +33,7 @@
 
 #include <rw_printf.h>
 #include <alg_test.h>
+#include <rw_value.h>   // for UserClass
 #include <driver.h>
 
 #ifndef _RWSTD_NO_REPLACEABLE_NEW_DELETE
@@ -55,7 +57,7 @@
 
 /**************************************************************************/
 
-typedef std::vector<X, std::allocator<X> > Vector;
+typedef std::vector<UserClass, std::allocator<UserClass> > Vector;
 
 Vector::size_type new_capacity;
 
@@ -96,7 +98,7 @@
 template <class Iterator>
 void exception_loop (int line, const char *fcall, bool capchg,
                      Vector &vec, const Vector::iterator &it,
-                     int n, const X *x,
+                     int n, const UserClass *x,
                      const Iterator &first, const Iterator &last,
                      std::size_t *n_copy, std::size_t *n_asgn)
 {
@@ -117,13 +119,13 @@
     // finally succeeds (i.e, no exception is thrown)
     for ( ; ; ) {
 
-        *n_copy = X::n_total_copy_ctor_;
-        *n_asgn = X::n_total_op_assign_;
+        *n_copy = UserClass::n_total_copy_ctor_;
+        *n_asgn = UserClass::n_total_op_assign_;
 
 #ifndef _RWSTD_NO_EXCEPTIONS
 
         // detect objects constructed but not destroyed after an exception
-        const std::size_t count = X::count_;
+        const std::size_t count = UserClass::count_;
 
 #  ifndef _RWSTD_NO_REPLACEABLE_NEW_DELETE
 
@@ -135,8 +137,8 @@
 
         // create "deep" copies of the iterators to thwart
         // InpuIter's multi-pass detection
-        const Iterator beg = copy_iter (first, (X*)0);
-        const Iterator end = copy_iter (last, (X*)0);
+        const Iterator beg = copy_iter (first, (UserClass*)0);
+        const Iterator end = copy_iter (last, (UserClass*)0);
 
 #ifndef _RWSTD_NO_EXCEPTIONS
 #  ifndef _RWSTD_NO_REPLACEABLE_NEW_DELETE
@@ -195,10 +197,10 @@
                        __LINE__, fcall, vec.begin () - begin);
 
 
-            rw_assert (count == X::count_, 0, line,
+            rw_assert (count == UserClass::count_, 0, line,
                        "line %d: %s: leaked %d objects "
                        "after an exception",
-                       __LINE__, fcall, X::count_ - count);
+                       __LINE__, fcall, UserClass::count_ - count);
 
             // increment to allow this call to operator new to succeed
             // and force the next one to fail, and try to insert again
@@ -249,9 +251,10 @@
 
 #endif   // _RWSTD_NO_REPLACEABLE_NEW_DELETE
 
-    // compute the number of calls to X copy ctor and assignment operator
-    *n_copy = X::n_total_copy_ctor_ - *n_copy;
-    *n_asgn = X::n_total_op_assign_ - *n_asgn;
+    // compute the number of calls to UserClass copy ctor
+    // and assignment operator
+    *n_copy = UserClass::n_total_copy_ctor_ - *n_copy;
+    *n_asgn = UserClass::n_total_op_assign_ - *n_asgn;
 }
 
 /**************************************************************************/
@@ -270,10 +273,10 @@
                   const char     *res,      // resulting sequence
                   std::size_t     reslen    /* length of resulting sequence */)
 {
-    // create arrays of `seqlen' and `inslen' elements of type X
+    // create arrays of `seqlen' and `inslen' elements of type UserClass
     // initialized from the sequences `seq' and `ins', respectively
-    const X* const xseq = X::from_char (seq, seqlen);
-          X* const xins = X::from_char (ins, inslen);
+    const UserClass* const xseq = UserClass::from_char (seq, seqlen);
+          UserClass* const xins = UserClass::from_char (ins, inslen);
 
     // construct a std::vector from the sequence of elements
     Vector vec = seqlen ? Vector (xseq, xseq + seqlen) : Vector ();
@@ -310,8 +313,8 @@
     // determine whether the insertion must or must not change capacity
     const bool capchg = seqlen + (n < 0 ? inslen : n) > seqcap;
 
-    std::size_t n_copy = X::n_total_copy_ctor_;
-    std::size_t n_asgn = X::n_total_op_assign_;
+    std::size_t n_copy = UserClass::n_total_copy_ctor_;
+    std::size_t n_asgn = UserClass::n_total_op_assign_;
 
     if (-2 == n) {
 
@@ -432,17 +435,17 @@
     rw_assert (expect_copy >= n_copy,
                0, line, 
                "line %d: %s: expected at most %zu "
-               "invocation(s) of X::X(const X&), got %zu", 
-               __LINE__, fcall, expect_copy, n_copy);
+               "invocation(s) of UserClass::UserClass(const UserClass&), "
+               "got %zu", __LINE__, fcall, expect_copy, n_copy);
 
     rw_assert (expect_asgn >= n_asgn,
                0, line,
                "line %d: %s: expected at most %zu invocation(s) "
-               "of X::operator=(const X&), got %zu",
+               "of UserClass::operator=(const UserClass&), got %zu",
                __LINE__, fcall, expect_asgn, n_asgn);
     
     delete [] xins;
-    delete [] _RWSTD_CONST_CAST (X*, xseq);
+    delete [] _RWSTD_CONST_CAST (UserClass*, xseq);
 }
 
 /**************************************************************************/
@@ -453,12 +456,12 @@
     // exercise vector::insert(iterator, const_reference)
 
     rw_info (0, 0, 0, 
-             "std::vector<X>::insert(iterator, const_reference)");
+             "std::vector<UserClass>::insert(iterator, const_reference)");
 
 #undef  TEST
 #define TEST(seq, seqcap, off, ins, res) do {   \
       const char insseq [] = { ins, '\0' };     \
-      test_insert (__LINE__, (X*)0, -2,         \
+      test_insert (__LINE__, (UserClass*)0, -2, \
                    seq, sizeof seq - 1,         \
                    std::size_t (seqcap), off,   \
                    insseq, 1,                   \
@@ -496,13 +499,13 @@
     // exercise vector::insert(iterator, size_type, const_reference)
 
     rw_info (0, 0, 0, 
-             "std::vector<X>::insert(iterator, "
+             "std::vector<UserClass>::insert(iterator, "
              "size_type, const_reference)");
 
 #undef TEST
 #define TEST(seq, seqcap, off, n, ins, res) do {        \
       const char insseq [] = { ins, '\0' };             \
-      test_insert (__LINE__, (X*)0, n,                  \
+      test_insert (__LINE__, (UserClass*)0, n,          \
                    seq, sizeof seq - 1,                 \
                    std::size_t (seqcap), off,           \
                    insseq, 1,                           \
@@ -543,10 +546,10 @@
 template <class Iterator>
 void test_insert_range (const Iterator &dummy)
 {
-    static const char* const itname = type_name (dummy, (X*)0);
+    static const char* const itname = type_name (dummy, (UserClass*)0);
 
     rw_info (0, 0, 0, 
-             "std::vector<X>::insert(iterator, %s, %s)",
+             "std::vector<UserClass>::insert(iterator, %s, %s)",
              itname, itname);
 
 #undef  TEST
@@ -685,7 +688,7 @@
     // (see also PR #30615)
 
     rw_info (0, 0, 0, 
-             "std::vector<X>::insert (end(), const_reference)");
+             "std::vector<UserClass>::insert (end(), const_reference)");
 
     typedef Vector::size_type size_type;
 
@@ -708,31 +711,31 @@
         // performed in (amortized) constant time
         while (v.size () < nextcap) {
 
-            n_copy = X::n_total_copy_ctor_;
-            n_asgn = X::n_total_op_assign_;
+            n_copy = UserClass::n_total_copy_ctor_;
+            n_asgn = UserClass::n_total_op_assign_;
 
             v.insert (v.end (), Vector::value_type ());
 
             rw_assert (nextcap >= v.capacity (), 0, __LINE__,
-                       "vector<X>::insert (end(), value_type()); "
+                       "vector<UserClass>::insert (end(), value_type()); "
                        "capacity == %zu, got %zu after %zu insertions",
                        nextcap, v.capacity (), v.size ());
 
             if (nextcap < v.capacity ())  break;
 
             // compute the number of copy ctor and assignment operator calls
-            n_copy = X::n_total_copy_ctor_ - n_copy;
-            n_asgn = X::n_total_op_assign_ - n_asgn;
+            n_copy = UserClass::n_total_copy_ctor_ - n_copy;
+            n_asgn = UserClass::n_total_op_assign_ - n_asgn;
 
             // verify that the copy ctor was invoked exactly once
             rw_assert (1U == n_copy, 0, __LINE__,
-                       "vector<X>::insert (end(), value_type()); "
+                       "vector<UserClass>::insert (end(), value_type()); "
                        "expected 1 invocation of the copy ctor, got %zu",
                        n_copy);
 
             // verify that the assignment operator was not invoked
             rw_assert (n_asgn == 0, 0, __LINE__,
-                       "vector<X>::insert (end(), value_type()); "
+                       "vector<UserClass>::insert (end(), value_type()); "
                        "expected 0 invocations of the assignment "
                        "operator, got %zu", n_asgn);
         }
@@ -741,7 +744,7 @@
         v.insert (v.end (), Vector::value_type ());
 
         rw_assert (v.capacity () > nextcap, 0, __LINE__,
-                   "vector<X>::insert (end(), value_type()); "
+                   "vector<UserClass>::insert (end(), value_type()); "
                    "capacity > %zu, got %zu after %zu insertions",
                    nextcap, v.capacity (), v.size ());
     }
@@ -754,15 +757,19 @@
 
 void test_complexity () 
 {
-    rw_info (0, 0, 0, "std::vector<X>::insert(iterator, const_reference)");
-    rw_info (0, 0, 0, "std::ector<X>::insert(iterator, size_type, "
+    rw_info (0, 0, 0, "std::vector<UserClass>::insert(iterator, "
+                      "const_reference)");
+    rw_info (0, 0, 0, "std::ector<UserClass>::insert(iterator, size_type, "
                       "const_reference)");
-    rw_info (0, 0, 0, "template <class InputIterator> std::vector<X>::insert"
+    rw_info (0, 0, 0, "template <class InputIterator> "
+                      "std::vector<UserClass>::insert"
                       "(iterator, InputIterator, InputIterator)");
-    rw_info (0, 0, 0, "std::vector<X>::erase(iterator)");
-    rw_info (0, 0, 0, "std::vector<X>::erase(iterator, iterator)");
+    rw_info (0, 0, 0, "std::vector<UserClass>::erase(iterator)");
+    rw_info (0, 0, 0, "std::vector<UserClass>::erase(iterator, iterator)");
     
-    typedef std::vector<X, std::allocator<X> > Vector;
+    typedef std::vector<UserClass, std::allocator<UserClass> > Vector;
+    typedef Vector::iterator                                   VectorIter;
+    typedef Vector::size_type                                  VectorSize;
     
     bool success = true;
 
@@ -770,22 +777,22 @@
     Vector v1;
     Vector v2;
 
-    Vector::iterator it = v0.begin ();
-    Vector::iterator it1 = v1.begin ();
-    Vector::iterator it2 = v2.begin ();
+    VectorIter it = v0.begin ();
+    VectorIter it1 = v1.begin ();
+    VectorIter it2 = v2.begin ();
 
-    Vector::size_type i;
+    VectorSize i;
     
     for (i = 0; i < rw_opt_nloops; i++) {
         // initialize the current size, capacity and begin iterator variables
-        Vector::size_type v0_size = v0.size ();
-        Vector::size_type v0_cap = v0.capacity ();
-        Vector::iterator v0_beg = v0.begin ();
+        VectorSize v0_size = v0.size ();
+        VectorSize v0_cap = v0.capacity ();
+        VectorIter v0_beg = v0.begin ();
 
-        X val;
+        UserClass val;
         
-        // reset the X totals
-        X::reset_totals ();
+        // reset the UserClass totals
+        UserClass::reset_totals ();
         
         // inseert val into the vector
         it = v0.insert (it, val);
@@ -794,39 +801,40 @@
         //               is greater than the old capacity
         rw_assert (v0_cap <= v0.size () || v0_beg == v0.begin (), 
                    0, __LINE__,
-                   "vector<X>::insert(iterator, const_reference) "
+                   "vector<UserClass>::insert(iterator, const_reference) "
                    "invalidated iterators w/o reallocation");
         
         // make sure that the vector is now one element larger
         rw_assert (v0.size () == v0_size + 1, 
                    0, __LINE__,
-                   "vector<X>::insert(iterator, const_reference); "
+                   "vector<UserClass>::insert(iterator, const_reference); "
                    "new size = %zu, expected %zu", v0.size (), v0_size + 1);
         
         // make sure that the returned iterator points to the new value
         rw_assert (*it == val, 
                    0, __LINE__,
-                   "vector<X>::insert(iterator, const_reference); "
+                   "vector<UserClass>::insert(iterator, const_reference); "
                    "returned iterator doesn't point at inserted value");
         
         // 23.2.4.3, p2: the complexity is linear in the number of elements
         //               in the range [first, last) plus the distance to the
         //               end of the vector.
         if(v0.begin () != v0_beg) {
-            rw_assert ((Vector::size_type)X::n_total_copy_ctor_ == v0.size (),
+            rw_assert ((VectorSize)UserClass::n_total_copy_ctor_ == v0.size (),
                        0, __LINE__, 
-                       "vector<X>::insert() - fails complexity "
+                       "vector<UserClass>::insert() - fails complexity "
                        "copy_ctor called %zu; size = %zu",
-                       X::n_total_copy_ctor_, v0.size ());
+                       UserClass::n_total_copy_ctor_, v0.size ());
         }
         else {
-            rw_assert (   (X::n_total_copy_ctor_ + X::n_total_op_assign_) 
+            rw_assert (   (UserClass::n_total_copy_ctor_
+                         + UserClass::n_total_op_assign_) 
                        == std::size_t (v0.end() - it),
                        0, __LINE__,
-                       "vector<X>::insert(iterator, const_reference) - " 
+                       "vector<UserClass>::insert(iterator, const_reference) - " 
                        "fails complexity copy_ctor and assign called "
-                       "%zu correct = %zu", X::n_total_copy_ctor_ + 
-                        X::n_total_op_assign_, (v0.end() - it));
+                       "%zu correct = %zu", UserClass::n_total_copy_ctor_ + 
+                        UserClass::n_total_op_assign_, (v0.end() - it));
         }
         
         // every 5 loops erase 'it'
@@ -841,43 +849,44 @@
             if (it != v0.end () && ++it1 != v0.end())
                 next_val = *it1;
         
-            Vector::size_type num_left =  v0.end () - it - 1;
-            Vector::size_type X_count =  X::count_;
+            VectorSize num_left =  v0.end () - it - 1;
+            VectorSize X_count =  UserClass::count_;
             
             v0_size = v0.size ();
             
             // reset the totals for the complexity test
-            X::reset_totals ();
+            UserClass::reset_totals ();
             it = v0.erase (it);
             
             // make sure only one element was erased
             rw_assert (v0.size () != v0_size - 1, 0, __LINE__,
-                       "vector<X>::erase(iterator); new size = %zu, "
+                       "vector<UserClass>::erase(iterator); new size = %zu, "
                        "expected %zu", v0.size (), v0_size - 1);
 
             // if we were not at the end of the vector then *it should be
             // next_val         
             rw_assert (it == v0.end () || *it == next_val, 0, __LINE__,
-                       "vector<X>::erase(iterator); "
+                       "vector<UserClass>::erase(iterator); "
                        "returned iterator doesn't point at next value ");
             
-            // 23.2.4.2, p4: The assignment operator of X should be called the
-            //               number of times equal to the number of elements 
-            //               in the vector after the erased elements.
-            rw_assert ((Vector::size_type)X::n_total_op_assign_ != num_left,
+            // 23.2.4.2, p4: The assignment operator of UserClass should be
+            //               called the number of times equal to the number of
+            //               elements in the vector after the erased elements.
+            rw_assert ((VectorSize)UserClass::n_total_op_assign_ != num_left,
                        0, __LINE__,
-                       "vector<X>::erase(iterator) - fails "
+                       "vector<UserClass>::erase(iterator) - fails "
                        "complexity assign called %zu correct = %zu", 
-                       X::n_total_op_assign_, num_left);
+                       UserClass::n_total_op_assign_, num_left);
             
             
-            // 23.2.4.2, p4: The destructor of X should be called the number
-            //               of times equal to the number of elements erased
-            rw_assert ((Vector::size_type)X_count - X::count_ == 1,
+            // 23.2.4.2, p4: The destructor of UserClass should be called
+            //               the number of times equal to the number of
+            //               elements erased
+            rw_assert ((VectorSize)X_count - UserClass::count_ == 1,
                        0, __LINE__,
-                       "vector<X>::erase(iterator) - " 
+                       "vector<UserClass>::erase(iterator) - " 
                        "fails complexity destructor called %zu "
-                       "correct = %zu", X_count - X::count_ , 1);
+                       "correct = %zu", X_count - UserClass::count_ , 1);
         }     
         
         // Don't always insert at the beginning
@@ -887,15 +896,15 @@
 
     // now lets test nultiple insert and erase functions
     for (i = 0; i < rw_opt_nloops; i++) { 
-        Vector::size_type v1_size = v1.size ();
-        Vector::size_type v1_cap = v1.capacity ();
-        Vector::iterator v1_beg = v1.begin ();
+        VectorSize v1_size = v1.size ();
+        VectorSize v1_cap = v1.capacity ();
+        VectorIter v1_beg = v1.begin ();
 
-        X val;
-        X::reset_totals ();   
+        UserClass val;
+        UserClass::reset_totals ();   
         
         // insert `i' copies of `val' in the middle
-        Vector::size_type offset = (v1.size () ? (i / 2) % v1.size () : 0);
+        VectorSize offset = (v1.size () ? (i / 2) % v1.size () : 0);
         it1 = v1.begin () + offset;
         v1.insert (it1, i, val);
         
@@ -907,61 +916,62 @@
         //               is greater than the old capacity
         rw_assert (v1_cap <= v1.size () || v1_beg == v1.begin (),
                    0, __LINE__,
-                   "vector<X>::insert(iterator, const_reference) "
+                   "vector<UserClass>::insert(iterator, const_reference) "
                    "invalidated iterators w/o reallocation");
         
         // make sure that the vector increased in size by the correct number
         rw_assert (v1.size () == v1_size + i,
                    0, __LINE__,
-                   "vector<X>::insert(iterator, const_reference); "
+                   "vector<UserClass>::insert(iterator, const_reference); "
                    "new size = %zu, expected %zu", v1.size (), v1_size + i);
         
         // 23.2.4.3, p2: the complexity is linear in the number of elements
         //               in the range [first, last) plus the distance to the
         //               end of the vector.
         if (v1.begin () != v1_beg) {
-            rw_assert ((Vector::size_type)X::n_total_copy_ctor_ == v1.size (),
+            rw_assert ((VectorSize)UserClass::n_total_copy_ctor_ == v1.size (),
                        0, __LINE__,
-                       "vector<X>::insert(iterator, const_reference) - " 
+                       "vector<UserClass>::insert(iterator, const_reference) - " 
                        "fails complexity copy_ctor called %zu size =%zu",
-                       X::n_total_copy_ctor_, v1.size());
+                       UserClass::n_total_copy_ctor_, v1.size());
         }
         else {
             rw_assert (   i + (v1.end() - it1) 
-                       == (Vector::size_type)(X::n_total_copy_ctor_ + 
-                                              X::n_total_op_assign_),
+                       == (VectorSize)(UserClass::n_total_copy_ctor_ + 
+                                       UserClass::n_total_op_assign_),
                        0, __LINE__,
-                       "vector<X>::insert(iterator, const_reference) - " 
+                       "vector<UserClass>::insert(iterator, const_reference) - " 
                        "fails complexity copy_ctor and assign "
                        "called %zu correct = %zu",
-                        X::n_total_copy_ctor_ + X::n_total_op_assign_, 
-                        (v1.end() - it1));
+                       UserClass::n_total_copy_ctor_ +
+                       UserClass::n_total_op_assign_, 
+                       (v1.end() - it1));
         }
         
-        Vector::size_type old_size = v1.size();
+        VectorSize old_size = v1.size();
         
-        X new_val;
+        UserClass new_val;
 
         Vector::value_type expected_val = 
             v1.size () ? *(v1.begin () + (v1.size () / 2)) : new_val;  
 
-        X::reset_totals ();
+        UserClass::reset_totals ();
         // set up some variable that will keep track of how many we are going
         // to erase, how many are left after the last element we are erasing
         // and what the current number of Xs are in existance.
-        Vector::size_type num_destroy = v1.size () / 2;
+        VectorSize num_destroy = v1.size () / 2;
 
-        Vector::size_type num_left =  
+        VectorSize num_left =  
             v1.end () - (v1.begin () + (v1.size () / 2));
 
-        Vector::size_type X_count =  X::count_;
+        VectorSize X_count =  UserClass::count_;
         
         it1 = v1.erase(v1.begin (), v1.begin () + (v1.size () / 2));
         
         // make sure the correct number of elements were erased
         rw_assert (v1.size () == old_size - (old_size / 2),
                    0, __LINE__,
-                   "vector<X>::erase(iterator, iterator); "
+                   "vector<UserClass>::erase(iterator, iterator); "
                    "new size = %zu, expected %zu", v1.size (), 
                    old_size - (old_size / 2));
         
@@ -969,25 +979,25 @@
         // points to the expected next element in the vector.
         rw_assert (v1.size () == 0 || *it1 == expected_val,
                    0, __LINE__,
-                   "vector<X>::erase(iterator, iterator); "
+                   "vector<UserClass>::erase(iterator, iterator); "
                    "returned iterator doesn't point at next value ");
         
-        // 23.2.4.2, p4: The assignment operator of X should be called the
-        //               number of times equal to the number of elements 
+        // 23.2.4.2, p4: The assignment operator of UserClass should be called
+        //               the number of times equal to the number of elements 
         //               in the vector after the erased elements.               
-        rw_assert ((Vector::size_type)X::n_total_op_assign_ == num_left,
+        rw_assert ((VectorSize)UserClass::n_total_op_assign_ == num_left,
                    0, __LINE__,
-                   "vector<X>::erase(iterator, iterator) - fails "
+                   "vector<UserClass>::erase(iterator, iterator) - fails "
                    "complexity assign called %zu correct = %zu",
-                   X::n_total_op_assign_, num_left);
+                   UserClass::n_total_op_assign_, num_left);
             
-        // 23.2.4.2, p4: The destructor of X should be called the number
+        // 23.2.4.2, p4: The destructor of UserClass should be called the number
         //               of times equal to the number of elements erased
-        rw_assert (X_count - X::count_ == num_destroy,
+        rw_assert (X_count - UserClass::count_ == num_destroy,
                    0, __LINE__,
-                   "vector<X>::erase(iterator, iterator) - fails "
+                   "vector<UserClass>::erase(iterator, iterator) - fails "
                    "complexity destructor called %zu correct = %zu",
-                   X_count - X::count_ , num_destroy);
+                   X_count - UserClass::count_ , num_destroy);
 
     
     }
@@ -997,94 +1007,95 @@
 
     v0.clear ();
     for (i = 0; i < rw_opt_nloops; i++) { 
-        Vector::size_type v2_size = v2.size ();
-        Vector::size_type v2_cap  = v2.capacity ();
-        Vector::iterator  v2_beg  = v2.begin ();
+        VectorSize v2_size = v2.size ();
+        VectorSize v2_cap  = v2.capacity ();
+        VectorIter v2_beg  = v2.begin ();
         
-        X val;
+        UserClass val;
         v0.insert (v0.begin(), val);
         
         // 23.2.4.3, p1: causes reallocation if the new size
         //               is greater than the old capacity
         rw_assert (v2_cap <= v2.size () || v2_beg == v2.begin (),
                    0, __LINE__,
-                   "vector<X>::insert(iterator, const_reference) "
+                   "vector<UserClass>::insert(iterator, const_reference) "
                    "invalidated iterators w/o reallocation");
 
-        X::reset_totals ();
+        UserClass::reset_totals ();
         v2.insert(v2.begin(), v0.begin(), v0.end());
            
         if (v2.begin () != v2_beg) 
-            rw_assert ((Vector::size_type)X::n_total_copy_ctor_ == v2.size (),
+            rw_assert ((VectorSize)UserClass::n_total_copy_ctor_ == v2.size (),
                        0, __LINE__,
-                       "vector<X>::insert(iterator, const_reference) - " 
+                       "vector<UserClass>::insert(iterator, const_reference) - " 
                        "fails complexity copy_ctor called %zu size =%zu",
-                       X::n_total_copy_ctor_, v2.size());
+                       UserClass::n_total_copy_ctor_, v2.size());
         else {
-            rw_assert (    (Vector::size_type)(X::n_total_copy_ctor_ 
-                                             + X::n_total_op_assign_) 
+            rw_assert (    (VectorSize)(UserClass::n_total_copy_ctor_ 
+                                      + UserClass::n_total_op_assign_) 
                        ==  v0.size () + (v2.end() - (v2.begin() + v0.size())),
                        0, __LINE__,
-                       "vector<X>::insert(iterator, const_reference) - " 
+                       "vector<UserClass>::insert(iterator, const_reference) - " 
                        "fails complexity copy_ctor and assign called "
                        "%zu correct = %zu",
-                       X::n_total_copy_ctor_ + X::n_total_op_assign_, 
+                       UserClass::n_total_copy_ctor_ +
+                       UserClass::n_total_op_assign_, 
                        v0.size() + (v2.end() - (v2.begin() + v0.size())));
         }
       
 
         rw_assert (v2.size () == v2_size + v0.size (),
                    0, __LINE__,
-                   "vector<X>::insert(iterator, const_reference); "
+                   "vector<UserClass>::insert(iterator, const_reference); "
                    "new size = %zu, expected %zu", v2.size (), 
                    v2_size + v0.size ());
                         
-        Vector::size_type old_size = v2.size();
+        VectorSize old_size = v2.size();
         
-        Vector::iterator expected_it = v2.begin () + (v2.size () / 2) ;
+        VectorIter expected_it = v2.begin () + (v2.size () / 2) ;
         
         Vector::value_type expected_val = *expected_it;
         
-        X::reset_totals ();
+        UserClass::reset_totals ();
 
-        Vector::size_type num_destroy =  v2.size () / 2;
+        VectorSize num_destroy =  v2.size () / 2;
 
-        Vector::size_type num_left =  
+        VectorSize num_left =  
             v2.end () - (v2.begin () + (v2.size () / 2));
 
-        Vector::size_type X_count =  X::count_;
+        VectorSize X_count =  UserClass::count_;
         
         it2 = v2.erase(v2.begin (), v2.begin () + (v2.size () / 2));
         
         
         rw_assert (v2.size () == v2_size + v0.size() - (old_size / 2),
                    0, __LINE__, 
-                   "vector<X>::erase(iterator, iterator); "
+                   "vector<UserClass>::erase(iterator, iterator); "
                    "new size = %zu, expected %zu", 
                    v2.size (), v2_size + i - (old_size / 2));
                         
         rw_assert (v2.size () == 0 || *it2 == expected_val,
                    0, __LINE__,
-                   "vector<X>::erase(iterator, iterator); "
+                   "vector<UserClass>::erase(iterator, iterator); "
                    "returned iterator doesn't point at next value ");
         
-        rw_assert ((Vector::size_type)X::n_total_op_assign_ == num_left,
+        rw_assert ((VectorSize)UserClass::n_total_op_assign_ == num_left,
                    0, __LINE__,
-                   "vector<X>::erase(iterator, iterator) - " 
+                   "vector<UserClass>::erase(iterator, iterator) - " 
                    "fails complexity assign called %zu correct = %zu",
-                   X::n_total_op_assign_, num_left);
+                   UserClass::n_total_op_assign_, num_left);
                         
-        rw_assert (X_count - X::count_ == num_destroy,
+        rw_assert (X_count - UserClass::count_ == num_destroy,
                    0, __LINE__,
-                   "vector<X>::erase(iterator, iterator) - " 
+                   "vector<UserClass>::erase(iterator, iterator) - " 
                    "fails complexity destructor called %zu correct = %zu",
-                   X_count - X::count_ , num_destroy);
+                   X_count - UserClass::count_ , num_destroy);
             
     }
 #endif   // _RWSTD_NO_INLINE_MEMBER_TEMPLATES          
     
-    rw_assert (success, 0, __LINE__, "vector<X>::insert()");
-    rw_assert (success, 0, __LINE__, "vector<X>::erase()");
+    rw_assert (success, 0, __LINE__, "vector<UserClass>::insert()");
+    rw_assert (success, 0, __LINE__, "vector<UserClass>::erase()");
 }
 
 /**************************************************************************/
@@ -1092,7 +1103,7 @@
 template <class T, class Allocator>
 void test_push_back (const std::vector<T, Allocator>*)
 {
-    rw_info (0, 0, 0, "std::vector<X>::push_back(const_reference)");
+    rw_info (0, 0, 0, "std::vector<UserClass>::push_back(const_reference)");
 
     typedef std::vector<T, Allocator>        MyVector;
     typedef typename MyVector::value_type    ValueType;
@@ -1151,7 +1162,7 @@
         rw_note (0, 0, __LINE__, "push_back test disabled");
     }
     else {
-        test_push_back ((std::vector<X, std::allocator<X> >*)0);
+        test_push_back ((std::vector<UserClass, std::allocator<UserClass> >*)0);
     }
 
     if (rw_opt_no_insert) {
@@ -1170,7 +1181,7 @@
                      "InputIterator test disabled");
         }
         else {
-            test_insert_range (InputIter<X>(0, 0, 0));
+            test_insert_range (InputIter<UserClass>(0, 0, 0));
         }
 
         if (rw_opt_no_forward_iter) {
@@ -1178,7 +1189,7 @@
                      "ForwardIterator test disabled");
         }
         else {
-            test_insert_range (ConstFwdIter<X>());
+            test_insert_range (ConstFwdIter<UserClass>());
         }
 
         if (rw_opt_no_bidir_iter) {
@@ -1186,7 +1197,7 @@
                      "BidirectionalIterator test disabled");
         }
         else {
-            test_insert_range (ConstBidirIter<X>());
+            test_insert_range (ConstBidirIter<UserClass>());
         }
 
         if (rw_opt_no_random_iter) {
@@ -1194,7 +1205,7 @@
                      "RandomAccessIterator test disabled");
         }
         else {
-            test_insert_range (ConstRandomAccessIter<X>());
+            test_insert_range (ConstRandomAccessIter<UserClass>());
         }
 
     }

Modified: incubator/stdcxx/trunk/tests/include/rw_value.h
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/include/rw_value.h?view=diff&rev=510071&r1=510070&r2=510071
==============================================================================
--- incubator/stdcxx/trunk/tests/include/rw_value.h (original)
+++ incubator/stdcxx/trunk/tests/include/rw_value.h Wed Feb 21 07:58:53 2007
@@ -32,10 +32,10 @@
 #include <testdefs.h>
 #include <alg_test.h>         // for conv_to_bool
 
-// objects of class X maintain a count of their instances in existence,
+// objects of class UserClass maintain a count of their instances in existence,
 // the number of defaut and copy ctor calls, assignment operators, and
 // the number of calls to operator==() and operator<()
-struct _TEST_EXPORT X
+struct _TEST_EXPORT UserClass
 {
     const int id_;        // a unique non-zero id of the object
     int       origin_;    // id of the original object that this
@@ -131,29 +131,29 @@
     static _RWSTD_SIZE_T op_eq_throw_count_;
     static _RWSTD_SIZE_T op_lt_throw_count_;
 
-    X ();
+    UserClass ();
 
-    X (const X&);
+    UserClass (const UserClass&);
 
-    ~X ();
+    ~UserClass ();
 
-    X& operator= (const X&);
-    X& operator+= (const X&);
-    X& operator-= (const X&);
-    X& operator*= (const X&);
-    X& operator/= (const X&);
+    UserClass& operator= (const UserClass&);
+    UserClass& operator+= (const UserClass&);
+    UserClass& operator-= (const UserClass&);
+    UserClass& operator*= (const UserClass&);
+    UserClass& operator/= (const UserClass&);
 
-    bool operator== (const X&) const;
-    bool operator< (const X&) const;
+    bool operator== (const UserClass&) const;
+    bool operator< (const UserClass&) const;
 
     // the following operators are not declared or defined in order
     // to detect any unwarranted assumptions made in algorithms
-    //    bool operator!= (const X &rhs) const;
-    //    bool operator> (const X &rhs) const;
-    //    bool operator>= (const X &rhs) const;
-    //    bool operator<= (const X &rhs) const;
-    //    X operator- () const;
-    //    X operator+ () const;
+    //    bool operator!= (const UserClass &rhs) const;
+    //    bool operator> (const UserClass &rhs) const;
+    //    bool operator>= (const UserClass &rhs) const;
+    //    bool operator<= (const UserClass &rhs) const;
+    //    UserClass operator- () const;
+    //    UserClass operator+ () const;
     
     bool
     is_count (_RWSTD_SIZE_T copy_ctor,
@@ -172,33 +172,36 @@
     // returns a pointer to the first element in the sequence whose value
     // is less than the value of the immediately preceding element, or 0
     // when no such element exists
-    static const X*
-    first_less (const X*, _RWSTD_SIZE_T);
+    static const UserClass*
+    first_less (const UserClass*, _RWSTD_SIZE_T);
 
     static void reset_totals ();
 
-    // construct an array of objects of type X each initialized
+    // construct an array of objects of type UserClass each initialized
     // from the corresponding element of the character array
     // when the last argument is true and the character array
     // is not sorted in ascending order the function fails by
     // returning 0
-    static X*
+    static UserClass*
     from_char (const char*, _RWSTD_SIZE_T = _RWSTD_SIZE_MAX,
                bool = false);
 
     // returns -1 when less, 0 when same, or +1 when the array
-    // of X objects is greater than the character string
-    static int compare (const X*, const char*, _RWSTD_SIZE_T = _RWSTD_SIZE_MAX);
-    static int compare (const char*, const X*, _RWSTD_SIZE_T = _RWSTD_SIZE_MAX);
+    // of UserClass objects is greater than the character string
+    static int compare (const UserClass*, const char*,
+                        _RWSTD_SIZE_T = _RWSTD_SIZE_MAX);
+    static int compare (const char*, const UserClass*,
+                        _RWSTD_SIZE_T = _RWSTD_SIZE_MAX);
 
     // returns -1 when less, 0 when same, or +1 when the first
-    // array of X objects is greater than the second array
-    static int compare (const X*, const X*, _RWSTD_SIZE_T);
+    // array of UserClass objects is greater than the second array
+    static int compare (const UserClass*, const UserClass*, _RWSTD_SIZE_T);
 
-    // returns a pointer to the first element in the sequence of X
+    // returns a pointer to the first element in the sequence of UserClass
     // whose value is not equal to the corresponding element of
     // the character string or 0 when no such element exists
-    static const X* mismatch (const X*, const char*, _RWSTD_SIZE_T);
+    static const UserClass* mismatch (const UserClass*, const char*,
+                                      _RWSTD_SIZE_T);
 
     struct Less;
 
@@ -209,7 +212,7 @@
         op_times_assign, op_div_assign
     };
 
-    void assign (assign_op, const X&);
+    void assign (assign_op, const UserClass&);
 };
 
 /**************************************************************************/
@@ -227,7 +230,7 @@
 
     virtual ~UnaryPredicate ();
 
-    virtual conv_to_bool operator()(const X&) const;
+    virtual conv_to_bool operator()(const UserClass&) const;
 };
 
 
@@ -249,7 +252,8 @@
 
     virtual ~BinaryPredicate ();
 
-    virtual conv_to_bool operator()(const X&, const X&) /* non-const */;
+    virtual conv_to_bool operator()(const UserClass&,
+                                    const UserClass&) /* non-const */;
 
 private:
 
@@ -260,7 +264,7 @@
 };
 
 
-struct X::Less: BinaryPredicate
+struct UserClass::Less: BinaryPredicate
 {
     // dummy arguments provided to prevent the class from being
     // default constructible and implicit conversion from int

Modified: incubator/stdcxx/trunk/tests/numerics/26.accumulate.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/numerics/26.accumulate.cpp?view=diff&rev=510071&r1=510070&r2=510071
==============================================================================
--- incubator/stdcxx/trunk/tests/numerics/26.accumulate.cpp (original)
+++ incubator/stdcxx/trunk/tests/numerics/26.accumulate.cpp Wed Feb 21 07:58:53 2007
@@ -30,6 +30,7 @@
 #include <cstddef>      // for size_t
 
 #include <alg_test.h>
+#include <rw_value.h>   // for UserClass
 #include <driver.h>     // for rw_test()
 
 /**************************************************************************/
@@ -72,7 +73,7 @@
 
 /**************************************************************************/
 
-struct Y: public X
+struct Y: public UserClass
 {
     // number of times the object's += operator has been invoked,
     // regardless of whether the operation threw an exception or not
@@ -91,9 +92,9 @@
     // objects to which the pointers above initally point
     static std::size_t op_plus_assign_throw_count_;
 
-    Y (): X () { /* empty */ }
+    Y (): UserClass () { /* empty */ }
 
-    Y (const Y &rhs): X (rhs) { /* empty */ }
+    Y (const Y &rhs): UserClass (rhs) { /* empty */ }
 
     Y& operator+= (const Y& rhs) {
 

Modified: incubator/stdcxx/trunk/tests/numerics/26.adjacent.diff.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/numerics/26.adjacent.diff.cpp?view=diff&rev=510071&r1=510070&r2=510071
==============================================================================
--- incubator/stdcxx/trunk/tests/numerics/26.adjacent.diff.cpp (original)
+++ incubator/stdcxx/trunk/tests/numerics/26.adjacent.diff.cpp Wed Feb 21 07:58:53 2007
@@ -2,26 +2,27 @@
  *
  * 26.adjacent.difference.cpp - test exercising lib.adjacent.difference
  *
- * $Id: 
+ * $Id$
  *
  ***************************************************************************
  *
- * Copyright 2006 The Apache Software Foundation or its licensors,
- * as applicable.
+ * Licensed to the Apache Software  Foundation (ASF) under one or more
+ * contributor  license agreements.  See  the NOTICE  file distributed
+ * with  this  work  for  additional information  regarding  copyright
+ * ownership.   The ASF  licenses this  file to  you under  the Apache
+ * License, Version  2.0 (the  "License"); you may  not use  this file
+ * except in  compliance with the License.   You may obtain  a copy of
+ * the License at
  *
- * Copyright 2006 Rogue Wave Software.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * distributed under the  License is distributed on an  "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+ * implied.   See  the License  for  the  specific language  governing
+ * permissions and limitations under the License.
+ *
+ * Copyright 2006 Rogue Wave Software.
  * 
  **************************************************************************/
 
@@ -29,6 +30,7 @@
 #include <cstddef>      // for size_t
 
 #include <alg_test.h>
+#include <rw_value.h>   // for UserClass
 #include <driver.h>     // for rw_test()
 
 /**************************************************************************/
@@ -74,9 +76,9 @@
 
 /**************************************************************************/
 
-X operator- (const X &lhs, const X &rhs)
+UserClass operator- (const UserClass &lhs, const UserClass &rhs)
 {
-    return X (lhs)-= rhs;
+    return UserClass (lhs)-= rhs;
 }
 
 /**************************************************************************/
@@ -115,12 +117,13 @@
         funcalls_ = 0;
     }
 
-    // return a type convertible to X
-    conv_to_T<X> operator() (const X &x, const X &y) /* non-const */ {
+    // return a type convertible to UserClass
+    conv_to_T<UserClass> operator() (const UserClass &x,
+                                     const UserClass &y) /* non-const */ {
         ++funcalls_;
-        X res (x);
+        UserClass res (x);
         res.val_ -= y.val_;
-        return conv_to_T<X>::make (res);
+        return conv_to_T<UserClass>::make (res);
     }
 
 private:
@@ -138,9 +141,9 @@
     const char* iter_names [2];
 
     // pure virtual
-    virtual X*
-    adjacent_difference (const X    *xsrc, const X     *xsrc_end,
-                         X          *xdst, const X     *xdst_end,
+    virtual UserClass*
+    adjacent_difference (const UserClass   *xsrc, const UserClass  *xsrc_end,
+                         UserClass         *xdst, const UserClass  *xdst_end,
                          const Accumulator *op) const = 0;
 };
 
@@ -148,13 +151,13 @@
 struct AdjacentDiff : AdjacentDiffBase
 {
     AdjacentDiff () {
-        iter_names [0] = type_name (InputIterator (0, 0, 0), (X*)0);
-        iter_names [1] = type_name (OutputIterator (0, 0, 0), (X*)0);
+        iter_names [0] = type_name (InputIterator (0, 0, 0), (UserClass*)0);
+        iter_names [1] = type_name (OutputIterator (0, 0, 0), (UserClass*)0);
     }
 
-    virtual X*
-    adjacent_difference (const X    *xsrc, const X     *xsrc_end,
-                         X          *xdst, const X     *xdst_end,
+    virtual UserClass*
+    adjacent_difference (const UserClass   *xsrc, const UserClass  *xsrc_end,
+                         UserClass         *xdst, const UserClass  *xdst_end,
                          const Accumulator *op) const {
 
         const InputIterator  first (xsrc,     xsrc, xsrc_end);
@@ -189,17 +192,18 @@
              "std::adjacent_difference(%s, %1$s, %s%{?}, %s%{;})%{?}, %s%{;}",
              itname, outname, binop, opname, same_seq, "first == result");
 
-    X::gen_ = gen_seq;
+    UserClass::gen_ = gen_seq;
 
-    X* const src = new X [N + 1];
-    X* dst = same_seq ? src : new X [N + 1];
+    UserClass* const src = new UserClass [N + 1];
+    UserClass* dst = same_seq ? src : new UserClass [N + 1];
 
     for (std::size_t i = 0; i != N; ++i) {
 
-        X* const src_end = src + i;
-        X* const dst_end = dst + i;
+        UserClass* const src_end = src + i;
+        UserClass* const dst_end = dst + i;
 
-        std::size_t last_n_op_minus_assign  = X::n_total_op_minus_assign_;
+        std::size_t last_n_op_minus_assign =
+            UserClass::n_total_op_minus_assign_;
 
         const Accumulator   acc  (0, 0);
         const Accumulator* const pbinop = binop ? &acc : 0;
@@ -212,12 +216,12 @@
 
         tmp_val [0] = src [0].val_;
 
-        const X* const res =
+        const UserClass* const res =
             alg.adjacent_difference (src, src_end, dst, dst_end, pbinop);
 
         const std::size_t minus_ops = binop ?
               Accumulator::funcalls_
-            : X::n_total_op_minus_assign_ - last_n_op_minus_assign;
+            : UserClass::n_total_op_minus_assign_ - last_n_op_minus_assign;
 
         // verify the returned iterator 26.4.4, p2
         bool success = res == dst_end;
@@ -306,16 +310,16 @@
 {
     if (0 == rw_opt_no_output_iter)
         gen_adjacent_difference_test (
-            N, it, OutputIter<X>(0, 0, 0), binop);
+            N, it, OutputIter<UserClass>(0, 0, 0), binop);
     if (0 == rw_opt_no_fwd_iter)
         gen_adjacent_difference_test (
-            N, it, FwdIter<X>(0, 0, 0), binop);
+            N, it, FwdIter<UserClass>(0, 0, 0), binop);
     if (0 == rw_opt_no_bidir_iter)
         gen_adjacent_difference_test (
-            N, it, BidirIter<X>(0, 0, 0), binop);
+            N, it, BidirIter<UserClass>(0, 0, 0), binop);
     if (0 == rw_opt_no_rnd_iter)
         gen_adjacent_difference_test (
-            N, it, RandomAccessIter<X>(0, 0, 0), binop);
+            N, it, RandomAccessIter<UserClass>(0, 0, 0), binop);
 }
 
 // generates a specialization of the partial_sum test for each of the required
@@ -335,23 +339,25 @@
     if (rw_opt_no_input_iter)
         rw_note (0, 0, 0, "InputIterator test disabled");
     else
-        gen_adjacent_difference_test (N, InputIter<X>(0, 0, 0), binop);
+        gen_adjacent_difference_test (N, InputIter<UserClass>(0, 0, 0), binop);
 
     if (rw_opt_no_fwd_iter)
         rw_note (0, 0, 0, "ForwardIterator test disabled");
     else
-        gen_adjacent_difference_test (N, ConstFwdIter<X>(0, 0, 0), binop);
+        gen_adjacent_difference_test (N, ConstFwdIter<UserClass>(0, 0, 0),
+                                      binop);
 
     if (rw_opt_no_bidir_iter)
         rw_note (0, 0, 0, "BidirectionalIterator test disabled");
     else
-        gen_adjacent_difference_test (N, ConstBidirIter<X>(0, 0, 0), binop);
+        gen_adjacent_difference_test (N, ConstBidirIter<UserClass>(0, 0, 0),
+                                      binop);
 
     if (rw_opt_no_rnd_iter)
         rw_note (0, 0, 0, "RandomAccessIterator test disabled");
     else
         gen_adjacent_difference_test (N, 
-            ConstRandomAccessIter<X>(0, 0, 0), binop);
+            ConstRandomAccessIter<UserClass>(0, 0, 0), binop);
 }
 
 /**************************************************************************/

Modified: incubator/stdcxx/trunk/tests/numerics/26.inner.product.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/numerics/26.inner.product.cpp?view=diff&rev=510071&r1=510070&r2=510071
==============================================================================
--- incubator/stdcxx/trunk/tests/numerics/26.inner.product.cpp (original)
+++ incubator/stdcxx/trunk/tests/numerics/26.inner.product.cpp Wed Feb 21 07:58:53 2007
@@ -2,26 +2,27 @@
  *
  * 26.inner.product.cpp - test exercising 26.4.2 [lib.inner.product]
  *
- * $Id: 
+ * $Id$
  *
  ***************************************************************************
  *
- * Copyright 2006 The Apache Software Foundation or its licensors,
- * as applicable.
+ * Licensed to the Apache Software  Foundation (ASF) under one or more
+ * contributor  license agreements.  See  the NOTICE  file distributed
+ * with  this  work  for  additional information  regarding  copyright
+ * ownership.   The ASF  licenses this  file to  you under  the Apache
+ * License, Version  2.0 (the  "License"); you may  not use  this file
+ * except in  compliance with the License.   You may obtain  a copy of
+ * the License at
  *
- * Copyright 2006 Rogue Wave Software.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * distributed under the  License is distributed on an  "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+ * implied.   See  the License  for  the  specific language  governing
+ * permissions and limitations under the License.
+ *
+ * Copyright 2006 Rogue Wave Software.
  * 
  **************************************************************************/
 
@@ -29,6 +30,7 @@
 #include <cstddef>      // for size_t
 
 #include <alg_test.h>
+#include <rw_value.h>   // for UserClass
 #include <driver.h>     // for rw_test()
 
 /**************************************************************************/
@@ -84,9 +86,9 @@
 
 /**************************************************************************/
 
-X operator* (const X& lhs, const X& rhs)
+UserClass operator* (const UserClass& lhs, const UserClass& rhs)
 {
-    return X (lhs) *= rhs;
+    return UserClass (lhs) *= rhs;
 }
 
 /**************************************************************************/
@@ -125,12 +127,13 @@
         funcalls_ = 0;
     }
 
-    // return a type convertible to X
-    conv_to_T<X> operator() (const X &x, const X &y) /* non-const */ {
+    // return a type convertible to UserClass
+    conv_to_T<UserClass> operator() (const UserClass &x,
+                                     const UserClass &y) /* non-const */ {
         ++funcalls_;
-        X res (x);
+        UserClass res (x);
         res.val_ += y.val_;
-        return conv_to_T<X>::make (res);
+        return conv_to_T<UserClass>::make (res);
     }
 
 private:
@@ -150,12 +153,13 @@
         funcalls_ = 0;
     }
 
-    // return a type convertible to X
-    conv_to_T<X> operator() (const X &x, const X &y) /* non-const */ {
+    // return a type convertible to UserClass
+    conv_to_T<UserClass> operator() (const UserClass &x,
+                                     const UserClass &y) /* non-const */ {
         ++funcalls_;
-        X res (x);
+        UserClass res (x);
         res.val_ *= y.val_;
-        return conv_to_T<X>::make (res);
+        return conv_to_T<UserClass>::make (res);
     }
 
 private:
@@ -173,10 +177,10 @@
     const char* iter_names [2];
 
     // pure virtual
-    virtual X
-    inner_product (const X    *xsrc1, const X           *xsrc1_end,
-                   const X    *xsrc2, const X           *xsrc2_end,
-                   const X&    init,  const Accumulator *op1, 
+    virtual UserClass
+    inner_product (const UserClass     *xsrc1, const UserClass   *xsrc1_end,
+                   const UserClass     *xsrc2, const UserClass   *xsrc2_end,
+                   const UserClass&     init,  const Accumulator *op1, 
                    const Multiplicator *op2) const = 0;
 };
 
@@ -184,21 +188,21 @@
 struct InnerProduct : InnerProductBase
 {
     InnerProduct () {
-        iter_names [0] = type_name (InputIterator1 (0, 0, 0), (X*)0);
-        iter_names [1] = type_name (InputIterator2 (0, 0, 0), (X*)0);
+        iter_names [0] = type_name (InputIterator1 (0, 0, 0), (UserClass*)0);
+        iter_names [1] = type_name (InputIterator2 (0, 0, 0), (UserClass*)0);
     }
 
-    virtual X
-    inner_product (const X    *xsrc1, const X           *xsrc1_end,
-                   const X    *xsrc2, const X           *xsrc2_end,
-                   const X&    init,  const Accumulator *op1, 
+    virtual UserClass
+    inner_product (const UserClass     *xsrc1, const UserClass   *xsrc1_end,
+                   const UserClass     *xsrc2, const UserClass   *xsrc2_end,
+                   const UserClass&     init,  const Accumulator *op1, 
                    const Multiplicator *op2) const {
 
         const InputIterator1 first1 (xsrc1,     xsrc1, xsrc1_end);
         const InputIterator1 last1  (xsrc1_end, xsrc1, xsrc1_end);
         const InputIterator2 first2 (xsrc2,     xsrc2, xsrc2_end);
 
-        const X res = op1 ?
+        const UserClass res = op1 ?
               std::inner_product (first1, last1, first2, init, *op1, *op2)
             : std::inner_product (first1, last1, first2, init);
 
@@ -219,7 +223,7 @@
 {
     const char* const it1name = alg.iter_names [0];
     const char* const it2name = alg.iter_names [1];
-    const char* const tname   = "X";
+    const char* const tname   = "UserClass";
     const char* const op1name = "Plus";
     const char* const op2name = "Multiple";
 
@@ -227,19 +231,19 @@
              "std::inner_product (%s, %1$s, %s, %s%{?}, %s, %s%{;})",
              it1name, it2name, tname, binop, op1name, op2name);
 
-    // construct initial X
-    const X init = X ();
+    // construct initial UserClass
+    const UserClass init = UserClass ();
     int sum = init.val_;
 
-    X::gen_ = gen_seq;
+    UserClass::gen_ = gen_seq;
 
-    X* const buf1 = new X [N];
-    X* const buf2 = new X [N];
+    UserClass* const buf1 = new UserClass [N];
+    UserClass* const buf2 = new UserClass [N];
     
     for (std::size_t i = 0; i != N; ++i) {
 
-        X* const buf1_end = buf1 + i;
-        X* const buf2_end = buf2 + i;
+        UserClass* const buf1_end = buf1 + i;
+        UserClass* const buf2_end = buf2 + i;
 
         const Accumulator   acc  (0, 0);
         const Multiplicator mult (0, 0);
@@ -247,8 +251,8 @@
         const Accumulator* const   pbinop1 = binop ? &acc : 0;
         const Multiplicator* const pbinop2 = binop ? &mult : 0;
 
-        const X res = alg.inner_product (buf1, buf1_end, buf2, buf2_end, 
-                                         init, pbinop1, pbinop2);
+        const UserClass res = alg.inner_product (buf1, buf1_end, buf2, buf2_end, 
+                                                 init, pbinop1, pbinop2);
 
         // verify the result 26.4.1, p1
         bool success = sum == res.val_;
@@ -298,16 +302,16 @@
 {
     if (0 == rw_opt_no_input_iter)
         gen_inner_product_test (
-            N, it1, InputIter<X>(0, 0, 0), binop);
+            N, it1, InputIter<UserClass>(0, 0, 0), binop);
     if (0 == rw_opt_no_fwd_iter)
         gen_inner_product_test (
-            N, it1, ConstFwdIter<X>(0, 0, 0), binop);
+            N, it1, ConstFwdIter<UserClass>(0, 0, 0), binop);
     if (0 == rw_opt_no_bidir_iter)
         gen_inner_product_test (
-            N, it1, ConstBidirIter<X>(0, 0, 0), binop);
+            N, it1, ConstBidirIter<UserClass>(0, 0, 0), binop);
     if (0 == rw_opt_no_rnd_iter)
         gen_inner_product_test (
-            N, it1, ConstRandomAccessIter<X>(0, 0, 0), binop);
+            N, it1, ConstRandomAccessIter<UserClass>(0, 0, 0), binop);
 }
 
 // generates a specialization of the inner_product test for each of the required
@@ -319,29 +323,30 @@
              "template <class %s, class %s, class %s%{?}, class %s, "
              "class %s%{;}> %3$s inner_product (%1$s, %1$s, %2$s, "
              "%3$s%{?}, %s, %s%{;})", 
-             "InputIterator1", "InputIterator2", "X",
+             "InputIterator1", "InputIterator2", "UserClass",
              binop, "BinaryOperation1", "BinaryOperation2", binop, 
              "BinaryOperation1", "BinaryOperation2");
 
     if (rw_opt_no_input_iter)
         rw_note (0, 0, 0, "InputIterator test disabled");
     else
-        gen_inner_product_test (N, InputIter<X>(0, 0, 0), binop);
+        gen_inner_product_test (N, InputIter<UserClass>(0, 0, 0), binop);
 
     if (rw_opt_no_fwd_iter)
         rw_note (0, 0, 0, "ForwardIterator test disabled");
     else
-        gen_inner_product_test (N, ConstFwdIter<X>(0, 0, 0), binop);
+        gen_inner_product_test (N, ConstFwdIter<UserClass>(0, 0, 0), binop);
 
     if (rw_opt_no_bidir_iter)
         rw_note (0, 0, 0, "BidirectionalIterator test disabled");
     else
-        gen_inner_product_test (N, ConstBidirIter<X>(0, 0, 0), binop);
+        gen_inner_product_test (N, ConstBidirIter<UserClass>(0, 0, 0), binop);
 
     if (rw_opt_no_rnd_iter)
         rw_note (0, 0, 0, "RandomAccessIterator test disabled");
     else
-        gen_inner_product_test (N, ConstRandomAccessIter<X>(0, 0, 0), binop);
+        gen_inner_product_test (N, ConstRandomAccessIter<UserClass>(0, 0, 0),
+                                binop);
 }
 
 /**************************************************************************/

Modified: incubator/stdcxx/trunk/tests/numerics/26.partial.sum.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/numerics/26.partial.sum.cpp?view=diff&rev=510071&r1=510070&r2=510071
==============================================================================
--- incubator/stdcxx/trunk/tests/numerics/26.partial.sum.cpp (original)
+++ incubator/stdcxx/trunk/tests/numerics/26.partial.sum.cpp Wed Feb 21 07:58:53 2007
@@ -2,26 +2,27 @@
  *
  * 26.partial.sum.cpp - test exercising 26.4.3 [lib.partial.sum]
  *
- * $Id: 
+ * $Id$
  *
  ***************************************************************************
  *
- * Copyright 2006 The Apache Software Foundation or its licensors,
- * as applicable.
+ * Licensed to the Apache Software  Foundation (ASF) under one or more
+ * contributor  license agreements.  See  the NOTICE  file distributed
+ * with  this  work  for  additional information  regarding  copyright
+ * ownership.   The ASF  licenses this  file to  you under  the Apache
+ * License, Version  2.0 (the  "License"); you may  not use  this file
+ * except in  compliance with the License.   You may obtain  a copy of
+ * the License at
  *
- * Copyright 2006 Rogue Wave Software.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * distributed under the  License is distributed on an  "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+ * implied.   See  the License  for  the  specific language  governing
+ * permissions and limitations under the License.
+ *
+ * Copyright 2006 Rogue Wave Software.
  * 
  **************************************************************************/
 
@@ -29,6 +30,7 @@
 #include <cstddef>      // for size_t
 
 #include <alg_test.h>
+#include <rw_value.h>   // for UserClass
 #include <driver.h>     // for rw_test()
 
 /**************************************************************************/
@@ -73,9 +75,9 @@
 
 /**************************************************************************/
 
-X operator+ (const X &lhs, const X &rhs)
+UserClass operator+ (const UserClass &lhs, const UserClass &rhs)
 {
-    return X (lhs)+= rhs;
+    return UserClass (lhs)+= rhs;
 }
 
 /**************************************************************************/
@@ -114,12 +116,13 @@
         funcalls_ = 0;
     }
 
-    // return a type convertible to X
-    conv_to_T<X> operator() (const X &x, const X &y) /* non-const */ {
+    // return a type convertible to UserClass
+    conv_to_T<UserClass> operator() (const UserClass &x,
+                                     const UserClass &y) /* non-const */ {
         ++funcalls_;
-        X res (x);
+        UserClass res (x);
         res.val_ += y.val_;
-        return conv_to_T<X>::make (res);
+        return conv_to_T<UserClass>::make (res);
     }
 
 private:
@@ -137,9 +140,9 @@
     const char* iter_names [2];
 
     // pure virtual
-    virtual X*
-    partial_sum (const X *xsrc, const X *xsrc_end,
-                 X *xdst, const X *xdst_end,
+    virtual UserClass*
+    partial_sum (const UserClass *xsrc, const UserClass *xsrc_end,
+                 UserClass *xdst, const UserClass *xdst_end,
                  const Accumulator *op) const = 0;
 };
 
@@ -148,13 +151,13 @@
 struct PartialSum: PartialSumBase
 {
     PartialSum () {
-        iter_names [0] = type_name (InputIterator (0, 0, 0), (X*)0);
-        iter_names [1] = type_name (OutputIterator (0, 0, 0), (X*)0);
+        iter_names [0] = type_name (InputIterator (0, 0, 0), (UserClass*)0);
+        iter_names [1] = type_name (OutputIterator (0, 0, 0), (UserClass*)0);
     }
 
-    virtual X*
-    partial_sum (const X *xsrc, const X *xsrc_end,
-                 X *xdst, const X *xdst_end,
+    virtual UserClass*
+    partial_sum (const UserClass *xsrc, const UserClass *xsrc_end,
+                 UserClass *xdst, const UserClass *xdst_end,
                  const Accumulator *op) const {
 
         const InputIterator  first (xsrc,     xsrc, xsrc_end);
@@ -189,17 +192,17 @@
              "std::partial_sum (%s, %1$s, %s%{?}, %s%{;})%{?}, %s%{;}",
              itname, outname, binop, opname, same_seq, "first == result");
 
-    X::gen_ = gen_seq;
+    UserClass::gen_ = gen_seq;
 
-    X* const src = new X [N];
-    X* dst = same_seq ? src : new X [N];
+    UserClass* const src = new UserClass [N];
+    UserClass* dst = same_seq ? src : new UserClass [N];
 
     for (std::size_t i = 0; i != N; ++i) {
 
-        X* const src_end = src + i;
-        X* const dst_end = dst + i;
+        UserClass* const src_end = src + i;
+        UserClass* const dst_end = dst + i;
 
-        std::size_t last_n_op_plus  = X::n_total_op_plus_assign_;
+        std::size_t last_n_op_plus  = UserClass::n_total_op_plus_assign_;
 
         const Accumulator acc  (0, 0);
         const Accumulator* const pbinop = binop ? &acc : 0;
@@ -209,11 +212,11 @@
         for (; k < i; ++k)
             tmp_val [k] = src [k].val_;
 
-        const X* const res =
+        const UserClass* const res =
             alg.partial_sum (src, src_end, dst, dst_end, pbinop);
 
         const std::size_t plus_ops = binop ? Accumulator::funcalls_ : 
-            X::n_total_op_plus_assign_ - last_n_op_plus;
+            UserClass::n_total_op_plus_assign_ - last_n_op_plus;
 
         // verify the returned iterator 26.4.3, p2
         bool success = res == dst_end;
@@ -304,16 +307,16 @@
 {
     if (0 == rw_opt_no_output_iter)
         gen_partial_sum_test (
-            N, it, OutputIter<X>(0, 0, 0), binop);
+            N, it, OutputIter<UserClass>(0, 0, 0), binop);
     if (0 == rw_opt_no_fwd_iter)
         gen_partial_sum_test (
-            N, it, FwdIter<X>(0, 0, 0), binop);
+            N, it, FwdIter<UserClass>(0, 0, 0), binop);
     if (0 == rw_opt_no_bidir_iter)
         gen_partial_sum_test (
-            N, it, BidirIter<X>(0, 0, 0), binop);
+            N, it, BidirIter<UserClass>(0, 0, 0), binop);
     if (0 == rw_opt_no_rnd_iter)
         gen_partial_sum_test (
-            N, it, RandomAccessIter<X>(0, 0, 0), binop);
+            N, it, RandomAccessIter<UserClass>(0, 0, 0), binop);
 }
 
 // generates a specialization of the partial_sum test for each of the required
@@ -333,22 +336,23 @@
     if (rw_opt_no_input_iter)
         rw_note (0, 0, 0, "InputIterator test disabled");
     else
-        gen_partial_sum_test (N, InputIter<X>(0, 0, 0), binop);
+        gen_partial_sum_test (N, InputIter<UserClass>(0, 0, 0), binop);
 
     if (rw_opt_no_fwd_iter)
         rw_note (0, 0, 0, "ForwardIterator test disabled");
     else
-        gen_partial_sum_test (N, ConstFwdIter<X>(0, 0, 0), binop);
+        gen_partial_sum_test (N, ConstFwdIter<UserClass>(0, 0, 0), binop);
 
     if (rw_opt_no_bidir_iter)
         rw_note (0, 0, 0, "BidirectionalIterator test disabled");
     else
-        gen_partial_sum_test (N, ConstBidirIter<X>(0, 0, 0), binop);
+        gen_partial_sum_test (N, ConstBidirIter<UserClass>(0, 0, 0), binop);
 
     if (rw_opt_no_rnd_iter)
         rw_note (0, 0, 0, "RandomAccessIterator test disabled");
     else
-        gen_partial_sum_test (N, ConstRandomAccessIter<X>(0, 0, 0), binop);
+        gen_partial_sum_test (N, ConstRandomAccessIter<UserClass>(0, 0, 0),
+                              binop);
 }
 
 /**************************************************************************/

Modified: incubator/stdcxx/trunk/tests/numerics/26.valarray.cons.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/numerics/26.valarray.cons.cpp?view=diff&rev=510071&r1=510070&r2=510071
==============================================================================
--- incubator/stdcxx/trunk/tests/numerics/26.valarray.cons.cpp (original)
+++ incubator/stdcxx/trunk/tests/numerics/26.valarray.cons.cpp Wed Feb 21 07:58:53 2007
@@ -27,7 +27,7 @@
 #include <cstdlib>       // for free(), strtol(), size_t
 #include <valarray>      // for indirect_array, valarray
 
-#include <alg_test.h>    // for class X
+#include <rw_value.h>    // for UserClass
 #include <driver.h>      // for rw_test()
 #include <rw_printf.h>   // for rw_asnprintf()
 
@@ -93,15 +93,16 @@
 
 /**************************************************************************/
 
-// returns an array of size elements of type X constructed from a string
-// of comma-separated values
-X*
-make_array (const X*, const char *s, std::size_t *psize)
+// returns an array of size elements of type UserClass
+// constructed from a string of comma-separated values
+UserClass*
+make_array (const UserClass*, const char *s, std::size_t *psize)
 {
     std::size_t nelems = psize ? *psize : 0;
 
-    void* const raw = operator new ((nelems ? nelems : 1024) * sizeof (X));
-    X* const buf = _RWSTD_STATIC_CAST (X*, raw);
+    const std::size_t size = sizeof (UserClass);
+    void* const raw = operator new ((nelems ? nelems : 1024) * size);
+    UserClass* const buf = _RWSTD_STATIC_CAST (UserClass*, raw);
 
     if (0 == nelems && (0 == s || '\0' == *s))
         return buf;
@@ -115,12 +116,12 @@
 
         RW_ASSERT (0 == end || '\0' == *end || ',' == *end);
 
-        new (buf + i) X ();
+        new (buf + i) UserClass ();
         buf [i].val_ = int (val);
 
         if (0 == end || '\0' == *end) {
             while (++i < nelems)
-                new (buf + i) X (buf [i - 1]);
+                new (buf + i) UserClass (buf [i - 1]);
 
             break;
         }
@@ -137,20 +138,20 @@
 
 // deletes an array of elements of type T returned from make_array
 void
-delete_array (const X *array, std::size_t nelems)
+delete_array (const UserClass *array, std::size_t nelems)
 {
-    X* const a = _RWSTD_CONST_CAST (X*, array);
+    UserClass* const a = _RWSTD_CONST_CAST (UserClass*, array);
     
     for (std::size_t i = 0; i != nelems; ++i)
-        (a + i)->~X ();
+        (a + i)->~UserClass ();
 
     operator delete (a);
 }
 
 
-const std::size_t* count (const X*) { return &X::count_; }
+const std::size_t* count (const UserClass*) { return &UserClass::count_; }
 
-int value (const X &val) { return val.val_; }
+int value (const UserClass &val) { return val.val_; }
 
 /**************************************************************************/
 
@@ -175,7 +176,7 @@
     std::size_t size  = 0;
 
     // pointer to a counter keepint track of all objects of type T
-    // in existence (non-null only for T=X)
+    // in existence (non-null only for T=UserClass)
     const std::size_t* const pcounter = count ((const T*)0);
 
     // get the number of objects of type T before invoking the ctor
@@ -245,7 +246,7 @@
 
     if (pcounter) {
         // compute the number of objects of type T constructed
-        // by the ctor (valid only for T=X)
+        // by the ctor (valid only for T=UserClass)
         nobjects = *pcounter - nobjects;
         
         rw_assert (nobjects == nelems, 0, line,
@@ -424,7 +425,7 @@
     TEST (int);
     TEST (double);
 
-    TEST (X);
+    TEST (UserClass);
 
     return 0;
 }

Modified: incubator/stdcxx/trunk/tests/self/0.inputiter.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/self/0.inputiter.cpp?view=diff&rev=510071&r1=510070&r2=510071
==============================================================================
--- incubator/stdcxx/trunk/tests/self/0.inputiter.cpp (original)
+++ incubator/stdcxx/trunk/tests/self/0.inputiter.cpp Wed Feb 21 07:58:53 2007
@@ -6,16 +6,23 @@
  *
  ************************************************************************
  *
- * Copyright (c) 1994-2005 Quovadx,  Inc., acting through its  Rogue Wave
- * Software division. Licensed under the Apache License, Version 2.0 (the
- * "License");  you may  not use this file except  in compliance with the
- * License.    You    may   obtain   a   copy   of    the   License    at
- * http://www.apache.org/licenses/LICENSE-2.0.    Unless   required    by
- * applicable law  or agreed to  in writing,  software  distributed under
- * the License is distributed on an "AS IS" BASIS,  WITHOUT WARRANTIES OR
- * CONDITIONS OF  ANY KIND, either  express or implied.  See  the License
- * for the specific language governing permissions  and limitations under
- * the License.
+ * Licensed to the Apache Software  Foundation (ASF) under one or more
+ * contributor  license agreements.  See  the NOTICE  file distributed
+ * with  this  work  for  additional information  regarding  copyright
+ * ownership.   The ASF  licenses this  file to  you under  the Apache
+ * License, Version  2.0 (the  "License"); you may  not use  this file
+ * except in  compliance with the License.   You may obtain  a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the  License is distributed on an  "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+ * implied.   See  the License  for  the  specific language  governing
+ * permissions and limitations under the License.
+ *
+ * Copyright 1994-2005 Rogue Wave Software.
  * 
  **************************************************************************/
 
@@ -23,7 +30,8 @@
 #include <signal.h>
 #include <stdio.h>
 
-#include <alg_test.h>   // for InputIter, X
+#include <alg_test.h>   // for InputIter
+#include <rw_value.h>   // for UserClass
 #include <driver.h>     // for rw_test(), ...
 
 /***********************************************************************/
@@ -68,9 +76,9 @@
     } (void)0
 
 
-typedef InputIter<X> Iterator;
+typedef InputIter<UserClass> Iterator;
 
-// FIXME: implement an easy way to print out an array of X
+// FIXME: implement an easy way to print out an array of UserClass
 #define X2STR(ign1, ign2)   "***NOT IMPLEMENTED ***"
 
 /***********************************************************************/
@@ -78,7 +86,7 @@
 static void
 test_0 ()
 {
-    X *x = X::from_char ("abc");
+    UserClass *x = UserClass::from_char ("abc");
 
     Iterator end0 = make_iter (x + 3, x + 0, x + 3, end0);
     Iterator end1 = make_iter (x + 3, x + 0, x + 3, end1);
@@ -89,26 +97,26 @@
     PASS (equal = end0 == end0);
 
     rw_assert (equal, 0, __LINE__,
-               "InputIter<X> end iterator unexpectedly "
+               "InputIter<UserClass> end iterator unexpectedly "
                "not equal to self: %p == %p", end0.cur_, end0.cur_);
 
     PASS (equal = end0 != end0);
 
     rw_assert (!equal, 0, __LINE__,
-               "InputIter<X> end iterator unexpectedly "
+               "InputIter<UserClass> end iterator unexpectedly "
                "not equal to self: %p == %p", end0.cur_, end0.cur_);
 
     // end iterator must compare equal to another
     PASS (equal = end0 == end1);
 
     rw_assert (equal, 0, __LINE__,
-               "InputIter<X> end iterator unexpectedly "
+               "InputIter<UserClass> end iterator unexpectedly "
                "not equal to another: %p == %p", end0.cur_, end1.cur_);
 
     PASS (equal = end0 != end1);
 
     rw_assert (!equal, 0, __LINE__,
-               "InputIter<X> end iterator unexpectedly "
+               "InputIter<UserClass> end iterator unexpectedly "
                "not equal to another: %p == %p", end0.cur_, end1.cur_);
 
     // cannot increment the end iterator
@@ -132,8 +140,8 @@
 static void
 test_1 ()
 {
-    X *x = X::from_char ("abcdef");
-    X *y = X::from_char ("ABCDEF");
+    UserClass *x = UserClass::from_char ("abcdef");
+    UserClass *y = UserClass::from_char ("ABCDEF");
 
     const Iterator end = make_iter (x + 6, x + 0, x + 6, end);
           Iterator it  = make_iter (x + 0, x + 0, x + 6, it);
@@ -144,7 +152,7 @@
     PASS (equal = it == end);
 
     rw_assert (!equal, 0, __LINE__,
-               "InputIter<X> unexpectedly equal to end: "
+               "InputIter<UserClass> unexpectedly equal to end: "
                "%p == %p", it.cur_, end.cur_);
     
     PASS (y [0] = *it);
@@ -152,7 +160,7 @@
     PASS (equal = it == end);
 
     rw_assert (!equal, 0, __LINE__,
-               "InputIter<X> unexpectedly equal to end: "
+               "InputIter<UserClass> unexpectedly equal to end: "
                "%p == %p", it.cur_, end.cur_);
 
     PASS (y [1] = *it);
@@ -161,7 +169,7 @@
     PASS (equal = it == it);
 
     rw_assert (equal, 0, __LINE__,
-               "InputIter<X> unexpectedly equal to self: "
+               "InputIter<UserClass> unexpectedly equal to self: "
                "%p == %p", it.cur_, it.cur_);
 
     PASS (y [2] = *it);
@@ -176,12 +184,12 @@
     PASS (equal = it == end);
 
     rw_assert (equal, 0, __LINE__,
-               "InputIter<X> unexpectedly not qual to end: "
+               "InputIter<UserClass> unexpectedly not qual to end: "
                "%p != %p (diff = %d)",
                it.cur_, end.cur_, end.cur_ - it.cur_);
 
-    rw_assert (0 == X::compare (x, y, 6), 0, __LINE__,
-               "InputIter<X> data mismatch: %s != %s",
+    rw_assert (0 == UserClass::compare (x, y, 6), 0, __LINE__,
+               "InputIter<UserClass> data mismatch: %s != %s",
                X2STR (x, 6), X2STR (y, 6));
     
     delete[] x;
@@ -193,8 +201,8 @@
 static void
 test_2 ()
 {
-    X *x = X::from_char ("abcdef");
-    X *y = X::from_char ("ABCDEF");
+    UserClass *x = UserClass::from_char ("abcdef");
+    UserClass *y = UserClass::from_char ("ABCDEF");
 
     const Iterator end = make_iter (x + 6, x + 0, x + 6, end);
           Iterator it  = make_iter (x + 0, x + 0, x + 6, it);
@@ -212,7 +220,7 @@
     PASS (equal = it == end);
 
     rw_assert (!equal, 0, __LINE__,
-               "InputIter<X> unexpectedly equal to end: "
+               "InputIter<UserClass> unexpectedly equal to end: "
                "%p != %p (diff = %d)",
                it.cur_, end.cur_, end.cur_ - it.cur_);
 
@@ -221,12 +229,12 @@
     PASS (equal = it == end);
 
     rw_assert (equal, 0, __LINE__,
-               "InputIter<X> unexpectedly not equal to end: "
+               "InputIter<UserClass> unexpectedly not equal to end: "
                "%p != %p (diff = %d)",
                it.cur_, end.cur_, end.cur_ - it.cur_);
 
-    rw_assert (0 == X::compare (x, y, 6), 0, __LINE__,
-               "InputIter<X> data mismatch: %s != %s",
+    rw_assert (0 == UserClass::compare (x, y, 6), 0, __LINE__,
+               "InputIter<UserClass> data mismatch: %s != %s",
                X2STR (x, 6), X2STR (y, 6));
     
     delete[] x;
@@ -238,8 +246,8 @@
 static void
 test_3 ()
 {
-    X *x = X::from_char ("abcdef");
-    X *y = X::from_char ("ABCDEF");
+    UserClass *x = UserClass::from_char ("abcdef");
+    UserClass *y = UserClass::from_char ("ABCDEF");
 
     const Iterator end = make_iter (x + 6, x + 6, x + 6, end);
           Iterator it0 = make_iter (x + 0, x + 0, x + 6, it0);
@@ -250,22 +258,22 @@
     PASS (equal = it0 == it1);
 
     rw_assert (equal, 0, __LINE__,
-               "InputIter<X> unexpectedly not equal: "
+               "InputIter<UserClass> unexpectedly not equal: "
                "%p != %p (diff = %d)",
                it0.cur_, it1.cur_, it0.cur_ - it1.cur_);
 
     PASS (equal = it0 == end);
 
     rw_assert (!equal, 0, __LINE__,
-               "InputIter<X> unexpectedly equal to end: "
+               "InputIter<UserClass> unexpectedly equal to end: "
                "%p == %p", it1.cur_, end.cur_);
 
     PASS (y [0] = *it0);
     PASS (y [1] = *it1);
 
     rw_assert (y [0].val_ == y [1].val_, 0, __LINE__,
-               "two copies of InputIter<X> unexpectedly yield different "
-               "values: %d != %d", y [0].val_, y [1].val_);
+               "two copies of InputIter<UserClass> unexpectedly yield "
+               "different values: %d != %d", y [0].val_, y [1].val_);
 
     PASS (it0++);
     FAIL (it1++);        // can't pass through the same iterator twice
@@ -274,7 +282,7 @@
     PASS (equal = it0 == end);
 
     rw_assert (!equal, 0, __LINE__,
-               "InputIter<X> unexpectedly equal to end: "
+               "InputIter<UserClass> unexpectedly equal to end: "
                "%p == %p", it1.cur_, end.cur_);
 
     PASS (it1 = it0);
@@ -282,18 +290,18 @@
     PASS (equal = it0 == it1);
 
     rw_assert (equal, 0, __LINE__,
-               "InputIter<X> unexpectedly not equal: "
+               "InputIter<UserClass> unexpectedly not equal: "
                "%p == %p", it0.cur_, it1.cur_);
 
     PASS (y [0] = *it0);
     PASS (y [1] = *it1);
 
     rw_assert (y [0].val_ == y [1].val_, 0, __LINE__,
-               "two copies of InputIter<X> unexpectedly yield different "
-               "values: %d != %d", y [0].val_, y [1].val_);
+               "two copies of InputIter<UserClass> unexpectedly yield "
+               "different values: %d != %d", y [0].val_, y [1].val_);
 
     rw_assert (y [0].val_ == 'b', 0, __LINE__,
-               "InputIter<X>::operator*() == %d, got %d",
+               "InputIter<UserClass>::operator*() == %d, got %d",
                y [0].val_, 'b');
 
     PASS (it1++);
@@ -303,7 +311,7 @@
     PASS (equal = it1 == end);
 
     rw_assert (!equal, 0, __LINE__,
-               "InputIter<X> unexpectedly equal to end: "
+               "InputIter<UserClass> unexpectedly equal to end: "
                "%p == %p", it1.cur_, end.cur_);
 
     FAIL (x [0] = *it0);   // cannot dereference



Mime
View raw message