From 33dea996a71bf31fdfa63ead548b38b5718dfb09 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 11 Oct 2019 19:57:49 +0300 Subject: [PATCH] Add constexpr tests for *_to_*, conditional_reverse --- test/endian_reverse_cx_test.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/endian_reverse_cx_test.cpp b/test/endian_reverse_cx_test.cpp index 39886c7..23e8140 100644 --- a/test/endian_reverse_cx_test.cpp +++ b/test/endian_reverse_cx_test.cpp @@ -31,4 +31,10 @@ STATIC_ASSERT( endian_reverse( static_cast( 0x0102 ) ) == 0x020 STATIC_ASSERT( endian_reverse( static_cast( 0x01020304 ) ) == 0x04030201 ); STATIC_ASSERT( endian_reverse( static_cast( 0x0102030405060708 ) ) == 0x0807060504030201 ); +STATIC_ASSERT( big_to_native( native_to_big( 0x01020304 ) ) == 0x01020304 ); +STATIC_ASSERT( little_to_native( native_to_little( 0x01020304 ) ) == 0x01020304 ); + +STATIC_ASSERT( native_to_big( 0x01020304 ) == (conditional_reverse( 0x01020304 )) ); +STATIC_ASSERT( native_to_big( 0x01020304 ) == conditional_reverse( 0x01020304, order::native, order::big ) ); + #endif