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
31// Author: maxtroy@google.com (Max Cai)
32
33package protobuf_unittest;
34
35option java_package = "com.google.protobuf.nano";
36option java_outer_classname = "NanoRepeatedPackables";
37
38enum Enum {
39  OPTION_ONE = 1;
40  OPTION_TWO = 2;
41}
42
43// Two almost identical messages with all packable repeated field types.
44// One with none marked as packed and the other all packed. For
45// compatibility, they should be able to parse each other's serialized
46// forms.
47
48message NonPacked {
49
50  // All packable types, none marked as packed.
51
52  repeated    int32 int32s    = 1;
53  repeated    int64 int64s    = 2;
54  repeated   uint32 uint32s   = 3;
55  repeated   uint64 uint64s   = 4;
56  repeated   sint32 sint32s   = 5;
57  repeated   sint64 sint64s   = 6;
58  repeated  fixed32 fixed32s  = 7;
59  repeated  fixed64 fixed64s  = 8;
60  repeated sfixed32 sfixed32s = 9;
61  repeated sfixed64 sfixed64s = 10;
62  repeated    float floats    = 11;
63  repeated   double doubles   = 12;
64  repeated     bool bools     = 13;
65  repeated     Enum enums     = 14;
66
67  // Noise for testing merged deserialization.
68  optional int32 noise = 15;
69
70}
71
72message Packed {
73
74  // All packable types, all matching the field numbers in NonPacked,
75  // all marked as packed.
76
77  repeated    int32 int32s    = 1  [ packed = true ];
78  repeated    int64 int64s    = 2  [ packed = true ];
79  repeated   uint32 uint32s   = 3  [ packed = true ];
80  repeated   uint64 uint64s   = 4  [ packed = true ];
81  repeated   sint32 sint32s   = 5  [ packed = true ];
82  repeated   sint64 sint64s   = 6  [ packed = true ];
83  repeated  fixed32 fixed32s  = 7  [ packed = true ];
84  repeated  fixed64 fixed64s  = 8  [ packed = true ];
85  repeated sfixed32 sfixed32s = 9  [ packed = true ];
86  repeated sfixed64 sfixed64s = 10 [ packed = true ];
87  repeated    float floats    = 11 [ packed = true ];
88  repeated   double doubles   = 12 [ packed = true ];
89  repeated     bool bools     = 13 [ packed = true ];
90  repeated     Enum enums     = 14 [ packed = true ];
91
92  // Noise for testing merged deserialization.
93  optional int32 noise = 15;
94
95}
96