bson 4.2.0 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/ext/bson/native-endian.h +9 -8
- data/lib/bson/decimal128.rb +1 -1
- data/lib/bson/regexp.rb +1 -1
- data/lib/bson/version.rb +1 -1
- data/spec/bson/decimal128_spec.rb +5 -1
- data/spec/bson/int64_spec.rb +47 -0
- data/spec/bson/raw_spec.rb +22 -0
- metadata +3 -3
- metadata.gz.sig +1 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0ac7ae0ca768ef98d4623098afcfd7a6274ae1c
|
4
|
+
data.tar.gz: 8ee3b34cb7a96012a8d849e0804699338f426264
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae110fdef5bf56e3c4afebd46e383b9e69496fc9b10bc4ea7f414020f101d054173c42101d80f2f4be111e234ffc73ec86d29f27bbffe80b314e51c5a4707fc4
|
7
|
+
data.tar.gz: 252f9e291534603084f3087b286a41deeb5c3562121e2bb1886acd5cf2f1ff43458985cf4c27d2dd874ae43d00262a24b23d9ba3925dbbf6b7ea43dbdb927c89
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/ext/bson/native-endian.h
CHANGED
@@ -35,13 +35,14 @@
|
|
35
35
|
# endif
|
36
36
|
#endif
|
37
37
|
|
38
|
-
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
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__
|
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
|
data/lib/bson/decimal128.rb
CHANGED
data/lib/bson/regexp.rb
CHANGED
data/lib/bson/version.rb
CHANGED
@@ -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.
|
65
|
+
expect(buffer.to_s).to eq(expected_bson)
|
62
66
|
end
|
63
67
|
|
64
68
|
it 'deserializes to the correct bits' do
|
data/spec/bson/int64_spec.rb
CHANGED
@@ -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
|
data/spec/bson/raw_spec.rb
CHANGED
@@ -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.
|
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-
|
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.
|
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
|
-
|
2
|
-
��G�S��\��頻PQ��{��Q�Rc�
|
1
|
+
�jS#��u�S�GM�1���;�Ho�d�0*eP�Y��<5��Jg��I[u��B ������|�x�����7tLV�/�̖��}F2&:�O��+��ެDC�r:����o*��|3�S篷�)���q&ݵAn9���U�ż��Rc�.����?J\ת��ئ�?T3b�wY�h��oS�N�����?���Mc�`*�B�`��g�G���S�Չ4ՅG?���0O��N�����ൿmK"��p�q�ވ�
|