forked from boostorg/endian
Add light test of modify-in-place interface
This commit is contained in:
1 parent
ec3aacd132
commit
6c00b65eb4
2 files changed
+28
-4
No files matched your search
+26
-1
@@ -170,7 +170,32 @@ namespace
|
||||
BOOST_TEST_EQ((be::convert_value(little, be::order::little, be::order::native)), native);
|
||||
BOOST_TEST_EQ((be::convert_value(native, be::order::native, be::order::big)), big);
|
||||
BOOST_TEST_EQ((be::convert_value(native, be::order::native, be::order::little)), native);
|
||||
}
|
||||
|
||||
// light test of modify-in-place functions
|
||||
|
||||
T x;
|
||||
|
||||
x = big; be::reverse(x); BOOST_TEST_EQ(x, little);
|
||||
x = big; be::convert<be::order::big, be::order::little>(x); BOOST_TEST_EQ(x, little);
|
||||
x = big; be::convert(x, be::order::big, be::order::little); BOOST_TEST_EQ(x, little);
|
||||
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
x = native; be::big_endian(x); BOOST_TEST_EQ(x, big);
|
||||
x = big; be::big_endian(x); BOOST_TEST_EQ(x, big);
|
||||
x = little; be::big_endian(x); BOOST_TEST_EQ(x, little);
|
||||
x = native; be::little_endian(x); BOOST_TEST_EQ(x, little);
|
||||
x = big; be::little_endian(x); BOOST_TEST_EQ(x, little);
|
||||
x = little; be::little_endian(x); BOOST_TEST_EQ(x, big);
|
||||
# else
|
||||
x = native; be::big_endian(x); BOOST_TEST_EQ(x, big);
|
||||
x = big; be::big_endian(x); BOOST_TEST_EQ(x, little);
|
||||
x = little; be::big_endian(x); BOOST_TEST_EQ(x, big);
|
||||
x = native; be::little_endian(x); BOOST_TEST_EQ(x, little);
|
||||
x = big; be::little_endian(x); BOOST_TEST_EQ(x, big);
|
||||
x = little; be::little_endian(x); BOOST_TEST_EQ(x, little);
|
||||
# endif
|
||||
|
||||
}
|
||||
} // unnamed namespace
|
||||
|
||||
int cpp_main(int, char * [])
|
||||
|
||||
Reference in new issue
Block a user