protobuf-core 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +23 -0
- data/Rakefile +5 -0
- data/bin/protoc-gen-ruby +16 -0
- data/lib/protobuf.rb +27 -0
- data/lib/protobuf/code_generator.rb +44 -0
- data/lib/protobuf/core.rb +2 -0
- data/lib/protobuf/core/version.rb +5 -0
- data/lib/protobuf/decoder.rb +73 -0
- data/lib/protobuf/deprecation.rb +112 -0
- data/lib/protobuf/descriptors.rb +3 -0
- data/lib/protobuf/descriptors/google/protobuf/compiler/plugin.pb.rb +54 -0
- data/lib/protobuf/descriptors/google/protobuf/descriptor.pb.rb +251 -0
- data/lib/protobuf/encoder.rb +67 -0
- data/lib/protobuf/enum.rb +303 -0
- data/lib/protobuf/exceptions.rb +9 -0
- data/lib/protobuf/field.rb +74 -0
- data/lib/protobuf/field/base_field.rb +267 -0
- data/lib/protobuf/field/bool_field.rb +59 -0
- data/lib/protobuf/field/bytes_field.rb +82 -0
- data/lib/protobuf/field/double_field.rb +25 -0
- data/lib/protobuf/field/enum_field.rb +68 -0
- data/lib/protobuf/field/field_array.rb +87 -0
- data/lib/protobuf/field/fixed32_field.rb +25 -0
- data/lib/protobuf/field/fixed64_field.rb +28 -0
- data/lib/protobuf/field/float_field.rb +41 -0
- data/lib/protobuf/field/int32_field.rb +21 -0
- data/lib/protobuf/field/int64_field.rb +21 -0
- data/lib/protobuf/field/integer_field.rb +23 -0
- data/lib/protobuf/field/message_field.rb +65 -0
- data/lib/protobuf/field/sfixed32_field.rb +27 -0
- data/lib/protobuf/field/sfixed64_field.rb +28 -0
- data/lib/protobuf/field/signed_integer_field.rb +29 -0
- data/lib/protobuf/field/sint32_field.rb +21 -0
- data/lib/protobuf/field/sint64_field.rb +21 -0
- data/lib/protobuf/field/string_field.rb +34 -0
- data/lib/protobuf/field/uint32_field.rb +21 -0
- data/lib/protobuf/field/uint64_field.rb +21 -0
- data/lib/protobuf/field/varint_field.rb +73 -0
- data/lib/protobuf/generators/base.rb +70 -0
- data/lib/protobuf/generators/enum_generator.rb +41 -0
- data/lib/protobuf/generators/extension_generator.rb +27 -0
- data/lib/protobuf/generators/field_generator.rb +131 -0
- data/lib/protobuf/generators/file_generator.rb +132 -0
- data/lib/protobuf/generators/group_generator.rb +105 -0
- data/lib/protobuf/generators/message_generator.rb +98 -0
- data/lib/protobuf/generators/printable.rb +160 -0
- data/lib/protobuf/logging.rb +39 -0
- data/lib/protobuf/message.rb +193 -0
- data/lib/protobuf/message/fields.rb +133 -0
- data/lib/protobuf/message/serialization.rb +89 -0
- data/lib/protobuf/optionable.rb +23 -0
- data/lib/protobuf/wire_type.rb +10 -0
- data/proto/dynamic_discovery.proto +44 -0
- data/proto/google/protobuf/compiler/plugin.proto +147 -0
- data/proto/google/protobuf/descriptor.proto +620 -0
- data/proto/rpc.proto +62 -0
- data/protobuf-core.gemspec +31 -0
- data/spec/bin/protoc-gen-ruby_spec.rb +23 -0
- data/spec/data/data.bin +3 -0
- data/spec/data/types.bin +0 -0
- data/spec/encoding/all_types_spec.rb +105 -0
- data/spec/encoding/extreme_values_spec.rb +0 -0
- data/spec/functional/class_inheritance_spec.rb +52 -0
- data/spec/functional/compile_and_require_spec.rb +29 -0
- data/spec/lib/protobuf/base_spec.rb +84 -0
- data/spec/lib/protobuf/code_generator_spec.rb +60 -0
- data/spec/lib/protobuf/enum_generator_spec.rb +73 -0
- data/spec/lib/protobuf/enum_spec.rb +265 -0
- data/spec/lib/protobuf/extension_generator_spec.rb +42 -0
- data/spec/lib/protobuf/field/bool_field_spec.rb +51 -0
- data/spec/lib/protobuf/field/field_array_spec.rb +69 -0
- data/spec/lib/protobuf/field/float_field_spec.rb +55 -0
- data/spec/lib/protobuf/field/int32_field_spec.rb +90 -0
- data/spec/lib/protobuf/field/string_field_spec.rb +45 -0
- data/spec/lib/protobuf/field_generator_spec.rb +102 -0
- data/spec/lib/protobuf/field_spec.rb +191 -0
- data/spec/lib/protobuf/file_generator_spec.rb +32 -0
- data/spec/lib/protobuf/message_generator_spec.rb +0 -0
- data/spec/lib/protobuf/message_spec.rb +526 -0
- data/spec/lib/protobuf/optionable_spec.rb +46 -0
- data/spec/lib/protobuf_spec.rb +45 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/support/packed_field.rb +22 -0
- data/spec/support/test/all_types.data.bin +0 -0
- data/spec/support/test/all_types.data.txt +119 -0
- data/spec/support/test/bacon.proto +14 -0
- data/spec/support/test/defaults.pb.rb +27 -0
- data/spec/support/test/defaults.proto +9 -0
- data/spec/support/test/enum.pb.rb +61 -0
- data/spec/support/test/enum.proto +34 -0
- data/spec/support/test/extended.pb.rb +24 -0
- data/spec/support/test/extended.proto +10 -0
- data/spec/support/test/extreme_values.data.bin +0 -0
- data/spec/support/test/google_unittest.pb.rb +530 -0
- data/spec/support/test/google_unittest.proto +713 -0
- data/spec/support/test/google_unittest_import.pb.rb +39 -0
- data/spec/support/test/google_unittest_import.proto +64 -0
- data/spec/support/test/google_unittest_import_public.pb.rb +10 -0
- data/spec/support/test/google_unittest_import_public.proto +38 -0
- data/spec/support/test/multi_field_extensions.pb.rb +58 -0
- data/spec/support/test/multi_field_extensions.proto +33 -0
- data/spec/support/test/resource.pb.rb +106 -0
- data/spec/support/test/resource.proto +94 -0
- metadata +306 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'protobuf/optionable'
|
3
|
+
|
4
|
+
RSpec.describe 'Optionable' do
|
5
|
+
|
6
|
+
describe '.set_option' do
|
7
|
+
before(:all) do
|
8
|
+
OptionableSetOptionTest = ::Class.new do
|
9
|
+
include ::Protobuf::Optionable
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'stores the given option and value' do
|
14
|
+
expect(OptionableSetOptionTest).to respond_to(:set_option)
|
15
|
+
expect(OptionableSetOptionTest.method(:set_option).arity).to eq(-2)
|
16
|
+
expect do
|
17
|
+
OptionableSetOptionTest.set_option(:foo, :bar)
|
18
|
+
end.to_not raise_error
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'defaults the value to true' do
|
22
|
+
OptionableSetOptionTest.set_option(:baz_enabled)
|
23
|
+
expect(OptionableSetOptionTest.get_option(:baz_enabled)).to be true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '.get_option' do
|
28
|
+
before(:all) do
|
29
|
+
OptionableGetOptionTest = ::Class.new do
|
30
|
+
include ::Protobuf::Optionable
|
31
|
+
set_option :foo, :bar
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'retrieves the option for the given name, if any' do
|
36
|
+
expect(OptionableGetOptionTest.get_option(:foo)).to eq(:bar)
|
37
|
+
expect(OptionableGetOptionTest.get_option(:baz)).to be_nil
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'retrieves the option in the context of an instance' do
|
41
|
+
expect(OptionableGetOptionTest.new.get_option(:foo)).to eq(:bar)
|
42
|
+
expect(OptionableGetOptionTest.new.get_option(:baz)).to be_nil
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'protobuf'
|
3
|
+
|
4
|
+
RSpec.describe ::Protobuf do
|
5
|
+
describe '.print_deprecation_warnings?' do
|
6
|
+
before { described_class.instance_variable_set(:@print_deprecation_warnings, nil) }
|
7
|
+
|
8
|
+
it 'defaults to a true value' do
|
9
|
+
expect(described_class.print_deprecation_warnings?).to be true
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'is settable' do
|
13
|
+
described_class.print_deprecation_warnings = false
|
14
|
+
expect(described_class.print_deprecation_warnings?).to be false
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'when ENV["PB_IGNORE_DEPRECATIONS"] present' do
|
18
|
+
it 'defaults to a false value' do
|
19
|
+
ENV['PB_IGNORE_DEPRECATIONS'] = '1'
|
20
|
+
expect(described_class.print_deprecation_warnings?).to be false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '.ignore_unknown_fields?' do
|
26
|
+
before do
|
27
|
+
if described_class.instance_variable_defined?(:@_ignore_unknown_fields)
|
28
|
+
described_class.send(:remove_instance_variable, :@_ignore_unknown_fields)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'defaults to a true value' do
|
33
|
+
expect(described_class.ignore_unknown_fields?).to be true
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'is settable' do
|
37
|
+
expect do
|
38
|
+
described_class.ignore_unknown_fields = false
|
39
|
+
end.to change {
|
40
|
+
described_class.ignore_unknown_fields?
|
41
|
+
}.from(true).to(false)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
require 'protobuf'
|
3
|
+
|
4
|
+
$LOAD_PATH << ::File.expand_path("../../lib/protobuf/descriptors", __FILE__)
|
5
|
+
require 'google/protobuf/compiler/plugin.pb'
|
6
|
+
|
7
|
+
$LOAD_PATH << ::File.expand_path('../support', __FILE__)
|
8
|
+
support_proto_glob = File.expand_path('../support/**/*.pb.rb', __FILE__)
|
9
|
+
Dir[support_proto_glob].each { |proto_file| require proto_file }
|
@@ -0,0 +1,22 @@
|
|
1
|
+
if defined?(RSpec)
|
2
|
+
shared_examples_for :packable_field do |field_klass|
|
3
|
+
|
4
|
+
before(:all) do
|
5
|
+
unless defined?(PackableFieldTest)
|
6
|
+
class PackableFieldTest < ::Protobuf::Message; end
|
7
|
+
end
|
8
|
+
|
9
|
+
field_name = "#{field_klass.name.split('::').last.underscore}_packed_field".to_sym
|
10
|
+
tag_num = PackableFieldTest.fields.size + 1
|
11
|
+
PackableFieldTest.repeated(field_klass, field_name, tag_num, :packed => true)
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:field_name) { "#{field_klass.name.split('::').last.underscore}_packed_field".to_sym }
|
15
|
+
let(:message_instance) { PackableFieldTest.new(field_name => [100, 200, 300]) }
|
16
|
+
|
17
|
+
subject { PackableFieldTest.get_field(field_name) }
|
18
|
+
|
19
|
+
specify { expect(subject).to be_packed }
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
Binary file
|
@@ -0,0 +1,119 @@
|
|
1
|
+
optional_int32: 101
|
2
|
+
optional_int64: 102
|
3
|
+
optional_uint32: 103
|
4
|
+
optional_uint64: 104
|
5
|
+
optional_sint32: 105
|
6
|
+
optional_sint64: 106
|
7
|
+
optional_fixed32: 107
|
8
|
+
optional_fixed64: 108
|
9
|
+
optional_sfixed32: 109
|
10
|
+
optional_sfixed64: 110
|
11
|
+
optional_float: 111
|
12
|
+
optional_double: 112
|
13
|
+
optional_bool: true
|
14
|
+
optional_string: "115"
|
15
|
+
optional_bytes: "116"
|
16
|
+
optional_nested_message {
|
17
|
+
bb: 118
|
18
|
+
}
|
19
|
+
optional_foreign_message {
|
20
|
+
c: 119
|
21
|
+
}
|
22
|
+
optional_import_message {
|
23
|
+
d: 120
|
24
|
+
}
|
25
|
+
optional_nested_enum: BAZ
|
26
|
+
optional_foreign_enum: FOREIGN_BAZ
|
27
|
+
optional_import_enum: IMPORT_BAZ
|
28
|
+
optional_string_piece: "124"
|
29
|
+
optional_cord: "125"
|
30
|
+
optional_public_import_message {
|
31
|
+
e: 126
|
32
|
+
}
|
33
|
+
optional_lazy_message {
|
34
|
+
bb: 127
|
35
|
+
}
|
36
|
+
repeated_int32: 201
|
37
|
+
repeated_int32: 301
|
38
|
+
repeated_int64: 202
|
39
|
+
repeated_int64: 302
|
40
|
+
repeated_uint32: 203
|
41
|
+
repeated_uint32: 303
|
42
|
+
repeated_uint64: 204
|
43
|
+
repeated_uint64: 304
|
44
|
+
repeated_sint32: 205
|
45
|
+
repeated_sint32: 305
|
46
|
+
repeated_sint64: 206
|
47
|
+
repeated_sint64: 306
|
48
|
+
repeated_fixed32: 207
|
49
|
+
repeated_fixed32: 307
|
50
|
+
repeated_fixed64: 208
|
51
|
+
repeated_fixed64: 308
|
52
|
+
repeated_sfixed32: 209
|
53
|
+
repeated_sfixed32: 309
|
54
|
+
repeated_sfixed64: 210
|
55
|
+
repeated_sfixed64: 310
|
56
|
+
repeated_float: 211
|
57
|
+
repeated_float: 311
|
58
|
+
repeated_double: 212
|
59
|
+
repeated_double: 312
|
60
|
+
repeated_bool: true
|
61
|
+
repeated_bool: false
|
62
|
+
repeated_string: "215"
|
63
|
+
repeated_string: "315"
|
64
|
+
repeated_bytes: "216"
|
65
|
+
repeated_bytes: "316"
|
66
|
+
repeated_nested_message {
|
67
|
+
bb: 218
|
68
|
+
}
|
69
|
+
repeated_nested_message {
|
70
|
+
bb: 318
|
71
|
+
}
|
72
|
+
repeated_foreign_message {
|
73
|
+
c: 219
|
74
|
+
}
|
75
|
+
repeated_foreign_message {
|
76
|
+
c: 319
|
77
|
+
}
|
78
|
+
repeated_import_message {
|
79
|
+
d: 220
|
80
|
+
}
|
81
|
+
repeated_import_message {
|
82
|
+
d: 320
|
83
|
+
}
|
84
|
+
repeated_nested_enum: BAR
|
85
|
+
repeated_nested_enum: BAZ
|
86
|
+
repeated_foreign_enum: FOREIGN_BAR
|
87
|
+
repeated_foreign_enum: FOREIGN_BAZ
|
88
|
+
repeated_import_enum: IMPORT_BAR
|
89
|
+
repeated_import_enum: IMPORT_BAZ
|
90
|
+
repeated_string_piece: "224"
|
91
|
+
repeated_string_piece: "324"
|
92
|
+
repeated_cord: "225"
|
93
|
+
repeated_cord: "325"
|
94
|
+
repeated_lazy_message {
|
95
|
+
bb: 227
|
96
|
+
}
|
97
|
+
repeated_lazy_message {
|
98
|
+
bb: 327
|
99
|
+
}
|
100
|
+
default_int32: 401
|
101
|
+
default_int64: 402
|
102
|
+
default_uint32: 403
|
103
|
+
default_uint64: 404
|
104
|
+
default_sint32: 405
|
105
|
+
default_sint64: 406
|
106
|
+
default_fixed32: 407
|
107
|
+
default_fixed64: 408
|
108
|
+
default_sfixed32: 409
|
109
|
+
default_sfixed64: 410
|
110
|
+
default_float: 411
|
111
|
+
default_double: 412
|
112
|
+
default_bool: false
|
113
|
+
default_string: "415"
|
114
|
+
default_bytes: "416"
|
115
|
+
default_nested_enum: FOO
|
116
|
+
default_foreign_enum: FOREIGN_FOO
|
117
|
+
default_import_enum: IMPORT_FOO
|
118
|
+
default_string_piece: "424"
|
119
|
+
default_cord: "425"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
##
|
4
|
+
# This file is auto-generated. DO NOT EDIT!
|
5
|
+
#
|
6
|
+
require 'protobuf/message'
|
7
|
+
|
8
|
+
module Test
|
9
|
+
|
10
|
+
##
|
11
|
+
# Message Classes
|
12
|
+
#
|
13
|
+
class Defaults < ::Protobuf::Message; end
|
14
|
+
|
15
|
+
|
16
|
+
##
|
17
|
+
# Message Fields
|
18
|
+
#
|
19
|
+
class Defaults
|
20
|
+
optional :bytes, :escaped_bytes, 1, :default => "\000\001\007\010\014\n\r\t\013\\\\'\"\376"
|
21
|
+
optional :double, :infinity_default, 2, :default => ::Float::INFINITY
|
22
|
+
optional :float, :neg_infinity_default, 3, :default => -::Float::INFINITY
|
23
|
+
optional :double, :nan_default, 4, :default => ::Float::NAN
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
package test;
|
2
|
+
|
3
|
+
message Defaults {
|
4
|
+
optional bytes escaped_bytes = 1 [default = "\0\001\a\b\f\n\r\t\v\\\'\"\xfe"];
|
5
|
+
optional double infinity_default = 2 [default = inf];
|
6
|
+
optional float neg_infinity_default = 3 [default = -inf];
|
7
|
+
optional double nan_default = 4 [default = nan];
|
8
|
+
}
|
9
|
+
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
##
|
4
|
+
# This file is auto-generated. DO NOT EDIT!
|
5
|
+
#
|
6
|
+
require 'protobuf/message'
|
7
|
+
|
8
|
+
|
9
|
+
##
|
10
|
+
# Imports
|
11
|
+
#
|
12
|
+
require 'test/resource.pb'
|
13
|
+
|
14
|
+
module Test
|
15
|
+
|
16
|
+
##
|
17
|
+
# Enum Classes
|
18
|
+
#
|
19
|
+
class EnumTestType < ::Protobuf::Enum
|
20
|
+
define :ONE, 1
|
21
|
+
define :TWO, 2
|
22
|
+
end
|
23
|
+
|
24
|
+
class AliasedEnum < ::Protobuf::Enum
|
25
|
+
set_option :allow_alias
|
26
|
+
|
27
|
+
define :THREE, 3
|
28
|
+
define :TRES, 3
|
29
|
+
define :FOUR, 4
|
30
|
+
define :CUATRO, 4
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
##
|
35
|
+
# Message Classes
|
36
|
+
#
|
37
|
+
class EnumTestMessage < ::Protobuf::Message; end
|
38
|
+
|
39
|
+
|
40
|
+
##
|
41
|
+
# Message Fields
|
42
|
+
#
|
43
|
+
class EnumTestMessage
|
44
|
+
optional ::Test::EnumTestType, :non_default_enum, 1
|
45
|
+
optional ::Test::EnumTestType, :default_enum, 2, :default => ::Test::EnumTestType::ONE
|
46
|
+
repeated ::Test::EnumTestType, :repeated_enums, 3
|
47
|
+
optional ::Test::AliasedEnum, :alias_non_default_enum, 4
|
48
|
+
optional ::Test::AliasedEnum, :alias_default_enum, 5, :default => ::Test::AliasedEnum::CUATRO
|
49
|
+
repeated ::Test::AliasedEnum, :alias_repeated_enums, 6
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
##
|
54
|
+
# Extended Message Fields
|
55
|
+
#
|
56
|
+
class ::Test::Resource < ::Protobuf::Message
|
57
|
+
optional :int32, :ext_other_file_defined_field, 200, :extension => true
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
package test;
|
2
|
+
import 'test/resource.proto';
|
3
|
+
|
4
|
+
// Test extending another message from an imported file.
|
5
|
+
|
6
|
+
enum EnumTestType {
|
7
|
+
ONE = 1;
|
8
|
+
TWO = 2;
|
9
|
+
}
|
10
|
+
|
11
|
+
// Uses aliases
|
12
|
+
enum AliasedEnum {
|
13
|
+
option allow_alias = true;
|
14
|
+
|
15
|
+
THREE = 3;
|
16
|
+
TRES = 3;
|
17
|
+
|
18
|
+
FOUR = 4;
|
19
|
+
CUATRO = 4;
|
20
|
+
}
|
21
|
+
|
22
|
+
message EnumTestMessage {
|
23
|
+
optional EnumTestType non_default_enum = 1;
|
24
|
+
optional EnumTestType default_enum = 2 [default=ONE];
|
25
|
+
repeated EnumTestType repeated_enums = 3;
|
26
|
+
|
27
|
+
optional AliasedEnum alias_non_default_enum = 4;
|
28
|
+
optional AliasedEnum alias_default_enum = 5 [default=CUATRO];
|
29
|
+
repeated AliasedEnum alias_repeated_enums = 6;
|
30
|
+
}
|
31
|
+
|
32
|
+
extend test.Resource {
|
33
|
+
optional int32 ext_other_file_defined_field = 200;
|
34
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
##
|
4
|
+
# This file is auto-generated. DO NOT EDIT!
|
5
|
+
#
|
6
|
+
require 'protobuf/message'
|
7
|
+
|
8
|
+
|
9
|
+
##
|
10
|
+
# Imports
|
11
|
+
#
|
12
|
+
require 'test/resource.pb'
|
13
|
+
|
14
|
+
module Test
|
15
|
+
|
16
|
+
##
|
17
|
+
# Extended Message Fields
|
18
|
+
#
|
19
|
+
class ::Test::Resource < ::Protobuf::Message
|
20
|
+
optional :int64, :deleted_at, 300, :extension => true
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
package test;
|
2
|
+
import 'test/resource.proto';
|
3
|
+
|
4
|
+
// Test that we will re-open a class and add
|
5
|
+
// extension fields to it even if there are no
|
6
|
+
// message or enum definitions in this FileDescriptor.
|
7
|
+
|
8
|
+
extend test.Resource {
|
9
|
+
optional int64 deleted_at = 300;
|
10
|
+
}
|
Binary file
|
@@ -0,0 +1,530 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
##
|
4
|
+
# This file is auto-generated. DO NOT EDIT!
|
5
|
+
#
|
6
|
+
require 'protobuf/message'
|
7
|
+
|
8
|
+
##
|
9
|
+
# Imports
|
10
|
+
#
|
11
|
+
require 'test/google_unittest_import.pb'
|
12
|
+
|
13
|
+
module GoogleUnittest
|
14
|
+
|
15
|
+
##
|
16
|
+
# Enum Classes
|
17
|
+
#
|
18
|
+
class ForeignEnum < ::Protobuf::Enum
|
19
|
+
define :FOREIGN_FOO, 4
|
20
|
+
define :FOREIGN_BAR, 5
|
21
|
+
define :FOREIGN_BAZ, 6
|
22
|
+
end
|
23
|
+
|
24
|
+
class TestSparseEnum < ::Protobuf::Enum
|
25
|
+
define :SPARSE_A, 123
|
26
|
+
define :SPARSE_B, 62374
|
27
|
+
define :SPARSE_C, 12589234
|
28
|
+
define :SPARSE_D, -15
|
29
|
+
define :SPARSE_E, -53452
|
30
|
+
define :SPARSE_F, 0
|
31
|
+
define :SPARSE_G, 2
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
##
|
36
|
+
# Message Classes
|
37
|
+
#
|
38
|
+
class TestAllTypes < ::Protobuf::Message
|
39
|
+
class NestedEnum < ::Protobuf::Enum
|
40
|
+
define :FOO, 1
|
41
|
+
define :BAR, 2
|
42
|
+
define :BAZ, 3
|
43
|
+
end
|
44
|
+
|
45
|
+
class NestedMessage < ::Protobuf::Message; end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
class TestDeprecatedFields < ::Protobuf::Message; end
|
50
|
+
class ForeignMessage < ::Protobuf::Message; end
|
51
|
+
class TestAllExtensions < ::Protobuf::Message; end
|
52
|
+
class TestNestedExtension < ::Protobuf::Message; end
|
53
|
+
class TestRequired < ::Protobuf::Message; end
|
54
|
+
class TestRequiredForeign < ::Protobuf::Message; end
|
55
|
+
class TestForeignNested < ::Protobuf::Message; end
|
56
|
+
class TestEmptyMessage < ::Protobuf::Message; end
|
57
|
+
class TestEmptyMessageWithExtensions < ::Protobuf::Message; end
|
58
|
+
class TestMultipleExtensionRanges < ::Protobuf::Message; end
|
59
|
+
class TestReallyLargeTagNumber < ::Protobuf::Message; end
|
60
|
+
class TestRecursiveMessage < ::Protobuf::Message; end
|
61
|
+
class TestMutualRecursionA < ::Protobuf::Message; end
|
62
|
+
class TestMutualRecursionB < ::Protobuf::Message; end
|
63
|
+
class TestDupFieldNumber < ::Protobuf::Message; end
|
64
|
+
class TestEagerMessage < ::Protobuf::Message; end
|
65
|
+
class TestLazyMessage < ::Protobuf::Message; end
|
66
|
+
class TestNestedMessageHasBits < ::Protobuf::Message
|
67
|
+
class NestedMessage < ::Protobuf::Message; end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
class TestCamelCaseFieldNames < ::Protobuf::Message; end
|
72
|
+
class TestFieldOrderings < ::Protobuf::Message; end
|
73
|
+
class TestExtremeDefaultValues < ::Protobuf::Message; end
|
74
|
+
class SparseEnumMessage < ::Protobuf::Message; end
|
75
|
+
class OneString < ::Protobuf::Message; end
|
76
|
+
class MoreString < ::Protobuf::Message; end
|
77
|
+
class OneBytes < ::Protobuf::Message; end
|
78
|
+
class MoreBytes < ::Protobuf::Message; end
|
79
|
+
class TestPackedTypes < ::Protobuf::Message; end
|
80
|
+
class TestUnpackedTypes < ::Protobuf::Message; end
|
81
|
+
class TestPackedExtensions < ::Protobuf::Message; end
|
82
|
+
class TestDynamicExtensions < ::Protobuf::Message
|
83
|
+
class DynamicEnumType < ::Protobuf::Enum
|
84
|
+
define :DYNAMIC_FOO, 2200
|
85
|
+
define :DYNAMIC_BAR, 2201
|
86
|
+
define :DYNAMIC_BAZ, 2202
|
87
|
+
end
|
88
|
+
|
89
|
+
class DynamicMessageType < ::Protobuf::Message; end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
class TestRepeatedScalarDifferentTagSizes < ::Protobuf::Message; end
|
94
|
+
class TestParsingMerge < ::Protobuf::Message
|
95
|
+
class RepeatedFieldsGenerator < ::Protobuf::Message; end
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
class TestCommentInjectionMessage < ::Protobuf::Message; end
|
100
|
+
class FooRequest < ::Protobuf::Message; end
|
101
|
+
class FooResponse < ::Protobuf::Message; end
|
102
|
+
class FooClientMessage < ::Protobuf::Message; end
|
103
|
+
class FooServerMessage < ::Protobuf::Message; end
|
104
|
+
class BarRequest < ::Protobuf::Message; end
|
105
|
+
class BarResponse < ::Protobuf::Message; end
|
106
|
+
|
107
|
+
|
108
|
+
##
|
109
|
+
# Message Fields
|
110
|
+
#
|
111
|
+
class TestAllTypes
|
112
|
+
class NestedMessage
|
113
|
+
optional :int32, :bb, 1
|
114
|
+
end
|
115
|
+
|
116
|
+
optional :int32, :optional_int32, 1
|
117
|
+
optional :int64, :optional_int64, 2
|
118
|
+
optional :uint32, :optional_uint32, 3
|
119
|
+
optional :uint64, :optional_uint64, 4
|
120
|
+
optional :sint32, :optional_sint32, 5
|
121
|
+
optional :sint64, :optional_sint64, 6
|
122
|
+
optional :fixed32, :optional_fixed32, 7
|
123
|
+
optional :fixed64, :optional_fixed64, 8
|
124
|
+
optional :sfixed32, :optional_sfixed32, 9
|
125
|
+
optional :sfixed64, :optional_sfixed64, 10
|
126
|
+
optional :float, :optional_float, 11
|
127
|
+
optional :double, :optional_double, 12
|
128
|
+
optional :bool, :optional_bool, 13
|
129
|
+
optional :string, :optional_string, 14
|
130
|
+
optional :bytes, :optional_bytes, 15
|
131
|
+
optional ::GoogleUnittest::TestAllTypes::NestedMessage, :optional_nested_message, 18
|
132
|
+
optional ::GoogleUnittest::ForeignMessage, :optional_foreign_message, 19
|
133
|
+
optional ::GoogleUnittestImport::ImportMessage, :optional_import_message, 20
|
134
|
+
optional ::GoogleUnittest::TestAllTypes::NestedEnum, :optional_nested_enum, 21
|
135
|
+
optional ::GoogleUnittest::ForeignEnum, :optional_foreign_enum, 22
|
136
|
+
optional ::GoogleUnittestImport::ImportEnum, :optional_import_enum, 23
|
137
|
+
optional :string, :optional_string_piece, 24
|
138
|
+
optional :string, :optional_cord, 25
|
139
|
+
optional ::GoogleUnittestImport::PublicImportMessage, :optional_public_import_message, 26
|
140
|
+
optional ::GoogleUnittest::TestAllTypes::NestedMessage, :optional_lazy_message, 27
|
141
|
+
repeated :int32, :repeated_int32, 31
|
142
|
+
repeated :int64, :repeated_int64, 32
|
143
|
+
repeated :uint32, :repeated_uint32, 33
|
144
|
+
repeated :uint64, :repeated_uint64, 34
|
145
|
+
repeated :sint32, :repeated_sint32, 35
|
146
|
+
repeated :sint64, :repeated_sint64, 36
|
147
|
+
repeated :fixed32, :repeated_fixed32, 37
|
148
|
+
repeated :fixed64, :repeated_fixed64, 38
|
149
|
+
repeated :sfixed32, :repeated_sfixed32, 39
|
150
|
+
repeated :sfixed64, :repeated_sfixed64, 40
|
151
|
+
repeated :float, :repeated_float, 41
|
152
|
+
repeated :double, :repeated_double, 42
|
153
|
+
repeated :bool, :repeated_bool, 43
|
154
|
+
repeated :string, :repeated_string, 44
|
155
|
+
repeated :bytes, :repeated_bytes, 45
|
156
|
+
repeated ::GoogleUnittest::TestAllTypes::NestedMessage, :repeated_nested_message, 48
|
157
|
+
repeated ::GoogleUnittest::ForeignMessage, :repeated_foreign_message, 49
|
158
|
+
repeated ::GoogleUnittestImport::ImportMessage, :repeated_import_message, 50
|
159
|
+
repeated ::GoogleUnittest::TestAllTypes::NestedEnum, :repeated_nested_enum, 51
|
160
|
+
repeated ::GoogleUnittest::ForeignEnum, :repeated_foreign_enum, 52
|
161
|
+
repeated ::GoogleUnittestImport::ImportEnum, :repeated_import_enum, 53
|
162
|
+
repeated :string, :repeated_string_piece, 54
|
163
|
+
repeated :string, :repeated_cord, 55
|
164
|
+
repeated ::GoogleUnittest::TestAllTypes::NestedMessage, :repeated_lazy_message, 57
|
165
|
+
optional :int32, :default_int32, 61, :default => 41
|
166
|
+
optional :int64, :default_int64, 62, :default => 42
|
167
|
+
optional :uint32, :default_uint32, 63, :default => 43
|
168
|
+
optional :uint64, :default_uint64, 64, :default => 44
|
169
|
+
optional :sint32, :default_sint32, 65, :default => -45
|
170
|
+
optional :sint64, :default_sint64, 66, :default => 46
|
171
|
+
optional :fixed32, :default_fixed32, 67, :default => 47
|
172
|
+
optional :fixed64, :default_fixed64, 68, :default => 48
|
173
|
+
optional :sfixed32, :default_sfixed32, 69, :default => 49
|
174
|
+
optional :sfixed64, :default_sfixed64, 70, :default => -50
|
175
|
+
optional :float, :default_float, 71, :default => 51.5
|
176
|
+
optional :double, :default_double, 72, :default => 52000
|
177
|
+
optional :bool, :default_bool, 73, :default => true
|
178
|
+
optional :string, :default_string, 74, :default => "hello"
|
179
|
+
optional :bytes, :default_bytes, 75, :default => "world"
|
180
|
+
optional ::GoogleUnittest::TestAllTypes::NestedEnum, :default_nested_enum, 81, :default => ::GoogleUnittest::TestAllTypes::NestedEnum::BAR
|
181
|
+
optional ::GoogleUnittest::ForeignEnum, :default_foreign_enum, 82, :default => ::GoogleUnittest::ForeignEnum::FOREIGN_BAR
|
182
|
+
optional ::GoogleUnittestImport::ImportEnum, :default_import_enum, 83, :default => ::GoogleUnittestImport::ImportEnum::IMPORT_BAR
|
183
|
+
optional :string, :default_string_piece, 84, :default => "abc"
|
184
|
+
optional :string, :default_cord, 85, :default => "123"
|
185
|
+
end
|
186
|
+
|
187
|
+
class TestDeprecatedFields
|
188
|
+
optional :int32, :deprecated_int32, 1, :deprecated => true
|
189
|
+
end
|
190
|
+
|
191
|
+
class ForeignMessage
|
192
|
+
optional :int32, :c, 1
|
193
|
+
end
|
194
|
+
|
195
|
+
class TestAllExtensions
|
196
|
+
# Extension Fields
|
197
|
+
extensions 1...536870912
|
198
|
+
optional :int32, :optional_int32_extension, 1, :extension => true
|
199
|
+
optional :int64, :optional_int64_extension, 2, :extension => true
|
200
|
+
optional :uint32, :optional_uint32_extension, 3, :extension => true
|
201
|
+
optional :uint64, :optional_uint64_extension, 4, :extension => true
|
202
|
+
optional :sint32, :optional_sint32_extension, 5, :extension => true
|
203
|
+
optional :sint64, :optional_sint64_extension, 6, :extension => true
|
204
|
+
optional :fixed32, :optional_fixed32_extension, 7, :extension => true
|
205
|
+
optional :fixed64, :optional_fixed64_extension, 8, :extension => true
|
206
|
+
optional :sfixed32, :optional_sfixed32_extension, 9, :extension => true
|
207
|
+
optional :sfixed64, :optional_sfixed64_extension, 10, :extension => true
|
208
|
+
optional :float, :optional_float_extension, 11, :extension => true
|
209
|
+
optional :double, :optional_double_extension, 12, :extension => true
|
210
|
+
optional :bool, :optional_bool_extension, 13, :extension => true
|
211
|
+
optional :string, :optional_string_extension, 14, :extension => true
|
212
|
+
optional :bytes, :optional_bytes_extension, 15, :extension => true
|
213
|
+
optional ::GoogleUnittest::TestAllTypes::NestedMessage, :optional_nested_message_extension, 18, :extension => true
|
214
|
+
optional ::GoogleUnittest::ForeignMessage, :optional_foreign_message_extension, 19, :extension => true
|
215
|
+
optional ::GoogleUnittestImport::ImportMessage, :optional_import_message_extension, 20, :extension => true
|
216
|
+
optional ::GoogleUnittest::TestAllTypes::NestedEnum, :optional_nested_enum_extension, 21, :extension => true
|
217
|
+
optional ::GoogleUnittest::ForeignEnum, :optional_foreign_enum_extension, 22, :extension => true
|
218
|
+
optional ::GoogleUnittestImport::ImportEnum, :optional_import_enum_extension, 23, :extension => true
|
219
|
+
optional :string, :optional_string_piece_extension, 24, :extension => true
|
220
|
+
optional :string, :optional_cord_extension, 25, :extension => true
|
221
|
+
optional ::GoogleUnittestImport::PublicImportMessage, :optional_public_import_message_extension, 26, :extension => true
|
222
|
+
optional ::GoogleUnittest::TestAllTypes::NestedMessage, :optional_lazy_message_extension, 27, :extension => true
|
223
|
+
repeated :int32, :repeated_int32_extension, 31, :extension => true
|
224
|
+
repeated :int64, :repeated_int64_extension, 32, :extension => true
|
225
|
+
repeated :uint32, :repeated_uint32_extension, 33, :extension => true
|
226
|
+
repeated :uint64, :repeated_uint64_extension, 34, :extension => true
|
227
|
+
repeated :sint32, :repeated_sint32_extension, 35, :extension => true
|
228
|
+
repeated :sint64, :repeated_sint64_extension, 36, :extension => true
|
229
|
+
repeated :fixed32, :repeated_fixed32_extension, 37, :extension => true
|
230
|
+
repeated :fixed64, :repeated_fixed64_extension, 38, :extension => true
|
231
|
+
repeated :sfixed32, :repeated_sfixed32_extension, 39, :extension => true
|
232
|
+
repeated :sfixed64, :repeated_sfixed64_extension, 40, :extension => true
|
233
|
+
repeated :float, :repeated_float_extension, 41, :extension => true
|
234
|
+
repeated :double, :repeated_double_extension, 42, :extension => true
|
235
|
+
repeated :bool, :repeated_bool_extension, 43, :extension => true
|
236
|
+
repeated :string, :repeated_string_extension, 44, :extension => true
|
237
|
+
repeated :bytes, :repeated_bytes_extension, 45, :extension => true
|
238
|
+
repeated ::GoogleUnittest::TestAllTypes::NestedMessage, :repeated_nested_message_extension, 48, :extension => true
|
239
|
+
repeated ::GoogleUnittest::ForeignMessage, :repeated_foreign_message_extension, 49, :extension => true
|
240
|
+
repeated ::GoogleUnittestImport::ImportMessage, :repeated_import_message_extension, 50, :extension => true
|
241
|
+
repeated ::GoogleUnittest::TestAllTypes::NestedEnum, :repeated_nested_enum_extension, 51, :extension => true
|
242
|
+
repeated ::GoogleUnittest::ForeignEnum, :repeated_foreign_enum_extension, 52, :extension => true
|
243
|
+
repeated ::GoogleUnittestImport::ImportEnum, :repeated_import_enum_extension, 53, :extension => true
|
244
|
+
repeated :string, :repeated_string_piece_extension, 54, :extension => true
|
245
|
+
repeated :string, :repeated_cord_extension, 55, :extension => true
|
246
|
+
repeated ::GoogleUnittest::TestAllTypes::NestedMessage, :repeated_lazy_message_extension, 57, :extension => true
|
247
|
+
optional :int32, :default_int32_extension, 61, :default => 41, :extension => true
|
248
|
+
optional :int64, :default_int64_extension, 62, :default => 42, :extension => true
|
249
|
+
optional :uint32, :default_uint32_extension, 63, :default => 43, :extension => true
|
250
|
+
optional :uint64, :default_uint64_extension, 64, :default => 44, :extension => true
|
251
|
+
optional :sint32, :default_sint32_extension, 65, :default => -45, :extension => true
|
252
|
+
optional :sint64, :default_sint64_extension, 66, :default => 46, :extension => true
|
253
|
+
optional :fixed32, :default_fixed32_extension, 67, :default => 47, :extension => true
|
254
|
+
optional :fixed64, :default_fixed64_extension, 68, :default => 48, :extension => true
|
255
|
+
optional :sfixed32, :default_sfixed32_extension, 69, :default => 49, :extension => true
|
256
|
+
optional :sfixed64, :default_sfixed64_extension, 70, :default => -50, :extension => true
|
257
|
+
optional :float, :default_float_extension, 71, :default => 51.5, :extension => true
|
258
|
+
optional :double, :default_double_extension, 72, :default => 52000, :extension => true
|
259
|
+
optional :bool, :default_bool_extension, 73, :default => true, :extension => true
|
260
|
+
optional :string, :default_string_extension, 74, :default => "hello", :extension => true
|
261
|
+
optional :bytes, :default_bytes_extension, 75, :default => "world", :extension => true
|
262
|
+
optional ::GoogleUnittest::TestAllTypes::NestedEnum, :default_nested_enum_extension, 81, :default => ::GoogleUnittest::TestAllTypes::NestedEnum::BAR, :extension => true
|
263
|
+
optional ::GoogleUnittest::ForeignEnum, :default_foreign_enum_extension, 82, :default => ::GoogleUnittest::ForeignEnum::FOREIGN_BAR, :extension => true
|
264
|
+
optional ::GoogleUnittestImport::ImportEnum, :default_import_enum_extension, 83, :default => ::GoogleUnittestImport::ImportEnum::IMPORT_BAR, :extension => true
|
265
|
+
optional :string, :default_string_piece_extension, 84, :default => "abc", :extension => true
|
266
|
+
optional :string, :default_cord_extension, 85, :default => "123", :extension => true
|
267
|
+
optional :string, :test, 1002, :default => "test", :extension => true
|
268
|
+
optional ::GoogleUnittest::TestRequired, :single, 1000, :extension => true
|
269
|
+
repeated ::GoogleUnittest::TestRequired, :multi, 1001, :extension => true
|
270
|
+
end
|
271
|
+
|
272
|
+
class TestRequired
|
273
|
+
required :int32, :a, 1
|
274
|
+
optional :int32, :dummy2, 2
|
275
|
+
required :int32, :b, 3
|
276
|
+
optional :int32, :dummy4, 4
|
277
|
+
optional :int32, :dummy5, 5
|
278
|
+
optional :int32, :dummy6, 6
|
279
|
+
optional :int32, :dummy7, 7
|
280
|
+
optional :int32, :dummy8, 8
|
281
|
+
optional :int32, :dummy9, 9
|
282
|
+
optional :int32, :dummy10, 10
|
283
|
+
optional :int32, :dummy11, 11
|
284
|
+
optional :int32, :dummy12, 12
|
285
|
+
optional :int32, :dummy13, 13
|
286
|
+
optional :int32, :dummy14, 14
|
287
|
+
optional :int32, :dummy15, 15
|
288
|
+
optional :int32, :dummy16, 16
|
289
|
+
optional :int32, :dummy17, 17
|
290
|
+
optional :int32, :dummy18, 18
|
291
|
+
optional :int32, :dummy19, 19
|
292
|
+
optional :int32, :dummy20, 20
|
293
|
+
optional :int32, :dummy21, 21
|
294
|
+
optional :int32, :dummy22, 22
|
295
|
+
optional :int32, :dummy23, 23
|
296
|
+
optional :int32, :dummy24, 24
|
297
|
+
optional :int32, :dummy25, 25
|
298
|
+
optional :int32, :dummy26, 26
|
299
|
+
optional :int32, :dummy27, 27
|
300
|
+
optional :int32, :dummy28, 28
|
301
|
+
optional :int32, :dummy29, 29
|
302
|
+
optional :int32, :dummy30, 30
|
303
|
+
optional :int32, :dummy31, 31
|
304
|
+
optional :int32, :dummy32, 32
|
305
|
+
required :int32, :c, 33
|
306
|
+
end
|
307
|
+
|
308
|
+
class TestRequiredForeign
|
309
|
+
optional ::GoogleUnittest::TestRequired, :optional_message, 1
|
310
|
+
repeated ::GoogleUnittest::TestRequired, :repeated_message, 2
|
311
|
+
optional :int32, :dummy, 3
|
312
|
+
end
|
313
|
+
|
314
|
+
class TestForeignNested
|
315
|
+
optional ::GoogleUnittest::TestAllTypes::NestedMessage, :foreign_nested, 1
|
316
|
+
end
|
317
|
+
|
318
|
+
class TestReallyLargeTagNumber
|
319
|
+
optional :int32, :a, 1
|
320
|
+
optional :int32, :bb, 268435455
|
321
|
+
end
|
322
|
+
|
323
|
+
class TestRecursiveMessage
|
324
|
+
optional ::GoogleUnittest::TestRecursiveMessage, :a, 1
|
325
|
+
optional :int32, :i, 2
|
326
|
+
end
|
327
|
+
|
328
|
+
class TestMutualRecursionA
|
329
|
+
optional ::GoogleUnittest::TestMutualRecursionB, :bb, 1
|
330
|
+
end
|
331
|
+
|
332
|
+
class TestMutualRecursionB
|
333
|
+
optional ::GoogleUnittest::TestMutualRecursionA, :a, 1
|
334
|
+
optional :int32, :optional_int32, 2
|
335
|
+
end
|
336
|
+
|
337
|
+
class TestDupFieldNumber
|
338
|
+
optional :int32, :a, 1
|
339
|
+
end
|
340
|
+
|
341
|
+
class TestEagerMessage
|
342
|
+
optional ::GoogleUnittest::TestAllTypes, :sub_message, 1
|
343
|
+
end
|
344
|
+
|
345
|
+
class TestLazyMessage
|
346
|
+
optional ::GoogleUnittest::TestAllTypes, :sub_message, 1
|
347
|
+
end
|
348
|
+
|
349
|
+
class TestNestedMessageHasBits
|
350
|
+
class NestedMessage
|
351
|
+
repeated :int32, :nestedmessage_repeated_int32, 1
|
352
|
+
repeated ::GoogleUnittest::ForeignMessage, :nestedmessage_repeated_foreignmessage, 2
|
353
|
+
end
|
354
|
+
|
355
|
+
optional ::GoogleUnittest::TestNestedMessageHasBits::NestedMessage, :optional_nested_message, 1
|
356
|
+
end
|
357
|
+
|
358
|
+
class TestCamelCaseFieldNames
|
359
|
+
optional :int32, :PrimitiveField, 1
|
360
|
+
optional :string, :StringField, 2
|
361
|
+
optional ::GoogleUnittest::ForeignEnum, :EnumField, 3
|
362
|
+
optional ::GoogleUnittest::ForeignMessage, :MessageField, 4
|
363
|
+
optional :string, :StringPieceField, 5
|
364
|
+
optional :string, :CordField, 6
|
365
|
+
repeated :int32, :RepeatedPrimitiveField, 7
|
366
|
+
repeated :string, :RepeatedStringField, 8
|
367
|
+
repeated ::GoogleUnittest::ForeignEnum, :RepeatedEnumField, 9
|
368
|
+
repeated ::GoogleUnittest::ForeignMessage, :RepeatedMessageField, 10
|
369
|
+
repeated :string, :RepeatedStringPieceField, 11
|
370
|
+
repeated :string, :RepeatedCordField, 12
|
371
|
+
end
|
372
|
+
|
373
|
+
class TestFieldOrderings
|
374
|
+
optional :string, :my_string, 11
|
375
|
+
optional :int64, :my_int, 1
|
376
|
+
optional :float, :my_float, 101
|
377
|
+
# Extension Fields
|
378
|
+
extensions 2...11
|
379
|
+
extensions 12...101
|
380
|
+
optional :string, :my_extension_string, 50, :extension => true
|
381
|
+
optional :int32, :my_extension_int, 5, :extension => true
|
382
|
+
end
|
383
|
+
|
384
|
+
class TestExtremeDefaultValues
|
385
|
+
optional :bytes, :escaped_bytes, 1, :default => "\000\001\007\010\014\n\r\t\013\\\\'\"\376"
|
386
|
+
optional :uint32, :large_uint32, 2, :default => 4294967295
|
387
|
+
optional :uint64, :large_uint64, 3, :default => 18446744073709551615
|
388
|
+
optional :int32, :small_int32, 4, :default => -2147483647
|
389
|
+
optional :int64, :small_int64, 5, :default => -9223372036854775807
|
390
|
+
optional :int32, :really_small_int32, 21, :default => -2147483648
|
391
|
+
optional :int64, :really_small_int64, 22, :default => -9223372036854775808
|
392
|
+
optional :string, :utf8_string, 6, :default => "ሴ"
|
393
|
+
optional :float, :zero_float, 7, :default => 0
|
394
|
+
optional :float, :one_float, 8, :default => 1
|
395
|
+
optional :float, :small_float, 9, :default => 1.5
|
396
|
+
optional :float, :negative_one_float, 10, :default => -1
|
397
|
+
optional :float, :negative_float, 11, :default => -1.5
|
398
|
+
optional :float, :large_float, 12, :default => 2e+08
|
399
|
+
optional :float, :small_negative_float, 13, :default => -8e-28
|
400
|
+
optional :double, :inf_double, 14, :default => ::Float::INFINITY
|
401
|
+
optional :double, :neg_inf_double, 15, :default => -::Float::INFINITY
|
402
|
+
optional :double, :nan_double, 16, :default => ::Float::NAN
|
403
|
+
optional :float, :inf_float, 17, :default => ::Float::INFINITY
|
404
|
+
optional :float, :neg_inf_float, 18, :default => -::Float::INFINITY
|
405
|
+
optional :float, :nan_float, 19, :default => ::Float::NAN
|
406
|
+
optional :string, :cpp_trigraph, 20, :default => "? ? ?? ?? ??? ??/ ??-"
|
407
|
+
optional :string, :string_with_zero, 23, :default => "hello"
|
408
|
+
optional :bytes, :bytes_with_zero, 24, :default => "wor\000ld"
|
409
|
+
optional :string, :string_piece_with_zero, 25, :default => "abc"
|
410
|
+
optional :string, :cord_with_zero, 26, :default => "123"
|
411
|
+
end
|
412
|
+
|
413
|
+
class SparseEnumMessage
|
414
|
+
optional ::GoogleUnittest::TestSparseEnum, :sparse_enum, 1
|
415
|
+
end
|
416
|
+
|
417
|
+
class OneString
|
418
|
+
optional :string, :data, 1
|
419
|
+
end
|
420
|
+
|
421
|
+
class MoreString
|
422
|
+
repeated :string, :data, 1
|
423
|
+
end
|
424
|
+
|
425
|
+
class OneBytes
|
426
|
+
optional :bytes, :data, 1
|
427
|
+
end
|
428
|
+
|
429
|
+
class MoreBytes
|
430
|
+
repeated :bytes, :data, 1
|
431
|
+
end
|
432
|
+
|
433
|
+
class TestPackedTypes
|
434
|
+
repeated :int32, :packed_int32, 90, :packed => true
|
435
|
+
repeated :int64, :packed_int64, 91, :packed => true
|
436
|
+
repeated :uint32, :packed_uint32, 92, :packed => true
|
437
|
+
repeated :uint64, :packed_uint64, 93, :packed => true
|
438
|
+
repeated :sint32, :packed_sint32, 94, :packed => true
|
439
|
+
repeated :sint64, :packed_sint64, 95, :packed => true
|
440
|
+
repeated :fixed32, :packed_fixed32, 96, :packed => true
|
441
|
+
repeated :fixed64, :packed_fixed64, 97, :packed => true
|
442
|
+
repeated :sfixed32, :packed_sfixed32, 98, :packed => true
|
443
|
+
repeated :sfixed64, :packed_sfixed64, 99, :packed => true
|
444
|
+
repeated :float, :packed_float, 100, :packed => true
|
445
|
+
repeated :double, :packed_double, 101, :packed => true
|
446
|
+
repeated :bool, :packed_bool, 102, :packed => true
|
447
|
+
repeated ::GoogleUnittest::ForeignEnum, :packed_enum, 103, :packed => true
|
448
|
+
end
|
449
|
+
|
450
|
+
class TestUnpackedTypes
|
451
|
+
repeated :int32, :unpacked_int32, 90
|
452
|
+
repeated :int64, :unpacked_int64, 91
|
453
|
+
repeated :uint32, :unpacked_uint32, 92
|
454
|
+
repeated :uint64, :unpacked_uint64, 93
|
455
|
+
repeated :sint32, :unpacked_sint32, 94
|
456
|
+
repeated :sint64, :unpacked_sint64, 95
|
457
|
+
repeated :fixed32, :unpacked_fixed32, 96
|
458
|
+
repeated :fixed64, :unpacked_fixed64, 97
|
459
|
+
repeated :sfixed32, :unpacked_sfixed32, 98
|
460
|
+
repeated :sfixed64, :unpacked_sfixed64, 99
|
461
|
+
repeated :float, :unpacked_float, 100
|
462
|
+
repeated :double, :unpacked_double, 101
|
463
|
+
repeated :bool, :unpacked_bool, 102
|
464
|
+
repeated ::GoogleUnittest::ForeignEnum, :unpacked_enum, 103
|
465
|
+
end
|
466
|
+
|
467
|
+
class TestPackedExtensions
|
468
|
+
# Extension Fields
|
469
|
+
extensions 1...536870912
|
470
|
+
repeated :int32, :packed_int32_extension, 90, :packed => true, :extension => true
|
471
|
+
repeated :int64, :packed_int64_extension, 91, :packed => true, :extension => true
|
472
|
+
repeated :uint32, :packed_uint32_extension, 92, :packed => true, :extension => true
|
473
|
+
repeated :uint64, :packed_uint64_extension, 93, :packed => true, :extension => true
|
474
|
+
repeated :sint32, :packed_sint32_extension, 94, :packed => true, :extension => true
|
475
|
+
repeated :sint64, :packed_sint64_extension, 95, :packed => true, :extension => true
|
476
|
+
repeated :fixed32, :packed_fixed32_extension, 96, :packed => true, :extension => true
|
477
|
+
repeated :fixed64, :packed_fixed64_extension, 97, :packed => true, :extension => true
|
478
|
+
repeated :sfixed32, :packed_sfixed32_extension, 98, :packed => true, :extension => true
|
479
|
+
repeated :sfixed64, :packed_sfixed64_extension, 99, :packed => true, :extension => true
|
480
|
+
repeated :float, :packed_float_extension, 100, :packed => true, :extension => true
|
481
|
+
repeated :double, :packed_double_extension, 101, :packed => true, :extension => true
|
482
|
+
repeated :bool, :packed_bool_extension, 102, :packed => true, :extension => true
|
483
|
+
repeated ::GoogleUnittest::ForeignEnum, :packed_enum_extension, 103, :packed => true, :extension => true
|
484
|
+
end
|
485
|
+
|
486
|
+
class TestDynamicExtensions
|
487
|
+
class DynamicMessageType
|
488
|
+
optional :int32, :dynamic_field, 2100
|
489
|
+
end
|
490
|
+
|
491
|
+
optional :fixed32, :scalar_extension, 2000
|
492
|
+
optional ::GoogleUnittest::ForeignEnum, :enum_extension, 2001
|
493
|
+
optional ::GoogleUnittest::TestDynamicExtensions::DynamicEnumType, :dynamic_enum_extension, 2002
|
494
|
+
optional ::GoogleUnittest::ForeignMessage, :message_extension, 2003
|
495
|
+
optional ::GoogleUnittest::TestDynamicExtensions::DynamicMessageType, :dynamic_message_extension, 2004
|
496
|
+
repeated :string, :repeated_extension, 2005
|
497
|
+
repeated :sint32, :packed_extension, 2006, :packed => true
|
498
|
+
end
|
499
|
+
|
500
|
+
class TestRepeatedScalarDifferentTagSizes
|
501
|
+
repeated :fixed32, :repeated_fixed32, 12
|
502
|
+
repeated :int32, :repeated_int32, 13
|
503
|
+
repeated :fixed64, :repeated_fixed64, 2046
|
504
|
+
repeated :int64, :repeated_int64, 2047
|
505
|
+
repeated :float, :repeated_float, 262142
|
506
|
+
repeated :uint64, :repeated_uint64, 262143
|
507
|
+
end
|
508
|
+
|
509
|
+
class TestParsingMerge
|
510
|
+
class RepeatedFieldsGenerator
|
511
|
+
repeated ::GoogleUnittest::TestAllTypes, :field1, 1
|
512
|
+
repeated ::GoogleUnittest::TestAllTypes, :field2, 2
|
513
|
+
repeated ::GoogleUnittest::TestAllTypes, :field3, 3
|
514
|
+
repeated ::GoogleUnittest::TestAllTypes, :ext1, 1000
|
515
|
+
repeated ::GoogleUnittest::TestAllTypes, :ext2, 1001
|
516
|
+
end
|
517
|
+
|
518
|
+
required ::GoogleUnittest::TestAllTypes, :required_all_types, 1
|
519
|
+
optional ::GoogleUnittest::TestAllTypes, :optional_all_types, 2
|
520
|
+
repeated ::GoogleUnittest::TestAllTypes, :repeated_all_types, 3
|
521
|
+
# Extension Fields
|
522
|
+
extensions 1000...536870912
|
523
|
+
optional ::GoogleUnittest::TestAllTypes, :optional_ext, 1000, :extension => true
|
524
|
+
repeated ::GoogleUnittest::TestAllTypes, :repeated_ext, 1001, :extension => true
|
525
|
+
end
|
526
|
+
|
527
|
+
class TestCommentInjectionMessage
|
528
|
+
optional :string, :a, 1, :default => "*/ <- Neither should this."
|
529
|
+
end
|
530
|
+
end
|