|
|
|
@ -382,6 +382,8 @@ TEST(GeneratedMessageTest, StringCharStarLength) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if !defined(PROTOBUF_TEST_NO_DESCRIPTORS) || \ |
|
|
|
|
!defined(GOOGLE_PROTOBUF_NO_RTTI) |
|
|
|
|
TEST(GeneratedMessageTest, CopyFrom) { |
|
|
|
|
unittest::TestAllTypes message1, message2; |
|
|
|
|
|
|
|
|
@ -393,7 +395,7 @@ TEST(GeneratedMessageTest, CopyFrom) { |
|
|
|
|
message2.CopyFrom(message2); |
|
|
|
|
TestUtil::ExpectAllFieldsSet(message2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
TEST(GeneratedMessageTest, SwapWithEmpty) { |
|
|
|
|
unittest::TestAllTypes message1, message2; |
|
|
|
@ -493,6 +495,8 @@ TEST(GeneratedMessageTest, CopyAssignmentOperator) { |
|
|
|
|
TestUtil::ExpectAllFieldsSet(message2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if !defined(PROTOBUF_TEST_NO_DESCRIPTORS) || \ |
|
|
|
|
!defined(GOOGLE_PROTOBUF_NO_RTTI) |
|
|
|
|
TEST(GeneratedMessageTest, UpcastCopyFrom) { |
|
|
|
|
// Test the CopyFrom method that takes in the generic const Message&
|
|
|
|
|
// parameter.
|
|
|
|
@ -505,6 +509,7 @@ TEST(GeneratedMessageTest, UpcastCopyFrom) { |
|
|
|
|
|
|
|
|
|
TestUtil::ExpectAllFieldsSet(message2); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifndef PROTOBUF_TEST_NO_DESCRIPTORS |
|
|
|
|
|
|
|
|
@ -530,6 +535,8 @@ TEST(GeneratedMessageTest, DynamicMessageCopyFrom) { |
|
|
|
|
|
|
|
|
|
#endif // !PROTOBUF_TEST_NO_DESCRIPTORS
|
|
|
|
|
|
|
|
|
|
#if !defined(PROTOBUF_TEST_NO_DESCRIPTORS) || \ |
|
|
|
|
!defined(GOOGLE_PROTOBUF_NO_RTTI) |
|
|
|
|
TEST(GeneratedMessageTest, NonEmptyMergeFrom) { |
|
|
|
|
// Test merging with a non-empty message. Code is a modified form
|
|
|
|
|
// of that found in google/protobuf/reflection_ops_unittest.cc.
|
|
|
|
@ -566,6 +573,7 @@ TEST(GeneratedMessageTest, MergeFromSelf) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endif // PROTOBUF_HAS_DEATH_TEST
|
|
|
|
|
#endif // !PROTOBUF_TEST_NO_DESCRIPTORS || !GOOGLE_PROTOBUF_NO_RTTI
|
|
|
|
|
|
|
|
|
|
// Test the generated SerializeWithCachedSizesToArray(),
|
|
|
|
|
TEST(GeneratedMessageTest, SerializationToArray) { |
|
|
|
@ -1199,7 +1207,7 @@ TEST_F(GeneratedServiceTest, CallMethod) { |
|
|
|
|
TEST_F(GeneratedServiceTest, CallMethodTypeFailure) { |
|
|
|
|
// Verify death if we call Foo() with Bar's message types.
|
|
|
|
|
|
|
|
|
|
#ifdef GTEST_HAS_DEATH_TEST // death tests do not work on Windows yet
|
|
|
|
|
#ifdef PROTOBUF_HAS_DEATH_TEST // death tests do not work on Windows yet
|
|
|
|
|
EXPECT_DEBUG_DEATH( |
|
|
|
|
mock_service_.CallMethod(foo_, &mock_controller_, |
|
|
|
|
&foo_request_, &bar_response_, done_.get()), |
|
|
|
@ -1210,7 +1218,7 @@ TEST_F(GeneratedServiceTest, CallMethodTypeFailure) { |
|
|
|
|
mock_service_.CallMethod(foo_, &mock_controller_, |
|
|
|
|
&bar_request_, &foo_response_, done_.get()), |
|
|
|
|
"dynamic_cast"); |
|
|
|
|
#endif // GTEST_HAS_DEATH_TEST
|
|
|
|
|
#endif // PROTOBUF_HAS_DEATH_TEST
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_F(GeneratedServiceTest, GetPrototypes) { |
|
|
|
|