From ceb561d65bfe234a301979a7e3f7ddc244d349b3 Mon Sep 17 00:00:00 2001 From: "kenton@google.com" Date: Thu, 25 Jun 2009 19:05:36 +0000 Subject: Add Swap(), SwapElements(), and RemoveLast() to Reflection. Patch by Scott Stafford. --- src/google/protobuf/test_util.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/google/protobuf/test_util.h') diff --git a/src/google/protobuf/test_util.h b/src/google/protobuf/test_util.h index 1bedb788..e581f419 100644 --- a/src/google/protobuf/test_util.h +++ b/src/google/protobuf/test_util.h @@ -96,6 +96,17 @@ class TestUtil { // SetAllFieldsAndExtensions(). static void ExpectAllFieldsAndExtensionsInOrder(const string& serialized); + // Check that all repeated fields have had their last elements removed. + static void ExpectLastRepeatedsRemoved( + const unittest::TestAllTypes& message); + static void ExpectLastRepeatedExtensionsRemoved( + const unittest::TestAllExtensions& message); + + // Check that all repeated fields have had their first and last elements swapped. + static void ExpectRepeatedsSwapped(const unittest::TestAllTypes& message); + static void ExpectRepeatedExtensionsSwapped( + const unittest::TestAllExtensions& message); + // Like above, but use the reflection interface. class ReflectionTester { public: @@ -116,6 +127,9 @@ class TestUtil { void ExpectPackedFieldsSetViaReflection(const Message& message); void ExpectPackedClearViaReflection(const Message& message); + void RemoveLastRepeatedsViaReflection(Message* message); + void SwapRepeatedsViaReflection(Message* message); + private: const FieldDescriptor* F(const string& name); -- cgit v1.2.3