bson 4.2.0 → 4.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb696b32143262aff3587deb025217f4e35278f0
4
- data.tar.gz: 98b45e1fad06f918e2f12ca974714e96ad07ddc5
3
+ metadata.gz: b0ac7ae0ca768ef98d4623098afcfd7a6274ae1c
4
+ data.tar.gz: 8ee3b34cb7a96012a8d849e0804699338f426264
5
5
  SHA512:
6
- metadata.gz: 583135decf330bf180f8600fb8ff976f4bc548778fc176ff4cfe62f07c434f18cc80fd2887308495ecef9eee626922cb26ae34e3b4603e846f131f3a03cbffb3
7
- data.tar.gz: b0446ddea4855a3c0e7b0ec5afc7b5a5b9e0b2aa897539bb4e29bc75be733bf16e12283c6c4bfb840377c1773ab3dbe2ae115a4ce6e706a8f8dfc7019e1e6b42
6
+ metadata.gz: ae110fdef5bf56e3c4afebd46e383b9e69496fc9b10bc4ea7f414020f101d054173c42101d80f2f4be111e234ffc73ec86d29f27bbffe80b314e51c5a4707fc4
7
+ data.tar.gz: 252f9e291534603084f3087b286a41deeb5c3562121e2bb1886acd5cf2f1ff43458985cf4c27d2dd874ae43d00262a24b23d9ba3925dbbf6b7ea43dbdb927c89
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -35,13 +35,14 @@
35
35
  # endif
36
36
  #endif
37
37
 
38
- #ifndef BSON_BYTE_ORDER
39
- # if BYTE_ORDER == LITTLE_ENDIAN
40
- # define BSON_BYTE_ORDER 1234
41
- # elif BYTE_ORDER == BIG_ENDIAN
42
- # define BSON_BYTE_ORDER 4321
43
- # endif
44
- #endif
38
+ /* See a similar check in ruby's sha2.h */
39
+ # ifndef BSON_BYTE_ORDER
40
+ # ifdef WORDS_BIGENDIAN
41
+ # define BSON_BYTE_ORDER BSON_BIG_ENDIAN
42
+ # else
43
+ # define BSON_BYTE_ORDER BSON_LITTLE_ENDIAN
44
+ # endif
45
+ # endif /* BSON_BYTE_ORDER */
45
46
 
46
47
  #if defined(__sun)
47
48
  # define BSON_UINT16_SWAP_LE_BE(v) __bson_uint16_swap_slow((uint16_t)v)
@@ -59,7 +60,7 @@
59
60
  # define BSON_UINT64_SWAP_LE_BE(v) __builtin_bswap64(v)
60
61
  # endif
61
62
  #elif defined(__GNUC__) && (__GNUC__ >= 4)
62
- # if __GNUC__ >= 4 && defined (__GNUC_MINOR__) && __GNUC_MINOR__ >= 3
63
+ # if __GNUC__ > 4 || (defined (__GNUC_MINOR__) && __GNUC_MINOR__ >= 3)
63
64
  # define BSON_UINT32_SWAP_LE_BE(v) __builtin_bswap32 ((uint32_t)v)
64
65
  # define BSON_UINT64_SWAP_LE_BE(v) __builtin_bswap64 ((uint64_t)v)
65
66
  # endif
@@ -200,7 +200,7 @@ module BSON
200
200
  #
201
201
  # @since 4.2.0
202
202
  def from_bson(buffer)
203
- from_bits(*buffer.get_decimal128_bytes.unpack('Q*'))
203
+ from_bits(*buffer.get_decimal128_bytes.unpack('Q<*'))
204
204
  end
205
205
 
206
206
  # Instantiate a Decimal128 from a string.
@@ -153,7 +153,7 @@ module BSON
153
153
  # as Integer will be removed in version 5.0.0.
154
154
  #
155
155
  # @since 3.0.0
156
- def initialize(pattern, options)
156
+ def initialize(pattern, options = '')
157
157
  @pattern = pattern
158
158
  @options = options
159
159
  end
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module BSON
16
- VERSION = "4.2.0".freeze
16
+ VERSION = "4.2.1".freeze
17
17
  end
@@ -49,6 +49,10 @@ describe BSON::Decimal128 do
49
49
  described_class.from_bson(buffer)
50
50
  end
51
51
 
52
+ let(:expected_bson) do
53
+ [expected_low_bits].pack(BSON::Int64::PACK) + [expected_high_bits].pack(BSON::Int64::PACK)
54
+ end
55
+
52
56
  it 'sets the correct high order bits' do
53
57
  expect(high_bits).to eq(expected_high_bits)
54
58
  end
@@ -58,7 +62,7 @@ describe BSON::Decimal128 do
58
62
  end
59
63
 
60
64
  it 'serializes to bson' do
61
- expect(buffer.length).to eq(16)
65
+ expect(buffer.to_s).to eq(expected_bson)
62
66
  end
63
67
 
64
68
  it 'deserializes to the correct bits' do
@@ -60,6 +60,53 @@ describe BSON::Int64 do
60
60
 
61
61
  it_behaves_like "a bson element"
62
62
  it_behaves_like "a deserializable bson element"
63
+
64
+
65
+ context "when the integer is within the MRI Fixnum range" do
66
+
67
+ let(:integer) { BSON::Integer::MAX_32BIT + 1 }
68
+
69
+ let(:bson) do
70
+ BSON::ByteBuffer.new(integer.to_bson.to_s)
71
+ end
72
+
73
+ context "when on JRuby", if: BSON::Environment.jruby? do
74
+
75
+ it "deserializes to a Fixnum object" do
76
+ expect(described_class.from_bson(bson).class).to be(Fixnum)
77
+ end
78
+ end
79
+
80
+ context "when using MRI", unless: BSON::Environment.jruby? do
81
+
82
+ it "deserializes to a Fixnum object" do
83
+ expect(described_class.from_bson(bson).class).to be(Fixnum)
84
+ end
85
+ end
86
+ end
87
+
88
+ context "when the 64-bit integer is the BSON max and thus larger than the MRI Fixnum range" do
89
+
90
+ let(:integer) { Integer::MAX_64BIT }
91
+
92
+ let(:bson) do
93
+ BSON::ByteBuffer.new(integer.to_bson.to_s)
94
+ end
95
+
96
+ context "when on JRuby", if: BSON::Environment.jruby? do
97
+
98
+ it "deserializes to a Fixnum object" do
99
+ expect(described_class.from_bson(bson).class).to be(Fixnum)
100
+ end
101
+ end
102
+
103
+ context "when using MRI", unless: BSON::Environment.jruby? do
104
+
105
+ it "deserializes to a Bignum object" do
106
+ expect(described_class.from_bson(bson).class).to be(Bignum)
107
+ end
108
+ end
109
+ end
63
110
  end
64
111
 
65
112
  describe "#to_bson" do
@@ -99,6 +99,28 @@ describe Regexp::Raw do
99
99
  end
100
100
  end
101
101
  end
102
+
103
+ context 'when options are not passed' do
104
+
105
+ let(:object) do
106
+ described_class.new(pattern)
107
+ end
108
+
109
+ it "sets no options on the raw regex" do
110
+ expect(object.options). to eq('')
111
+ end
112
+
113
+ context "When the raw regexp is compiled" do
114
+
115
+ let(:regexp) do
116
+ object.compile
117
+ end
118
+
119
+ it "sets the options on the compiled regexp object" do
120
+ expect(regexp.options).to eq(0)
121
+ end
122
+ end
123
+ end
102
124
  end
103
125
 
104
126
  describe "#from_bson" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bson
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Brock
@@ -34,7 +34,7 @@ cert_chain:
34
34
  yVPbgNJA2D/PnLe8ZFMhgJf+VIA1V4oybP/o+9aqlghTtNfYHJpRCAluUiaywwXl
35
35
  KzD4mmIBpxtbWrWB3hx7tsVJmWx5zgO9aDAfvWnXfoo=
36
36
  -----END CERTIFICATE-----
37
- date: 2016-11-29 00:00:00.000000000 Z
37
+ date: 2016-12-19 00:00:00.000000000 Z
38
38
  dependencies: []
39
39
  description: A full featured BSON specification implementation, in Ruby
40
40
  email:
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  version: 1.3.6
178
178
  requirements: []
179
179
  rubyforge_project: bson
180
- rubygems_version: 2.4.5.1
180
+ rubygems_version: 2.6.8
181
181
  signing_key:
182
182
  specification_version: 4
183
183
  summary: Ruby Implementation of the BSON specification
metadata.gz.sig CHANGED
@@ -1,2 +1 @@
1
- B�]a���������v��x����@��L��(��`u �_aȌ�C����JI{v38�*B���y��%Gڨ����td"70mHw"�� 9U����1��t���nb�S\�<J��|lވ���7���Pg)q� ����#^)J{��m��^^�g��.V�� �nb:���%����R�=U-�����3y����L?Bj"V���-J36�.��=���.%��J�}�
2
- ��G�S��\��頻PQ��{��Q�Rc�
1
+ �jS#��u�SGM�1���;�Ho�d�0*eP�Y��<5��Jg��I[u��B ������|�x�����7tLV�/�̖��}F2&:�O��+��ެDCr:����o*��|3�S篷�)���q&ݵAn9���U�ż��Rc�.����?J\ת��ئ�?T3bwY�h��oS�N�����?���Mc�`*�B�`��g�G���S�Չ4ՅG?���0O��N�����ൿmK"��pq�ވ�