Skip to content

Commit

Permalink
[ADT] Guard PagedVector death tests
Browse files Browse the repository at this point in the history
These are not available in all build configurations.

Originally introuduced in: #66430
  • Loading branch information
kuhar committed Sep 30, 2023
1 parent e39727d commit 8580010
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions llvm/unittests/ADT/PagedVectorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ TEST(PagedVectorTest, EmptyTest) {
EXPECT_EQ(V.materialized_end().getIndex(), 0ULL);
EXPECT_EQ(std::distance(V.materialized_begin(), V.materialized_end()), 0LL);

#if GTEST_HAS_DEATH_TEST && !defined(NDEBUG)
EXPECT_DEATH(V[0], "Index < Size");
EXPECT_DEATH(PagedVector<int>(nullptr), "Allocator cannot be null");
#endif
}

TEST(PagedVectorTest, ExpandTest) {
Expand Down Expand Up @@ -68,8 +70,11 @@ TEST(PagedVectorTest, HalfPageFillingTest) {
EXPECT_EQ(std::distance(V.materialized_begin(), V.materialized_end()), 5LL);
for (int I = 0; I < 5; ++I)
EXPECT_EQ(V[I], I);

#if GTEST_HAS_DEATH_TEST && !defined(NDEBUG)
for (int I = 5; I < 10; ++I)
EXPECT_DEATH(V[I], "Index < Size");
#endif
}

TEST(PagedVectorTest, FillFullMultiPageTest) {
Expand Down Expand Up @@ -244,7 +249,10 @@ TEST(PagedVectorTest, ShrinkTest) {
EXPECT_EQ(V.size(), 0ULL);
EXPECT_EQ(V.capacity(), 0ULL);
EXPECT_EQ(std::distance(V.materialized_begin(), V.materialized_end()), 0LL);

#if GTEST_HAS_DEATH_TEST && !defined(NDEBUG)
EXPECT_DEATH(V[0], "Index < Size");
#endif
}

TEST(PagedVectorTest, FunctionalityTest) {
Expand Down

0 comments on commit 8580010

Please sign in to comment.