Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65603 - sandbox/opaque/libs/opaque/test
From: vicente.botet_at_[hidden]
Date: 2010-09-26 09:22:15


Author: viboes
Date: 2010-09-26 09:22:12 EDT (Sun, 26 Sep 2010)
New Revision: 65603
URL: http://svn.boost.org/trac/boost/changeset/65603

Log:
Opaque: Add more test
Text files modified:
   sandbox/opaque/libs/opaque/test/multi_level_conversion.cpp | 4 +++
   sandbox/opaque/libs/opaque/test/new_type_test.cpp | 2
   sandbox/opaque/libs/opaque/test/private_opaque_test.cpp | 47 ++++++++++++++++++++-------------------
   3 files changed, 29 insertions(+), 24 deletions(-)

Modified: sandbox/opaque/libs/opaque/test/multi_level_conversion.cpp
==============================================================================
--- sandbox/opaque/libs/opaque/test/multi_level_conversion.cpp (original)
+++ sandbox/opaque/libs/opaque/test/multi_level_conversion.cpp 2010-09-26 09:22:12 EDT (Sun, 26 Sep 2010)
@@ -24,6 +24,7 @@
 BOOST_OPAQUE_PUBLIC_TYPEDEF(energy,kinetic_energy);
 BOOST_OPAQUE_PUBLIC_TYPEDEF(energy,potential_energy);
 BOOST_OPAQUE_PUBLIC_TYPEDEF(energy,heat_energy);
+BOOST_OPAQUE_PUBLIC_TYPEDEF(potential_energy,potential_energy2);
 
 BOOST_OPAQUE_STATIC_ASSERT((
     is_same<
@@ -85,11 +86,14 @@
     mass1_leng2_per_time2 x(d);
     energy e(d);
     potential_energy p(d);
+ potential_energy2 p2(d);
 
     x = e;
     e = p;
     x = p; // 2 levels
     d = p; // 3 levels
+ d = p2; // 4 levels
+
     }
 }
 

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-26 09:22:12 EDT (Sun, 26 Sep 2010)
@@ -61,7 +61,7 @@
 
     unsigned short i;
 
- i=new_type_static_cast<unsigned short>(a);
+ i=opaque_static_cast<unsigned short>(a);
     //~ i=a; // error
 
     //~ a=i; // error

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-26 09:22:12 EDT (Sun, 26 Sep 2010)
@@ -42,13 +42,13 @@
     BOOST_CHECK(b==c);
     BOOST_CHECK((a==b)==false);
 }
-#if 0
-void private_eq_test_fails() {
- private_unsigned a;
- private_unsigned2 a2;
- BOOST_CHECK(a==a2);
+
+void private_neq_test() {
+ private_unsigned a(1), b(2), c(2);
+ BOOST_CHECK(a!=b);
+ BOOST_CHECK((b!=c)==false);
 }
-#endif
+
 void private_lt_test() {
     private_unsigned a(1), b(2), c(2);
     BOOST_CHECK(a<b);
@@ -82,17 +82,6 @@
     BOOST_CHECK(c==a+b);
     BOOST_CHECK((a+b==d)==false);
     BOOST_CHECK((d==a+b)==false);
-
- private_unsigned2 x;
- //~ a=a+x; // error
-
- //~ unsigned u=3,v=0;
- //~ BOOST_CHECK(a+b==3u);
- //~ BOOST_CHECK(u==a+b);
- //~ BOOST_CHECK(a+b==u);
- //~ BOOST_CHECK((a+b==v)==false);
- //~ BOOST_CHECK((v==a+b)==false);
-
 }
 
 void private_substract_test() {
@@ -101,16 +90,25 @@
     BOOST_CHECK(a==c-b);
     BOOST_CHECK((c-b==d)==false);
     BOOST_CHECK((d==c-b)==false);
+}
 
- //~ unsigned u=1,v=0;
- //~ BOOST_CHECK(c-b==1u);
- //~ BOOST_CHECK(u==c-b);
- //~ BOOST_CHECK(c-b==u);
- //~ BOOST_CHECK((c-b==v)==false);
- //~ BOOST_CHECK((v==c-b)==false);
+void private_multiply_test() {
+ private_unsigned a(1), b(2), c(3),d(6);
+ BOOST_CHECK(b*c==d);
+ BOOST_CHECK(b==a*b);
+ BOOST_CHECK((b*c==a)==false);
+ BOOST_CHECK((d==a*b)==false);
+}
 
+void private_divide_test() {
+ private_unsigned a(1), b(2), c(3),d(6);
+ BOOST_CHECK(d/c==b);
+ BOOST_CHECK(b==d/c);
+ BOOST_CHECK((d/c==a)==false);
+ BOOST_CHECK((a==d/c)==false);
 }
 
+
 void unariy_plus_test() {
     private_unsigned a(1);
     BOOST_CHECK(+a==a);
@@ -142,12 +140,15 @@
 
   test->add(BOOST_TEST_CASE(&private_assign_test));
   test->add(BOOST_TEST_CASE(&private_eq_test));
+ test->add(BOOST_TEST_CASE(&private_neq_test));
   test->add(BOOST_TEST_CASE(&private_lt_test));
   test->add(BOOST_TEST_CASE(&private_gt_test));
   test->add(BOOST_TEST_CASE(&private_le_test));
   test->add(BOOST_TEST_CASE(&private_ge_test));
   test->add(BOOST_TEST_CASE(&private_add_test));
   test->add(BOOST_TEST_CASE(&private_substract_test));
+ test->add(BOOST_TEST_CASE(&private_multiply_test));
+ test->add(BOOST_TEST_CASE(&private_divide_test));
   test->add(BOOST_TEST_CASE(&unariy_plus_test));
   test->add(BOOST_TEST_CASE(&unariy_minus_test));
   test->add(BOOST_TEST_CASE(&pre_increment_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