Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65685 - sandbox/opaque/libs/opaque/test
From: vicente.botet_at_[hidden]
Date: 2010-09-29 15:50:48


Author: viboes
Date: 2010-09-29 15:50:45 EDT (Wed, 29 Sep 2010)
New Revision: 65685
URL: http://svn.boost.org/trac/boost/changeset/65685

Log:
Opaque:
* Add check on sizeof

Text files modified:
   sandbox/opaque/libs/opaque/test/new_class_test.cpp | 7 +++++++
   sandbox/opaque/libs/opaque/test/new_type_test.cpp | 7 +++++++
   sandbox/opaque/libs/opaque/test/private_opaque_test.cpp | 6 ++++++
   sandbox/opaque/libs/opaque/test/public_opaque_test.cpp | 9 ++++++---
   4 files changed, 26 insertions(+), 3 deletions(-)

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 2010-09-29 15:50:45 EDT (Wed, 29 Sep 2010)
@@ -56,6 +56,12 @@
     {}
 };
 
+void size_test() {
+
+ BOOST_CHECK(sizeof(private_unsigned)==sizeof(unsigned));
+ BOOST_CHECK(sizeof(private_unsigned2)==sizeof(unsigned));
+}
+
 void private_assign_test() {
     private_unsigned a, a2;
     private_unsigned2 b;
@@ -149,6 +155,7 @@
   test_suite* test = BOOST_TEST_SUITE("private");
 
 
+ test->add(BOOST_TEST_CASE(&size_test));
   test->add(BOOST_TEST_CASE(&private_assign_test));
   test->add(BOOST_TEST_CASE(&private_eq_test));
   test->add(BOOST_TEST_CASE(&private_lt_test));

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 2010-09-29 15:50:45 EDT (Wed, 29 Sep 2010)
@@ -58,6 +58,12 @@
 typedef boost::new_type<unsigned, private_unsigned2_tag> private_unsigned2;
 
 #endif
+void size_test() {
+
+ BOOST_CHECK(sizeof(private_unsigned)==sizeof(unsigned));
+ BOOST_CHECK(sizeof(private_unsigned2)==sizeof(unsigned));
+}
+
 void private_assign_test() {
     private_unsigned a, a2;
     private_unsigned2 b;
@@ -151,6 +157,7 @@
   test_suite* test = BOOST_TEST_SUITE("private");
 
 
+ test->add(BOOST_TEST_CASE(&size_test));
   test->add(BOOST_TEST_CASE(&private_assign_test));
   test->add(BOOST_TEST_CASE(&private_eq_test));
   test->add(BOOST_TEST_CASE(&private_lt_test));

Modified: sandbox/opaque/libs/opaque/test/private_opaque_test.cpp
==============================================================================
--- sandbox/opaque/libs/opaque/test/private_opaque_test.cpp (original)
+++ sandbox/opaque/libs/opaque/test/private_opaque_test.cpp 2010-09-29 15:50:45 EDT (Wed, 29 Sep 2010)
@@ -20,6 +20,11 @@
 BOOST_OPAQUE_PRIVATE_TYPEDEF(unsigned,private_unsigned);
 BOOST_OPAQUE_PRIVATE_TYPEDEF(unsigned,private_unsigned2);
 
+void size_test() {
+
+ BOOST_CHECK(sizeof(private_unsigned)==sizeof(unsigned));
+}
+
 void assign_test() {
     private_unsigned a, a2;
     private_unsigned2 b;
@@ -138,6 +143,7 @@
   test_suite* test = BOOST_TEST_SUITE("private");
 
 
+ test->add(BOOST_TEST_CASE(&size_test));
   test->add(BOOST_TEST_CASE(&assign_test));
   test->add(BOOST_TEST_CASE(&eq_test));
   test->add(BOOST_TEST_CASE(&neq_test));

Modified: sandbox/opaque/libs/opaque/test/public_opaque_test.cpp
==============================================================================
--- sandbox/opaque/libs/opaque/test/public_opaque_test.cpp (original)
+++ sandbox/opaque/libs/opaque/test/public_opaque_test.cpp 2010-09-29 15:50:45 EDT (Wed, 29 Sep 2010)
@@ -9,16 +9,19 @@
 //////////////////////////////////////////////////////////////////////////////
 
 #include <boost/opaque/opaque.hpp>
-
 #include <boost/test/unit_test.hpp>
 
 using namespace boost;
 using namespace boost::unit_test;
 
-
 BOOST_OPAQUE_PUBLIC_TYPEDEF(unsigned,public_unsigned);
 BOOST_OPAQUE_PUBLIC_TYPEDEF(unsigned,public_unsigned2);
 
+void size_test() {
+
+ BOOST_CHECK(sizeof(public_unsigned)==sizeof(unsigned));
+}
+
 void assign_test() {
     public_unsigned a, a2;
     public_unsigned2 b;
@@ -160,6 +163,7 @@
 {
   test_suite* test = BOOST_TEST_SUITE("public");
 
+ test->add(BOOST_TEST_CASE(&size_test));
   test->add(BOOST_TEST_CASE(&assign_test));
   test->add(BOOST_TEST_CASE(&eq_test));
   test->add(BOOST_TEST_CASE(&neq_test));
@@ -179,4 +183,3 @@
   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