PageRenderTime 39ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/thirdparty/breakpad/third_party/protobuf/protobuf/src/google/protobuf/test_util_lite.h

http://github.com/tomahawk-player/tomahawk
C++ Header | 101 lines | 46 code | 13 blank | 42 comment | 0 complexity | 1ddceb62806aec38fc30a63fce0d32b7 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, GPL-3.0, GPL-2.0
  1. // Protocol Buffers - Google's data interchange format
  2. // Copyright 2008 Google Inc. All rights reserved.
  3. // http://code.google.com/p/protobuf/
  4. //
  5. // Redistribution and use in source and binary forms, with or without
  6. // modification, are permitted provided that the following conditions are
  7. // met:
  8. //
  9. // * Redistributions of source code must retain the above copyright
  10. // notice, this list of conditions and the following disclaimer.
  11. // * Redistributions in binary form must reproduce the above
  12. // copyright notice, this list of conditions and the following disclaimer
  13. // in the documentation and/or other materials provided with the
  14. // distribution.
  15. // * Neither the name of Google Inc. nor the names of its
  16. // contributors may be used to endorse or promote products derived from
  17. // this software without specific prior written permission.
  18. //
  19. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  23. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  25. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. // Author: kenton@google.com (Kenton Varda)
  31. // Based on original Protocol Buffers design by
  32. // Sanjay Ghemawat, Jeff Dean, and others.
  33. #ifndef GOOGLE_PROTOBUF_TEST_UTIL_LITE_H__
  34. #define GOOGLE_PROTOBUF_TEST_UTIL_LITE_H__
  35. #include <google/protobuf/unittest_lite.pb.h>
  36. namespace google {
  37. namespace protobuf {
  38. namespace unittest = protobuf_unittest;
  39. namespace unittest_import = protobuf_unittest_import;
  40. class TestUtilLite {
  41. public:
  42. // Set every field in the message to a unique value.
  43. static void SetAllFields(unittest::TestAllTypesLite* message);
  44. static void SetAllExtensions(unittest::TestAllExtensionsLite* message);
  45. static void SetPackedFields(unittest::TestPackedTypesLite* message);
  46. static void SetPackedExtensions(unittest::TestPackedExtensionsLite* message);
  47. // Use the repeated versions of the set_*() accessors to modify all the
  48. // repeated fields of the messsage (which should already have been
  49. // initialized with Set*Fields()). Set*Fields() itself only tests
  50. // the add_*() accessors.
  51. static void ModifyRepeatedFields(unittest::TestAllTypesLite* message);
  52. static void ModifyRepeatedExtensions(
  53. unittest::TestAllExtensionsLite* message);
  54. static void ModifyPackedFields(unittest::TestPackedTypesLite* message);
  55. static void ModifyPackedExtensions(
  56. unittest::TestPackedExtensionsLite* message);
  57. // Check that all fields have the values that they should have after
  58. // Set*Fields() is called.
  59. static void ExpectAllFieldsSet(const unittest::TestAllTypesLite& message);
  60. static void ExpectAllExtensionsSet(
  61. const unittest::TestAllExtensionsLite& message);
  62. static void ExpectPackedFieldsSet(
  63. const unittest::TestPackedTypesLite& message);
  64. static void ExpectPackedExtensionsSet(
  65. const unittest::TestPackedExtensionsLite& message);
  66. // Expect that the message is modified as would be expected from
  67. // Modify*Fields().
  68. static void ExpectRepeatedFieldsModified(
  69. const unittest::TestAllTypesLite& message);
  70. static void ExpectRepeatedExtensionsModified(
  71. const unittest::TestAllExtensionsLite& message);
  72. static void ExpectPackedFieldsModified(
  73. const unittest::TestPackedTypesLite& message);
  74. static void ExpectPackedExtensionsModified(
  75. const unittest::TestPackedExtensionsLite& message);
  76. // Check that all fields have their default values.
  77. static void ExpectClear(const unittest::TestAllTypesLite& message);
  78. static void ExpectExtensionsClear(
  79. const unittest::TestAllExtensionsLite& message);
  80. static void ExpectPackedClear(const unittest::TestPackedTypesLite& message);
  81. static void ExpectPackedExtensionsClear(
  82. const unittest::TestPackedExtensionsLite& message);
  83. private:
  84. GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TestUtilLite);
  85. };
  86. } // namespace protobuf
  87. } // namespace google
  88. #endif // GOOGLE_PROTOBUF_TEST_UTIL_LITE_H__