|
|
|
@ -1035,7 +1035,7 @@ TEST(Movable, Works) { |
|
|
|
|
EXPECT_FALSE(internal::IsMovable<NonMovable>::value); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST(RepeatedField, MoveAdd) { |
|
|
|
|
TEST(RepeatedPtrField, MoveAdd) { |
|
|
|
|
RepeatedPtrField<TestAllTypes> field; |
|
|
|
|
TestAllTypes test_all_types; |
|
|
|
|
auto* optional_nested_message = |
|
|
|
@ -1911,9 +1911,12 @@ TEST(RepeatedPtrField, SmallOptimization) { |
|
|
|
|
// Verify the string is where we think it is.
|
|
|
|
|
EXPECT_EQ(&*array->begin(), &str); |
|
|
|
|
EXPECT_EQ(array->pointer_begin()[0], &str); |
|
|
|
|
auto is_inlined = [array]() { |
|
|
|
|
return std::less_equal<void*>{}(array, &*array->pointer_begin()) && |
|
|
|
|
std::less<void*>{}(&*array->pointer_begin(), array + 1); |
|
|
|
|
}; |
|
|
|
|
// The T** in pointer_begin points into the sso in the object.
|
|
|
|
|
EXPECT_TRUE(std::less_equal<void*>{}(array, &*array->pointer_begin())); |
|
|
|
|
EXPECT_TRUE(std::less_equal<void*>{}(&*array->pointer_begin(), array + 1)); |
|
|
|
|
EXPECT_TRUE(is_inlined()); |
|
|
|
|
|
|
|
|
|
// Adding a second object stops sso.
|
|
|
|
|
std::string str2; |
|
|
|
@ -1925,8 +1928,7 @@ TEST(RepeatedPtrField, SmallOptimization) { |
|
|
|
|
// We used some arena space now.
|
|
|
|
|
EXPECT_LT(usage_before, arena.SpaceUsed()); |
|
|
|
|
// And the pointer_begin is not in the sso anymore.
|
|
|
|
|
EXPECT_FALSE(std::less_equal<void*>{}(array, &*array->pointer_begin()) && |
|
|
|
|
std::less_equal<void*>{}(&*array->pointer_begin(), array + 1)); |
|
|
|
|
EXPECT_FALSE(is_inlined()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST(RepeatedPtrField, CopyAssign) { |
|
|
|
|