$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r74603 - sandbox/endian/libs/endian/test
From: bdawes_at_[hidden]
Date: 2011-09-28 15:13:13
Author: bemandawes
Date: 2011-09-28 15:13:12 EDT (Wed, 28 Sep 2011)
New Revision: 74603
URL: http://svn.boost.org/trac/boost/changeset/74603
Log:
Add check_udt() test
Text files modified: 
   sandbox/endian/libs/endian/test/endian_test.cpp |    32 ++++++++++++++++++++++++++++++++        
   1 files changed, 32 insertions(+), 0 deletions(-)
Modified: sandbox/endian/libs/endian/test/endian_test.cpp
==============================================================================
--- sandbox/endian/libs/endian/test/endian_test.cpp	(original)
+++ sandbox/endian/libs/endian/test/endian_test.cpp	2011-09-28 15:13:12 EDT (Wed, 28 Sep 2011)
@@ -73,6 +73,8 @@
 
     ++v; // verify integer_cover_operators being applied to this type -
          // will fail to compile if no endian<> specialization is present
+
+    v+v;
   }
 
   const char * big_rep    = "\x12\x34\x56\x78\x9A\xBC\xDE\xF0";
@@ -698,6 +700,35 @@
 
   } // check_representation_and_range
 
+  class MyInt
+  {
+    int32_t mx;
+  public:
+    MyInt(int32_t x) : mx(x) {}
+    operator int32_t() const {return mx;}
+
+    //friend int32_t operator+(const MyInt& x) {return x;}
+  };
+
+  void check_udt()
+  {
+    typedef boost::endian::endian< endianness::big, MyInt, 32 >  mybig32_t;
+
+    mybig32_t v(10);
+    cout << "+v is " << +v << endl;
+    v += 1;
+    cout << "v is " << +v << endl;
+    v -= 2;
+    cout << "v is " << +v << endl;
+    v *= 2;
+    cout << "v is " << +v << endl;
+    ++v;
+    cout << "v is " << +v << endl;
+    --v;
+    cout << "v is " << +v << endl;
+//    cout << "v+v is " << +(v+v) << endl;
+  }
+
   long iterations = 10000;
   
   template< class Endian >
@@ -737,6 +768,7 @@
   check_alignment();
   check_representation_and_range_and_ops();
   check_data();
+  check_udt();
 
   //timing_test<big32_t> ( "big32_t" );
   //timing_test<aligned_big32_t>( "aligned_big32_t" );