diff options
Diffstat (limited to 'runtime/indirect_reference_table_test.cc')
-rw-r--r-- | runtime/indirect_reference_table_test.cc | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/runtime/indirect_reference_table_test.cc b/runtime/indirect_reference_table_test.cc index c5ae4c63f7..5da7a30ece 100644 --- a/runtime/indirect_reference_table_test.cc +++ b/runtime/indirect_reference_table_test.cc @@ -106,8 +106,9 @@ TEST_F(IndirectReferenceTableTest, BasicTest) { // Table should be empty now. EXPECT_EQ(0U, irt.Capacity()); - // Get invalid entry (off the end of the list). - EXPECT_TRUE(irt.Get(iref0) == nullptr); + // Check that the entry off the end of the list is not valid. + // (CheckJNI shall abort for such entries.) + EXPECT_FALSE(irt.IsValidReference(iref0, &error_msg)); // Add three, remove in the opposite order. iref0 = irt.Add(cookie, obj0.Get(), &error_msg); @@ -145,8 +146,8 @@ TEST_F(IndirectReferenceTableTest, BasicTest) { ASSERT_FALSE(irt.Remove(cookie, iref1)); CheckDump(&irt, 2, 2); - // Get invalid entry (from hole). - EXPECT_TRUE(irt.Get(iref1) == nullptr); + // Check that the reference to the hole is not valid. + EXPECT_FALSE(irt.IsValidReference(iref1, &error_msg)); ASSERT_TRUE(irt.Remove(cookie, iref2)); CheckDump(&irt, 1, 1); @@ -227,15 +228,12 @@ TEST_F(IndirectReferenceTableTest, BasicTest) { ASSERT_EQ(0U, irt.Capacity()) << "temporal del not empty"; CheckDump(&irt, 0, 0); - // null isn't a valid iref. - ASSERT_TRUE(irt.Get(nullptr) == nullptr); - - // Stale lookup. + // Stale reference is not valid. iref0 = irt.Add(cookie, obj0.Get(), &error_msg); EXPECT_TRUE(iref0 != nullptr); CheckDump(&irt, 1, 1); ASSERT_TRUE(irt.Remove(cookie, iref0)); - EXPECT_TRUE(irt.Get(iref0) == nullptr) << "stale lookup succeeded"; + EXPECT_FALSE(irt.IsValidReference(iref0, &error_msg)) << "stale lookup succeeded"; CheckDump(&irt, 0, 0); // Test table resizing. @@ -322,7 +320,7 @@ TEST_F(IndirectReferenceTableTest, Holes) { // Must not have filled the previous hole. EXPECT_EQ(irt.Capacity(), 4u); - EXPECT_TRUE(irt.Get(iref1) == nullptr); + EXPECT_FALSE(irt.IsValidReference(iref1, &error_msg)); CheckDump(&irt, 3, 3); UNUSED(iref0, iref1, iref2, iref3); @@ -357,7 +355,7 @@ TEST_F(IndirectReferenceTableTest, Holes) { IndirectRef iref4 = irt.Add(cookie1, obj4.Get(), &error_msg); EXPECT_EQ(irt.Capacity(), 2u); - EXPECT_TRUE(irt.Get(iref2) == nullptr); + EXPECT_FALSE(irt.IsValidReference(iref2, &error_msg)); CheckDump(&irt, 2, 2); UNUSED(iref0, iref1, iref2, iref3, iref4); @@ -397,7 +395,7 @@ TEST_F(IndirectReferenceTableTest, Holes) { IndirectRef iref4 = irt.Add(cookie1, obj4.Get(), &error_msg); EXPECT_EQ(irt.Capacity(), 3u); - EXPECT_TRUE(irt.Get(iref1) == nullptr); + EXPECT_FALSE(irt.IsValidReference(iref1, &error_msg)); CheckDump(&irt, 3, 3); UNUSED(iref0, iref1, iref2, iref3, iref4); @@ -439,7 +437,7 @@ TEST_F(IndirectReferenceTableTest, Holes) { IndirectRef iref5 = irt.Add(cookie1, obj4.Get(), &error_msg); EXPECT_EQ(irt.Capacity(), 2u); - EXPECT_TRUE(irt.Get(iref3) == nullptr); + EXPECT_FALSE(irt.IsValidReference(iref3, &error_msg)); CheckDump(&irt, 2, 2); UNUSED(iref0, iref1, iref2, iref3, iref4, iref5); @@ -479,7 +477,7 @@ TEST_F(IndirectReferenceTableTest, Holes) { IndirectRef iref4 = irt.Add(cookie1, obj3.Get(), &error_msg); EXPECT_EQ(irt.Capacity(), 2u); - EXPECT_TRUE(irt.Get(iref3) == nullptr); + EXPECT_FALSE(irt.IsValidReference(iref3, &error_msg)); CheckDump(&irt, 2, 2); UNUSED(iref0, iref1, iref2, iref3, iref4); |