41#include <gtest/gtest.h>
50TEST(AddrRangeMapTest, LegacyTests)
56 ASSERT_NE(
i,
r.end());
59 ASSERT_NE(
i,
r.end());
61 EXPECT_NE(
r.intersects(
RangeIn(20, 30)),
r.end());
62 EXPECT_EQ(
r.contains(
RangeIn(55, 55)),
r.end());
63 EXPECT_EQ(
r.intersects(
RangeIn(55, 55)),
r.end());
66 EXPECT_EQ(
i,
r.end());
69 ASSERT_NE(
i,
r.end());
71 EXPECT_NE(
r.contains(
RangeIn(20, 30)),
r.end());
88TEST(AddrRangeMapTest, InterleavedTest1)
97 const Addr start = 0x80000000;
98 const Addr end = 0xc0000000;
105 for (
int k=0;
k < N;
k++) {
109 i =
r.contains(start);
111 ASSERT_NE(
i,
r.end()) <<
"start address not found in AddrRangeMap";
113 EXPECT_EQ(
i->second, 0);
132TEST(AddrRangeMapTest, InterleavedTest2)
141 const Addr start = 0x80000000;
142 const Addr end = 0xc0000000;
149 for (
int k=0;
k < N;
k++) {
153 i =
r.contains(start);
155 ASSERT_NE(
i,
r.end()) <<
"start address not found in AddrRangeMap";
157 EXPECT_EQ(
i->second, 2);
TEST(AddrRangeMapTest, LegacyTests)
The AddrRangeMap uses an STL map to implement an interval tree for address decoding.
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
iterator insert(const AddrRange &r, const V &d)
AddrRange RangeIn(Addr start, Addr end)
RangeMap::const_iterator const_iterator
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.