Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65745 - in sandbox/opaque/libs/opaque/test: . new_class
From: vicente.botet_at_[hidden]
Date: 2010-10-04 07:13:22


Author: viboes
Date: 2010-10-04 07:13:12 EDT (Mon, 04 Oct 2010)
New Revision: 65745
URL: http://svn.boost.org/trac/boost/changeset/65745

Log:
Opaque:
* Added new_class tests

Added:
   sandbox/opaque/libs/opaque/test/new_class/equal_fail.cpp (contents, props changed)
   sandbox/opaque/libs/opaque/test/new_class/greater_than_equal_fail.cpp (contents, props changed)
   sandbox/opaque/libs/opaque/test/new_class/greater_than_fail.cpp (contents, props changed)
   sandbox/opaque/libs/opaque/test/new_class/less_than_equal_fail.cpp (contents, props changed)
   sandbox/opaque/libs/opaque/test/new_class/less_than_fail.cpp (contents, props changed)
   sandbox/opaque/libs/opaque/test/new_class/using_equal_pass.cpp (contents, props changed)
   sandbox/opaque/libs/opaque/test/new_class/using_greater_than_equal_pass.cpp (contents, props changed)
   sandbox/opaque/libs/opaque/test/new_class/using_greater_than_pass.cpp (contents, props changed)
   sandbox/opaque/libs/opaque/test/new_class/using_less_than_equal_pass.cpp (contents, props changed)
   sandbox/opaque/libs/opaque/test/new_class/using_less_than_pass.cpp (contents, props changed)
Text files modified:
   sandbox/opaque/libs/opaque/test/Jamfile.v2 | 12 ++++++++++++
   1 files changed, 12 insertions(+), 0 deletions(-)

Modified: sandbox/opaque/libs/opaque/test/Jamfile.v2
==============================================================================
--- sandbox/opaque/libs/opaque/test/Jamfile.v2 (original)
+++ sandbox/opaque/libs/opaque/test/Jamfile.v2 2010-10-04 07:13:12 EDT (Mon, 04 Oct 2010)
@@ -45,6 +45,18 @@
         [ compile-fail new_class/assign_down_fail.cpp ]
         #[ compile-fail new_class/bad_metamixin_fail.cpp ]
         [ compile-fail new_class/copy_construct_from_non_convertible_fail.cpp ]
+
+ [ run new_class/using_less_than_pass.cpp ]
+ [ run new_class/using_less_than_equal_pass.cpp ]
+ [ run new_class/using_greater_than_pass.cpp ]
+ [ run new_class/using_greater_than_equal_pass.cpp ]
+ [ run new_class/using_equal_pass.cpp ]
+
+ [ compile-fail new_class/less_than_fail.cpp ]
+ [ compile-fail new_class/less_than_equal_fail.cpp ]
+ [ compile-fail new_class/greater_than_fail.cpp ]
+ [ compile-fail new_class/greater_than_equal_fail.cpp ]
+ [ compile-fail new_class/equal_fail.cpp ]
         
         ;
 

Added: sandbox/opaque/libs/opaque/test/new_class/equal_fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/opaque/libs/opaque/test/new_class/equal_fail.cpp 2010-10-04 07:13:12 EDT (Mon, 04 Oct 2010)
@@ -0,0 +1,41 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2010. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/opaque for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/opaque/opaque.hpp>
+
+using namespace boost;
+
+typedef unsigned UT;
+typedef std::string NUT;
+
+// NEW_CLASS(NT1,UT)
+struct NT1 : boost::new_class<NT1, UT>
+{
+ typedef
+ boost::new_class<NT1, UT>
+ base_type;
+
+ NT1(){}
+ explicit NT1(unsigned v) : base_type(v) {}
+ template <typename W>
+ explicit NT1(W w)
+ : base_type(w)
+ {}
+ NT1(NT1 const& r)
+ : base_type(r.val_)
+ {}
+};
+
+void fail() {
+ NT1 a1(1), b2(2);
+ bool b =(a1 == b2);
+}
+
+

Added: sandbox/opaque/libs/opaque/test/new_class/greater_than_equal_fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/opaque/libs/opaque/test/new_class/greater_than_equal_fail.cpp 2010-10-04 07:13:12 EDT (Mon, 04 Oct 2010)
@@ -0,0 +1,40 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2010. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/opaque for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/opaque/opaque.hpp>
+
+using namespace boost;
+
+typedef unsigned UT;
+
+// NEW_CLASS(NT1,UT)
+struct NT1 : boost::new_class<NT1, UT>
+{
+ typedef
+ boost::new_class<NT1, UT>
+ base_type;
+
+ NT1(){}
+ explicit NT1(unsigned v) : base_type(v) {}
+ template <typename W>
+ explicit NT1(W w)
+ : base_type(w)
+ {}
+ NT1(NT1 const& r)
+ : base_type(r.val_)
+ {}
+};
+
+void fail() {
+ NT1 a1(1), b2(2);
+ bool b =(a1 >= b2);
+}
+
+

Added: sandbox/opaque/libs/opaque/test/new_class/greater_than_fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/opaque/libs/opaque/test/new_class/greater_than_fail.cpp 2010-10-04 07:13:12 EDT (Mon, 04 Oct 2010)
@@ -0,0 +1,40 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2010. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/opaque for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/opaque/opaque.hpp>
+
+using namespace boost;
+
+typedef unsigned UT;
+
+// NEW_CLASS(NT1,UT)
+struct NT1 : boost::new_class<NT1, UT>
+{
+ typedef
+ boost::new_class<NT1, UT>
+ base_type;
+
+ NT1(){}
+ explicit NT1(unsigned v) : base_type(v) {}
+ template <typename W>
+ explicit NT1(W w)
+ : base_type(w)
+ {}
+ NT1(NT1 const& r)
+ : base_type(r.val_)
+ {}
+};
+
+void fail() {
+ NT1 a1(1), b2(2);
+ bool b =(a1 > b2);
+}
+
+

Added: sandbox/opaque/libs/opaque/test/new_class/less_than_equal_fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/opaque/libs/opaque/test/new_class/less_than_equal_fail.cpp 2010-10-04 07:13:12 EDT (Mon, 04 Oct 2010)
@@ -0,0 +1,41 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2010. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/opaque for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/opaque/opaque.hpp>
+
+using namespace boost;
+
+typedef unsigned UT;
+typedef std::string NUT;
+
+// NEW_CLASS(NT1,UT)
+struct NT1 : boost::new_class<NT1, UT>
+{
+ typedef
+ boost::new_class<NT1, UT>
+ base_type;
+
+ NT1(){}
+ explicit NT1(unsigned v) : base_type(v) {}
+ template <typename W>
+ explicit NT1(W w)
+ : base_type(w)
+ {}
+ NT1(NT1 const& r)
+ : base_type(r.val_)
+ {}
+};
+
+void fail() {
+ NT1 a1(1), b2(2);
+ bool b =(a1 <= b2);
+}
+
+

Added: sandbox/opaque/libs/opaque/test/new_class/less_than_fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/opaque/libs/opaque/test/new_class/less_than_fail.cpp 2010-10-04 07:13:12 EDT (Mon, 04 Oct 2010)
@@ -0,0 +1,41 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2010. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/opaque for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/opaque/opaque.hpp>
+
+using namespace boost;
+
+typedef unsigned UT;
+typedef std::string NUT;
+
+// NEW_CLASS(NT1,UT)
+struct NT1 : boost::new_class<NT1, UT>
+{
+ typedef
+ boost::new_class<NT1, UT>
+ base_type;
+
+ NT1(){}
+ explicit NT1(unsigned v) : base_type(v) {}
+ template <typename W>
+ explicit NT1(W w)
+ : base_type(w)
+ {}
+ NT1(NT1 const& r)
+ : base_type(r.val_)
+ {}
+};
+
+void fail() {
+ NT1 a1(1), b2(2);
+ bool b=(a1<b2);
+}
+
+

Added: sandbox/opaque/libs/opaque/test/new_class/using_equal_pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/opaque/libs/opaque/test/new_class/using_equal_pass.cpp 2010-10-04 07:13:12 EDT (Mon, 04 Oct 2010)
@@ -0,0 +1,107 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2010. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/opaque for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/opaque/opaque.hpp>
+
+#include <boost/test/unit_test.hpp>
+
+using namespace boost;
+using namespace boost::unit_test;
+
+typedef int UT;
+typedef short UT2;
+
+// NEW_CLASS(NT,UT,((opaque::using_equality_comparable1<>)))
+struct NT :
+ boost::new_class<NT, UT
+ , boost::mpl::vector<
+ boost::opaque::using_equal<>
+ >
+ >
+{
+ typedef
+ boost::new_class<NT, UT
+ , boost::mpl::vector<
+ boost::opaque::using_equal<>
+ >
+ >
+ base_type;
+
+ NT(){}
+ explicit NT(unsigned v) : base_type(v) {}
+ template <typename W>
+ explicit NT(W w)
+ : base_type(w)
+ {}
+ NT(NT const& r)
+ : base_type(r.val_)
+ {}
+};
+
+
+void size_test() {
+ BOOST_CHECK(sizeof(NT)==sizeof(UT));
+}
+#if 0
+void default_constructor_test() {
+ NT a;
+}
+void copy_from_ut_test() {
+ UT ut(1);
+ NT a(ut);
+ BOOST_CHECK(a.underlying()==ut);
+}
+void copy_from_ut2_test() {
+ UT2 ut(1);
+ NT a(ut);
+ BOOST_CHECK(a.underlying()==ut);
+}
+void copy_constructor_test() {
+ NT a(1);
+ NT b(a);
+ BOOST_CHECK(a.underlying()==b.underlying());
+}
+
+void assign_test() {
+ NT a1, a2(2);
+ a1=a2; // OK
+ BOOST_CHECK(a1.underlying()==a2.underlying());
+}
+
+void opaque_static_cast_test() {
+ NT a(1);
+ UT2 i;
+ i=opaque_static_cast<UT2>(a);
+ BOOST_CHECK(i==a.underlying());
+}
+#endif
+void equal_test() {
+ NT a1(1), b2(2), c2(2);
+ BOOST_CHECK(b2==c2);
+ BOOST_CHECK((b2==a1)==false);
+}
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("new_class.less_than_pass");
+
+ test->add(BOOST_TEST_CASE(&size_test));
+#if 0
+ test->add(BOOST_TEST_CASE(&default_constructor_test));
+ test->add(BOOST_TEST_CASE(&copy_from_ut_test));
+ test->add(BOOST_TEST_CASE(&copy_from_ut2_test));
+ test->add(BOOST_TEST_CASE(&copy_constructor_test));
+ test->add(BOOST_TEST_CASE(&assign_test));
+ test->add(BOOST_TEST_CASE(&opaque_static_cast_test));
+#endif
+ test->add(BOOST_TEST_CASE(&equal_test));
+
+ return test;
+}

Added: sandbox/opaque/libs/opaque/test/new_class/using_greater_than_equal_pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/opaque/libs/opaque/test/new_class/using_greater_than_equal_pass.cpp 2010-10-04 07:13:12 EDT (Mon, 04 Oct 2010)
@@ -0,0 +1,108 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2010. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/opaque for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/opaque/opaque.hpp>
+
+#include <boost/test/unit_test.hpp>
+
+using namespace boost;
+using namespace boost::unit_test;
+
+typedef int UT;
+typedef short UT2;
+
+// NEW_CLASS(NT,UT,((opaque::using_equality_comparable1<>)))
+struct NT :
+ boost::new_class<NT, UT
+ , boost::mpl::vector<
+ boost::opaque::using_greater_than_equal<>
+ >
+ >
+{
+ typedef
+ boost::new_class<NT, UT
+ , boost::mpl::vector<
+ boost::opaque::using_greater_than_equal<>
+ >
+ >
+ base_type;
+
+ NT(){}
+ explicit NT(unsigned v) : base_type(v) {}
+ template <typename W>
+ explicit NT(W w)
+ : base_type(w)
+ {}
+ NT(NT const& r)
+ : base_type(r.val_)
+ {}
+};
+
+
+void size_test() {
+ BOOST_CHECK(sizeof(NT)==sizeof(UT));
+}
+#if 0
+void default_constructor_test() {
+ NT a;
+}
+void copy_from_ut_test() {
+ UT ut(1);
+ NT a(ut);
+ BOOST_CHECK(a.underlying()==ut);
+}
+void copy_from_ut2_test() {
+ UT2 ut(1);
+ NT a(ut);
+ BOOST_CHECK(a.underlying()==ut);
+}
+void copy_constructor_test() {
+ NT a(1);
+ NT b(a);
+ BOOST_CHECK(a.underlying()==b.underlying());
+}
+
+void assign_test() {
+ NT a1, a2(2);
+ a1=a2; // OK
+ BOOST_CHECK(a1.underlying()==a2.underlying());
+}
+
+void opaque_static_cast_test() {
+ NT a(1);
+ UT2 i;
+ i=opaque_static_cast<UT2>(a);
+ BOOST_CHECK(i==a.underlying());
+}
+#endif
+void greater_than_equal_test() {
+ NT a1(1), b2(2), c2(2);
+ BOOST_CHECK(b2>=a1);
+ BOOST_CHECK((a1>=b2)==false);
+ BOOST_CHECK(b2>=c2);
+}
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("new_class.greater_than_equal_pass");
+
+ test->add(BOOST_TEST_CASE(&size_test));
+#if 0
+ test->add(BOOST_TEST_CASE(&default_constructor_test));
+ test->add(BOOST_TEST_CASE(&copy_from_ut_test));
+ test->add(BOOST_TEST_CASE(&copy_from_ut2_test));
+ test->add(BOOST_TEST_CASE(&copy_constructor_test));
+ test->add(BOOST_TEST_CASE(&assign_test));
+ test->add(BOOST_TEST_CASE(&opaque_static_cast_test));
+#endif
+ test->add(BOOST_TEST_CASE(&greater_than_equal_test));
+
+ return test;
+}

Added: sandbox/opaque/libs/opaque/test/new_class/using_greater_than_pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/opaque/libs/opaque/test/new_class/using_greater_than_pass.cpp 2010-10-04 07:13:12 EDT (Mon, 04 Oct 2010)
@@ -0,0 +1,108 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2010. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/opaque for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/opaque/opaque.hpp>
+
+#include <boost/test/unit_test.hpp>
+
+using namespace boost;
+using namespace boost::unit_test;
+
+typedef int UT;
+typedef short UT2;
+
+// NEW_CLASS(NT,UT,((opaque::using_equality_comparable1<>)))
+struct NT :
+ boost::new_class<NT, UT
+ , boost::mpl::vector<
+ boost::opaque::using_greater_than<>
+ >
+ >
+{
+ typedef
+ boost::new_class<NT, UT
+ , boost::mpl::vector<
+ boost::opaque::using_greater_than<>
+ >
+ >
+ base_type;
+
+ NT(){}
+ explicit NT(unsigned v) : base_type(v) {}
+ template <typename W>
+ explicit NT(W w)
+ : base_type(w)
+ {}
+ NT(NT const& r)
+ : base_type(r.val_)
+ {}
+};
+
+
+void size_test() {
+ BOOST_CHECK(sizeof(NT)==sizeof(UT));
+}
+#if 0
+void default_constructor_test() {
+ NT a;
+}
+void copy_from_ut_test() {
+ UT ut(1);
+ NT a(ut);
+ BOOST_CHECK(a.underlying()==ut);
+}
+void copy_from_ut2_test() {
+ UT2 ut(1);
+ NT a(ut);
+ BOOST_CHECK(a.underlying()==ut);
+}
+void copy_constructor_test() {
+ NT a(1);
+ NT b(a);
+ BOOST_CHECK(a.underlying()==b.underlying());
+}
+
+void assign_test() {
+ NT a1, a2(2);
+ a1=a2; // OK
+ BOOST_CHECK(a1.underlying()==a2.underlying());
+}
+
+void opaque_static_cast_test() {
+ NT a(1);
+ UT2 i;
+ i=opaque_static_cast<UT2>(a);
+ BOOST_CHECK(i==a.underlying());
+}
+#endif
+void greater_than_test() {
+ NT a1(1), b2(2), c2(2);
+ BOOST_CHECK(b2>a1);
+ BOOST_CHECK((a1>b2)==false);
+ BOOST_CHECK((b2>c2)==false);
+}
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("new_class.less_than_pass");
+
+ test->add(BOOST_TEST_CASE(&size_test));
+#if 0
+ test->add(BOOST_TEST_CASE(&default_constructor_test));
+ test->add(BOOST_TEST_CASE(&copy_from_ut_test));
+ test->add(BOOST_TEST_CASE(&copy_from_ut2_test));
+ test->add(BOOST_TEST_CASE(&copy_constructor_test));
+ test->add(BOOST_TEST_CASE(&assign_test));
+ test->add(BOOST_TEST_CASE(&opaque_static_cast_test));
+#endif
+ test->add(BOOST_TEST_CASE(&greater_than_test));
+
+ return test;
+}

Added: sandbox/opaque/libs/opaque/test/new_class/using_less_than_equal_pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/opaque/libs/opaque/test/new_class/using_less_than_equal_pass.cpp 2010-10-04 07:13:12 EDT (Mon, 04 Oct 2010)
@@ -0,0 +1,108 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2010. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/opaque for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/opaque/opaque.hpp>
+
+#include <boost/test/unit_test.hpp>
+
+using namespace boost;
+using namespace boost::unit_test;
+
+typedef int UT;
+typedef short UT2;
+
+// NEW_CLASS(NT,UT,((opaque::using_equality_comparable1<>)))
+struct NT :
+ boost::new_class<NT, UT
+ , boost::mpl::vector<
+ boost::opaque::using_less_than_equal<>
+ >
+ >
+{
+ typedef
+ boost::new_class<NT, UT
+ , boost::mpl::vector<
+ boost::opaque::using_less_than_equal<>
+ >
+ >
+ base_type;
+
+ NT(){}
+ explicit NT(unsigned v) : base_type(v) {}
+ template <typename W>
+ explicit NT(W w)
+ : base_type(w)
+ {}
+ NT(NT const& r)
+ : base_type(r.val_)
+ {}
+};
+
+
+void size_test() {
+ BOOST_CHECK(sizeof(NT)==sizeof(UT));
+}
+#if 0
+void default_constructor_test() {
+ NT a;
+}
+void copy_from_ut_test() {
+ UT ut(1);
+ NT a(ut);
+ BOOST_CHECK(a.underlying()==ut);
+}
+void copy_from_ut2_test() {
+ UT2 ut(1);
+ NT a(ut);
+ BOOST_CHECK(a.underlying()==ut);
+}
+void copy_constructor_test() {
+ NT a(1);
+ NT b(a);
+ BOOST_CHECK(a.underlying()==b.underlying());
+}
+
+void assign_test() {
+ NT a1, a2(2);
+ a1=a2; // OK
+ BOOST_CHECK(a1.underlying()==a2.underlying());
+}
+
+void opaque_static_cast_test() {
+ NT a(1);
+ UT2 i;
+ i=opaque_static_cast<UT2>(a);
+ BOOST_CHECK(i==a.underlying());
+}
+#endif
+void less_than_equal_test() {
+ NT a1(1), b2(2), c2(2);
+ BOOST_CHECK(a1<=b2);
+ BOOST_CHECK((b2<=a1)==false);
+ BOOST_CHECK(b2<=c2);
+}
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("new_class.less_than_pass");
+
+ test->add(BOOST_TEST_CASE(&size_test));
+#if 0
+ test->add(BOOST_TEST_CASE(&default_constructor_test));
+ test->add(BOOST_TEST_CASE(&copy_from_ut_test));
+ test->add(BOOST_TEST_CASE(&copy_from_ut2_test));
+ test->add(BOOST_TEST_CASE(&copy_constructor_test));
+ test->add(BOOST_TEST_CASE(&assign_test));
+ test->add(BOOST_TEST_CASE(&opaque_static_cast_test));
+#endif
+ test->add(BOOST_TEST_CASE(&less_than_equal_test));
+
+ return test;
+}

Added: sandbox/opaque/libs/opaque/test/new_class/using_less_than_pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/opaque/libs/opaque/test/new_class/using_less_than_pass.cpp 2010-10-04 07:13:12 EDT (Mon, 04 Oct 2010)
@@ -0,0 +1,108 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2010. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/opaque for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/opaque/opaque.hpp>
+
+#include <boost/test/unit_test.hpp>
+
+using namespace boost;
+using namespace boost::unit_test;
+
+typedef int UT;
+typedef short UT2;
+
+// NEW_CLASS(NT,UT,((opaque::using_equality_comparable1<>)))
+struct NT :
+ boost::new_class<NT, UT
+ , boost::mpl::vector<
+ boost::opaque::using_less_than<>
+ >
+ >
+{
+ typedef
+ boost::new_class<NT, UT
+ , boost::mpl::vector<
+ boost::opaque::using_less_than<>
+ >
+ >
+ base_type;
+
+ NT(){}
+ explicit NT(unsigned v) : base_type(v) {}
+ template <typename W>
+ explicit NT(W w)
+ : base_type(w)
+ {}
+ NT(NT const& r)
+ : base_type(r.val_)
+ {}
+};
+
+
+void size_test() {
+ BOOST_CHECK(sizeof(NT)==sizeof(UT));
+}
+#if 0
+void default_constructor_test() {
+ NT a;
+}
+void copy_from_ut_test() {
+ UT ut(1);
+ NT a(ut);
+ BOOST_CHECK(a.underlying()==ut);
+}
+void copy_from_ut2_test() {
+ UT2 ut(1);
+ NT a(ut);
+ BOOST_CHECK(a.underlying()==ut);
+}
+void copy_constructor_test() {
+ NT a(1);
+ NT b(a);
+ BOOST_CHECK(a.underlying()==b.underlying());
+}
+
+void assign_test() {
+ NT a1, a2(2);
+ a1=a2; // OK
+ BOOST_CHECK(a1.underlying()==a2.underlying());
+}
+
+void opaque_static_cast_test() {
+ NT a(1);
+ UT2 i;
+ i=opaque_static_cast<UT2>(a);
+ BOOST_CHECK(i==a.underlying());
+}
+#endif
+void less_than_test() {
+ NT a1(1), b2(2), c2(2);
+ BOOST_CHECK(a1<b2);
+ BOOST_CHECK((b2<a1)==false);
+ BOOST_CHECK((b2<c2)==false);
+}
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("new_class.less_than_pass");
+
+ test->add(BOOST_TEST_CASE(&size_test));
+#if 0
+ test->add(BOOST_TEST_CASE(&default_constructor_test));
+ test->add(BOOST_TEST_CASE(&copy_from_ut_test));
+ test->add(BOOST_TEST_CASE(&copy_from_ut2_test));
+ test->add(BOOST_TEST_CASE(&copy_constructor_test));
+ test->add(BOOST_TEST_CASE(&assign_test));
+ test->add(BOOST_TEST_CASE(&opaque_static_cast_test));
+#endif
+ test->add(BOOST_TEST_CASE(&less_than_test));
+
+ return test;
+}


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