Add BOOST_MINIMAL_INTEGER_COVER_OPERATORS to reduce coupling to boost/operators.hpp, make constructor from T explicit to eliminate unintended consequences, add logging feature, extend test coverage.

git-svn-id: http://svn.boost.org/svn/boost/sandbox/endian@48004 b8fc166d-592f-0410-95f2-cb63ce0dd405
This commit is contained in:
bemandawes committed 2008-08-06 18:34:15 +00:00
1 parent 5610e8d97b
commit f37a6cd5ca
5 files changed
+347 -147

No files matched your search

+13 -7
View File
@@ -1,6 +1,6 @@
// endian_test.cpp ---------------------------------------------------------//
// Copyright Beman Dawes, 1999-2006
// Copyright Beman Dawes, 1999-2008
// 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)
@@ -9,6 +9,13 @@
//----------------------------------------------------------------------------//
// This test probes for correct endianess, size, and value.
// See endian_operations_test for tests of operator correctness and interaction
// between operand types.
//----------------------------------------------------------------------------//
#include <boost/integer/endian.hpp>
#include <boost/cstdint.hpp>
#include <boost/progress.hpp>
@@ -19,9 +26,10 @@
#include <cstdlib> // for atoi(), exit()
#include <cstring> // for memcmp()
using namespace std; // not the best programming practice, but I
using namespace std; // Not the best programming practice, but I
using namespace boost; // want to verify this combination of using
using namespace boost::integer; // namespaces works.
using namespace boost::integer; // namespaces works. See endian_operations_test
// // for tests that don't do "using namespace".
#define VERIFY(predicate) verify( predicate, __LINE__ )
#define VERIFY_SIZE(actual, expected) verify_size( actual, expected, __LINE__ )
@@ -72,8 +80,8 @@ namespace
void verify_representation( bool is_big, int line )
{
int silence = 0;
Endian x = static_cast<typename Endian::value_type>
(0x123456789abcdef0LL + silence); // will truncate
Endian x ( static_cast<typename Endian::value_type>
(0x123456789abcdef0LL + silence) ); // will truncate
if ( is_big )
verify( memcmp( &x,
@@ -93,8 +101,6 @@ namespace
# endif
}
// detect_endianness -----------------------------------------------------//
void detect_endianness()