]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/endian/test/endian_reverse_test5.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / endian / test / endian_reverse_test5.cpp
diff --git a/ceph/src/boost/libs/endian/test/endian_reverse_test5.cpp b/ceph/src/boost/libs/endian/test/endian_reverse_test5.cpp
new file mode 100644 (file)
index 0000000..5273795
--- /dev/null
@@ -0,0 +1,30 @@
+// Copyright 2020 Peter Dimov
+// Distributed under the Boost Software License, Version 1.0.
+// https://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/endian/conversion.hpp>
+#include <boost/core/lightweight_test.hpp>
+#include <boost/config.hpp>
+#include <cstddef>
+
+int main()
+{
+    int v[] = { 1, 2 };
+
+    boost::endian::endian_reverse_inplace( v );
+    boost::endian::endian_reverse_inplace( v );
+    BOOST_TEST_EQ( v[0], 1 );
+    BOOST_TEST_EQ( v[1], 2 );
+
+    boost::endian::native_to_little_inplace( v );
+    boost::endian::little_to_native_inplace( v );
+    BOOST_TEST_EQ( v[0], 1 );
+    BOOST_TEST_EQ( v[1], 2 );
+
+    boost::endian::native_to_big_inplace( v );
+    boost::endian::big_to_native_inplace( v );
+    BOOST_TEST_EQ( v[0], 1 );
+    BOOST_TEST_EQ( v[1], 2 );
+
+    return boost::report_errors();
+}