bson 4.1.1 → 4.2.0.rc0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Rakefile +18 -3
- data/ext/bson/{native.c → bson_native.c} +48 -8
- data/ext/bson/extconf.rb +1 -1
- data/ext/bson/native-endian.h +1 -1
- data/lib/bson.rb +3 -1
- data/lib/bson/config.rb +1 -1
- data/lib/bson/decimal128.rb +318 -0
- data/lib/bson/decimal128/builder.rb +448 -0
- data/lib/bson/document.rb +2 -2
- data/lib/bson/environment.rb +13 -1
- data/lib/bson/int32.rb +46 -0
- data/lib/bson/int64.rb +46 -0
- data/lib/bson/max_key.rb +1 -1
- data/lib/bson/min_key.rb +1 -1
- data/lib/bson/object_id.rb +2 -1
- data/lib/bson/open_struct.rb +57 -0
- data/lib/bson/regexp.rb +1 -1
- data/lib/bson/registry.rb +1 -1
- data/lib/bson/version.rb +2 -2
- data/spec/bson/decimal128_spec.rb +1583 -0
- data/spec/bson/document_spec.rb +1 -1
- data/spec/bson/driver_bson_spec.rb +77 -0
- data/spec/bson/int32_spec.rb +58 -0
- data/spec/bson/int64_spec.rb +58 -0
- data/spec/bson/open_struct_spec.rb +144 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/support/common_driver.rb +347 -0
- data/spec/support/driver-spec-tests/decimal128/decimal128-1.json +363 -0
- data/spec/support/driver-spec-tests/decimal128/decimal128-2.json +793 -0
- data/spec/support/driver-spec-tests/decimal128/decimal128-3.json +1771 -0
- data/spec/support/driver-spec-tests/decimal128/decimal128-4.json +165 -0
- data/spec/support/driver-spec-tests/decimal128/decimal128-5.json +402 -0
- data/spec/support/driver-spec-tests/decimal128/decimal128-6.json +131 -0
- data/spec/support/driver-spec-tests/decimal128/decimal128-7.json +327 -0
- metadata +29 -4
- metadata.gz.sig +0 -0
@@ -0,0 +1,131 @@
|
|
1
|
+
{
|
2
|
+
"description": "Decimal128",
|
3
|
+
"bson_type": "0x13",
|
4
|
+
"test_key": "d",
|
5
|
+
"parseErrors": [
|
6
|
+
{
|
7
|
+
"description": "Incomplete Exponent",
|
8
|
+
"subject": "1e"
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"description": "Exponent at the beginning",
|
12
|
+
"subject": "E01"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"description": "Just a decimal place",
|
16
|
+
"subject": "."
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"description": "2 decimal places",
|
20
|
+
"subject": "..3"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"description": "2 decimal places",
|
24
|
+
"subject": ".13.3"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"description": "2 decimal places",
|
28
|
+
"subject": "1..3"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"description": "2 decimal places",
|
32
|
+
"subject": "1.3.4"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"description": "2 decimal places",
|
36
|
+
"subject": "1.34."
|
37
|
+
},
|
38
|
+
{
|
39
|
+
"description": "Decimal with no digits",
|
40
|
+
"subject": ".e"
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"description": "2 signs",
|
44
|
+
"subject": "+-32.4"
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"description": "2 signs",
|
48
|
+
"subject": "-+32.4"
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"description": "2 negative signs",
|
52
|
+
"subject": "--32.4"
|
53
|
+
},
|
54
|
+
{
|
55
|
+
"description": "2 negative signs",
|
56
|
+
"subject": "-32.-4"
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"description": "End in negative sign",
|
60
|
+
"subject": "32.0-"
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"description": "2 negative signs",
|
64
|
+
"subject": "32.4E--21"
|
65
|
+
},
|
66
|
+
{
|
67
|
+
"description": "2 negative signs",
|
68
|
+
"subject": "32.4E-2-1"
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"description": "2 signs",
|
72
|
+
"subject": "32.4E+-21"
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"description": "Empty string",
|
76
|
+
"subject": ""
|
77
|
+
},
|
78
|
+
{
|
79
|
+
"description": "leading white space positive number",
|
80
|
+
"subject": " 1"
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"description": "leading white space negative number",
|
84
|
+
"subject": " -1"
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"description": "trailing white space",
|
88
|
+
"subject": "1 "
|
89
|
+
},
|
90
|
+
{
|
91
|
+
"description": "Invalid",
|
92
|
+
"subject": "E"
|
93
|
+
},
|
94
|
+
{
|
95
|
+
"description": "Invalid",
|
96
|
+
"subject": "invalid"
|
97
|
+
},
|
98
|
+
{
|
99
|
+
"description": "Invalid",
|
100
|
+
"subject": "i"
|
101
|
+
},
|
102
|
+
{
|
103
|
+
"description": "Invalid",
|
104
|
+
"subject": "in"
|
105
|
+
},
|
106
|
+
{
|
107
|
+
"description": "Invalid",
|
108
|
+
"subject": "-in"
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"description": "Invalid",
|
112
|
+
"subject": "Na"
|
113
|
+
},
|
114
|
+
{
|
115
|
+
"description": "Invalid",
|
116
|
+
"subject": "-Na"
|
117
|
+
},
|
118
|
+
{
|
119
|
+
"description": "Invalid",
|
120
|
+
"subject": "1.23abc"
|
121
|
+
},
|
122
|
+
{
|
123
|
+
"description": "Invalid",
|
124
|
+
"subject": "1.23abcE+02"
|
125
|
+
},
|
126
|
+
{
|
127
|
+
"description": "Invalid",
|
128
|
+
"subject": "1.23E+0aabs2"
|
129
|
+
}
|
130
|
+
]
|
131
|
+
}
|
@@ -0,0 +1,327 @@
|
|
1
|
+
{
|
2
|
+
"description": "Decimal128",
|
3
|
+
"bson_type": "0x13",
|
4
|
+
"test_key": "d",
|
5
|
+
"parseErrors": [
|
6
|
+
{
|
7
|
+
"description": "[basx572] Near-specials (Conversion_syntax)",
|
8
|
+
"subject": "-9Inf"
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"description": "[basx516] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
12
|
+
"subject": "-1-"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"description": "[basx533] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
16
|
+
"subject": "0000.."
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"description": "[basx534] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
20
|
+
"subject": ".0000."
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"description": "[basx535] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
24
|
+
"subject": "00..00"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"description": "[basx569] Near-specials (Conversion_syntax)",
|
28
|
+
"subject": "0Inf"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"description": "[basx571] Near-specials (Conversion_syntax)",
|
32
|
+
"subject": "-0Inf"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"description": "[basx575] Near-specials (Conversion_syntax)",
|
36
|
+
"subject": "0sNaN"
|
37
|
+
},
|
38
|
+
{
|
39
|
+
"description": "[basx503] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
40
|
+
"subject": "++1"
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"description": "[basx504] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
44
|
+
"subject": "--1"
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"description": "[basx505] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
48
|
+
"subject": "-+1"
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"description": "[basx506] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
52
|
+
"subject": "+-1"
|
53
|
+
},
|
54
|
+
{
|
55
|
+
"description": "[basx510] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
56
|
+
"subject": " +1"
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"description": "[basx513] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
60
|
+
"subject": " + 1"
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"description": "[basx514] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
64
|
+
"subject": " - 1"
|
65
|
+
},
|
66
|
+
{
|
67
|
+
"description": "[basx501] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
68
|
+
"subject": "."
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"description": "[basx502] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
72
|
+
"subject": ".."
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"description": "[basx519] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
76
|
+
"subject": ""
|
77
|
+
},
|
78
|
+
{
|
79
|
+
"description": "[basx525] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
80
|
+
"subject": "e100"
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"description": "[basx549] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
84
|
+
"subject": "e+1"
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"description": "[basx577] some baddies with dots and Es and dots and specials (Conversion_syntax)",
|
88
|
+
"subject": ".e+1"
|
89
|
+
},
|
90
|
+
{
|
91
|
+
"description": "[basx578] some baddies with dots and Es and dots and specials (Conversion_syntax)",
|
92
|
+
"subject": "+.e+1"
|
93
|
+
},
|
94
|
+
{
|
95
|
+
"description": "[basx581] some baddies with dots and Es and dots and specials (Conversion_syntax)",
|
96
|
+
"subject": "E+1"
|
97
|
+
},
|
98
|
+
{
|
99
|
+
"description": "[basx582] some baddies with dots and Es and dots and specials (Conversion_syntax)",
|
100
|
+
"subject": ".E+1"
|
101
|
+
},
|
102
|
+
{
|
103
|
+
"description": "[basx583] some baddies with dots and Es and dots and specials (Conversion_syntax)",
|
104
|
+
"subject": "+.E+1"
|
105
|
+
},
|
106
|
+
{
|
107
|
+
"description": "[basx579] some baddies with dots and Es and dots and specials (Conversion_syntax)",
|
108
|
+
"subject": "-.e+"
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"description": "[basx580] some baddies with dots and Es and dots and specials (Conversion_syntax)",
|
112
|
+
"subject": "-.e"
|
113
|
+
},
|
114
|
+
{
|
115
|
+
"description": "[basx584] some baddies with dots and Es and dots and specials (Conversion_syntax)",
|
116
|
+
"subject": "-.E+"
|
117
|
+
},
|
118
|
+
{
|
119
|
+
"description": "[basx585] some baddies with dots and Es and dots and specials (Conversion_syntax)",
|
120
|
+
"subject": "-.E"
|
121
|
+
},
|
122
|
+
{
|
123
|
+
"description": "[basx589] some baddies with dots and Es and dots and specials (Conversion_syntax)",
|
124
|
+
"subject": "+.Inf"
|
125
|
+
},
|
126
|
+
{
|
127
|
+
"description": "[basx586] some baddies with dots and Es and dots and specials (Conversion_syntax)",
|
128
|
+
"subject": ".NaN"
|
129
|
+
},
|
130
|
+
{
|
131
|
+
"description": "[basx587] some baddies with dots and Es and dots and specials (Conversion_syntax)",
|
132
|
+
"subject": "-.NaN"
|
133
|
+
},
|
134
|
+
{
|
135
|
+
"description": "[basx545] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
136
|
+
"subject": "ONE"
|
137
|
+
},
|
138
|
+
{
|
139
|
+
"description": "[basx561] Near-specials (Conversion_syntax)",
|
140
|
+
"subject": "qNaN"
|
141
|
+
},
|
142
|
+
{
|
143
|
+
"description": "[basx573] Near-specials (Conversion_syntax)",
|
144
|
+
"subject": "-sNa"
|
145
|
+
},
|
146
|
+
{
|
147
|
+
"description": "[basx588] some baddies with dots and Es and dots and specials (Conversion_syntax)",
|
148
|
+
"subject": "+.sNaN"
|
149
|
+
},
|
150
|
+
{
|
151
|
+
"description": "[basx544] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
152
|
+
"subject": "ten"
|
153
|
+
},
|
154
|
+
{
|
155
|
+
"description": "[basx527] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
156
|
+
"subject": "u0b65"
|
157
|
+
},
|
158
|
+
{
|
159
|
+
"description": "[basx526] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
160
|
+
"subject": "u0e5a"
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"description": "[basx515] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
164
|
+
"subject": "x"
|
165
|
+
},
|
166
|
+
{
|
167
|
+
"description": "[basx574] Near-specials (Conversion_syntax)",
|
168
|
+
"subject": "xNaN"
|
169
|
+
},
|
170
|
+
{
|
171
|
+
"description": "[basx530] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
172
|
+
"subject": ".123.5"
|
173
|
+
},
|
174
|
+
{
|
175
|
+
"description": "[basx500] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
176
|
+
"subject": "1..2"
|
177
|
+
},
|
178
|
+
{
|
179
|
+
"description": "[basx542] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
180
|
+
"subject": "1e1.0"
|
181
|
+
},
|
182
|
+
{
|
183
|
+
"description": "[basx553] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
184
|
+
"subject": "1E+1.2.3"
|
185
|
+
},
|
186
|
+
{
|
187
|
+
"description": "[basx543] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
188
|
+
"subject": "1e123e"
|
189
|
+
},
|
190
|
+
{
|
191
|
+
"description": "[basx552] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
192
|
+
"subject": "1E+1.2"
|
193
|
+
},
|
194
|
+
{
|
195
|
+
"description": "[basx546] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
196
|
+
"subject": "1e.1"
|
197
|
+
},
|
198
|
+
{
|
199
|
+
"description": "[basx547] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
200
|
+
"subject": "1e1."
|
201
|
+
},
|
202
|
+
{
|
203
|
+
"description": "[basx554] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
204
|
+
"subject": "1E++1"
|
205
|
+
},
|
206
|
+
{
|
207
|
+
"description": "[basx555] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
208
|
+
"subject": "1E--1"
|
209
|
+
},
|
210
|
+
{
|
211
|
+
"description": "[basx556] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
212
|
+
"subject": "1E+-1"
|
213
|
+
},
|
214
|
+
{
|
215
|
+
"description": "[basx557] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
216
|
+
"subject": "1E-+1"
|
217
|
+
},
|
218
|
+
{
|
219
|
+
"description": "[basx558] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
220
|
+
"subject": "1E'1"
|
221
|
+
},
|
222
|
+
{
|
223
|
+
"description": "[basx559] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
224
|
+
"subject": "1E\"1"
|
225
|
+
},
|
226
|
+
{
|
227
|
+
"description": "[basx520] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
228
|
+
"subject": "1e-"
|
229
|
+
},
|
230
|
+
{
|
231
|
+
"description": "[basx560] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
232
|
+
"subject": "1E"
|
233
|
+
},
|
234
|
+
{
|
235
|
+
"description": "[basx548] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
236
|
+
"subject": "1ee"
|
237
|
+
},
|
238
|
+
{
|
239
|
+
"description": "[basx551] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
240
|
+
"subject": "1.2.1"
|
241
|
+
},
|
242
|
+
{
|
243
|
+
"description": "[basx550] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
244
|
+
"subject": "1.23.4"
|
245
|
+
},
|
246
|
+
{
|
247
|
+
"description": "[basx529] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
248
|
+
"subject": "1.34.5"
|
249
|
+
},
|
250
|
+
{
|
251
|
+
"description": "[basx531] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
252
|
+
"subject": "01.35."
|
253
|
+
},
|
254
|
+
{
|
255
|
+
"description": "[basx532] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
256
|
+
"subject": "01.35-"
|
257
|
+
},
|
258
|
+
{
|
259
|
+
"description": "[basx518] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
260
|
+
"subject": "3+"
|
261
|
+
},
|
262
|
+
{
|
263
|
+
"description": "[basx521] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
264
|
+
"subject": "7e99999a"
|
265
|
+
},
|
266
|
+
{
|
267
|
+
"description": "[basx570] Near-specials (Conversion_syntax)",
|
268
|
+
"subject": "9Inf"
|
269
|
+
},
|
270
|
+
{
|
271
|
+
"description": "[basx512] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
272
|
+
"subject": "12 "
|
273
|
+
},
|
274
|
+
{
|
275
|
+
"description": "[basx517] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
276
|
+
"subject": "12-"
|
277
|
+
},
|
278
|
+
{
|
279
|
+
"description": "[basx507] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
280
|
+
"subject": "12e"
|
281
|
+
},
|
282
|
+
{
|
283
|
+
"description": "[basx508] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
284
|
+
"subject": "12e++"
|
285
|
+
},
|
286
|
+
{
|
287
|
+
"description": "[basx509] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
288
|
+
"subject": "12f4"
|
289
|
+
},
|
290
|
+
{
|
291
|
+
"description": "[basx536] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
292
|
+
"subject": "111e*123"
|
293
|
+
},
|
294
|
+
{
|
295
|
+
"description": "[basx537] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
296
|
+
"subject": "111e123-"
|
297
|
+
},
|
298
|
+
{
|
299
|
+
"description": "[basx540] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
300
|
+
"subject": "111e1*23"
|
301
|
+
},
|
302
|
+
{
|
303
|
+
"description": "[basx538] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
304
|
+
"subject": "111e+12+"
|
305
|
+
},
|
306
|
+
{
|
307
|
+
"description": "[basx539] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
308
|
+
"subject": "111e1-3-"
|
309
|
+
},
|
310
|
+
{
|
311
|
+
"description": "[basx541] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
312
|
+
"subject": "111E1e+3"
|
313
|
+
},
|
314
|
+
{
|
315
|
+
"description": "[basx528] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
316
|
+
"subject": "123,65"
|
317
|
+
},
|
318
|
+
{
|
319
|
+
"description": "[basx523] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
320
|
+
"subject": "7e12356789012x"
|
321
|
+
},
|
322
|
+
{
|
323
|
+
"description": "[basx522] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
|
324
|
+
"subject": "7e123567890x"
|
325
|
+
}
|
326
|
+
]
|
327
|
+
}
|