protobuf 3.3.6 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +48 -0
  3. data/.rubocop_todo.yml +79 -0
  4. data/.travis.yml +12 -4
  5. data/Rakefile +14 -11
  6. data/bin/protoc-gen-ruby +0 -1
  7. data/bin/rpc_server +1 -0
  8. data/install-protobuf.sh +8 -0
  9. data/lib/protobuf.rb +30 -24
  10. data/lib/protobuf/cli.rb +35 -35
  11. data/lib/protobuf/code_generator.rb +11 -8
  12. data/lib/protobuf/decoder.rb +4 -5
  13. data/lib/protobuf/deprecation.rb +20 -0
  14. data/lib/protobuf/descriptors/google/protobuf/compiler/plugin.pb.rb +2 -0
  15. data/lib/protobuf/descriptors/google/protobuf/descriptor.pb.rb +2 -0
  16. data/lib/protobuf/encoder.rb +9 -4
  17. data/lib/protobuf/enum.rb +38 -54
  18. data/lib/protobuf/field.rb +2 -2
  19. data/lib/protobuf/field/base_field.rb +28 -32
  20. data/lib/protobuf/field/bool_field.rb +4 -4
  21. data/lib/protobuf/field/bytes_field.rb +5 -4
  22. data/lib/protobuf/field/double_field.rb +0 -1
  23. data/lib/protobuf/field/enum_field.rb +4 -7
  24. data/lib/protobuf/field/field_array.rb +3 -4
  25. data/lib/protobuf/field/fixed32_field.rb +1 -1
  26. data/lib/protobuf/field/fixed64_field.rb +0 -1
  27. data/lib/protobuf/field/float_field.rb +0 -1
  28. data/lib/protobuf/field/int32_field.rb +0 -1
  29. data/lib/protobuf/field/int64_field.rb +0 -1
  30. data/lib/protobuf/field/integer_field.rb +0 -1
  31. data/lib/protobuf/field/message_field.rb +2 -3
  32. data/lib/protobuf/field/sfixed32_field.rb +0 -1
  33. data/lib/protobuf/field/sfixed64_field.rb +0 -1
  34. data/lib/protobuf/field/signed_integer_field.rb +0 -1
  35. data/lib/protobuf/field/sint32_field.rb +0 -1
  36. data/lib/protobuf/field/sint64_field.rb +0 -1
  37. data/lib/protobuf/field/string_field.rb +0 -1
  38. data/lib/protobuf/field/uint32_field.rb +0 -1
  39. data/lib/protobuf/field/uint64_field.rb +0 -1
  40. data/lib/protobuf/field/varint_field.rb +0 -1
  41. data/lib/protobuf/generators/base.rb +1 -2
  42. data/lib/protobuf/generators/enum_generator.rb +1 -2
  43. data/lib/protobuf/generators/extension_generator.rb +1 -2
  44. data/lib/protobuf/generators/field_generator.rb +4 -5
  45. data/lib/protobuf/generators/file_generator.rb +22 -27
  46. data/lib/protobuf/generators/group_generator.rb +15 -16
  47. data/lib/protobuf/generators/message_generator.rb +13 -14
  48. data/lib/protobuf/generators/printable.rb +9 -10
  49. data/lib/protobuf/generators/service_generator.rb +1 -2
  50. data/lib/protobuf/lifecycle.rb +20 -33
  51. data/lib/protobuf/logging.rb +4 -6
  52. data/lib/protobuf/message.rb +22 -16
  53. data/lib/protobuf/message/fields.rb +14 -17
  54. data/lib/protobuf/message/serialization.rb +6 -5
  55. data/lib/protobuf/rpc/buffer.rb +10 -12
  56. data/lib/protobuf/rpc/client.rb +12 -12
  57. data/lib/protobuf/rpc/connectors/base.rb +4 -3
  58. data/lib/protobuf/rpc/connectors/common.rb +15 -17
  59. data/lib/protobuf/rpc/connectors/socket.rb +2 -2
  60. data/lib/protobuf/rpc/connectors/zmq.rb +118 -108
  61. data/lib/protobuf/rpc/dynamic_discovery.pb.rb +2 -0
  62. data/lib/protobuf/rpc/env.rb +12 -12
  63. data/lib/protobuf/rpc/error.rb +1 -1
  64. data/lib/protobuf/rpc/error/client_error.rb +4 -4
  65. data/lib/protobuf/rpc/error/server_error.rb +6 -6
  66. data/lib/protobuf/rpc/middleware/exception_handler.rb +1 -1
  67. data/lib/protobuf/rpc/middleware/logger.rb +3 -3
  68. data/lib/protobuf/rpc/middleware/request_decoder.rb +5 -5
  69. data/lib/protobuf/rpc/middleware/response_encoder.rb +3 -3
  70. data/lib/protobuf/rpc/rpc.pb.rb +2 -0
  71. data/lib/protobuf/rpc/servers/socket/server.rb +75 -65
  72. data/lib/protobuf/rpc/servers/socket/worker.rb +2 -2
  73. data/lib/protobuf/rpc/servers/socket_runner.rb +12 -6
  74. data/lib/protobuf/rpc/servers/zmq/broker.rb +10 -6
  75. data/lib/protobuf/rpc/servers/zmq/server.rb +20 -26
  76. data/lib/protobuf/rpc/servers/zmq/util.rb +7 -7
  77. data/lib/protobuf/rpc/servers/zmq/worker.rb +5 -7
  78. data/lib/protobuf/rpc/servers/zmq_runner.rb +14 -3
  79. data/lib/protobuf/rpc/service.rb +15 -15
  80. data/lib/protobuf/rpc/service_directory.rb +7 -11
  81. data/lib/protobuf/rpc/service_dispatcher.rb +3 -3
  82. data/lib/protobuf/rpc/service_filters.rb +27 -28
  83. data/lib/protobuf/rpc/stat.rb +4 -7
  84. data/lib/protobuf/socket.rb +0 -1
  85. data/lib/protobuf/tasks/compile.rake +2 -2
  86. data/lib/protobuf/version.rb +1 -1
  87. data/protobuf.gemspec +20 -4
  88. data/spec/benchmark/tasks.rb +49 -23
  89. data/spec/bin/protoc-gen-ruby_spec.rb +11 -6
  90. data/spec/encoding/all_types_spec.rb +91 -77
  91. data/spec/encoding/extreme_values_spec.rb +0 -0
  92. data/spec/functional/socket_server_spec.rb +9 -10
  93. data/spec/functional/zmq_server_spec.rb +21 -19
  94. data/spec/lib/protobuf/cli_spec.rb +20 -20
  95. data/spec/lib/protobuf/code_generator_spec.rb +6 -6
  96. data/spec/lib/protobuf/enum_spec.rb +57 -31
  97. data/spec/lib/protobuf/field/float_field_spec.rb +2 -2
  98. data/spec/lib/protobuf/field/int32_field_spec.rb +1 -1
  99. data/spec/lib/protobuf/field/string_field_spec.rb +7 -8
  100. data/spec/lib/protobuf/field_spec.rb +3 -6
  101. data/spec/lib/protobuf/generators/base_spec.rb +6 -6
  102. data/spec/lib/protobuf/generators/enum_generator_spec.rb +22 -17
  103. data/spec/lib/protobuf/generators/extension_generator_spec.rb +8 -9
  104. data/spec/lib/protobuf/generators/field_generator_spec.rb +14 -11
  105. data/spec/lib/protobuf/generators/file_generator_spec.rb +7 -4
  106. data/spec/lib/protobuf/generators/service_generator_spec.rb +14 -11
  107. data/spec/lib/protobuf/lifecycle_spec.rb +9 -4
  108. data/spec/lib/protobuf/message_spec.rb +63 -35
  109. data/spec/lib/protobuf/optionable_spec.rb +3 -3
  110. data/spec/lib/protobuf/rpc/client_spec.rb +2 -2
  111. data/spec/lib/protobuf/rpc/connector_spec.rb +1 -1
  112. data/spec/lib/protobuf/rpc/connectors/base_spec.rb +6 -6
  113. data/spec/lib/protobuf/rpc/connectors/common_spec.rb +26 -18
  114. data/spec/lib/protobuf/rpc/connectors/socket_spec.rb +4 -4
  115. data/spec/lib/protobuf/rpc/connectors/zmq_spec.rb +11 -9
  116. data/spec/lib/protobuf/rpc/middleware/exception_handler_spec.rb +2 -2
  117. data/spec/lib/protobuf/rpc/middleware/logger_spec.rb +7 -7
  118. data/spec/lib/protobuf/rpc/middleware/request_decoder_spec.rb +14 -14
  119. data/spec/lib/protobuf/rpc/middleware/response_encoder_spec.rb +5 -5
  120. data/spec/lib/protobuf/rpc/servers/socket_server_spec.rb +1 -1
  121. data/spec/lib/protobuf/rpc/servers/zmq/server_spec.rb +9 -7
  122. data/spec/lib/protobuf/rpc/servers/zmq/util_spec.rb +9 -9
  123. data/spec/lib/protobuf/rpc/servers/zmq/worker_spec.rb +2 -2
  124. data/spec/lib/protobuf/rpc/service_directory_spec.rb +24 -23
  125. data/spec/lib/protobuf/rpc/service_dispatcher_spec.rb +4 -4
  126. data/spec/lib/protobuf/rpc/service_filters_spec.rb +84 -51
  127. data/spec/lib/protobuf/rpc/service_spec.rb +15 -14
  128. data/spec/lib/protobuf/rpc/stat_spec.rb +1 -1
  129. data/spec/lib/protobuf_spec.rb +9 -9
  130. data/spec/spec_helper.rb +7 -19
  131. data/spec/support/server.rb +29 -59
  132. data/spec/support/test/defaults.pb.rb +2 -0
  133. data/spec/support/test/enum.pb.rb +2 -0
  134. data/spec/support/test/extended.pb.rb +2 -0
  135. data/spec/support/test/google_unittest_import.pb.rb +2 -0
  136. data/spec/support/test/google_unittest_import_public.pb.rb +2 -0
  137. data/spec/support/test/multi_field_extensions.pb.rb +2 -0
  138. data/spec/support/test/resource.pb.rb +2 -0
  139. data/spec/support/test/resource_service.rb +17 -20
  140. metadata +153 -112
  141. data/lib/protobuf/deprecator.rb +0 -42
@@ -17,9 +17,7 @@ module Protobuf
17
17
  start
18
18
  end
19
19
 
20
- def client=(client_host)
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
- ! end_time.nil?
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
-
@@ -19,4 +19,3 @@ require 'protobuf'
19
19
 
20
20
  require 'protobuf/rpc/servers/socket/server'
21
21
  require 'protobuf/rpc/connectors/socket'
22
-
@@ -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, [ :package, :source, :destination, :plugin, :file_extension ] do |tasks, args|
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, [ :package, :destination, :file_extension ] do |task, args|
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
 
@@ -1,3 +1,3 @@
1
1
  module Protobuf
2
- VERSION = '3.3.6'
2
+ VERSION = '3.4.0'
3
3
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
- $:.push ::File.expand_path("../lib", __FILE__)
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 'perftools.rb'
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
@@ -3,11 +3,13 @@ require 'protobuf/socket'
3
3
  require 'support/all'
4
4
  require 'support/test/resource_service'
5
5
 
6
- begin
7
- require 'perftools'
8
- rescue LoadError
9
- $stderr.puts 'perftools must be uncommented in the gemspec before you can run this benchmark task'
10
- exit(1)
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
- StubServer.new(:server => Protobuf::Rpc::Socket::Server, :port => 9399) do |server|
36
- client = ::Test::ResourceService.client(:port => 9399)
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
- (1..number_tests.to_i).each { client.find(:name => "Test Name" * test_length.to_i, :active => true) }
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
- StubServer.new(:port => 9399, :server => Protobuf::Rpc::Zmq::Server) do |server|
49
- client = ::Test::ResourceService.client(:port => 9399)
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
- (1..number_tests.to_i).each { client.find(:name => "Test Name" * test_length.to_i, :active => true) }
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 |t, args|
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 |t, args|
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
- ::PerfTools::CpuProfiler.start(args[:profile_output]) do
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 |t, args|
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
- ::PerfTools::CpuProfiler.start(args[:profile_output]) do
81
- args[:number].to_i.times { Test::Resource.new(create_params) }
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 |t, args|
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
- ::PerfTools::CpuProfiler.start(args[:profile_output]) do
92
- args[:number].to_i.times { Test::Resource.new(create_params).serialize }
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 |t, args|
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 |t, args|
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(:request_bytes) { ::Google::Protobuf::Compiler::CodeGeneratorRequest.new(:file_to_generate => [ "test/foo.proto" ]) }
8
- let(:expected_file) { ::Google::Protobuf::Compiler::CodeGeneratorResponse::File.new(:name => 'test/foo.pb.rb') }
9
- let(:expected_response_bytes) { ::Google::Protobuf::Compiler::CodeGeneratorRequest.encode(:files => [ expected_file ]) }
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
- expect(pipe.read(expected_response_bytes.size)).to eq expected_response_bytes
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: 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: [::GoogleUnittest::TestAllTypes::NestedMessage.new(bb: 218),
47
- ::GoogleUnittest::TestAllTypes::NestedMessage.new(bb: 318)],
48
- repeated_foreign_message: [::GoogleUnittest::ForeignMessage.new(c: 219),
49
- ::GoogleUnittest::ForeignMessage.new(c: 319)],
50
- repeated_import_message: [::GoogleUnittestImport::ImportMessage.new(d: 220),
51
- ::GoogleUnittestImport::ImportMessage.new(d: 320)],
52
- repeated_nested_enum: [::GoogleUnittest::TestAllTypes::NestedEnum::BAR,
53
- ::GoogleUnittest::TestAllTypes::NestedEnum::BAZ],
54
- repeated_foreign_enum: [::GoogleUnittest::ForeignEnum::FOREIGN_BAR,
55
- ::GoogleUnittest::ForeignEnum::FOREIGN_BAZ],
56
- repeated_import_enum: [::GoogleUnittestImport::ImportEnum::IMPORT_BAR,
57
- ::GoogleUnittestImport::ImportEnum::IMPORT_BAZ],
58
- repeated_string_piece: ["224", "324"],
59
- repeated_cord: ["225", "325"],
60
- repeated_lazy_message: [::GoogleUnittest::TestAllTypes::NestedMessage.new(bb:227),
61
- ::GoogleUnittest::TestAllTypes::NestedMessage.new(bb:327)],
62
- default_int32: 401,
63
- default_int64: 402,
64
- default_uint32: 403,
65
- default_uint64: 404,
66
- default_sint32: 405,
67
- default_sint64: 406,
68
- default_fixed32: 407,
69
- default_fixed64: 408,
70
- default_sfixed32: 409,
71
- default_sfixed64: 410,
72
- default_float: 411,
73
- default_double: 412,
74
- default_bool: false,
75
- default_string: "415",
76
- default_bytes: "416",
77
- default_nested_enum: ::GoogleUnittest::TestAllTypes::NestedEnum::FOO,
78
- default_foreign_enum: ::GoogleUnittest::ForeignEnum::FOREIGN_FOO,
79
- default_import_enum: ::GoogleUnittestImport::ImportEnum::IMPORT_FOO,
80
- default_string_piece: "424",
81
- default_cord: "425",
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__)