summaryrefslogtreecommitdiffstats
path: root/libunwindstack/tests
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2019-01-08 16:47:06 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-01-08 16:47:06 +0000
commitd76bd4c8d061fd9e87cf67cf41193c6449921160 (patch)
treeeb27f9fa3f7412ffa6fa78797b4e1a4c129d9c24 /libunwindstack/tests
parent6cc741ec9ac58ca55a3a137c0c8082683d2a0220 (diff)
parenta39aaf91ebec78f59a371e356523b10453efb4b2 (diff)
downloadsystem_core-d76bd4c8d061fd9e87cf67cf41193c6449921160.tar.gz
system_core-d76bd4c8d061fd9e87cf67cf41193c6449921160.tar.bz2
system_core-d76bd4c8d061fd9e87cf67cf41193c6449921160.zip
Merge "Remove CHECK in AdjustEncodedValue."
Diffstat (limited to 'libunwindstack/tests')
-rw-r--r--libunwindstack/tests/DwarfMemoryTest.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/libunwindstack/tests/DwarfMemoryTest.cpp b/libunwindstack/tests/DwarfMemoryTest.cpp
index f12d2fe3e..650e965b2 100644
--- a/libunwindstack/tests/DwarfMemoryTest.cpp
+++ b/libunwindstack/tests/DwarfMemoryTest.cpp
@@ -54,6 +54,8 @@ class DwarfMemoryTest : public ::testing::Test {
void ReadEncodedValue_overflow();
template <typename AddressType>
void ReadEncodedValue_high_bit_set();
+ template <typename AddressType>
+ void ReadEncodedValue_all();
MemoryFake memory_;
std::unique_ptr<DwarfMemory> dwarf_mem_;
@@ -457,6 +459,27 @@ TEST_F(DwarfMemoryTest, ReadEncodedValue_high_bit_set_uint64_t) {
ReadEncodedValue_high_bit_set<uint64_t>();
}
+template <typename AddressType>
+void DwarfMemoryTest::ReadEncodedValue_all() {
+ MemoryFakeAlwaysReadZero memory;
+ DwarfMemory dwarf_mem(&memory);
+
+ for (size_t i = 0; i <= 0xff; i++) {
+ uint64_t value;
+ if (dwarf_mem.ReadEncodedValue<AddressType>(static_cast<uint8_t>(i), &value)) {
+ ASSERT_EQ(0U, value);
+ }
+ }
+}
+
+TEST_F(DwarfMemoryTest, ReadEncodedValue_all_uint32_t) {
+ ReadEncodedValue_all<uint32_t>();
+}
+
+TEST_F(DwarfMemoryTest, ReadEncodedValue_all_uint64_t) {
+ ReadEncodedValue_all<uint64_t>();
+}
+
TEST_F(DwarfMemoryTest, AdjustEncodedValue_absptr) {
uint64_t value = 0x1234;
ASSERT_TRUE(dwarf_mem_->AdjustEncodedValue(0x00, &value));