google-protobuf 3.21.9 → 3.25.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/google/protobuf_c/Rakefile +3 -0
- data/ext/google/protobuf_c/convert.c +23 -70
- data/ext/google/protobuf_c/convert.h +3 -28
- data/ext/google/protobuf_c/defs.c +178 -55
- data/ext/google/protobuf_c/defs.h +3 -28
- data/ext/google/protobuf_c/extconf.rb +4 -4
- data/ext/google/protobuf_c/glue.c +56 -0
- data/ext/google/protobuf_c/map.c +54 -70
- data/ext/google/protobuf_c/map.h +6 -28
- data/ext/google/protobuf_c/message.c +178 -161
- data/ext/google/protobuf_c/message.h +10 -28
- data/ext/google/protobuf_c/protobuf.c +39 -176
- data/ext/google/protobuf_c/protobuf.h +24 -32
- data/ext/google/protobuf_c/repeated_field.c +28 -29
- data/ext/google/protobuf_c/repeated_field.h +6 -28
- data/ext/google/protobuf_c/ruby-upb.c +12326 -9027
- data/ext/google/protobuf_c/ruby-upb.h +11950 -4518
- data/ext/google/protobuf_c/shared_convert.c +64 -0
- data/ext/google/protobuf_c/shared_convert.h +26 -0
- data/ext/google/protobuf_c/shared_message.c +65 -0
- data/ext/google/protobuf_c/shared_message.h +25 -0
- data/ext/google/protobuf_c/third_party/utf8_range/LICENSE +1 -0
- data/ext/google/protobuf_c/third_party/utf8_range/naive.c +0 -0
- data/ext/google/protobuf_c/third_party/utf8_range/range2-neon.c +1 -1
- data/ext/google/protobuf_c/third_party/utf8_range/range2-sse.c +0 -0
- data/ext/google/protobuf_c/third_party/utf8_range/utf8_range.h +13 -1
- data/ext/google/protobuf_c/wrap_memcpy.c +3 -26
- data/lib/google/protobuf/any_pb.rb +24 -5
- data/lib/google/protobuf/api_pb.rb +26 -23
- data/lib/google/protobuf/descriptor_dsl.rb +0 -0
- data/lib/google/protobuf/descriptor_pb.rb +43 -226
- data/lib/google/protobuf/duration_pb.rb +24 -5
- data/lib/google/protobuf/empty_pb.rb +24 -3
- data/lib/google/protobuf/ffi/descriptor.rb +165 -0
- data/lib/google/protobuf/ffi/descriptor_pool.rb +75 -0
- data/lib/google/protobuf/ffi/enum_descriptor.rb +171 -0
- data/lib/google/protobuf/ffi/ffi.rb +213 -0
- data/lib/google/protobuf/ffi/field_descriptor.rb +319 -0
- data/lib/google/protobuf/ffi/file_descriptor.rb +59 -0
- data/lib/google/protobuf/ffi/internal/arena.rb +66 -0
- data/lib/google/protobuf/ffi/internal/convert.rb +305 -0
- data/lib/google/protobuf/ffi/internal/pointer_helper.rb +35 -0
- data/lib/google/protobuf/ffi/internal/type_safety.rb +25 -0
- data/lib/google/protobuf/ffi/map.rb +407 -0
- data/lib/google/protobuf/ffi/message.rb +662 -0
- data/lib/google/protobuf/ffi/object_cache.rb +30 -0
- data/lib/google/protobuf/ffi/oneof_descriptor.rb +95 -0
- data/lib/google/protobuf/ffi/repeated_field.rb +383 -0
- data/lib/google/protobuf/field_mask_pb.rb +24 -4
- data/lib/google/protobuf/message_exts.rb +8 -26
- data/lib/google/protobuf/object_cache.rb +97 -0
- data/lib/google/protobuf/plugin_pb.rb +47 -0
- data/lib/google/protobuf/repeated_field.rb +3 -26
- data/lib/google/protobuf/source_context_pb.rb +24 -4
- data/lib/google/protobuf/struct_pb.rb +24 -20
- data/lib/google/protobuf/timestamp_pb.rb +24 -5
- data/lib/google/protobuf/type_pb.rb +26 -68
- data/lib/google/protobuf/well_known_types.rb +5 -34
- data/lib/google/protobuf/wrappers_pb.rb +24 -28
- data/lib/google/protobuf.rb +27 -45
- data/lib/google/protobuf_ffi.rb +50 -0
- data/lib/google/protobuf_native.rb +20 -0
- data/lib/google/tasks/ffi.rake +102 -0
- metadata +75 -12
- data/tests/basic.rb +0 -739
- data/tests/generated_code_test.rb +0 -23
- data/tests/stress.rb +0 -38
@@ -1,23 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
|
3
|
-
# generated_code.rb is in the same directory as this test.
|
4
|
-
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
|
5
|
-
|
6
|
-
require 'generated_code_pb'
|
7
|
-
require 'test_import_pb'
|
8
|
-
require 'test_ruby_package_pb'
|
9
|
-
require 'test/unit'
|
10
|
-
|
11
|
-
class GeneratedCodeTest < Test::Unit::TestCase
|
12
|
-
def test_generated_msg
|
13
|
-
# just test that we can instantiate the message. The purpose of this test
|
14
|
-
# is to ensure that the output of the code generator is valid Ruby and
|
15
|
-
# successfully creates message definitions and classes, not to test every
|
16
|
-
# aspect of the extension (basic.rb is for that).
|
17
|
-
A::B::C::TestMessage.new
|
18
|
-
A::B::C::TestMessage::NestedMessage.new
|
19
|
-
A::B::C::TestLowercaseNested::Lowercase.new
|
20
|
-
FooBar::TestImportedMessage.new
|
21
|
-
A::B::TestRubyPackageMessage.new
|
22
|
-
end
|
23
|
-
end
|
data/tests/stress.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
|
3
|
-
require 'google/protobuf'
|
4
|
-
require 'test/unit'
|
5
|
-
|
6
|
-
module StressTest
|
7
|
-
pool = Google::Protobuf::DescriptorPool.new
|
8
|
-
pool.build do
|
9
|
-
add_message "TestMessage" do
|
10
|
-
optional :a, :int32, 1
|
11
|
-
repeated :b, :message, 2, "M"
|
12
|
-
end
|
13
|
-
add_message "M" do
|
14
|
-
optional :foo, :string, 1
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
TestMessage = pool.lookup("TestMessage").msgclass
|
19
|
-
M = pool.lookup("M").msgclass
|
20
|
-
|
21
|
-
class StressTest < Test::Unit::TestCase
|
22
|
-
def get_msg
|
23
|
-
TestMessage.new(:a => 1000,
|
24
|
-
:b => [M.new(:foo => "hello"),
|
25
|
-
M.new(:foo => "world")])
|
26
|
-
end
|
27
|
-
def test_stress
|
28
|
-
m = get_msg
|
29
|
-
data = TestMessage.encode(m)
|
30
|
-
100_000.times do
|
31
|
-
mnew = TestMessage.decode(data)
|
32
|
-
mnew = mnew.dup
|
33
|
-
assert_equal m.inspect, mnew.inspect
|
34
|
-
assert TestMessage.encode(mnew) == data
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|