Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3127)

Unified Diff: base/sys_byteorder_unittest.cc

Issue 2518253002: Move Partition Allocator into Chromium base. (Closed)
Patch Set: Move OOM_CRASH into its own, more specific header. Fixes Windows build. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)
« base/allocator/oom.h ('K') | « base/sys_byteorder.h ('k') | docs/memory-infra/README.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698