Add more tests to endian_reverse_test3/4

This commit is contained in:
Peter Dimov
2020-05-05 20:18:58 +03:00
parent 62091e5d0c
commit d46d2916a8
2 changed files with 22 additions and 1 deletions

View File

@ -11,8 +11,15 @@ template<class T> 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<class T> 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 );
}

View File

@ -15,7 +15,14 @@ template<class T> 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 );
}