1
// Protocol Buffers - Google's data interchange format
2
// Copyright 2008 Google Inc. All rights reserved.
3
// http://code.google.com/p/protobuf/
5
// Redistribution and use in source and binary forms, with or without
6
// modification, are permitted provided that the following conditions are
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
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.
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.
31
// Author: kenton@google.com (Kenton Varda)
32
// Based on original Protocol Buffers design by
33
// Sanjay Ghemawat, Jeff Dean, and others.
35
#ifndef GOOGLE_PROTOBUF_TEST_UTIL_LITE_H__
36
#define GOOGLE_PROTOBUF_TEST_UTIL_LITE_H__
38
#include <google/protobuf/unittest_lite.pb.h>
43
namespace unittest = protobuf_unittest;
44
namespace unittest_import = protobuf_unittest_import;
48
// Set every field in the message to a unique value.
49
static void SetAllFields(unittest::TestAllTypesLite* message);
50
static void SetAllExtensions(unittest::TestAllExtensionsLite* message);
51
static void SetPackedFields(unittest::TestPackedTypesLite* message);
52
static void SetPackedExtensions(unittest::TestPackedExtensionsLite* message);
54
// Use the repeated versions of the set_*() accessors to modify all the
55
// repeated fields of the messsage (which should already have been
56
// initialized with Set*Fields()). Set*Fields() itself only tests
57
// the add_*() accessors.
58
static void ModifyRepeatedFields(unittest::TestAllTypesLite* message);
59
static void ModifyRepeatedExtensions(
60
unittest::TestAllExtensionsLite* message);
61
static void ModifyPackedFields(unittest::TestPackedTypesLite* message);
62
static void ModifyPackedExtensions(
63
unittest::TestPackedExtensionsLite* message);
65
// Check that all fields have the values that they should have after
66
// Set*Fields() is called.
67
static void ExpectAllFieldsSet(const unittest::TestAllTypesLite& message);
68
static void ExpectAllExtensionsSet(
69
const unittest::TestAllExtensionsLite& message);
70
static void ExpectPackedFieldsSet(
71
const unittest::TestPackedTypesLite& message);
72
static void ExpectPackedExtensionsSet(
73
const unittest::TestPackedExtensionsLite& message);
75
// Expect that the message is modified as would be expected from
77
static void ExpectRepeatedFieldsModified(
78
const unittest::TestAllTypesLite& message);
79
static void ExpectRepeatedExtensionsModified(
80
const unittest::TestAllExtensionsLite& message);
81
static void ExpectPackedFieldsModified(
82
const unittest::TestPackedTypesLite& message);
83
static void ExpectPackedExtensionsModified(
84
const unittest::TestPackedExtensionsLite& message);
86
// Check that all fields have their default values.
87
static void ExpectClear(const unittest::TestAllTypesLite& message);
88
static void ExpectExtensionsClear(
89
const unittest::TestAllExtensionsLite& message);
90
static void ExpectPackedClear(const unittest::TestPackedTypesLite& message);
91
static void ExpectPackedExtensionsClear(
92
const unittest::TestPackedExtensionsLite& message);
95
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TestUtilLite);
98
} // namespace protobuf
100
} // namespace google
101
#endif // GOOGLE_PROTOBUF_TEST_UTIL_LITE_H__