Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69304 - in sandbox/opaque/libs/opaque/test: . new_class
From: vicente.botet_at_[hidden]
Date: 2011-02-26 09:18:41


Author: viboes
Date: 2011-02-26 09:18:39 EST (Sat, 26 Feb 2011)
New Revision: 69304
URL: http://svn.boost.org/trac/boost/changeset/69304

Log:
Opaque: cleanup + test on new_class_macro
Text files modified:
   sandbox/opaque/libs/opaque/test/new_class/copy_construct_from_non_convertible_fail.cpp | 21 +++++++++--------
   sandbox/opaque/libs/opaque/test/new_class/equal_fail.cpp | 20 ++++++++--------
   sandbox/opaque/libs/opaque/test/new_class/hiding_plus_fail.cpp | 30 ++++++++++++------------
   sandbox/opaque/libs/opaque/test/new_class/less_than_fail.cpp | 20 ++++++++--------
   sandbox/opaque/libs/opaque/test/new_class/not_equal_fail.cpp | 20 ++++++++--------
   sandbox/opaque/libs/opaque/test/new_class/regular_pass.cpp | 20 ++++++++--------
   sandbox/opaque/libs/opaque/test/new_class/using_minus_assign_pass.cpp | 8 +++---
   sandbox/opaque/libs/opaque/test/new_class/using_not_equal_pass.cpp | 42 ++++++++++++++++++++--------------
   sandbox/opaque/libs/opaque/test/new_class_test.cpp | 48 ++++++++++++++++++++--------------------
   sandbox/opaque/libs/opaque/test/new_type_test.cpp | 4 +-
   10 files changed, 121 insertions(+), 112 deletions(-)

Modified: sandbox/opaque/libs/opaque/test/new_class/copy_construct_from_non_convertible_fail.cpp
==============================================================================
--- sandbox/opaque/libs/opaque/test/new_class/copy_construct_from_non_convertible_fail.cpp (original)
+++ sandbox/opaque/libs/opaque/test/new_class/copy_construct_from_non_convertible_fail.cpp 2011-02-26 09:18:39 EST (Sat, 26 Feb 2011)
@@ -9,6 +9,7 @@
 //////////////////////////////////////////////////////////////////////////////
 
 #include <boost/opaque/new_class.hpp>
+#include <string>
 
 using namespace boost;
 
@@ -16,20 +17,20 @@
 typedef std::string NUT;
 
 // NEW_CLASS(NT1,UT)
-struct NT1 : boost::new_class<NT1, UT>
+struct NT1 : boost::opaque::new_class<NT1, UT>
 {
- typedef
- boost::new_class<NT1, UT>
+ typedef
+ boost::opaque::new_class<NT1, UT>
     base_type;
-
- NT1(){}
+
+ NT1(){}
     explicit NT1(unsigned v) : base_type(v) {}
- template <typename W>
- explicit NT1(W w)
- : base_type(w)
+ template <typename W>
+ explicit NT1(W w)
+ : base_type(w)
     {}
- NT1(NT1 const& r)
- : base_type(r.val_)
+ NT1(NT1 const& r)
+ : base_type(r.val_)
     {}
 };
 

Modified: sandbox/opaque/libs/opaque/test/new_class/equal_fail.cpp
==============================================================================
--- sandbox/opaque/libs/opaque/test/new_class/equal_fail.cpp (original)
+++ sandbox/opaque/libs/opaque/test/new_class/equal_fail.cpp 2011-02-26 09:18:39 EST (Sat, 26 Feb 2011)
@@ -13,23 +13,23 @@
 using namespace boost;
 
 typedef unsigned UT;
-typedef std::string NUT;
+//~ typedef std::string NUT;
 
 // NEW_CLASS(NT1,UT)
-struct NT1 : boost::opaque::new_class<NT1, UT>
+struct NT1 : boost::opaque::new_class<NT1, UT>
 {
- typedef
+ typedef
     boost::opaque::new_class<NT1, UT>
     base_type;
-
- NT1(){}
+
+ NT1(){}
     explicit NT1(unsigned v) : base_type(v) {}
- template <typename W>
- explicit NT1(W w)
- : base_type(w)
+ template <typename W>
+ explicit NT1(W w)
+ : base_type(w)
     {}
- NT1(NT1 const& r)
- : base_type(r.val_)
+ NT1(NT1 const& r)
+ : base_type(r.val_)
     {}
 };
 void remove_warning(bool) {}

Modified: sandbox/opaque/libs/opaque/test/new_class/hiding_plus_fail.cpp
==============================================================================
--- sandbox/opaque/libs/opaque/test/new_class/hiding_plus_fail.cpp (original)
+++ sandbox/opaque/libs/opaque/test/new_class/hiding_plus_fail.cpp 2011-02-26 09:18:39 EST (Sat, 26 Feb 2011)
@@ -17,31 +17,31 @@
 typedef short UT2;
 
 // NEW_CLASS(NT,UT,((opaque::using_equality_comparable1<>)))
-struct NT :
+struct NT :
     boost::opaque::new_class<NT, UT
     , boost::mpl::vector<
- boost::opaque::using_plus,
- boost::opaque::hiding_plus
- >
+ boost::opaque::using_plus,
+ boost::opaque::hiding_plus
+ >
>
 {
- typedef
+ typedef
     boost::opaque::new_class<NT, UT
     , boost::mpl::vector<
- boost::opaque::using_plus,
- boost::opaque::hiding_plus
- >
+ boost::opaque::using_plus,
+ boost::opaque::hiding_plus
+ >
>
     base_type;
-
- NT(){}
+
+ NT(){}
     explicit NT(unsigned v) : base_type(v) {}
- template <typename W>
- explicit NT(W w)
- : base_type(w)
+ template <typename W>
+ explicit NT(W w)
+ : base_type(w)
     {}
- NT(NT const& r)
- : base_type(r.val_)
+ NT(NT const& r)
+ : base_type(r.val_)
     {}
 };
 

Modified: sandbox/opaque/libs/opaque/test/new_class/less_than_fail.cpp
==============================================================================
--- sandbox/opaque/libs/opaque/test/new_class/less_than_fail.cpp (original)
+++ sandbox/opaque/libs/opaque/test/new_class/less_than_fail.cpp 2011-02-26 09:18:39 EST (Sat, 26 Feb 2011)
@@ -13,23 +13,23 @@
 using namespace boost;
 
 typedef unsigned UT;
-typedef std::string NUT;
+//~ typedef std::string NUT;
 
 // NEW_CLASS(NT1,UT)
-struct NT1 : boost::opaque::new_class<NT1, UT>
+struct NT1 : boost::opaque::new_class<NT1, UT>
 {
- typedef
+ typedef
     boost::opaque::new_class<NT1, UT>
     base_type;
-
- NT1(){}
+
+ NT1(){}
     explicit NT1(unsigned v) : base_type(v) {}
- template <typename W>
- explicit NT1(W w)
- : base_type(w)
+ template <typename W>
+ explicit NT1(W w)
+ : base_type(w)
     {}
- NT1(NT1 const& r)
- : base_type(r.val_)
+ NT1(NT1 const& r)
+ : base_type(r.val_)
     {}
 };
 

Modified: sandbox/opaque/libs/opaque/test/new_class/not_equal_fail.cpp
==============================================================================
--- sandbox/opaque/libs/opaque/test/new_class/not_equal_fail.cpp (original)
+++ sandbox/opaque/libs/opaque/test/new_class/not_equal_fail.cpp 2011-02-26 09:18:39 EST (Sat, 26 Feb 2011)
@@ -13,23 +13,23 @@
 using namespace boost;
 
 typedef unsigned UT;
-typedef std::string NUT;
+//~ typedef std::string NUT;
 
 // NEW_CLASS(NT1,UT)
-struct NT1 : boost::opaque::new_class<NT1, UT>
+struct NT1 : boost::opaque::new_class<NT1, UT>
 {
- typedef
+ typedef
     boost::opaque::new_class<NT1, UT>
     base_type;
-
- NT1(){}
+
+ NT1(){}
     explicit NT1(unsigned v) : base_type(v) {}
- template <typename W>
- explicit NT1(W w)
- : base_type(w)
+ template <typename W>
+ explicit NT1(W w)
+ : base_type(w)
     {}
- NT1(NT1 const& r)
- : base_type(r.val_)
+ NT1(NT1 const& r)
+ : base_type(r.val_)
     {}
 };
 void remove_warning(bool) {}

Modified: sandbox/opaque/libs/opaque/test/new_class/regular_pass.cpp
==============================================================================
--- sandbox/opaque/libs/opaque/test/new_class/regular_pass.cpp (original)
+++ sandbox/opaque/libs/opaque/test/new_class/regular_pass.cpp 2011-02-26 09:18:39 EST (Sat, 26 Feb 2011)
@@ -18,21 +18,21 @@
 typedef short UT2;
 
 // NEW_CLASS(NT,UT,())
-struct NT :
+struct NT :
     boost::opaque::new_class<NT, UT>
 {
- typedef
+ typedef
     boost::opaque::new_class<NT, UT>
     base_type;
-
- NT(){}
+
+ NT(){}
     explicit NT(unsigned v) : base_type(v) {}
- template <typename W>
- explicit NT(W w)
- : base_type(w)
+ template <typename W>
+ explicit NT(W w)
+ : base_type(w)
     {}
- NT(NT const& r)
- : base_type(r.val_)
+ NT(NT const& r)
+ : base_type(r.val_)
     {}
 };
 
@@ -69,7 +69,7 @@
 void opaque_static_cast_test() {
     NT a(1);
     UT2 i;
- i=opaque::opaque_static_cast<UT2>(a);
+ i=opaque_static_cast<UT2>(a);
     BOOST_TEST(i==a.underlying());
 }
 

Modified: sandbox/opaque/libs/opaque/test/new_class/using_minus_assign_pass.cpp
==============================================================================
--- sandbox/opaque/libs/opaque/test/new_class/using_minus_assign_pass.cpp (original)
+++ sandbox/opaque/libs/opaque/test/new_class/using_minus_assign_pass.cpp 2011-02-26 09:18:39 EST (Sat, 26 Feb 2011)
@@ -22,14 +22,14 @@
 struct NT :
     boost::opaque::new_class<NT, UT
     , boost::mpl::vector<
- boost::opaque::using_minus_assign
+ boost::opaque::using_minus_assign
>
>
 {
     typedef
     boost::opaque::new_class<NT, UT
     , boost::mpl::vector<
- boost::opaque::using_minus_assign
+ boost::opaque::using_minus_assign
>
>
     base_type;
@@ -49,7 +49,7 @@
 void size_test() {
     BOOST_TEST(sizeof(NT)==sizeof(UT));
 }
-#if 0
+#if 1
 void default_constructor_test() {
     NT a;
 }
@@ -92,7 +92,7 @@
 {
 
   size_test();
-#if 0
+#if 1
   default_constructor_test();
   copy_from_ut_test();
   copy_from_ut2_test();

Modified: sandbox/opaque/libs/opaque/test/new_class/using_not_equal_pass.cpp
==============================================================================
--- sandbox/opaque/libs/opaque/test/new_class/using_not_equal_pass.cpp (original)
+++ sandbox/opaque/libs/opaque/test/new_class/using_not_equal_pass.cpp 2011-02-26 09:18:39 EST (Sat, 26 Feb 2011)
@@ -8,7 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#include <boost/opaque/new_class.hpp>
+#include <boost/opaque/new_class_macro.hpp>
+//~ #include <boost/opaque/new_class.hpp>
 #include <boost/opaque/meta_mixin/operators.hpp>
 
 #include <boost/detail/lightweight_test.hpp>
@@ -18,38 +19,47 @@
 typedef int UT;
 typedef short UT2;
 
-// NEW_CLASS(NT,UT,(opaque::using_not_equal<>))
-struct NT :
+#ifdef BOOST_OPAQUE_NEW_CLASS
+
+struct NT : public
+BOOST_OPAQUE_NEW_CLASS(NT,UT,(opaque::using_not_equal<>))
+{
+ BOOST_OPAQUE_FORWARD_CONSTRUCTORS(NT,BOOST_OPAQUE_NEW_CLASS(NT,UT,(opaque::using_not_equal<>)));
+
+};
+#else
+struct NT : public
     boost::opaque::new_class<NT, UT
     , boost::mpl::vector<
- boost::opaque::using_not_equal<>
+ boost::opaque::using_not_equal<>
>
>
 {
- typedef
+ typedef
     boost::opaque::new_class<NT, UT
     , boost::mpl::vector<
- boost::opaque::using_not_equal<>
+ boost::opaque::using_not_equal<>
>
>
     base_type;
-
- NT(){}
+
+ NT(){}
     explicit NT(unsigned v) : base_type(v) {}
- template <typename W>
- explicit NT(W w)
- : base_type(w)
+ template <typename W>
+ explicit NT(W w)
+ : base_type(w)
     {}
- NT(NT const& r)
- : base_type(r.val_)
+ NT(NT const& r)
+ : base_type(r.val_)
     {}
 };
+#endif
 
 
 void size_test() {
     BOOST_TEST(sizeof(NT)==sizeof(UT));
 }
-#if 0
+
 void default_constructor_test() {
     NT a;
 }
@@ -81,7 +91,7 @@
     i=opaque_static_cast<UT2>(a);
     BOOST_TEST(i==a.underlying());
 }
-#endif
+
 void not_equal_test() {
     NT a1(1), b2(2), c2(2);
     BOOST_TEST(a1!=c2);
@@ -92,14 +102,12 @@
 {
 
   size_test();
-#if 0
   default_constructor_test();
   copy_from_ut_test();
   copy_from_ut2_test();
   copy_constructor_test();
   assign_test();
   opaque_static_cast_test();
-#endif
   not_equal_test();
 
   return boost::report_errors();

Modified: sandbox/opaque/libs/opaque/test/new_class_test.cpp
==============================================================================
--- sandbox/opaque/libs/opaque/test/new_class_test.cpp (original)
+++ sandbox/opaque/libs/opaque/test/new_class_test.cpp 2011-02-26 09:18:39 EST (Sat, 26 Feb 2011)
@@ -15,42 +15,42 @@
 using namespace boost;
 
 
-struct private_unsigned :
- boost::opaque::new_class<private_unsigned, unsigned
- , boost::mpl::vector<opaque::using_equality_comparable1<>
- >
+struct private_unsigned :
+ boost::opaque::new_class<private_unsigned, unsigned
+ , boost::mpl::vector<opaque::using_equality_comparable1<>
+ >
>
 {
- typedef
- boost::opaque::new_class<private_unsigned, unsigned
- , boost::mpl::vector<opaque::using_equality_comparable1<>
- >
+ typedef
+ boost::opaque::new_class<private_unsigned, unsigned
+ , boost::mpl::vector<opaque::using_equality_comparable1<>
+ >
>
     base_type;
-
- private_unsigned(){}
+
+ private_unsigned(){}
     explicit private_unsigned(unsigned v) : base_type(v) {}
- template <typename W>
- explicit private_unsigned(W w)
- : base_type(w)
+ template <typename W>
+ explicit private_unsigned(W w)
+ : base_type(w)
     {}
- private_unsigned(private_unsigned const& r)
- : base_type(r.val_)
+ private_unsigned(private_unsigned const& r)
+ : base_type(r.val_)
     {}
 };
 
-struct private_unsigned2: boost::opaque::new_class<private_unsigned2, unsigned>
+struct private_unsigned2: boost::opaque::new_class<private_unsigned2, unsigned>
 {
     typedef boost::opaque::new_class<private_unsigned2, unsigned> base_type;
-
- private_unsigned2(){}
+
+ private_unsigned2(){}
     explicit private_unsigned2(unsigned v) : base_type(v) {}
- template <typename W>
- explicit private_unsigned2(W w)
- : base_type(w)
+ template <typename W>
+ explicit private_unsigned2(W w)
+ : base_type(w)
     {}
- private_unsigned2(private_unsigned2 const& r)
- : base_type(r.val_)
+ private_unsigned2(private_unsigned2 const& r)
+ : base_type(r.val_)
     {}
 };
 
@@ -69,7 +69,7 @@
 
     unsigned short i;
 
- i=opaque::opaque_static_cast<unsigned short>(a);
+ i=opaque_static_cast<unsigned short>(a);
     //~ i=a; // error
 
     //~ a=i; // error

Modified: sandbox/opaque/libs/opaque/test/new_type_test.cpp
==============================================================================
--- sandbox/opaque/libs/opaque/test/new_type_test.cpp (original)
+++ sandbox/opaque/libs/opaque/test/new_type_test.cpp 2011-02-26 09:18:39 EST (Sat, 26 Feb 2011)
@@ -36,7 +36,7 @@
 
     unsigned short i;
 
- i=opaque::opaque_static_cast<unsigned short>(a);
+ i=opaque_static_cast<unsigned short>(a);
     //~ i=a; // error
 
     //~ a=i; // error
@@ -132,6 +132,6 @@
   //~ private_ge_test();
   //~ private_add_test();
   //~ private_substract_test();
-
+
   return boost::report_errors();
 }


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