summaryrefslogtreecommitdiffstats
path: root/lldb/unittests/Utility/DataExtractorTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/unittests/Utility/DataExtractorTest.cpp')
-rw-r--r--lldb/unittests/Utility/DataExtractorTest.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lldb/unittests/Utility/DataExtractorTest.cpp b/lldb/unittests/Utility/DataExtractorTest.cpp
index fbf13399a1c..4dfa9511ac7 100644
--- a/lldb/unittests/Utility/DataExtractorTest.cpp
+++ b/lldb/unittests/Utility/DataExtractorTest.cpp
@@ -13,7 +13,7 @@
using namespace lldb_private;
TEST(DataExtractorTest, GetBitfield) {
- uint8_t buffer[] = {0x01, 0x23, 0x45, 0x67};
+ uint8_t buffer[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
DataExtractor LE(buffer, sizeof(buffer), lldb::eByteOrderLittle,
sizeof(void *));
DataExtractor BE(buffer, sizeof(buffer), lldb::eByteOrderBig, sizeof(void *));
@@ -24,6 +24,15 @@ TEST(DataExtractorTest, GetBitfield) {
ASSERT_EQ(buffer[1], LE.GetMaxU64Bitfield(&offset, sizeof(buffer), 8, 8));
offset = 0;
ASSERT_EQ(buffer[1], BE.GetMaxU64Bitfield(&offset, sizeof(buffer), 8, 8));
+ offset = 0;
+ ASSERT_EQ(static_cast<uint64_t>(0x0123456789ABCDEF),
+ BE.GetMaxU64Bitfield(&offset, sizeof(buffer), 64, 0));
+ offset = 0;
+ ASSERT_EQ(static_cast<uint64_t>(0x01234567),
+ BE.GetMaxU64Bitfield(&offset, sizeof(buffer), 32, 0));
+ offset = 0;
+ ASSERT_EQ(static_cast<uint64_t>(0x012345678),
+ BE.GetMaxU64Bitfield(&offset, sizeof(buffer), 36, 0));
offset = 0;
ASSERT_EQ(int8_t(buffer[1]),
OpenPOWER on IntegriCloud