OsmAnd
jni/protobuf/google/protobuf/test_util_lite.h
Go to the documentation of this file.
00001 // Protocol Buffers - Google's data interchange format
00002 // Copyright 2008 Google Inc.  All rights reserved.
00003 // http://code.google.com/p/protobuf/
00004 //
00005 // Redistribution and use in source and binary forms, with or without
00006 // modification, are permitted provided that the following conditions are
00007 // met:
00008 //
00009 //     * Redistributions of source code must retain the above copyright
00010 // notice, this list of conditions and the following disclaimer.
00011 //     * Redistributions in binary form must reproduce the above
00012 // copyright notice, this list of conditions and the following disclaimer
00013 // in the documentation and/or other materials provided with the
00014 // distribution.
00015 //     * Neither the name of Google Inc. nor the names of its
00016 // contributors may be used to endorse or promote products derived from
00017 // this software without specific prior written permission.
00018 //
00019 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00020 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00021 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00022 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00023 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00024 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00025 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00026 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00027 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00028 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00029 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030 
00031 // Author: kenton@google.com (Kenton Varda)
00032 //  Based on original Protocol Buffers design by
00033 //  Sanjay Ghemawat, Jeff Dean, and others.
00034 
00035 #ifndef GOOGLE_PROTOBUF_TEST_UTIL_LITE_H__
00036 #define GOOGLE_PROTOBUF_TEST_UTIL_LITE_H__
00037 
00038 #include <google/protobuf/unittest_lite.pb.h>
00039 
00040 namespace google {
00041 namespace protobuf {
00042 
00043 namespace unittest = protobuf_unittest;
00044 namespace unittest_import = protobuf_unittest_import;
00045 
00046 class TestUtilLite {
00047  public:
00048   // Set every field in the message to a unique value.
00049   static void SetAllFields(unittest::TestAllTypesLite* message);
00050   static void SetAllExtensions(unittest::TestAllExtensionsLite* message);
00051   static void SetPackedFields(unittest::TestPackedTypesLite* message);
00052   static void SetPackedExtensions(unittest::TestPackedExtensionsLite* message);
00053 
00054   // Use the repeated versions of the set_*() accessors to modify all the
00055   // repeated fields of the messsage (which should already have been
00056   // initialized with Set*Fields()).  Set*Fields() itself only tests
00057   // the add_*() accessors.
00058   static void ModifyRepeatedFields(unittest::TestAllTypesLite* message);
00059   static void ModifyRepeatedExtensions(
00060       unittest::TestAllExtensionsLite* message);
00061   static void ModifyPackedFields(unittest::TestPackedTypesLite* message);
00062   static void ModifyPackedExtensions(
00063       unittest::TestPackedExtensionsLite* message);
00064 
00065   // Check that all fields have the values that they should have after
00066   // Set*Fields() is called.
00067   static void ExpectAllFieldsSet(const unittest::TestAllTypesLite& message);
00068   static void ExpectAllExtensionsSet(
00069       const unittest::TestAllExtensionsLite& message);
00070   static void ExpectPackedFieldsSet(
00071       const unittest::TestPackedTypesLite& message);
00072   static void ExpectPackedExtensionsSet(
00073       const unittest::TestPackedExtensionsLite& message);
00074 
00075   // Expect that the message is modified as would be expected from
00076   // Modify*Fields().
00077   static void ExpectRepeatedFieldsModified(
00078       const unittest::TestAllTypesLite& message);
00079   static void ExpectRepeatedExtensionsModified(
00080       const unittest::TestAllExtensionsLite& message);
00081   static void ExpectPackedFieldsModified(
00082       const unittest::TestPackedTypesLite& message);
00083   static void ExpectPackedExtensionsModified(
00084       const unittest::TestPackedExtensionsLite& message);
00085 
00086   // Check that all fields have their default values.
00087   static void ExpectClear(const unittest::TestAllTypesLite& message);
00088   static void ExpectExtensionsClear(
00089       const unittest::TestAllExtensionsLite& message);
00090   static void ExpectPackedClear(const unittest::TestPackedTypesLite& message);
00091   static void ExpectPackedExtensionsClear(
00092       const unittest::TestPackedExtensionsLite& message);
00093 
00094  private:
00095   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TestUtilLite);
00096 };
00097 
00098 }  // namespace protobuf
00099 
00100 }  // namespace google
00101 #endif  // GOOGLE_PROTOBUF_TEST_UTIL_LITE_H__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines