Copied: stdcxx/trunk/tests/utilities/20.tuple.creation.cpp (from r672948, 
stdcxx/branches/4.3.x/tests/utilities/20.tuple.creation.cpp)
URL: 
http://svn.apache.org/viewvc/stdcxx/trunk/tests/utilities/20.tuple.creation.cpp?p2=stdcxx/trunk/tests/utilities/20.tuple.creation.cpp&p1=stdcxx/branches/4.3.x/tests/utilities/20.tuple.creation.cpp&r1=672948&r2=681820&rev=681820&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.tuple.creation.cpp (original)
+++ stdcxx/trunk/tests/utilities/20.tuple.creation.cpp Fri Aug  1 13:51:17 2008
@@ -28,8 +28,9 @@
 
 #include <rw_driver.h>
 
- // compile out all test code if extensions disabled
- #ifndef _RWSTD_NO_EXT_CXX_0X
+// compile out all test code if extensions disabled
+#if    !defined(_RWSTD_NO_EXT_CXX_0X) \
+    && !defined(_RWSTD_NO_RVALUE_REFERENCES)
 
 #include <functional>           // for reference_wrapper
 #include <tuple>
@@ -45,47 +46,58 @@
 {
     rw_info (0, __FILE__, __LINE__, "make_tuple");
 
-    IntTuple it1 = std::make_tuple (1);
+    std::tuple<int> it1 = std::make_tuple (1);
 
-    typedef std::tuple<int, int>        IntTuple2;
     int i = 2;
-    IntTuple2 it2 = std::make_tuple (1, i);
+    std::tuple<int, int> it2 = std::make_tuple (1, i);
 
-    typedef std::tuple<int, int, int>   IntTuple3;
     const int j = 3;
-    IntTuple3 it3 = std::make_tuple (1, i, j);
+    std::tuple<int, int, int> it3 = std::make_tuple (1, i, j);
 
+    std::tuple<int&> rt1 = std::make_tuple (std::ref (i));
+
+    std::tuple<const int&> rt2 = std::make_tuple (std::cref (i));
 }
 
 /**************************************************************************/
 
+#include <cstring>
+
 static void
 test_tie ()
 {
     rw_info (0, __FILE__, __LINE__, "tie");
 
+    int i = 0; double d = 0.0; const char* s = 0;
+    std::tie (i, std::ignore, s)
+        = std::make_tuple (256, 3.14159, "string");
+
+    rw_assert (i == 256, __FILE__, __LINE__,
+               "i == 256, got false, expected true");
+    rw_assert (d == 0.0, __FILE__, __LINE__,
+               "d == 0.0, got false, expected true");
+    rw_assert (0 == std::strcmp (s, "string"), __FILE__, __LINE__,
+               "s == \"string\", got false, expected true");
 }
 
 /**************************************************************************/
 
-#define Big1stPart  bool, char, int, double
-#define Big2ndPart  void*, UserClass
-
 static void
 test_tuple_cat ()
 {
     rw_info (0, __FILE__, __LINE__, "tuple_cat");
 
-#define Big1stPart  bool, char, int, double
-#define Big2ndPart  void*, UserClass
+#define FirstHalf       bool, char, int, double
+#define SecondHalf      void*, UserDefined
 
-    typedef std::tuple<Big1stPart> Big1stTuple;
-    Big1stTuple bt1 (true, 'a', 256, 3.14159);
+    typedef std::tuple<FirstHalf>   FirstTuple;
+    FirstTuple t1 (true, 'a', 256, 3.14159);
 
-    typedef std::tuple<Big2ndPart> Big2ndTuple;
-    Big2ndTuple bt2 (&bt1, UserClass ());
+    typedef std::tuple<SecondHalf>  SecondTuple;
+    SecondTuple t2 (&t1, UserDefined ());
 
-    //BigTuple bt (tuple_cat (bt1, bt2));
+    typedef std::tuple<FirstHalf, SecondHalf>   WholeTuple;
+    //WholeTuple t3 (tuple_cat (t1, t2));
 }
 
 /**************************************************************************/
@@ -103,17 +115,28 @@
     return 0;
 }
 
-#else // !_RWSTD_NO_EXT_CXX_0X
+#else // _RWSTD_NO_EXT_CXX_0X || _RWSTD_NO_RVALUE_REFERENCES
 
 static int
 run_test (int, char*[])
 {
-    rw_info (0, 0, __LINE__,
-             "tests for C++0x tuple extension disabled");
+#if defined (_RWSTD_NO_EXT_CXX_0X)
+
+    rw_warn (0, 0, __LINE__,
+             "test disabled because _RWSTD_NO_EXT_CXX_0X is defined");
+
+#elif defined (_RWSTD_NO_RVALUE_REFERENCES)
+
+    rw_warn (0, 0, __LINE__,
+                "test disabled because _RWSTD_NO_RVALUE_REFERENCES is "
+                        "defined");
+
+#endif
+
     return 0;
 }
 
-#endif // !_RWSTD_NO_EXT_CXX_0X
+#endif // _RWSTD_NO_EXT_CXX_0X || _RWSTD_NO_RVALUE_REFERENCES
 
 /*extern*/ int
 main (int argc, char* argv [])

Modified: stdcxx/trunk/tests/utilities/20.tuple.elem.cpp
URL: 
http://svn.apache.org/viewvc/stdcxx/trunk/tests/utilities/20.tuple.elem.cpp?rev=681820&r1=681819&r2=681820&view=diff
==============================================================================
--- stdcxx/trunk/tests/utilities/20.tuple.elem.cpp (original)
+++ stdcxx/trunk/tests/utilities/20.tuple.elem.cpp Fri Aug  1 13:51:17 2008
@@ -2,7 +2,7 @@
  *
  * 20.tuple.elem.cpp - tests exercising tuple element accessors
  *
- * $Id$
+ * $Id: 20.tuple.elem.cpp 677985 2008-07-18 18:05:55Z elemings $
  *
  ***************************************************************************
  *
@@ -11,7 +11,7 @@
  * 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
+ * except in  compliance with the License.   You may otain  a copy of
  * the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
@@ -22,54 +22,166 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2008 Rogue Wave Software.
- * 
+ * Copyright 2008 Rogue Wave Software, Inc.
+ *
  **************************************************************************/
 
+#include <rw_driver.h>
+
+// compile out all test code if extensions disabled
+#if    !defined (_RWSTD_NO_EXT_CXX_0X) \
+    && !defined (_RWSTD_NO_RVALUE_REFERENCES)
+
 #include <tuple>
 
 #include "20.tuple.h"
 
 /**************************************************************************/
 
-#include <rw_driver.h>
+#include <rw_valcmp.h>
+
+#define BOOL_VAL    true
+#define CHAR_VAL    'a'
+#define INT_VAL     256
+#define DBL_VAL     3.14159
+#define PTR_VAL     ptr_val
+#define USER_VAL    user_val
+
+static void*        ptr_val;
+static UserDefined  user_val;
+
+typedef std::tuple<bool, char, int, double, void*, UserDefined> Tuple;
 
 static void
-test_get ()
+test_const_get (const Tuple& t)
 {
-    rw_info (0, __FILE__, __LINE__, "get");
+    rw_info (0, __FILE__, __LINE__, "get (const)");
 
-    IntTuple it (4);
-    rw_assert (std::get<0> (it) == 4, __FILE__, __LINE__,
-               "get<0> (it), got %d, expected 4", std::get<0> (it));
+    const bool& b = std::get<0> (t);
+    rw_assert (b == BOOL_VAL, __FILE__, __LINE__, "get<0>(t), got %s, "
+               "expected %s", b? "true": "false", BOOL_VAL? "true": "false");
+
+    const char& c = std::get<1> (t);
+    rw_assert (c == CHAR_VAL, __FILE__, __LINE__,
+               "get<1>(t), got \'%c\', expected \'%c\'", c, CHAR_VAL);
+
+    const int& i = std::get<2> (t);
+    rw_assert (i == INT_VAL, __FILE__, __LINE__,
+               "get<2>(t), got %d, expected %d", i, INT_VAL);
+
+    const double& d = std::get<3> (t);
+    rw_assert (0 == rw_dblcmp (d, DBL_VAL), __FILE__, __LINE__,
+               "get<3>(t), got %f, expected %f", d, DBL_VAL);
+
+    void* const& p = std::get<4> (t);
+    rw_assert (p == PTR_VAL, __FILE__, __LINE__,
+               "get<4>(t), got %p, expected %p", p, PTR_VAL);
+
+    const UserDefined& uc = std::get<5> (t);
+    rw_assert (uc == USER_VAL, __FILE__, __LINE__,
+               "get<5>(t), got %d, expected %d",
+               uc.value (), USER_VAL.value ());
 }
 
 /**************************************************************************/
 
 static void
-test_const_get ()
+test_get (Tuple& t)
 {
-    rw_info (0, __FILE__, __LINE__, "get (const)");
+    rw_info (0, __FILE__, __LINE__, "get");
 
+    bool& b = std::get<0> (t);
+    rw_assert (b == BOOL_VAL, __FILE__, __LINE__,
+               "get<0>(t), got %d, expected %b", b, BOOL_VAL);
+    b = !BOOL_VAL;
+    rw_assert (std::get<0> (t) == !BOOL_VAL, __FILE__, __LINE__,
+               "get<0>(t), got %d, expected %b", std::get<0> (t),
+               !BOOL_VAL);
+
+    char& c = std::get<1> (t);
+    rw_assert (c == 'a', __FILE__, __LINE__,
+               "get<1>(t), got %c, expected \'%c\'", c, CHAR_VAL);
+    c = '1';
+    rw_assert (std::get<1> (t) == '1', __FILE__, __LINE__,
+               "get<1>(t), got %c, expected \'1\'", std::get<1> (t));
+
+    int& i = std::get<2> (t);
+    rw_assert (i == INT_VAL, __FILE__, __LINE__,
+               "get<2>(t), got %d, expected %d", i, INT_VAL);
+    i = INT_VAL+1;
+    rw_assert (std::get<2> (t) == INT_VAL+1, __FILE__, __LINE__,
+               "get<1>(t), got %d, expected %d", std::get<2> (t),
+               INT_VAL+1);
+
+    double& d = std::get<3> (t);
+    rw_assert (0 == rw_dblcmp (d, DBL_VAL), __FILE__, __LINE__,
+               "get<3>(t), got %f, expected %f", d, DBL_VAL);
+    d = DBL_VAL*DBL_VAL;
+    rw_assert (0 == rw_dblcmp (std::get<3> (t), DBL_VAL*DBL_VAL),
+               __FILE__, __LINE__,
+               "get<3>(t), got %f, expected %f", std::get<3> (t),
+               DBL_VAL*DBL_VAL);
+
+    void* p = std::get<4> (t);
+    rw_assert (p == PTR_VAL, __FILE__, __LINE__,
+               "get<4>(t), got %p, expected %p", p, PTR_VAL);
+    p = &d;
+    rw_assert (std::get<4> (t) == &d, __FILE__, __LINE__,
+               "get<4>(t), got %p, expected %p", std::get<4> (t), &d);
+
+    UserDefined& uc = std::get<5> (t);
+    rw_assert (uc == USER_VAL, __FILE__, __LINE__,
+               "get<5>(t), got %d, expected %d",
+               uc.value (), USER_VAL.value ());
+    uc = UserDefined (INT_VAL);
+    rw_assert ((std::get<5> (t)).value () == INT_VAL, __FILE__, __LINE__,
+               "get<5>(t), got %d, expected %d",
+               (std::get<5> (t)).value (), INT_VAL);
 }
 
 /**************************************************************************/
 
 static int
-run_test (int /*unused*/, char* /*unused*/ [])
+run_test (int /*argc*/, char* argv [])
+{
+    ptr_val = static_cast<void*> (argv [0]);
+    Tuple t (BOOL_VAL, CHAR_VAL, INT_VAL, DBL_VAL, PTR_VAL, USER_VAL);
+
+    test_const_get (t);
+    test_get (t);
+
+    return 0;
+}
+
+#else // _RWSTD_NO_EXT_CXX_0X || _RWSTD_NO_RVALUE_REFERENCES
+
+static int
+run_test (int, char*[])
 {
-    test_get ();
-    test_const_get ();
+
+#if defined (_RWSTD_NO_EXT_CXX_0X)
+
+    rw_warn (0, 0, __LINE__,
+             "test disabled because _RWSTD_NO_EXT_CXX_0X is defined");
+
+#elif defined (_RWSTD_NO_RVALUE_REFERENCES)
+
+    rw_warn (0, 0, __LINE__,
+             "test disabled because _RWSTD_NO_RVALUE_REFERENCES is "
+                        "defined");
+
+#endif
 
     return 0;
 }
 
+#endif // _RWSTD_NO_EXT_CXX_0X || _RWSTD_NO_RVALUE_REFERENCES
+
 /*extern*/ int
 main (int argc, char* argv [])
 {
     return rw_test (argc, argv, __FILE__,
-                    "[tuple.elem]",
-                    "20.3.1.5  Element access",
+                    "[tuple.elem]", "20.3.1.5  Element access",
                     run_test, "", 0);
 }
 

Modified: stdcxx/trunk/tests/utilities/20.tuple.h
URL: 
http://svn.apache.org/viewvc/stdcxx/trunk/tests/utilities/20.tuple.h?rev=681820&r1=681819&r2=681820&view=diff
==============================================================================
--- stdcxx/trunk/tests/utilities/20.tuple.h (original)
+++ stdcxx/trunk/tests/utilities/20.tuple.h Fri Aug  1 13:51:17 2008
@@ -2,7 +2,7 @@
  *
  * 20.tuple.h - framework for tuple tests
  *
- * $Id$
+ * $Id: 20.tuple.h 677985 2008-07-18 18:05:55Z elemings $
  *
  ***************************************************************************
  *
@@ -22,31 +22,203 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2008 Rogue Wave Software.
- * 
+ * Copyright 2008 Rogue Wave Software, Inc.
+ *
  **************************************************************************/
 
 #ifndef RW_20_TUPLE_H_INCLUDED
 #define RW_20_TUPLE_H_INCLUDED
 
+#include <ostream>              // for std::ostream
 #include <tuple>
+#include <type_traits>          // for std::decay
+#include <utility>              // for std::move
+
+
+// user-defined class for tuple testing (similar to UserClass)
+
+class UserDefined
+{
+
+    int                 value_;         // some arbitrary value
+
+public:
+
+    // types
+
+    typedef int         value_type;
+    typedef unsigned    size_type;
+
+    struct count_type   // number of constructors/operators called
+    {
+        size_type   dflt_ctor;
+        size_type   copy_ctor;
+        size_type   tmpl_ctor;
+        size_type   move_ctor;
+        size_type   copy_asgn;
+        size_type   tmpl_asgn;
+        size_type   move_asgn;
+    };
+
+    static count_type   actual;         // since last reset()
+    static count_type   expect;         // modified by expect()
+
+
+    // constructors
+
+    UserDefined ()
+        : value_ () { ++actual.dflt_ctor; }
+
+    UserDefined (const UserDefined& src)
+        : value_ (src.value_) { ++actual.copy_ctor; }
+
+#if !defined _RWSTD_NO_RVALUE_REFERENCES
+
+    UserDefined (UserDefined&& src)
+        : value_ (std::move (src.value_))
+        { ++actual.move_ctor; }
+
+    // Requires: U is convertible to `value_type'.
+    template <class U >
+    explicit UserDefined (U&& u)
+        : value_ (std::move (u)) { ++actual.tmpl_ctor; }
+
+#endif   // !defined _RWSTD_NO_RVALUE_REFERENCES
+
+
+    // assignment
+
+    UserDefined& operator= (const UserDefined& src)
+    {
+        value_ = src.value_;
+        ++actual.copy_asgn;
+        return *this;
+    }
+
+    template <class U>
+    UserDefined& operator= (const U& src)
+    {
+        value_ = src;
+        ++actual.tmpl_asgn;
+        return *this;
+    }
+
+#if !defined _RWSTD_NO_RVALUE_REFERENCES
+
+    UserDefined& operator= (const UserDefined&& src)
+    {
+        value_ = std::move (src.value_);
+        ++actual.move_asgn;
+        return *this;
+    }
+
+#endif   // !defined _RWSTD_NO_RVALUE_REFERENCES
+
+
+    // accessors
+
+    value_type value () const { return value_; }
+
+
+    // testing
+
+    static void reset ()
+    {
+        actual.dflt_ctor = actual.copy_ctor = actual.tmpl_ctor =
+        actual.move_ctor = actual.copy_asgn = actual.move_asgn =
+        actual.tmpl_asgn = 0;
+
+        expect.dflt_ctor = expect.copy_ctor = expect.tmpl_ctor =
+        expect.move_ctor = expect.copy_asgn = expect.move_asgn =
+        expect.tmpl_asgn = 0;
+    }
+
+
+    // implicit value_type conversion?
+};
+
+UserDefined::count_type
+UserDefined::actual = { 0, 0, 0, 0, 0, 0, 0 };
+
+UserDefined::count_type
+UserDefined::expect = { 0, 0, 0, 0, 0, 0, 0 };
+
+inline bool
+operator== (const UserDefined& lhs, const UserDefined& rhs)
+{
+    return lhs.value () == rhs.value ();
+}
+
+inline bool
+operator< (const UserDefined& lhs, const UserDefined& rhs)
+{
+    return lhs.value () < rhs.value ();
+}
+
+/**************************************************************************/
+
+// tuple names
+
+template <class T>
+struct type_name_ { static const char* value; };
+
+#define TYPE_NAME(T)    \
+template <> const char* type_name_<T>::value = #T;
+
+TYPE_NAME (std::tuple<>)
+TYPE_NAME (std::tuple<int>)
+TYPE_NAME (std::tuple<const int>)
+TYPE_NAME (std::tuple<int&>)
+TYPE_NAME (std::tuple<std::tuple<int> >)
+TYPE_NAME (std::tuple<UserDefined>)
+
+#undef TYPE_NAME
+#define TYPE_NAME(T, S) \
+template <> const char* type_name_<T>::value = S;
+
+#undef TUPLE
+#define TUPLE           std::tuple<long, const char*>
+TYPE_NAME (TUPLE, "std::tuple<long, const char*>")
+
+#undef TUPLE
+#define TUPLE           \
+std::tuple<bool, char, int, double, void*, UserDefined>
+TYPE_NAME (TUPLE, "std::tuple<bool, char, int, double, void*, " \
+                  "UserDefined>")
+
+#undef TUPLE
+
+#undef TYPE_NAME
+#define TYPE_NAME(T)    type_name_<T>::value
+
+/**************************************************************************/
 
-#include <rw_value.h>                       // for UserClass
+// formatting specifiers
 
+template <class T>
+struct fmt_spec { static const char* value; };
 
-// various tuple types for test purposes
+#define FMT_SPEC(T, S)  \
+template <> const char* fmt_spec<T>::value = #S;
 
-typedef std::tuple < >                      EmptyTuple;
-typedef std::tuple < int >                  IntTuple;
-typedef std::tuple < const int >            ConstIntTuple;
-typedef std::tuple < long, const char* >    PairTuple;
-typedef std::tuple < UserClass >            UserTuple;
-typedef std::tuple < std::tuple < int > >   NestedTuple;
+FMT_SPEC (bool, %b)
+FMT_SPEC (char, %c)
+FMT_SPEC (int, %d)
+FMT_SPEC (unsigned, %u)
+FMT_SPEC (long, %ld)
+FMT_SPEC (float, %f)
+FMT_SPEC (double, %f)
+FMT_SPEC (char*, %s)
+FMT_SPEC (char const*, %s)
+FMT_SPEC (void*, %p)
+FMT_SPEC (void const*, %p)
 
-#define BigList      bool, char, int, double, void*, UserClass
-#define BigListSize  6
+#undef DECAY
+#define DECAY(T)        typename std::decay<T>::type
 
-typedef std::tuple < BigList >              BigTuple;
+// ignore cv-qualifiers and references
+#undef FMT_SPEC
+#define FMT_SPEC(T)     fmt_spec<DECAY (T)>::value
 
 
 #endif   // define RW_20_TUPLE_H_INCLUDED

Modified: stdcxx/trunk/tests/utilities/20.tuple.helpers.cpp
URL: 
http://svn.apache.org/viewvc/stdcxx/trunk/tests/utilities/20.tuple.helpers.cpp?rev=681820&r1=681819&r2=681820&view=diff
==============================================================================
--- stdcxx/trunk/tests/utilities/20.tuple.helpers.cpp (original)
+++ stdcxx/trunk/tests/utilities/20.tuple.helpers.cpp Fri Aug  1 13:51:17 2008
@@ -2,7 +2,7 @@
  *
  * 20.tuple.helpers.cpp - tests exercising tuple helpers
  *
- * $Id$
+ * $Id: 20.tuple.helpers.cpp 677985 2008-07-18 18:05:55Z elemings $
  *
  ***************************************************************************
  *
@@ -22,18 +22,22 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2008 Rogue Wave Software.
- * 
+ * Copyright 2008 Rogue Wave Software, Inc.
+ *
  **************************************************************************/
 
+#include <rw_driver.h>
+
+// compile out all test code if extensions disabled
+#if    !defined (_RWSTD_NO_EXT_CXX_0X) \
+    && !defined (_RWSTD_NO_RVALUE_REFERENCES)
+
 #include <tuple>
 
 #include "20.tuple.h"
 
 /**************************************************************************/
 
-#include <rw_driver.h>
-
 static void
 test_tuple_size ()
 {
@@ -45,16 +49,22 @@
                "tuple_size<" #T ">::value, got %d, expected " \
                STRING (S), std::tuple_size<T>::value)
 
-    TEST (EmptyTuple, 0);
+    TEST (std::tuple<>, 0);
 
-    TEST (IntTuple, 1);
-    TEST (ConstIntTuple, 1);
-    TEST (UserTuple, 1);
-    TEST (NestedTuple, 1);
+    TEST (std::tuple<int>, 1);
+    TEST (std::tuple<const int>, 1);
+    TEST (std::tuple<UserDefined>, 1);
+    TEST (std::tuple<std::tuple<int> >, 1);
 
-    TEST (PairTuple, 2);
+#undef TUPLE
+#define TUPLE std::tuple<long, const char*>
 
-    TEST (BigTuple, BigListSize);
+    TEST (TUPLE, 2);
+
+#undef TUPLE
+#define TUPLE std::tuple<bool, char, int, double, void*, UserDefined>
+
+    TEST (TUPLE, 6);
 }
 
 /**************************************************************************/
@@ -69,7 +79,7 @@
     enum {
         inherited,
         const_int,
-        user_class,
+        user_defined,
         int_tuple
     } type_id;
 
@@ -82,8 +92,8 @@
     any_t (const int)
         : rw_any_t (char ()), type_id (const_int) { }
 
-    any_t (UserClass)
-        : rw_any_t (char ()), type_id (user_class) { }
+    any_t (UserDefined)
+        : rw_any_t (char ()), type_id (user_defined) { }
 
     any_t (std::tuple< int >)
         : rw_any_t (char ()), type_id (int_tuple) { }
@@ -91,7 +101,7 @@
     const char* type_name () const
     {
         return type_id == const_int? "const int":
-               type_id == user_class? "UserClass":
+               type_id == user_defined? "UserDefined":
                type_id == int_tuple? "std::tuple<int>":
                rw_any_t::type_name ();
     }
@@ -102,32 +112,43 @@
 {
     rw_info (0, __FILE__, __LINE__, "tuple_element");
 
+#undef IS_SAME
 #define IS_SAME(T,U) \
         _RW::__rw_is_same<T, U>::value
+
+#undef TYPE_NAME
 #define TYPE_NAME(T) \
         (any_t (T ())).type_name ()
 
 #undef TEST
 #define TEST(N, T, E) \
-    typedef std::tuple_element<N, T>::type T ## N; \
-    rw_assert (IS_SAME(T ## N, E), __FILE__, __LINE__, \
+{ \
+    typedef std::tuple_element<N, T>::type elem_type; \
+    rw_assert (IS_SAME(elem_type, E), __FILE__, __LINE__, \
                "tuple_element<0, " #T ">::type, got type \"%s\", " \
-               "expected type \"" #E "\"", TYPE_NAME (T##N))
+               "expected type \"" #E "\"", TYPE_NAME (elem_type)); \
+}
 
-    TEST (0, IntTuple, int);
-    TEST (0, ConstIntTuple, const int);
-    TEST (0, NestedTuple, std::tuple<int>);
-    TEST (0, UserTuple, UserClass);
-
-    TEST (0, PairTuple, long);
-    TEST (1, PairTuple, const char*);
-
-    TEST (0, BigTuple, bool);
-    TEST (1, BigTuple, char);
-    TEST (2, BigTuple, int);
-    TEST (3, BigTuple, double);
-    TEST (4, BigTuple, void*);
-    TEST (5, BigTuple, UserClass);
+    TEST (0, std::tuple<int>, int)
+    TEST (0, std::tuple<const int>, const int)
+    TEST (0, std::tuple<std::tuple<int> >, std::tuple<int>)
+    TEST (0, std::tuple<UserDefined>, UserDefined)
+
+#undef TUPLE
+#define TUPLE std::tuple<long, const char*>
+
+    TEST (0, TUPLE, long)
+    TEST (1, TUPLE, const char*)
+
+#undef TUPLE
+#define TUPLE std::tuple<bool, char, int, double, void*, UserDefined>
+
+    TEST (0, TUPLE, bool)
+    TEST (1, TUPLE, char)
+    TEST (2, TUPLE, int)
+    TEST (3, TUPLE, double)
+    TEST (4, TUPLE, void*)
+    TEST (5, TUPLE, UserDefined)
 }
 
 /**************************************************************************/
@@ -141,6 +162,30 @@
     return 0;
 }
 
+#else // _RWSTD_NO_EXT_CXX_0X || _RWSTD_NO_RVALUE_REFERENCES
+
+static int
+run_test (int, char*[])
+{
+
+#if defined (_RWSTD_NO_EXT_CXX_0X)
+
+    rw_warn (0, 0, __LINE__,
+             "test disabled because _RWSTD_NO_EXT_CXX_0X is defined");
+
+#elif defined (_RWSTD_NO_RVALUE_REFERENCES)
+
+    rw_warn (0, 0, __LINE__,
+             "test disabled because _RWSTD_NO_RVALUE_REFERENCES is "
+                        "defined");
+
+#endif
+
+    return 0;
+}
+
+#endif // _RWSTD_NO_EXT_CXX_0X || _RWSTD_NO_RVALUE_REFERENCES
+
 /*extern*/ int
 main (int argc, char* argv [])
 {

Copied: stdcxx/trunk/tests/utilities/20.tuple.rel.cpp (from r672948, 
stdcxx/branches/4.3.x/tests/utilities/20.tuple.rel.cpp)
URL: 
http://svn.apache.org/viewvc/stdcxx/trunk/tests/utilities/20.tuple.rel.cpp?p2=stdcxx/trunk/tests/utilities/20.tuple.rel.cpp&p1=stdcxx/branches/4.3.x/tests/utilities/20.tuple.rel.cpp&r1=672948&r2=681820&rev=681820&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.tuple.rel.cpp (original)
+++ stdcxx/trunk/tests/utilities/20.tuple.rel.cpp Fri Aug  1 13:51:17 2008
@@ -29,7 +29,8 @@
 #include <rw_driver.h>
 
 // compile out all test code if extensions disabled
-#ifndef _RWSTD_NO_EXT_CXX_0X
+#if    !defined (_RWSTD_NO_EXT_CXX_0X) \
+    && !defined (_RWSTD_NO_RVALUE_REFERENCES)
 
 #include <tuple>
 
@@ -42,31 +43,36 @@
 {
     rw_info (0, __FILE__, __LINE__, "operator==");
 
-    EmptyTuple nt1, nt2;
+    std::tuple<> nt1, nt2;
+    // special case
     rw_assert (nt1 == nt1, __FILE__, __LINE__,
                "nt1 == nt1, got false, expected true");
-    rw_assert (nt1 == nt2, __FILE__, __LINE__,
-               "nt1 == nt2, got true, expected false");
 
-    IntTuple it1 (1), it2 (1);
-    rw_assert (it1 == it1, __FILE__, __LINE__,
-               "it1 == it1, got false, expected true");
-    rw_assert (it1 == it2, __FILE__, __LINE__,
-               "it1 == it2, got false, expected true");
-
-    UserClass uc;
-    UserTuple ut1 (uc), ut2 (uc);
-    rw_assert (ut1 == ut1, __FILE__, __LINE__,
-               "ut1 == ut1, got false, expected true");
-    rw_assert (ut1 == ut2, __FILE__, __LINE__,
-               "ut1 == ut2, got false, expected true");
-
-    BigTuple bt1 (true, 'a', 256, 3.14159, &nt1, uc);
-    BigTuple bt2 (true, 'a', 256, 3.14159, &nt1, uc);
-    rw_assert (bt1 == bt1, __FILE__, __LINE__,
-               "bt1 == bt1, got false, expected true");
-    rw_assert (bt1 == bt2, __FILE__, __LINE__,
-               "bt1 == bt2, got false, expected true");
+#undef TEST
+#define TEST(expr)      \
+    rw_assert (expr, __FILE__, __LINE__, #expr \
+               "; got %b, expected %b", !(expr), expr)
+
+    TEST (nt1 == nt2);
+
+    std::tuple<int> it1 (1), it2 (1), it3 (2);
+    TEST (it1 == it1);
+    TEST (it1 == it2);
+    TEST (!(it1 == it3));
+
+    UserDefined ud1 (1), ud2 (2);
+    std::tuple<UserDefined> ut1 (ud1), ut2 (ud1), ut3 (ud2);
+    TEST (ut1 == ut1);
+    TEST (ut1 == ut2);
+    TEST (!(ut1 == ut3));
+
+    std::tuple<bool, char, int, double, void*, UserDefined>
+        bt1 (true, 'a', 255, 3.14159, &nt1, ud1),
+        bt2 (true, 'a', 255, 3.14159, &nt1, ud1),
+        bt3 (true, 'a', 256, 3.14159, &nt1, ud1);
+    TEST (bt1 == bt1);
+    TEST (bt1 == bt2);
+    TEST (!(bt1 == bt3));
 }
 
 /**************************************************************************/
@@ -76,27 +82,36 @@
 {
     rw_info (0, __FILE__, __LINE__, "operator<");
 
-    EmptyTuple nt1, nt2;
-    rw_assert (!(nt1 < nt1), __FILE__, __LINE__,
-               "nt1 < nt1, got true, expected false");
-    rw_assert (!(nt1 < nt2), __FILE__, __LINE__,
-               "nt1 < nt2, got true, expected false");
-
-    IntTuple it1 (1), it2 (2);
-    rw_assert (it1 < it2, __FILE__, __LINE__,
-               "it1 < it2, got false, expected true");
-
-    UserClass uc1, uc2;
-    uc1.data_.val_ = 1, uc2.data_.val_ = 2;
-
-    UserTuple ut1 (uc1), ut2 (uc2);
-    rw_assert (ut1 < ut2, __FILE__, __LINE__,
-               "ut1 < ut2, got false, expected true");
-
-    BigTuple bt1 (true, 'a', 255, 3.14159, &nt1, uc1);
-    BigTuple bt2 (true, 'a', 256, 3.14159, &nt1, uc1);
+    std::tuple<> nt1, nt2;
+    TEST (!(nt1 < nt1));
+    TEST (!(nt1 < nt2));
+
+    std::tuple<int> it1 (1), it2 (2);
+    TEST (!(it1 < it1));
+    TEST (it1 < it2);
+
+    UserDefined ud1 (1), ud2 (2);
+    std::tuple<UserDefined> ut1 (ud1), ut2 (ud2);
+    TEST (!(ut1 < ut1));
+    TEST (ut1 < ut2);
+
+    std::tuple<long, const char*> pt1 (1234L, "string");
+    TEST (!(pt1 < pt1));
+    std::tuple<long, const char*> pt2 (1235L, "string");
+    TEST (pt1 < pt2);
+    std::tuple<long, const char*> pt3 (1234L, "strings");
+    TEST (pt1 < pt3);
+
+    std::tuple<bool, char, int, double, void*, UserDefined>
+        bt1 (true, 'a', 255, 3.14159, &nt1, ud1),
+        bt2 (true, 'a', 256, 3.14159, &nt1, ud1),
+        bt3 (true, 'a', 255, 3.14159, &nt1, ud2);
+    rw_assert (!(bt1 < bt1), __FILE__, __LINE__,
+               "bt1 < bt1, got true, expected false");
     rw_assert (bt1 < bt2, __FILE__, __LINE__,
                "bt1 < bt2, got false, expected true");
+    rw_assert (bt1 < bt3, __FILE__, __LINE__,
+               "bt1 < bt3, got false, expected true");
 }
 
 /**************************************************************************/
@@ -115,17 +130,29 @@
     return 0;
 }
 
-#else // !_RWSTD_NO_EXT_CXX_0X
+#else // _RWSTD_NO_EXT_CXX_0X || _RWSTD_NO_RVALUE_REFERENCES
 
 static int
 run_test (int, char*[])
 {
-    rw_info (0, 0, __LINE__,
-             "tests for C++0x tuple extension disabled");
+
+#if defined (_RWSTD_NO_RVALUE_REFERENCES)
+
+    rw_warn (0, 0, __LINE__,
+             "test disabled because _RWSTD_NO_EXT_CXX_OX is defined");
+
+#elif defined (_RWSTD_NO_RVALUE_REFERENCES)
+
+    rw_warn (0, 0, __LINE__,
+             "test disabled because _RWSTD_NO_RVALUE_REFERENCES is "
+                        "defined");
+
+#endif
+
     return 0;
 }
 
-#endif // !_RWSTD_NO_EXT_CXX_0X
+#endif // _RWSTD_NO_EXT_CXX_0X || _RWSTD_NO_RVALUE_REFERENCES
 
 /*extern*/ int
 main (int argc, char* argv [])


Reply via email to