Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50492 - sandbox/move/libs/move/test
From: daniel_james_at_[hidden]
Date: 2009-01-06 03:17:34


Author: danieljames
Date: 2009-01-06 03:17:32 EST (Tue, 06 Jan 2009)
New Revision: 50492
URL: http://svn.boost.org/trac/boost/changeset/50492

Log:
Rename X and Y to more descriptive names.
Text files modified:
   sandbox/move/libs/move/test/const_lvalue_by_ref_fail.cpp | 4
   sandbox/move/libs/move/test/const_rvalue_by_ref_fail.cpp | 4
   sandbox/move/libs/move/test/movable.hpp | 24 +++++-----
   sandbox/move/libs/move/test/move.cpp | 86 ++++++++++++++++++++--------------------
   sandbox/move/libs/move/test/move_boost_move.cpp | 4
   sandbox/move/libs/move/test/noncopyable.cpp | 86 ++++++++++++++++++++--------------------
   sandbox/move/libs/move/test/noncopyable.hpp | 24 +++++-----
   sandbox/move/libs/move/test/noncopyable_copy_const_fail.cpp | 4
   sandbox/move/libs/move/test/rvalue_by_ref_fail.cpp | 4
   9 files changed, 120 insertions(+), 120 deletions(-)

Modified: sandbox/move/libs/move/test/const_lvalue_by_ref_fail.cpp
==============================================================================
--- sandbox/move/libs/move/test/const_lvalue_by_ref_fail.cpp (original)
+++ sandbox/move/libs/move/test/const_lvalue_by_ref_fail.cpp 2009-01-06 03:17:32 EST (Tue, 06 Jan 2009)
@@ -3,6 +3,6 @@
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 #include "movable.hpp"
 
-int f(X&);
-X const& g();
+int f(movable&);
+movable const& g();
 int a = f(g());

Modified: sandbox/move/libs/move/test/const_rvalue_by_ref_fail.cpp
==============================================================================
--- sandbox/move/libs/move/test/const_rvalue_by_ref_fail.cpp (original)
+++ sandbox/move/libs/move/test/const_rvalue_by_ref_fail.cpp 2009-01-06 03:17:32 EST (Tue, 06 Jan 2009)
@@ -3,6 +3,6 @@
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 #include "movable.hpp"
 
-int f(X&);
-X const g();
+int f(movable&);
+movable const g();
 int a = f(g());

Modified: sandbox/move/libs/move/test/movable.hpp
==============================================================================
--- sandbox/move/libs/move/test/movable.hpp (original)
+++ sandbox/move/libs/move/test/movable.hpp 2009-01-06 03:17:32 EST (Tue, 06 Jan 2009)
@@ -12,20 +12,20 @@
 //
 // A sample movable class.
 //
-class X
+class movable
 {
  public: // "Ordinary" stuff
- X() : resource(++cnt)
+ movable() : resource(++cnt)
     {
- SAY("X() #" << resource);
+ SAY("movable() #" << resource);
     }
 
- X(X const& rhs) : resource(++cnt)
+ movable(movable const& rhs) : resource(++cnt)
     {
         copy(rhs);
     }
 
- ~X()
+ ~movable()
     {
         release();
     }
@@ -34,7 +34,7 @@
     
  public: // Move stuff
     // move constructor
- X(boost::move_from<X> rhs)
+ movable(boost::move_from<movable> rhs)
       : resource(rhs.source.resource)
     {
         BOOST_ASSERT(rhs.source.resource <= cnt); // check for garbage
@@ -45,7 +45,7 @@
     }
 
     // move assignment
- X& operator=(X rhs)
+ movable& operator=(movable rhs)
     {
         BOOST_ASSERT(rhs.resource <= cnt); // check for garbage
         release();
@@ -59,7 +59,7 @@
     
     static int copies; // count the number of copies
     
- operator boost::move_from<X>() { return *this; }
+ operator boost::move_from<movable>() { return *this; }
 
     int value() const { return resource; }
     
@@ -74,7 +74,7 @@
         resource = 0;
     }
 
- void copy(X const& rhs)
+ void copy(movable const& rhs)
     {
         BOOST_ASSERT(rhs.resource <= cnt); // check for garbage
         SAY("copy #" << this->resource << " <- #" << rhs.resource);
@@ -88,11 +88,11 @@
     static int cnt; // count the number of resources
 };
 
-int X::cnt;
-int X::copies;
+int movable::cnt;
+int movable::copies;
 
 struct X_source {
- X operator()() { return X(); }
+ movable operator()() { return movable(); }
 };
 
 #endif // X_DWA2004410_HPP

Modified: sandbox/move/libs/move/test/move.cpp
==============================================================================
--- sandbox/move/libs/move/test/move.cpp (original)
+++ sandbox/move/libs/move/test/move.cpp 2009-01-06 03:17:32 EST (Tue, 06 Jan 2009)
@@ -12,32 +12,32 @@
 // Some functions we can use to test the passing of Xs in and out of
 // functions.
 //
-X source()
+movable source()
 {
- return X();
+ return movable();
 }
 
-X const csource()
+movable const csource()
 {
- return X();
+ return movable();
 }
 
-void sink(X)
+void sink(movable)
 {
     SAY("in rvalue sink");
 }
 
-void sink2(X&)
+void sink2(movable&)
 {
     SAY("in non-const lvalue sink2");
 }
 
-void sink2(X const&)
+void sink2(movable const&)
 {
     SAY("in const lvalue sink2");
 }
 
-void sink3(X&)
+void sink3(movable&)
 {
     SAY("in non-const lvalue sink3");
 }
@@ -51,96 +51,96 @@
 int main()
 {
     SAY(" ------ test 1, direct init from rvalue ------- ");
- //X::expect_move();
- X z2(source());
+ //movable::expect_move();
+ movable z2(source());
 
     SAY(" ------ test 2, copy init from rvalue ------- ");
- //X::expect_move();
- X z4 = X();
+ //movable::expect_move();
+ movable z4 = movable();
 
     SAY(" ------ test 3, copy init from lvalue ------- ");
- //X::expect_copy();
- X z5 = z4;
+ //movable::expect_copy();
+ movable z5 = z4;
 
     SAY(" ------ test 4, direct init from lvalue ------- ");
- //X::expect_copy();
- X z6(z4);
+ //movable::expect_copy();
+ movable z6(z4);
 
     SAY(" ------ test 5, construct const ------- ");
- X const z7;
+ movable const z7;
 
     SAY(" ------ test 6, copy init from lvalue ------- ");
- //X::expect_copy();
- X z8 = z7;
+ //movable::expect_copy();
+ movable z8 = z7;
 
     SAY(" ------ test 7, direct init from lvalue ------- ");
- //X::expect_copy();
- X z9(z7);
+ //movable::expect_copy();
+ movable z9(z7);
 
     SAY(" ------ test 8, pass rvalue by-value ------- ");
- //X::expect_move();
+ //movable::expect_move();
     sink(source());
 
     SAY(" ------ test 9, pass const rvalue by-value ------- ");
- //X::expect_move();
+ //movable::expect_move();
     sink(csource());
 
     SAY(" ------ test 10, pass rvalue by overloaded reference ------- ");
- //X::expect_move();
+ //movable::expect_move();
     sink2(source());
 
     SAY(" ------ test 11, pass const rvalue by overloaded reference ------- ");
- //X::expect_move();
+ //movable::expect_move();
     sink2(csource());
 
     SAY(" ------ test 13, pass lvalue by-value ------- ");
- //X::expect_copy();
+ //movable::expect_copy();
     sink(z5);
 
     SAY(" ------ test 14, pass const lvalue by-value ------- ");
- //X::expect_copy();
+ //movable::expect_copy();
     sink(z7);
 
     SAY(" ------ test 15, pass lvalue by-reference ------- ");
- //X::expect_copy();
+ //movable::expect_copy();
     sink2(z4);
 
     SAY(" ------ test 16, pass const lvalue by const reference ------- ");
- //X::expect_copy();
+ //movable::expect_copy();
     sink2(z7);
 
     SAY(" ------ test 17, pass rvalue by value to template param ------- ");
- //X::expect_move();
+ //movable::expect_move();
     tsink(source());
 
- SAY(" ------ test 18, direct initialize a const X with an X ------- ");
- //X::expect_move();
- typedef X const XC;
- sink2(XC(X()));
+ SAY(" ------ test 18, direct initialize a const movable with an movable ------- ");
+ //movable::expect_move();
+ typedef movable const XC;
+ sink2(XC(movable()));
 
     SAY(" ------ test 19, assign from non-const lvalue ------- ");
- //X::expect_copy();
+ //movable::expect_copy();
     z4 = z5;
 
     SAY(" ------ test 20, assign from const lvalue ------- ");
- //X::expect_copy();
+ //movable::expect_copy();
     z4 = z7;
 
     SAY(" ------ test 21, assign from rvalue ------- ");
- //X::expect_move();
+ //movable::expect_move();
     z4 = source();
 
     SAY(" ------ test 22, explicit move direct init from movable lvalue ------- ");
- BOOST_STATIC_ASSERT(boost::is_movable<X>::value);
- //X::expect_move();
- X z10(boost::move(z2));
+ BOOST_STATIC_ASSERT(boost::is_movable<movable>::value);
+ //movable::expect_move();
+ movable z10(boost::move(z2));
     
     SAY(" ------ test 23, explicit move copy init from movable lvalue ------- ");
- //X::expect_move();
- X z11 = boost::move(z9);
+ //movable::expect_move();
+ movable z11 = boost::move(z9);
     
     SAY(" ------ test 24, move assign from movable lvalue ------- ");
- //X::expect_move();
+ //movable::expect_move();
     z10 = boost::move(z8);
     
     SAY(" ------ test 25, request move construct from non-movable lvalue ------- ");

Modified: sandbox/move/libs/move/test/move_boost_move.cpp
==============================================================================
--- sandbox/move/libs/move/test/move_boost_move.cpp (original)
+++ sandbox/move/libs/move/test/move_boost_move.cpp 2009-01-06 03:17:32 EST (Tue, 06 Jan 2009)
@@ -11,6 +11,6 @@
 #include "./generic_tests.hpp"
 
 int main() {
- test::generic_tests<X>::copy_and_move_tests();
- test::generic_tests<Y>::move_tests();
+ test::generic_tests<movable>::copy_and_move_tests();
+ test::generic_tests<noncopyable>::move_tests();
 }

Modified: sandbox/move/libs/move/test/noncopyable.cpp
==============================================================================
--- sandbox/move/libs/move/test/noncopyable.cpp (original)
+++ sandbox/move/libs/move/test/noncopyable.cpp 2009-01-06 03:17:32 EST (Tue, 06 Jan 2009)
@@ -15,32 +15,32 @@
 // Some functions we can use to test the passing of Ys in and out of
 // functions.
 //
-Y y_source()
+noncopyable y_source()
 {
- return Y();
+ return noncopyable();
 }
 
-Y const y_csource()
+noncopyable const y_csource()
 {
- return Y();
+ return noncopyable();
 }
 
-void y_sink(Y)
+void y_sink(noncopyable)
 {
     SAY("in rvalue sink");
 }
 
-void y_sink2(Y&)
+void y_sink2(noncopyable&)
 {
     SAY("in non-const lvalue sink2");
 }
 
-void y_sink2(Y const&)
+void y_sink2(noncopyable const&)
 {
     SAY("in const lvalue sink2");
 }
 
-void y_sink3(Y&)
+void y_sink3(noncopyable&)
 {
     SAY("in non-const lvalue sink3");
 }
@@ -53,43 +53,43 @@
 
 int main()
 {
- test::generic_tests<Y>::move_tests();
+ test::generic_tests<noncopyable>::move_tests();
 
     // SAY(" ------ test 1, direct init from rvalue ------- ");
- //Y::expect_move();
- Y z2(y_source());
+ //noncopyable::expect_move();
+ noncopyable z2(y_source());
 
     // SAY(" ------ test 2, copy init from rvalue ------- ");
- //Y::expect_move();
- Y z4 = Y();
+ //noncopyable::expect_move();
+ noncopyable z4 = noncopyable();
 
     //SAY(" ------ test 3, copy init from lvalue ------- ");
- //Y::expect_copy();
- //Y z5 = z4;
+ //noncopyable::expect_copy();
+ //noncopyable z5 = z4;
 
     //SAY(" ------ test 4, direct init from lvalue ------- ");
- //Y::expect_copy();
- //Y z6(z4);
+ //noncopyable::expect_copy();
+ //noncopyable z6(z4);
 
     // SAY(" ------ test 5, construct const ------- ");
- Y const z7;
+ noncopyable const z7;
 
     //SAY(" ------ test 6, copy init from lvalue ------- ");
- //Y::expect_copy();
- //Y z8 = z7;
- Y z8;
+ //noncopyable::expect_copy();
+ //noncopyable z8 = z7;
+ noncopyable z8;
 
     //SAY(" ------ test 7, direct init from lvalue ------- ");
- //Y::expect_copy();
- //Y z9(z7);
- Y z9;
+ //noncopyable::expect_copy();
+ //noncopyable z9(z7);
+ noncopyable z9;
 
     //SAY(" ------ test 8, pass rvalue by-value ------- ");
- //Y::expect_move();
+ //noncopyable::expect_move();
     //y_sink(y_source());
 
     //SAY(" ------ test 9, pass const rvalue by-value ------- ");
- //Y::expect_move();
+ //noncopyable::expect_move();
     //y_sink(y_csource());
 
     // http://lists.boost.org/Archives/boost/2008/06/138884.php
@@ -112,49 +112,49 @@
     //y_sink(z5);
 
     //SAY(" ------ test 14, pass const lvalue by-value ------- ");
- //Y::expect_copy();
+ //noncopyable::expect_copy();
     //y_sink(z7);
 
     SAY(" ------ test 15, pass lvalue by-reference ------- ");
- //Y::expect_copy();
+ //noncopyable::expect_copy();
     y_sink2(z4);
 
     SAY(" ------ test 16, pass const lvalue by const reference ------- ");
- //Y::expect_copy();
+ //noncopyable::expect_copy();
     y_sink2(z7);
 
     SAY(" ------ test 17, pass rvalue by value to template param ------- ");
- //Y::expect_move();
+ //noncopyable::expect_move();
     y_tsink(y_source());
 
- //SAY(" ------ test 18, direct initialize a const Y with an Y ------- ");
- //Y::expect_move();
- //typedef Y const YC;
- //y_sink2(YC(Y()));
+ //SAY(" ------ test 18, direct initialize a const noncopyable with an noncopyable ------- ");
+ //noncopyable::expect_move();
+ //typedef noncopyable const YC;
+ //y_sink2(YC(noncopyable()));
 
     //SAY(" ------ test 19, assign from non-const lvalue ------- ");
- //Y::expect_copy();
+ //noncopyable::expect_copy();
     //z4 = z5;
 
     //SAY(" ------ test 20, assign from const lvalue ------- ");
- //Y::expect_copy();
+ //noncopyable::expect_copy();
     //z4 = z7;
 
     SAY(" ------ test 21, assign from rvalue ------- ");
- //Y::expect_move();
+ //noncopyable::expect_move();
     z4 = y_source();
 
     SAY(" ------ test 22, explicit move direct init from movable lvalue ------- ");
- BOOST_STATIC_ASSERT(boost::is_movable<Y>::value);
- //Y::expect_move();
- Y z10(boost::move(z2));
+ BOOST_STATIC_ASSERT(boost::is_movable<noncopyable>::value);
+ //noncopyable::expect_move();
+ noncopyable z10(boost::move(z2));
     
     SAY(" ------ test 23, explicit move copy init from movable lvalue ------- ");
- //Y::expect_move();
- Y z11 = boost::move(z9);
+ //noncopyable::expect_move();
+ noncopyable z11 = boost::move(z9);
     
     SAY(" ------ test 24, move assign from movable lvalue ------- ");
- //Y::expect_move();
+ //noncopyable::expect_move();
     z10 = boost::move(z8);
 
     SAY("----- done, with " << test::suboptimal_copies << " suboptimal copies -----");

Modified: sandbox/move/libs/move/test/noncopyable.hpp
==============================================================================
--- sandbox/move/libs/move/test/noncopyable.hpp (original)
+++ sandbox/move/libs/move/test/noncopyable.hpp 2009-01-06 03:17:32 EST (Tue, 06 Jan 2009)
@@ -13,23 +13,23 @@
 //
 // A sample movable class.
 //
-class Y
+class noncopyable
 {
- Y(Y& rhs);
+ noncopyable(noncopyable& rhs);
  public: // "Ordinary" stuff
- Y() : resource(++cnt)
+ noncopyable() : resource(++cnt)
     {
- SAY("Y() #" << resource);
+ SAY("noncopyable() #" << resource);
     }
 
- ~Y()
+ ~noncopyable()
     {
         release();
     }
 
  public: // Move stuff
     // move constructor
- Y(boost::move_from<Y> rhs)
+ noncopyable(boost::move_from<noncopyable> rhs)
       : resource(rhs.source.resource)
     {
         BOOST_ASSERT(rhs.source.resource <= cnt); // check for garbage
@@ -40,7 +40,7 @@
     }
 
     // move assignment
- Y& operator=(Y rhs)
+ noncopyable& operator=(noncopyable rhs)
     {
         BOOST_ASSERT(rhs.resource <= cnt); // check for garbage
         release();
@@ -52,9 +52,9 @@
         return *this;
     }
 
- operator boost::move_from<Y>()
+ operator boost::move_from<noncopyable>()
     {
- return boost::move_from<Y>(*this);
+ return boost::move_from<noncopyable>(*this);
     }
 
     int value() const { return resource; }
@@ -72,7 +72,7 @@
         resource = 0;
     }
 
- void copy(Y const& rhs)
+ void copy(noncopyable const& rhs)
     {
         BOOST_ASSERT(rhs.resource <= cnt); // check for garbage
         SAY("copy #" << this->resource << " <- #" << rhs.resource);
@@ -86,7 +86,7 @@
     static int cnt; // count the number of resources
 };
 
-int Y::cnt;
-int Y::copies;
+int noncopyable::cnt;
+int noncopyable::copies;
 
 #endif // Y_DWA2004410_HPP

Modified: sandbox/move/libs/move/test/noncopyable_copy_const_fail.cpp
==============================================================================
--- sandbox/move/libs/move/test/noncopyable_copy_const_fail.cpp (original)
+++ sandbox/move/libs/move/test/noncopyable_copy_const_fail.cpp 2009-01-06 03:17:32 EST (Tue, 06 Jan 2009)
@@ -6,6 +6,6 @@
 #include "noncopyable.hpp"
 
 int main() {
- Y const y_const;
- Y y(y_const);
+ noncopyable const y_const;
+ noncopyable y(y_const);
 }

Modified: sandbox/move/libs/move/test/rvalue_by_ref_fail.cpp
==============================================================================
--- sandbox/move/libs/move/test/rvalue_by_ref_fail.cpp (original)
+++ sandbox/move/libs/move/test/rvalue_by_ref_fail.cpp 2009-01-06 03:17:32 EST (Tue, 06 Jan 2009)
@@ -3,6 +3,6 @@
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 #include "movable.hpp"
 
-int f(X&);
-X g();
+int f(movable&);
+movable g();
 int a = f(g());


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk