stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elemi...@apache.org
Subject svn commit: r667638 - /stdcxx/branches/4.3.x/tests/utilities/20.forward.cpp
Date Fri, 13 Jun 2008 20:23:12 GMT
Author: elemings
Date: Fri Jun 13 13:23:12 2008
New Revision: 667638

URL: http://svn.apache.org/viewvc?rev=667638&view=rev
Log:
2008-06-13  Eric Lemings <eric.lemings@roguewave.com>

	STDCXX-958
	* tests/utilities/20.forward.cpp: Rough outline of new test for
	exercising move/forward helpers in <utility> header.


Added:
    stdcxx/branches/4.3.x/tests/utilities/20.forward.cpp

Added: stdcxx/branches/4.3.x/tests/utilities/20.forward.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.forward.cpp?rev=667638&view=auto
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.forward.cpp (added)
+++ stdcxx/branches/4.3.x/tests/utilities/20.forward.cpp Fri Jun 13 13:23:12 2008
@@ -0,0 +1,126 @@
+/***************************************************************************
+ *
+ * 20.forward.cpp - tests exercising move/forward helpers
+ *
+ * $Id$
+ *
+ ***************************************************************************
+ *
+ * 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-2008 Rogue Wave Software.
+ * 
+ **************************************************************************/
+
+#include <rw/_forward.h>
+#include <rw/_meta_rel.h>
+#include <rw/_static_assert.h>
+
+#include <rw_driver.h>
+
+
+struct Foo
+{
+   Foo (int& ) { }
+};
+
+// compile tests
+
+typedef std::identity<Foo> FooIdent;
+typedef std::identity<Foo>::type FooIdentType;
+
+_RWSTD_STATIC_ASSERT ((_RW::__rw_is_same<Foo, FooIdentType>::value),
+                      "(is_same<Foo, FooIdentType>), got false, "
+                      "expected true");
+
+static void
+test_identity ()
+{
+    rw_info (0, __FILE__, __LINE__, "std::identity<T> class template");
+
+    int i = 1;
+    FooIdent foo_ident;
+    Foo foo = foo_ident (i);
+
+}
+
+/**************************************************************************/
+
+// using example from standard as a test case
+
+template <class Type>
+class shared_ptr
+{
+    Type* ptr_;
+
+public:
+    shared_ptr (Type* ptr): ptr_ (ptr) { }
+    ~shared_ptr () { delete ptr_; }
+};
+
+template <class Type, class AType>
+shared_ptr<Type> factory (AType&& at)
+{
+    return shared_ptr<Type> (new Type (std::forward<AType> (at)));
+};
+
+static void
+test_forward ()
+{
+    rw_info (0, __FILE__, __LINE__, "std::forward() function");
+
+}
+
+/**************************************************************************/
+
+static void
+test_move ()
+{
+    rw_info (0, __FILE__, __LINE__, "std::move() function");
+
+}
+
+/**************************************************************************/
+
+static int
+run_test (int /*unused*/, char* /*unused*/ [])
+{
+
+#if !defined _RWSTD_NO_RVALUE_REFERENCES
+
+    test_identity ();
+    test_forward ();
+    test_move ();
+
+#else // no rvalue references
+
+    rw_info (true, __FILE__, __LINE__,
+             "No compiler support for rvalue references; tests disabled.");
+
+#endif   // !defined _RWSTD_NO_RVALUE_REFERENCES
+
+    return 0;
+}
+
+/*extern*/ int
+main (int argc, char* argv [])
+{
+    return rw_test (argc, argv, __FILE__,
+                    "[forward]", "20.2.2  forward/move helpers",
+                    run_test, "", 0);
+}
+



Mime
View raw message