aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/test_util.h
diff options
context:
space:
mode:
authorGravatar jieluo@google.com <jieluo@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2014-07-18 00:47:59 +0000
committerGravatar jieluo@google.com <jieluo@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2014-07-18 00:47:59 +0000
commit4de8f55113007fdc8e34107950e605fc0209d465 (patch)
tree92b7da8757a7740d9e1f2d3ead233542947d8c8c /src/google/protobuf/test_util.h
parentc5553a3d18f80132b9079c5504bc0aa1f7f950a0 (diff)
down integrate to svn
Diffstat (limited to 'src/google/protobuf/test_util.h')
-rw-r--r--src/google/protobuf/test_util.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/google/protobuf/test_util.h b/src/google/protobuf/test_util.h
index 45519573..6e2d552a 100644
--- a/src/google/protobuf/test_util.h
+++ b/src/google/protobuf/test_util.h
@@ -54,11 +54,15 @@ class TestUtil {
static void AddRepeatedFields1(unittest::TestAllTypes* message);
static void AddRepeatedFields2(unittest::TestAllTypes* message);
static void SetDefaultFields(unittest::TestAllTypes* message);
+ static void SetOneofFields(unittest::TestAllTypes* message);
static void SetAllExtensions(unittest::TestAllExtensions* message);
+ static void SetOneofFields(unittest::TestAllExtensions* message);
static void SetAllFieldsAndExtensions(unittest::TestFieldOrderings* message);
static void SetPackedFields(unittest::TestPackedTypes* message);
static void SetPackedExtensions(unittest::TestPackedExtensions* message);
static void SetUnpackedFields(unittest::TestUnpackedTypes* message);
+ static void SetOneof1(unittest::TestOneof2* message);
+ static void SetOneof2(unittest::TestOneof2* message);
// Use the repeated versions of the set_*() accessors to modify all the
// repeated fields of the messsage (which should already have been
@@ -79,6 +83,10 @@ class TestUtil {
const unittest::TestPackedExtensions& message);
static void ExpectUnpackedFieldsSet(
const unittest::TestUnpackedTypes& message);
+ static void ExpectUnpackedExtensionsSet(
+ const unittest::TestUnpackedExtensions& message);
+ static void ExpectOneofSet1(const unittest::TestOneof2& message);
+ static void ExpectOneofSet2(const unittest::TestOneof2& message);
// Expect that the message is modified as would be expected from
// Modify*Fields().
@@ -97,6 +105,7 @@ class TestUtil {
static void ExpectPackedClear(const unittest::TestPackedTypes& message);
static void ExpectPackedExtensionsClear(
const unittest::TestPackedExtensions& message);
+ static void ExpectOneofClear(const unittest::TestOneof2& message);
// Check that the passed-in serialization is the canonical serialization we
// expect for a TestFieldOrderings message filled in by
@@ -119,6 +128,9 @@ class TestUtil {
static void ExpectRepeatedExtensionsSwapped(
const unittest::TestAllExtensions& message);
+ static void ExpectAtMostOneFieldSetInOneof(
+ const unittest::TestOneof2 &message);
+
// Like above, but use the reflection interface.
class ReflectionTester {
public:
@@ -143,6 +155,11 @@ class TestUtil {
void ReleaseLastRepeatedsViaReflection(
Message* message, bool expect_extensions_notnull);
void SwapRepeatedsViaReflection(Message* message);
+ void SetAllocatedOptionalMessageFieldsToNullViaReflection(
+ Message* message);
+ static void SetAllocatedOptionalMessageFieldsToMessageViaReflection(
+ Message* from_message,
+ Message* to_message);
enum MessageReleaseState {
IS_NULL,
@@ -152,6 +169,11 @@ class TestUtil {
void ExpectMessagesReleasedViaReflection(
Message* message, MessageReleaseState expected_release_state);
+ // Set and check functions for TestOneof2 messages. No need to construct
+ // the ReflectionTester by TestAllTypes nor TestAllExtensions.
+ static void SetOneofViaReflection(Message* message);
+ static void ExpectOneofSetViaReflection(const Message& message);
+
private:
const FieldDescriptor* F(const string& name);