kpumuk commented on code in PR #3387:
URL: https://github.com/apache/thrift/pull/3387#discussion_r3082501959
##########
lib/rb/spec/compact_protocol_spec.rb:
##########
@@ -71,6 +81,46 @@
end
end
+ it "should round-trip signed integer boundaries correctly" do
+ INTEGER_BOUNDARY_TESTS.each_pair do |primitive_type, test_values|
+ test_values.each do |value|
+ trans = Thrift::MemoryBufferTransport.new
+ proto = Thrift::CompactProtocol.new(trans)
+
+ proto.send(writer(primitive_type), value)
+ expect(proto.send(reader(primitive_type))).to eq(value)
+ end
+ end
+ end
+
+ it "should encode signed integer minima with the canonical zigzag varint
bytes" do
+ INTEGER_MINIMUM_ENCODINGS.each_pair do |primitive_type, expected_bytes|
+ trans = Thrift::MemoryBufferTransport.new
+ proto = Thrift::CompactProtocol.new(trans)
+
+ proto.send(writer(primitive_type),
INTEGER_BOUNDARY_TESTS.fetch(primitive_type).first)
+ expect(trans.read(trans.available).bytes).to eq(expected_bytes)
+ end
+ end
+
+ it "should decode i32 minima from direct canonical zigzag bytes" do
+ trans = Thrift::MemoryBufferTransport.new
Review Comment:
Added
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]