From d46d2916a828f4fcea2a45e68de306d5ba8bcfb1 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Tue, 5 May 2020 20:18:58 +0300 Subject: [PATCH] Add more tests to endian_reverse_test3/4 --- test/endian_reverse_test3.cpp | 16 +++++++++++++++- test/endian_reverse_test4.cpp | 7 +++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/test/endian_reverse_test3.cpp b/test/endian_reverse_test3.cpp index 64a38a0..6ea9636 100644 --- a/test/endian_reverse_test3.cpp +++ b/test/endian_reverse_test3.cpp @@ -11,8 +11,15 @@ template void test_reverse( T x ) { using boost::endian::endian_reverse; - T x2 = endian_reverse( endian_reverse( x ) ); + T x2( x ); + x2 = endian_reverse( endian_reverse( x2 ) ); + BOOST_TEST( x == x2 ); + + x2 = boost::endian::native_to_little( boost::endian::little_to_native( x2 ) ); + BOOST_TEST( x == x2 ); + + x2 = boost::endian::native_to_big( boost::endian::big_to_native( x2 ) ); BOOST_TEST( x == x2 ); } @@ -24,7 +31,14 @@ template void test_reverse_inplace( T x ) endian_reverse_inplace( x2 ); endian_reverse_inplace( x2 ); + BOOST_TEST( x == x2 ); + boost::endian::native_to_little_inplace( x2 ); + boost::endian::little_to_native_inplace( x2 ); + BOOST_TEST( x == x2 ); + + boost::endian::native_to_big_inplace( x2 ); + boost::endian::big_to_native_inplace( x2 ); BOOST_TEST( x == x2 ); } diff --git a/test/endian_reverse_test4.cpp b/test/endian_reverse_test4.cpp index 64baaa0..ac1bd02 100644 --- a/test/endian_reverse_test4.cpp +++ b/test/endian_reverse_test4.cpp @@ -15,7 +15,14 @@ template void test_reverse_inplace( T x ) endian_reverse_inplace( x2 ); endian_reverse_inplace( x2 ); + BOOST_TEST( x == x2 ); + boost::endian::native_to_little_inplace( x2 ); + boost::endian::little_to_native_inplace( x2 ); + BOOST_TEST( x == x2 ); + + boost::endian::native_to_big_inplace( x2 ); + boost::endian::big_to_native_inplace( x2 ); BOOST_TEST( x == x2 ); }