From 40fa3beec41af339b4f686cdb30c1c26652d9bcf Mon Sep 17 00:00:00 2001
From: bemandawes
Date: Thu, 19 Mar 2009 15:38:46 +0000
Subject: [PATCH] Endian: get ready to test on more compilers
git-svn-id: http://svn.boost.org/svn/boost/sandbox/endian@51856 b8fc166d-592f-0410-95f2-cb63ce0dd405
---
libs/integer/doc/endian.html | 26 +++++++++++++-------------
libs/integer/test/Jamfile.v2 | 18 +++++++++++-------
libs/integer/test/test.bat | 4 ++--
libs/integer/zip-endian.bat | 33 ++++++++++++++++++++++-----------
4 files changed, 48 insertions(+), 33 deletions(-)
diff --git a/libs/integer/doc/endian.html b/libs/integer/doc/endian.html
index 9dd8f71..de2e49e 100644
--- a/libs/integer/doc/endian.html
+++ b/libs/integer/doc/endian.html
@@ -281,19 +281,19 @@ usual operations on integers are supplied.
namespace integer
{
- namespace endianness { enum enum_t { big, little, native }; } // simulate C++0x scoped enum
- namespace alignment { enum enum_t { unaligned, aligned }; } // simulate C++0x scoped enum
+ enum class endianness { big, little, native }; // scoped enum emulated on C++03
+ enum class alignment { unaligned, aligned }; // scoped enum emulated on C++03
- template <endianness::enum_t E, typename T, std::size_t n_bits,
- alignment::enum_t A = alignment::unaligned>
+ template <endianness E, typename T, std::size_t n_bits,
+ alignment A = alignment::unaligned>
class endian : integer_cover_operators< endian<E, T, n_bits, A>, T >
{
public:
typedef T value_type;
- endian(){}
- explicit endian(T v);
- endian & operator=(T v);
- operator T() const;
+ endian() = default; // = default replaced by {} on C++03
+ explicit endian(T v);
+ endian & operator=(T v);
+ operator T() const;
};
// unaligned big endian signed integer types
@@ -385,29 +385,29 @@ usual operations on integers are supplied.
} // namespace integer
} // namespace boost
-endian(){}
+endian() = default; // C++03: endian(){}
Effects: Constructs an object of type endian<E, T, n_bits, A>
.
-explicit endian(T v);
+explicit endian(T v);
Effects: Constructs an object of type endian<E, T, n_bits, A>
.
Postcondition: x == v,
where x
is the
constructed object.
-endian & operator=(T v);
+endian & operator=(T v);
Postcondition: x == v,
where x
is the
constructed object.
Returns: *this
.
-operator T() const;
+operator T() const;
Returns: The current value stored in *this
, converted to
value_type
.
Other operators
-All other operators on endian objects are forwarded to the equivalent
+
Other operators on endian objects are forwarded to the equivalent
operator on value_type
.
Why bother with endian types? External data portability and both speed
diff --git a/libs/integer/test/Jamfile.v2 b/libs/integer/test/Jamfile.v2
index a2f1130..f36b1a3 100644
--- a/libs/integer/test/Jamfile.v2
+++ b/libs/integer/test/Jamfile.v2
@@ -2,15 +2,19 @@
# Copyright Beman Dawes 2006
-# 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)
+# Distributed under the Boost Software License, Version 1.0.
+# See http://www.boost.org/LICENSE_1_0.txt
-# See library home page at http://www.boost.org/libs/endian
+# See library home page at http://www.boost.org/libs/integer/doc/endian.html
import testing ;
test-suite "endian"
- : [ run endian_test.cpp ]
-# [ run endian_operations_test.cpp ]
-# [ run endian_in_union_test.cpp ]
- ;
+ :
+ [ run binary_stream_test.cpp ]
+ [ run endian_binary_stream_test.cpp ]
+ [ run endian_test.cpp ]
+ [ run endian_operations_test.cpp ]
+ [ run endian_in_union_test.cpp ]
+ [ run scoped_enum_emulation_test.cpp ]
+ ;
diff --git a/libs/integer/test/test.bat b/libs/integer/test/test.bat
index d5c72f2..e998ac4 100644
--- a/libs/integer/test/test.bat
+++ b/libs/integer/test/test.bat
@@ -1,8 +1,8 @@
-set ENDIAN_LOCATE_ROOT=%temp%\endian-regr
+set ENDIAN_LOCATE_ROOT=%TEMP%\endian-regr
md %ENDIAN_LOCATE_ROOT% 2>nul
echo Begin test processing...
-bjam --dump-tests "-sALL_LOCATE_TARGET=%ENDIAN_LOCATE_ROOT%" %* >bjam.log 2>&1
+bjam --dump-tests includes=/boost/trunk "-sALL_LOCATE_TARGET=%ENDIAN_LOCATE_ROOT%" %* >bjam.log 2>&1
echo Begin log processing...
process_jam_log %ENDIAN_LOCATE_ROOT% nul
+rmdir /s \temp\%1 2>nul
pushd .
-mkdir \tmp\%1
-cd \tmp\%1
+mkdir \temp\%1
+cd \temp\%1
+md doc\html
md boost\integer
md libs\integer\doc
md libs\integer\example
md libs\integer\test
popd
-copy ..\..\boost\integer\endian.hpp \tmp\%1\boost\integer
-copy ..\..\boost\integer\cover_operators.hpp \tmp\%1\boost\integer
-copy ..\..\libs\integer\doc\endian.html \tmp\%1\libs\integer\doc
-copy ..\..\libs\integer\example\endian_example.cpp \tmp\%1\libs\integer\example
-copy ..\..\libs\integer\test\endian_test.cpp \tmp\%1\libs\integer\test
-copy ..\..\libs\integer\test\Jamfile.* \tmp\%1\libs\integer\test
+copy ..\..\boost.png \temp\%1
+copy ..\..\boost\doc\html\minimal.css \temp\%1\doc\html
+copy ..\..\boost\binary_stream.hpp \temp\%1\boost
+copy ..\..\boost\integer\endian.hpp \temp\%1\boost\integer
+copy ..\..\boost\integer\endian_binary_stream.hpp \temp\%1\boost\integer
+copy ..\..\boost\integer\cover_operators.hpp \temp\%1\boost\integer
+copy ..\..\libs\integer\doc\endian.html \temp\%1\libs\integer\doc
+copy ..\..\libs\integer\example\endian_example.cpp \temp\%1\libs\integer\example
+copy ..\..\libs\integer\example\endian_hello_world.cpp \temp\%1\libs\integer\example
+copy ..\..\libs\integer\test\endian_test.cpp \temp\%1\libs\integer\test
+copy ..\..\libs\integer\test\binary_stream_test.cpp \temp\%1\libs\integer\test
+copy ..\..\libs\integer\test\endian_binary_stream_test.cpp \temp\%1\libs\integer\test
+copy ..\..\libs\integer\test\endian_in_union_test.cpp \temp\%1\libs\integer\test
+copy ..\..\libs\integer\test\endian_operations_test.cpp \temp\%1\libs\integer\test
+copy ..\..\libs\integer\test\scoped_enum_emulation_test.cpp \temp\%1\libs\integer\test
+copy ..\..\libs\integer\test\Jamfile.* \temp\%1\libs\integer\test
-pushd \tmp
+pushd \temp
zip -r %1.zip %1
popd
-move \tmp\%1.zip .
+move \temp\%1.zip .
goto done