protobuf 3.3.6 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop.yml +48 -0
- data/.rubocop_todo.yml +79 -0
- data/.travis.yml +12 -4
- data/Rakefile +14 -11
- data/bin/protoc-gen-ruby +0 -1
- data/bin/rpc_server +1 -0
- data/install-protobuf.sh +8 -0
- data/lib/protobuf.rb +30 -24
- data/lib/protobuf/cli.rb +35 -35
- data/lib/protobuf/code_generator.rb +11 -8
- data/lib/protobuf/decoder.rb +4 -5
- data/lib/protobuf/deprecation.rb +20 -0
- data/lib/protobuf/descriptors/google/protobuf/compiler/plugin.pb.rb +2 -0
- data/lib/protobuf/descriptors/google/protobuf/descriptor.pb.rb +2 -0
- data/lib/protobuf/encoder.rb +9 -4
- data/lib/protobuf/enum.rb +38 -54
- data/lib/protobuf/field.rb +2 -2
- data/lib/protobuf/field/base_field.rb +28 -32
- data/lib/protobuf/field/bool_field.rb +4 -4
- data/lib/protobuf/field/bytes_field.rb +5 -4
- data/lib/protobuf/field/double_field.rb +0 -1
- data/lib/protobuf/field/enum_field.rb +4 -7
- data/lib/protobuf/field/field_array.rb +3 -4
- data/lib/protobuf/field/fixed32_field.rb +1 -1
- data/lib/protobuf/field/fixed64_field.rb +0 -1
- data/lib/protobuf/field/float_field.rb +0 -1
- data/lib/protobuf/field/int32_field.rb +0 -1
- data/lib/protobuf/field/int64_field.rb +0 -1
- data/lib/protobuf/field/integer_field.rb +0 -1
- data/lib/protobuf/field/message_field.rb +2 -3
- data/lib/protobuf/field/sfixed32_field.rb +0 -1
- data/lib/protobuf/field/sfixed64_field.rb +0 -1
- data/lib/protobuf/field/signed_integer_field.rb +0 -1
- data/lib/protobuf/field/sint32_field.rb +0 -1
- data/lib/protobuf/field/sint64_field.rb +0 -1
- data/lib/protobuf/field/string_field.rb +0 -1
- data/lib/protobuf/field/uint32_field.rb +0 -1
- data/lib/protobuf/field/uint64_field.rb +0 -1
- data/lib/protobuf/field/varint_field.rb +0 -1
- data/lib/protobuf/generators/base.rb +1 -2
- data/lib/protobuf/generators/enum_generator.rb +1 -2
- data/lib/protobuf/generators/extension_generator.rb +1 -2
- data/lib/protobuf/generators/field_generator.rb +4 -5
- data/lib/protobuf/generators/file_generator.rb +22 -27
- data/lib/protobuf/generators/group_generator.rb +15 -16
- data/lib/protobuf/generators/message_generator.rb +13 -14
- data/lib/protobuf/generators/printable.rb +9 -10
- data/lib/protobuf/generators/service_generator.rb +1 -2
- data/lib/protobuf/lifecycle.rb +20 -33
- data/lib/protobuf/logging.rb +4 -6
- data/lib/protobuf/message.rb +22 -16
- data/lib/protobuf/message/fields.rb +14 -17
- data/lib/protobuf/message/serialization.rb +6 -5
- data/lib/protobuf/rpc/buffer.rb +10 -12
- data/lib/protobuf/rpc/client.rb +12 -12
- data/lib/protobuf/rpc/connectors/base.rb +4 -3
- data/lib/protobuf/rpc/connectors/common.rb +15 -17
- data/lib/protobuf/rpc/connectors/socket.rb +2 -2
- data/lib/protobuf/rpc/connectors/zmq.rb +118 -108
- data/lib/protobuf/rpc/dynamic_discovery.pb.rb +2 -0
- data/lib/protobuf/rpc/env.rb +12 -12
- data/lib/protobuf/rpc/error.rb +1 -1
- data/lib/protobuf/rpc/error/client_error.rb +4 -4
- data/lib/protobuf/rpc/error/server_error.rb +6 -6
- data/lib/protobuf/rpc/middleware/exception_handler.rb +1 -1
- data/lib/protobuf/rpc/middleware/logger.rb +3 -3
- data/lib/protobuf/rpc/middleware/request_decoder.rb +5 -5
- data/lib/protobuf/rpc/middleware/response_encoder.rb +3 -3
- data/lib/protobuf/rpc/rpc.pb.rb +2 -0
- data/lib/protobuf/rpc/servers/socket/server.rb +75 -65
- data/lib/protobuf/rpc/servers/socket/worker.rb +2 -2
- data/lib/protobuf/rpc/servers/socket_runner.rb +12 -6
- data/lib/protobuf/rpc/servers/zmq/broker.rb +10 -6
- data/lib/protobuf/rpc/servers/zmq/server.rb +20 -26
- data/lib/protobuf/rpc/servers/zmq/util.rb +7 -7
- data/lib/protobuf/rpc/servers/zmq/worker.rb +5 -7
- data/lib/protobuf/rpc/servers/zmq_runner.rb +14 -3
- data/lib/protobuf/rpc/service.rb +15 -15
- data/lib/protobuf/rpc/service_directory.rb +7 -11
- data/lib/protobuf/rpc/service_dispatcher.rb +3 -3
- data/lib/protobuf/rpc/service_filters.rb +27 -28
- data/lib/protobuf/rpc/stat.rb +4 -7
- data/lib/protobuf/socket.rb +0 -1
- data/lib/protobuf/tasks/compile.rake +2 -2
- data/lib/protobuf/version.rb +1 -1
- data/protobuf.gemspec +20 -4
- data/spec/benchmark/tasks.rb +49 -23
- data/spec/bin/protoc-gen-ruby_spec.rb +11 -6
- data/spec/encoding/all_types_spec.rb +91 -77
- data/spec/encoding/extreme_values_spec.rb +0 -0
- data/spec/functional/socket_server_spec.rb +9 -10
- data/spec/functional/zmq_server_spec.rb +21 -19
- data/spec/lib/protobuf/cli_spec.rb +20 -20
- data/spec/lib/protobuf/code_generator_spec.rb +6 -6
- data/spec/lib/protobuf/enum_spec.rb +57 -31
- data/spec/lib/protobuf/field/float_field_spec.rb +2 -2
- data/spec/lib/protobuf/field/int32_field_spec.rb +1 -1
- data/spec/lib/protobuf/field/string_field_spec.rb +7 -8
- data/spec/lib/protobuf/field_spec.rb +3 -6
- data/spec/lib/protobuf/generators/base_spec.rb +6 -6
- data/spec/lib/protobuf/generators/enum_generator_spec.rb +22 -17
- data/spec/lib/protobuf/generators/extension_generator_spec.rb +8 -9
- data/spec/lib/protobuf/generators/field_generator_spec.rb +14 -11
- data/spec/lib/protobuf/generators/file_generator_spec.rb +7 -4
- data/spec/lib/protobuf/generators/service_generator_spec.rb +14 -11
- data/spec/lib/protobuf/lifecycle_spec.rb +9 -4
- data/spec/lib/protobuf/message_spec.rb +63 -35
- data/spec/lib/protobuf/optionable_spec.rb +3 -3
- data/spec/lib/protobuf/rpc/client_spec.rb +2 -2
- data/spec/lib/protobuf/rpc/connector_spec.rb +1 -1
- data/spec/lib/protobuf/rpc/connectors/base_spec.rb +6 -6
- data/spec/lib/protobuf/rpc/connectors/common_spec.rb +26 -18
- data/spec/lib/protobuf/rpc/connectors/socket_spec.rb +4 -4
- data/spec/lib/protobuf/rpc/connectors/zmq_spec.rb +11 -9
- data/spec/lib/protobuf/rpc/middleware/exception_handler_spec.rb +2 -2
- data/spec/lib/protobuf/rpc/middleware/logger_spec.rb +7 -7
- data/spec/lib/protobuf/rpc/middleware/request_decoder_spec.rb +14 -14
- data/spec/lib/protobuf/rpc/middleware/response_encoder_spec.rb +5 -5
- data/spec/lib/protobuf/rpc/servers/socket_server_spec.rb +1 -1
- data/spec/lib/protobuf/rpc/servers/zmq/server_spec.rb +9 -7
- data/spec/lib/protobuf/rpc/servers/zmq/util_spec.rb +9 -9
- data/spec/lib/protobuf/rpc/servers/zmq/worker_spec.rb +2 -2
- data/spec/lib/protobuf/rpc/service_directory_spec.rb +24 -23
- data/spec/lib/protobuf/rpc/service_dispatcher_spec.rb +4 -4
- data/spec/lib/protobuf/rpc/service_filters_spec.rb +84 -51
- data/spec/lib/protobuf/rpc/service_spec.rb +15 -14
- data/spec/lib/protobuf/rpc/stat_spec.rb +1 -1
- data/spec/lib/protobuf_spec.rb +9 -9
- data/spec/spec_helper.rb +7 -19
- data/spec/support/server.rb +29 -59
- data/spec/support/test/defaults.pb.rb +2 -0
- data/spec/support/test/enum.pb.rb +2 -0
- data/spec/support/test/extended.pb.rb +2 -0
- data/spec/support/test/google_unittest_import.pb.rb +2 -0
- data/spec/support/test/google_unittest_import_public.pb.rb +2 -0
- data/spec/support/test/multi_field_extensions.pb.rb +2 -0
- data/spec/support/test/resource.pb.rb +2 -0
- data/spec/support/test/resource_service.rb +17 -20
- metadata +153 -112
- data/lib/protobuf/deprecator.rb +0 -42
data/lib/protobuf/rpc/stat.rb
CHANGED
@@ -17,9 +17,7 @@ module Protobuf
|
|
17
17
|
start
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
@client = client_host
|
22
|
-
end
|
20
|
+
attr_writer :client
|
23
21
|
|
24
22
|
def client
|
25
23
|
@client || nil
|
@@ -34,7 +32,7 @@ module Protobuf
|
|
34
32
|
end
|
35
33
|
|
36
34
|
def server=(peer)
|
37
|
-
@server = {:port => peer[0], :ip => peer[1]}
|
35
|
+
@server = { :port => peer[0], :ip => peer[1] }
|
38
36
|
end
|
39
37
|
|
40
38
|
def server
|
@@ -63,7 +61,7 @@ module Protobuf
|
|
63
61
|
end
|
64
62
|
|
65
63
|
def stopped?
|
66
|
-
!
|
64
|
+
!end_time.nil?
|
67
65
|
end
|
68
66
|
|
69
67
|
def rpc
|
@@ -86,7 +84,7 @@ module Protobuf
|
|
86
84
|
rpc,
|
87
85
|
sizes,
|
88
86
|
elapsed_time,
|
89
|
-
@end_time.try(:iso8601)
|
87
|
+
@end_time.try(:iso8601),
|
90
88
|
].compact.join(' - ')
|
91
89
|
end
|
92
90
|
|
@@ -97,4 +95,3 @@ module Protobuf
|
|
97
95
|
end
|
98
96
|
end
|
99
97
|
end
|
100
|
-
|
data/lib/protobuf/socket.rb
CHANGED
@@ -3,7 +3,7 @@ require 'fileutils'
|
|
3
3
|
namespace :protobuf do
|
4
4
|
|
5
5
|
desc 'Clean & Compile the protobuf source to ruby classes. Pass PB_NO_CLEAN=1 if you do not want to force-clean first.'
|
6
|
-
task :compile, [
|
6
|
+
task :compile, [:package, :source, :destination, :plugin, :file_extension] do |_tasks, args|
|
7
7
|
args.with_defaults(:destination => 'lib')
|
8
8
|
args.with_defaults(:source => 'definitions')
|
9
9
|
args.with_defaults(:plugin => 'ruby')
|
@@ -27,7 +27,7 @@ namespace :protobuf do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
desc 'Clean the generated *.pb.rb files from the destination package. Pass PB_FORCE_CLEAN=1 to skip confirmation step.'
|
30
|
-
task :clean, [
|
30
|
+
task :clean, [:package, :destination, :file_extension] do |_task, args|
|
31
31
|
args.with_defaults(:destination => 'lib')
|
32
32
|
args.with_defaults(:file_extension => '.pb.rb')
|
33
33
|
|
data/lib/protobuf/version.rb
CHANGED
data/protobuf.gemspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
|
2
|
+
$LOAD_PATH.push ::File.expand_path("../lib", __FILE__)
|
3
3
|
require "protobuf/version"
|
4
4
|
|
5
5
|
::Gem::Specification.new do |s|
|
@@ -25,11 +25,27 @@ require "protobuf/version"
|
|
25
25
|
s.add_dependency 'thread_safe'
|
26
26
|
|
27
27
|
s.add_development_dependency 'ffi-rzmq'
|
28
|
-
s.add_development_dependency 'pry-nav'
|
29
28
|
s.add_development_dependency 'rake'
|
30
29
|
s.add_development_dependency 'rspec', '>= 3.0'
|
30
|
+
s.add_development_dependency 'rubocop'
|
31
31
|
s.add_development_dependency 'simplecov'
|
32
|
-
s.add_development_dependency 'yard'
|
33
32
|
s.add_development_dependency 'timecop'
|
34
|
-
s.add_development_dependency '
|
33
|
+
s.add_development_dependency 'yard'
|
34
|
+
|
35
|
+
# debuggers only work in MRI
|
36
|
+
if RUBY_ENGINE.to_sym == :ruby
|
37
|
+
# we don't support MRI < 1.9.3
|
38
|
+
pry_debugger = if RUBY_VERSION < '2.0.0'
|
39
|
+
'pry-debugger'
|
40
|
+
else
|
41
|
+
'pry-byebug'
|
42
|
+
end
|
43
|
+
|
44
|
+
s.add_development_dependency pry_debugger
|
45
|
+
s.add_development_dependency 'pry-stack_explorer'
|
46
|
+
else
|
47
|
+
s.add_development_dependency 'pry'
|
48
|
+
end
|
49
|
+
|
50
|
+
s.add_development_dependency 'ruby-prof' if RUBY_ENGINE.to_sym == :ruby
|
35
51
|
end
|
data/spec/benchmark/tasks.rb
CHANGED
@@ -3,11 +3,13 @@ require 'protobuf/socket'
|
|
3
3
|
require 'support/all'
|
4
4
|
require 'support/test/resource_service'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
case RUBY_ENGINE.to_sym
|
7
|
+
when :ruby
|
8
|
+
require 'ruby-prof'
|
9
|
+
when :rbx
|
10
|
+
require 'rubinius/profiler'
|
11
|
+
when :jruby
|
12
|
+
require 'jruby/profiler'
|
11
13
|
end
|
12
14
|
|
13
15
|
# Including a way to turn on debug logger for spec runs
|
@@ -32,12 +34,14 @@ namespace :benchmark do
|
|
32
34
|
def sock_client_sock_server(number_tests, test_length, global_bench = nil)
|
33
35
|
load "protobuf/socket.rb"
|
34
36
|
|
35
|
-
|
36
|
-
|
37
|
+
port = 1000 + Kernel.rand(2**16 - 1000)
|
38
|
+
|
39
|
+
StubServer.new(:server => Protobuf::Rpc::Socket::Server, :port => port) do
|
40
|
+
client = ::Test::ResourceService.client(:port => port)
|
37
41
|
|
38
42
|
benchmark_wrapper(global_bench) do |bench|
|
39
43
|
bench.report("SS / SC") do
|
40
|
-
(
|
44
|
+
Integer(number_tests).times { client.find(:name => "Test Name" * Integer(test_length), :active => true) }
|
41
45
|
end
|
42
46
|
end
|
43
47
|
end
|
@@ -45,28 +49,31 @@ namespace :benchmark do
|
|
45
49
|
|
46
50
|
def zmq_client_zmq_server(number_tests, test_length, global_bench = nil)
|
47
51
|
load "protobuf/zmq.rb"
|
48
|
-
|
49
|
-
|
52
|
+
|
53
|
+
port = 1000 + Kernel.rand(2**16 - 1000)
|
54
|
+
|
55
|
+
StubServer.new(:port => port, :server => Protobuf::Rpc::Zmq::Server) do
|
56
|
+
client = ::Test::ResourceService.client(:port => port)
|
50
57
|
|
51
58
|
benchmark_wrapper(global_bench) do |bench|
|
52
59
|
bench.report("ZS / ZC") do
|
53
|
-
(
|
60
|
+
Integer(number_tests).times { client.find(:name => "Test Name" * Integer(test_length), :active => true) }
|
54
61
|
end
|
55
62
|
end
|
56
|
-
server.stop
|
57
63
|
end
|
58
64
|
end
|
59
65
|
|
60
66
|
desc "benchmark ZMQ client with ZMQ server"
|
61
|
-
task :zmq_client_zmq_server, [:number, :length] do |
|
67
|
+
task :zmq_client_zmq_server, [:number, :length] do |_task, args|
|
62
68
|
args.with_defaults(:number => 1000, :length => 100)
|
63
69
|
zmq_client_zmq_server(args[:number], args[:length])
|
64
70
|
end
|
65
71
|
|
66
72
|
desc "benchmark ZMQ client with ZMQ server and profile"
|
67
|
-
task :zmq_profile, [:number, :length, :profile_output] do |
|
73
|
+
task :zmq_profile, [:number, :length, :profile_output] do |_task, args|
|
68
74
|
args.with_defaults(:number => 1000, :length => 100, :profile_output => "/tmp/zmq_profiler_#{Time.now.to_i}")
|
69
|
-
|
75
|
+
|
76
|
+
profile_code(args[:profile_output]) do
|
70
77
|
zmq_client_zmq_server(args[:number], args[:length])
|
71
78
|
end
|
72
79
|
|
@@ -74,35 +81,54 @@ namespace :benchmark do
|
|
74
81
|
end
|
75
82
|
|
76
83
|
desc "benchmark Protobuf Message #new"
|
77
|
-
task :profile_protobuf_new, [:number, :profile_output] do |
|
84
|
+
task :profile_protobuf_new, [:number, :profile_output] do |_task, args|
|
78
85
|
args.with_defaults(:number => 1000, :profile_output => "/tmp/profiler_new_#{Time.now.to_i}")
|
79
86
|
create_params = { :name => "The name that we set", :date_created => Time.now.to_i, :status => 2 }
|
80
|
-
|
81
|
-
args[:number].
|
87
|
+
profile_code(args[:profile_output]) do
|
88
|
+
Integer(args[:number]).times { Test::Resource.new(create_params) }
|
82
89
|
end
|
83
90
|
|
84
91
|
puts args[:profile_output]
|
85
92
|
end
|
86
93
|
|
87
94
|
desc "benchmark Protobuf Message #serialize"
|
88
|
-
task :profile_protobuf_serialize, [:number, :profile_output] do |
|
95
|
+
task :profile_protobuf_serialize, [:number, :profile_output] do |_task, args|
|
89
96
|
args.with_defaults(:number => 1000, :profile_output => "/tmp/profiler_new_#{Time.now.to_i}")
|
90
97
|
create_params = { :name => "The name that we set", :date_created => Time.now.to_i, :status => 2 }
|
91
|
-
|
92
|
-
args[:number].
|
98
|
+
profile_code(args[:profile_output]) do
|
99
|
+
Integer(args[:number]).times { Test::Resource.new(create_params).serialize }
|
93
100
|
end
|
94
101
|
|
95
102
|
puts args[:profile_output]
|
96
103
|
end
|
97
104
|
|
105
|
+
def profile_code(output, &block)
|
106
|
+
case RUBY_ENGINE.to_sym
|
107
|
+
when :ruby
|
108
|
+
profile_data = RubyProf.profile(&block)
|
109
|
+
RubyProf::FlatPrinter.new(profile_data).print(:path => output)
|
110
|
+
when :rbx
|
111
|
+
profiler = Rubinius::Profiler::Instrumenter.new
|
112
|
+
profiler.profile(false, &block)
|
113
|
+
File.open(output, 'w') do |f|
|
114
|
+
profiler.show(f)
|
115
|
+
end
|
116
|
+
when :jruby
|
117
|
+
profile_data = JRuby::Profiler.profile(&block)
|
118
|
+
File.open(output, 'w') do |f|
|
119
|
+
JRuby::Profiler::FlatProfilePrinter.new(profile_data).printProfile(f)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
98
124
|
desc "benchmark Socket client with Socket server"
|
99
|
-
task :sock_client_sock_server, [:number, :length] do |
|
125
|
+
task :sock_client_sock_server, [:number, :length] do |_task, args|
|
100
126
|
args.with_defaults(:number => 1000, :length => 100)
|
101
127
|
sock_client_sock_server(args[:number], args[:length])
|
102
128
|
end
|
103
129
|
|
104
130
|
desc "benchmark server performance"
|
105
|
-
task :servers, [:number, :length] do |
|
131
|
+
task :servers, [:number, :length] do |_task, args|
|
106
132
|
args.with_defaults(:number => 1000, :length => 100)
|
107
133
|
|
108
134
|
Benchmark.bm(10) do |bench|
|
@@ -2,17 +2,22 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
require 'protobuf/code_generator'
|
4
4
|
|
5
|
-
describe 'protoc-gen-ruby' do
|
5
|
+
RSpec.describe 'protoc-gen-ruby' do
|
6
6
|
let(:binpath) { ::File.expand_path('../../../bin/protoc-gen-ruby', __FILE__) }
|
7
|
-
let(:
|
8
|
-
let(:
|
9
|
-
|
7
|
+
let(:package) { 'test' }
|
8
|
+
let(:request_bytes) do
|
9
|
+
::Google::Protobuf::Compiler::CodeGeneratorRequest.encode(
|
10
|
+
:proto_file => [{ :package => package }],
|
11
|
+
)
|
12
|
+
end
|
10
13
|
|
11
14
|
it 'reads the serialized request bytes and outputs serialized response bytes' do
|
12
15
|
::IO.popen(binpath, 'w+') do |pipe|
|
13
16
|
pipe.write(request_bytes)
|
14
|
-
|
17
|
+
pipe.close_write # needed so we can implicitly read until EOF
|
18
|
+
response_bytes = pipe.read
|
19
|
+
response = ::Google::Protobuf::Compiler::CodeGeneratorResponse.decode(response_bytes)
|
20
|
+
expect(response.file.first.content).to include("module #{package.titleize}")
|
15
21
|
end
|
16
22
|
end
|
17
23
|
end
|
18
|
-
|
@@ -1,84 +1,98 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe ::Protobuf do
|
3
|
+
RSpec.describe ::Protobuf do
|
4
4
|
it "correctly encodes all types" do
|
5
5
|
message = GoogleUnittest::TestAllTypes.new(
|
6
|
-
optional_int32
|
7
|
-
optional_int64
|
8
|
-
optional_uint32
|
9
|
-
optional_uint64
|
10
|
-
optional_sint32
|
11
|
-
optional_sint64
|
12
|
-
optional_fixed32
|
13
|
-
optional_fixed64
|
14
|
-
optional_sfixed32
|
15
|
-
optional_sfixed64
|
16
|
-
optional_float
|
17
|
-
optional_double
|
18
|
-
optional_bool
|
19
|
-
optional_string
|
20
|
-
optional_bytes
|
21
|
-
optional_nested_message
|
22
|
-
optional_foreign_message
|
23
|
-
optional_import_message
|
24
|
-
optional_nested_enum
|
25
|
-
optional_foreign_enum
|
26
|
-
optional_import_enum
|
27
|
-
optional_string_piece
|
28
|
-
optional_cord
|
29
|
-
optional_public_import_message
|
30
|
-
optional_lazy_message
|
31
|
-
repeated_int32
|
32
|
-
repeated_int64
|
33
|
-
repeated_uint32
|
34
|
-
repeated_uint64
|
35
|
-
repeated_sint32
|
36
|
-
repeated_sint64
|
37
|
-
repeated_fixed32
|
38
|
-
repeated_fixed64
|
39
|
-
repeated_sfixed32
|
40
|
-
repeated_sfixed64
|
41
|
-
repeated_float
|
42
|
-
repeated_double
|
43
|
-
repeated_bool
|
44
|
-
repeated_string
|
45
|
-
repeated_bytes
|
46
|
-
repeated_nested_message
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
6
|
+
:optional_int32 => 101,
|
7
|
+
:optional_int64 => 102,
|
8
|
+
:optional_uint32 => 103,
|
9
|
+
:optional_uint64 => 104,
|
10
|
+
:optional_sint32 => 105,
|
11
|
+
:optional_sint64 => 106,
|
12
|
+
:optional_fixed32 => 107,
|
13
|
+
:optional_fixed64 => 108,
|
14
|
+
:optional_sfixed32 => 109,
|
15
|
+
:optional_sfixed64 => 110,
|
16
|
+
:optional_float => 111,
|
17
|
+
:optional_double => 112,
|
18
|
+
:optional_bool => true,
|
19
|
+
:optional_string => "115",
|
20
|
+
:optional_bytes => "116",
|
21
|
+
:optional_nested_message => GoogleUnittest::TestAllTypes::NestedMessage.new(:bb => 118),
|
22
|
+
:optional_foreign_message => GoogleUnittest::ForeignMessage.new(:c => 119),
|
23
|
+
:optional_import_message => GoogleUnittestImport::ImportMessage.new(:d => 120),
|
24
|
+
:optional_nested_enum => GoogleUnittest::TestAllTypes::NestedEnum::BAZ,
|
25
|
+
:optional_foreign_enum => GoogleUnittest::ForeignEnum::FOREIGN_BAZ,
|
26
|
+
:optional_import_enum => GoogleUnittestImport::ImportEnum::IMPORT_BAZ,
|
27
|
+
:optional_string_piece => "124",
|
28
|
+
:optional_cord => "125",
|
29
|
+
:optional_public_import_message => GoogleUnittestImport::PublicImportMessage.new(:e => 126),
|
30
|
+
:optional_lazy_message => GoogleUnittest::TestAllTypes::NestedMessage.new(:bb => 127),
|
31
|
+
:repeated_int32 => [201, 301],
|
32
|
+
:repeated_int64 => [202, 302],
|
33
|
+
:repeated_uint32 => [203, 303],
|
34
|
+
:repeated_uint64 => [204, 304],
|
35
|
+
:repeated_sint32 => [205, 305],
|
36
|
+
:repeated_sint64 => [206, 306],
|
37
|
+
:repeated_fixed32 => [207, 307],
|
38
|
+
:repeated_fixed64 => [208, 308],
|
39
|
+
:repeated_sfixed32 => [209, 309],
|
40
|
+
:repeated_sfixed64 => [210, 310],
|
41
|
+
:repeated_float => [211, 311],
|
42
|
+
:repeated_double => [212, 312],
|
43
|
+
:repeated_bool => [true, false],
|
44
|
+
:repeated_string => ["215", "315"],
|
45
|
+
:repeated_bytes => ["216", "316"],
|
46
|
+
:repeated_nested_message => [
|
47
|
+
::GoogleUnittest::TestAllTypes::NestedMessage.new(:bb => 218),
|
48
|
+
::GoogleUnittest::TestAllTypes::NestedMessage.new(:bb => 318),
|
49
|
+
],
|
50
|
+
:repeated_foreign_message => [
|
51
|
+
::GoogleUnittest::ForeignMessage.new(:c => 219),
|
52
|
+
::GoogleUnittest::ForeignMessage.new(:c => 319),
|
53
|
+
],
|
54
|
+
:repeated_import_message => [
|
55
|
+
::GoogleUnittestImport::ImportMessage.new(:d => 220),
|
56
|
+
::GoogleUnittestImport::ImportMessage.new(:d => 320),
|
57
|
+
],
|
58
|
+
:repeated_nested_enum => [
|
59
|
+
::GoogleUnittest::TestAllTypes::NestedEnum::BAR,
|
60
|
+
::GoogleUnittest::TestAllTypes::NestedEnum::BAZ,
|
61
|
+
],
|
62
|
+
:repeated_foreign_enum => [
|
63
|
+
::GoogleUnittest::ForeignEnum::FOREIGN_BAR,
|
64
|
+
::GoogleUnittest::ForeignEnum::FOREIGN_BAZ,
|
65
|
+
],
|
66
|
+
:repeated_import_enum => [
|
67
|
+
::GoogleUnittestImport::ImportEnum::IMPORT_BAR,
|
68
|
+
::GoogleUnittestImport::ImportEnum::IMPORT_BAZ,
|
69
|
+
],
|
70
|
+
:repeated_string_piece => ["224", "324"],
|
71
|
+
:repeated_cord => ["225", "325"],
|
72
|
+
:repeated_lazy_message => [
|
73
|
+
::GoogleUnittest::TestAllTypes::NestedMessage.new(:bb => 227),
|
74
|
+
::GoogleUnittest::TestAllTypes::NestedMessage.new(:bb => 327),
|
75
|
+
],
|
76
|
+
:default_int32 => 401,
|
77
|
+
:default_int64 => 402,
|
78
|
+
:default_uint32 => 403,
|
79
|
+
:default_uint64 => 404,
|
80
|
+
:default_sint32 => 405,
|
81
|
+
:default_sint64 => 406,
|
82
|
+
:default_fixed32 => 407,
|
83
|
+
:default_fixed64 => 408,
|
84
|
+
:default_sfixed32 => 409,
|
85
|
+
:default_sfixed64 => 410,
|
86
|
+
:default_float => 411,
|
87
|
+
:default_double => 412,
|
88
|
+
:default_bool => false,
|
89
|
+
:default_string => "415",
|
90
|
+
:default_bytes => "416",
|
91
|
+
:default_nested_enum => ::GoogleUnittest::TestAllTypes::NestedEnum::FOO,
|
92
|
+
:default_foreign_enum => ::GoogleUnittest::ForeignEnum::FOREIGN_FOO,
|
93
|
+
:default_import_enum => ::GoogleUnittestImport::ImportEnum::IMPORT_FOO,
|
94
|
+
:default_string_piece => "424",
|
95
|
+
:default_cord => "425",
|
82
96
|
)
|
83
97
|
|
84
98
|
data_file_path = File.expand_path('../../support/test/all_types.data.bin', __FILE__)
|