#include "src/diagnostics/gdb-jit.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace v8 {
namespace internal {
namespace GDBJITInterface {
#ifdef ENABLE_GDB_JIT_INTERFACE
TEST(GDBJITTest, OverlapEntries) {
ClearCodeMapForTesting();
base::AddressRegion ar{10, 10};
AddRegionForTesting(ar);
ASSERT_EQ(1u, NumOverlapEntriesForTesting({11, 2}));
ASSERT_EQ(1u, NumOverlapEntriesForTesting({5, 10}));
ASSERT_EQ(1u, NumOverlapEntriesForTesting({15, 10}));
ASSERT_EQ(0u, NumOverlapEntriesForTesting({5, 5}));
ASSERT_EQ(0u, NumOverlapEntriesForTesting({20, 10}));
AddRegionForTesting({20, 10});
ASSERT_EQ(0u, NumOverlapEntriesForTesting({0, 5}));
ASSERT_EQ(0u, NumOverlapEntriesForTesting({30, 5}));
ASSERT_EQ(1u, NumOverlapEntriesForTesting({15, 5}));
ASSERT_EQ(1u, NumOverlapEntriesForTesting({20, 5}));
ASSERT_EQ(2u, NumOverlapEntriesForTesting({15, 10}));
ASSERT_EQ(2u, NumOverlapEntriesForTesting({5, 20}));
ASSERT_EQ(2u, NumOverlapEntriesForTesting({15, 20}));
ASSERT_EQ(2u, NumOverlapEntriesForTesting({0, 40}));
ClearCodeMapForTesting();
}
#endif
}
}
}