| Index: base/sys_byteorder_unittest.cc
|
| diff --git a/base/sys_byteorder_unittest.cc b/base/sys_byteorder_unittest.cc
|
| index 0352c2a97c628e91c988ed6febc6556cbf43b3e2..8167be3b9ab09d9dee3272737d438e83b46dc4db 100644
|
| --- a/base/sys_byteorder_unittest.cc
|
| +++ b/base/sys_byteorder_unittest.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include <stdint.h>
|
|
|
| +#include "build/build_config.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace {
|
| @@ -40,6 +41,25 @@ TEST(ByteOrderTest, ByteSwap64) {
|
| EXPECT_EQ(k64BitTestData, reswapped);
|
| }
|
|
|
| +TEST(ByteOrderTest, ByteSwapUintPtrT) {
|
| +#if defined(ARCH_CPU_64_BITS)
|
| + const uintptr_t test_data = static_cast<uintptr_t>(k64BitTestData);
|
| + const uintptr_t swapped_test_data =
|
| + static_cast<uintptr_t>(k64BitSwappedTestData);
|
| +#elif defined(ARCH_CPU_32_BITS)
|
| + const uintptr_t test_data = static_cast<uintptr_t>(k32BitTestData);
|
| + const uintptr_t swapped_test_data =
|
| + static_cast<uintptr_t>(k32BitSwappedTestData);
|
| +#else
|
| +#error architecture not supported
|
| +#endif
|
| +
|
| + uintptr_t swapped = base::ByteSwapUintPtrT(test_data);
|
| + EXPECT_EQ(swapped_test_data, swapped);
|
| + uintptr_t reswapped = base::ByteSwapUintPtrT(swapped);
|
| + EXPECT_EQ(test_data, reswapped);
|
| +}
|
| +
|
| TEST(ByteOrderTest, ByteSwapToLE16) {
|
| uint16_t le = base::ByteSwapToLE16(k16BitTestData);
|
| #if defined(ARCH_CPU_LITTLE_ENDIAN)
|
|
|