sparsam 0.2.9 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/ext/extconf.rb +15 -15
- data/ext/serializer.cpp +5 -11
- data/lib/sparsam/base_type.rb +4 -0
- data/lib/sparsam/deserializer.rb +2 -0
- data/lib/sparsam/exceptions.rb +8 -4
- data/lib/sparsam/struct.rb +1 -0
- data/lib/sparsam/types.rb +1 -0
- data/lib/sparsam/union.rb +3 -0
- data/lib/sparsam.rb +1 -0
- data/spec/sparsam_spec.rb +50 -50
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb363b6de95b82d54b824db9a9e8c1d433e00a31771f730a7edd10a9bc10ef7b
|
4
|
+
data.tar.gz: ce9921ab0a2268cd211873cf9f764e1295e9ef777400ed52ad2d32cf36a7aebc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 360d36ab7da517b81f3ac9fcf2313134856d339da0a12b34684c39b2f9ba238c78912b86a8fdaeceb2652188ede9d561424799ba0149a9f2d50ef6ad9a2083c6
|
7
|
+
data.tar.gz: 7cc72e286b041cbd9e5241781455354ff4faf1c38f439cffaa1844b63d78d6fd0ea40b28101fc06997688d09afa29658398e0551aea95e82a8611d1eae8e27db
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Sparsam
|
1
|
+
# Sparsam ![Build Status](https://github.com/airbnb/sparsam/actions/workflows/rspec_rubocop.yml/badge.svg?branch=main) [![Coverage Status](https://coveralls.io/repos/github/airbnb/sparsam/badge.svg?branch=master)](https://coveralls.io/github/airbnb/sparsam?branch=master) [![Gem Version](https://badge.fury.io/rb/sparsam.svg)](https://badge.fury.io/rb/sparsam)
|
2
2
|
New Thrift bindings and generator for Ruby!
|
3
3
|
|
4
4
|
## Super basic Example
|
data/ext/extconf.rb
CHANGED
@@ -14,27 +14,27 @@ brew = find_executable('brew')
|
|
14
14
|
use_homebrew = enable_config('homebrew', brew)
|
15
15
|
|
16
16
|
if use_homebrew
|
17
|
-
|
18
|
-
|
17
|
+
warn "Using #{brew} to locate thrift and boost packages"
|
18
|
+
warn '(disable Homebrew integration via --disable-homebrew)'
|
19
19
|
|
20
20
|
thrift_package = with_config('homebrew-thrift-package', 'thrift@0.9')
|
21
|
-
|
22
|
-
|
21
|
+
warn "looking for Homebrew thrift package '#{thrift_package}'"
|
22
|
+
warn '(change Homebrew thrift package name via --with-homebrew-thrift-package=<package>)'
|
23
23
|
|
24
24
|
thrift_prefix = `#{brew} --prefix #{thrift_package}`.strip
|
25
25
|
|
26
26
|
unless File.exists?(thrift_prefix)
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
warn "#{thrift_prefix} does not exist"
|
28
|
+
warn "To resolve, `brew install #{thrift_package}` or pass"
|
29
|
+
warn '--with-homebrew-thrift-package=<package> to this build to specify'
|
30
|
+
warn 'an alternative thrift package to build against. e.g.:'
|
31
|
+
warn
|
32
|
+
warn ' $ bundle config --global build.sparsam --with-homebrew-thrift-package=mythrift'
|
33
33
|
|
34
34
|
raise "Homebrew package #{thrift_package} not installed"
|
35
35
|
end
|
36
36
|
|
37
|
-
|
37
|
+
warn "using Homebrew thrift at #{thrift_prefix}"
|
38
38
|
$CFLAGS << " -I#{thrift_prefix}/include"
|
39
39
|
$CXXFLAGS << " -I#{thrift_prefix}/include"
|
40
40
|
$CPPFLAGS << " -I#{thrift_prefix}/include"
|
@@ -42,18 +42,18 @@ if use_homebrew
|
|
42
42
|
|
43
43
|
# Also add boost to the includes search path if it is installed.
|
44
44
|
boost_package = with_config('homebrew-boost-package', 'boost')
|
45
|
-
|
46
|
-
|
45
|
+
warn "looking for Homebrew boost package '#{boost_package}'"
|
46
|
+
warn '(change Homebrew boost package name via --with-homebrew-boost-package=<package>)'
|
47
47
|
|
48
48
|
boost_prefix = `#{brew} --prefix #{boost_package}`.strip
|
49
49
|
|
50
50
|
if File.exists?(boost_prefix)
|
51
|
-
|
51
|
+
warn("using Homebrew boost at #{boost_prefix}")
|
52
52
|
$CFLAGS << " -I#{boost_prefix}/include"
|
53
53
|
$CXXFLAGS << " -I#{boost_prefix}/include"
|
54
54
|
$CPPFLAGS << " -I#{boost_prefix}/include"
|
55
55
|
else
|
56
|
-
|
56
|
+
warn 'Homebrew boost not found; assuming boost is in default search paths'
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
data/ext/serializer.cpp
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
extern "C" {
|
2
1
|
#include <ruby.h>
|
3
2
|
#include <ruby/intern.h>
|
4
|
-
}
|
5
3
|
#include <ruby/encoding.h>
|
6
4
|
#include <stdio.h>
|
7
5
|
#include <thrift/protocol/TBinaryProtocol.h>
|
@@ -51,6 +49,8 @@ VALUE SetClass;
|
|
51
49
|
KlassFieldsCache klassCache; // consider the memory leaked.
|
52
50
|
std::unordered_set<VALUE> unions;
|
53
51
|
|
52
|
+
#define SPARSAM_CHECK_TYPE(x, t, outer_struct, field_sym) if (!(RB_TYPE_P(x, t))) { raise_type_mismatch(outer_struct, field_sym, t, x); }
|
53
|
+
|
54
54
|
void *serializer_create() { return (void *)(new ThriftSerializer()); }
|
55
55
|
|
56
56
|
void serializer_free(void *data) {
|
@@ -185,12 +185,6 @@ static inline long raise_type_mismatch_as_value(VALUE outer_struct,
|
|
185
185
|
return 0;
|
186
186
|
}
|
187
187
|
|
188
|
-
static inline void Sparsam_Check_Type(VALUE x, int t, VALUE outer_struct,
|
189
|
-
VALUE field_sym) {
|
190
|
-
if (!(RB_TYPE_P(x, t))) {
|
191
|
-
raise_type_mismatch(outer_struct, field_sym, t, x);
|
192
|
-
}
|
193
|
-
}
|
194
188
|
|
195
189
|
static inline VALUE make_ruby_bool(bool val) { return val ? Qtrue : Qfalse; }
|
196
190
|
|
@@ -513,7 +507,7 @@ void ThriftSerializer::writeAny(TType ttype, FieldInfo *field_info,
|
|
513
507
|
HANDLE_TYPE(BYTE, Byte, CONVERT_FIXNUM(byte_convert, protocol::T_BYTE))
|
514
508
|
|
515
509
|
case protocol::T_STRING: {
|
516
|
-
|
510
|
+
SPARSAM_CHECK_TYPE(actual, T_STRING, outer_struct, field_sym);
|
517
511
|
|
518
512
|
string data = string(StringValuePtr(actual), RSTRING_LEN(actual));
|
519
513
|
if (field_info->isBinaryString) {
|
@@ -525,7 +519,7 @@ void ThriftSerializer::writeAny(TType ttype, FieldInfo *field_info,
|
|
525
519
|
}
|
526
520
|
|
527
521
|
case protocol::T_LIST: {
|
528
|
-
|
522
|
+
SPARSAM_CHECK_TYPE(actual, T_ARRAY, outer_struct, field_sym);
|
529
523
|
|
530
524
|
long length = RARRAY_LEN(actual);
|
531
525
|
TType elem = field_info->elementType->ftype;
|
@@ -556,7 +550,7 @@ void ThriftSerializer::writeAny(TType ttype, FieldInfo *field_info,
|
|
556
550
|
}
|
557
551
|
|
558
552
|
case protocol::T_MAP: {
|
559
|
-
|
553
|
+
SPARSAM_CHECK_TYPE(actual, T_HASH, outer_struct, field_sym);
|
560
554
|
|
561
555
|
TType keyTType = field_info->keyType->ftype,
|
562
556
|
valueTType = field_info->elementType->ftype;
|
data/lib/sparsam/base_type.rb
CHANGED
@@ -65,12 +65,16 @@ module Sparsam
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
+
# rubocop:disable Airbnb/OptArgParameters
|
68
69
|
def serialize(prot = Sparsam::CompactProtocol)
|
70
|
+
# rubocop:enable Airbnb/OptArgParameters
|
69
71
|
s = Sparsam::Serializer.new(prot, "")
|
70
72
|
s.serialize(self.class, self)
|
71
73
|
end
|
72
74
|
|
75
|
+
# rubocop:disable Airbnb/OptArgParameters
|
73
76
|
def validate(mode = Sparsam::NORMAL)
|
77
|
+
# rubocop:enable Airbnb/OptArgParameters
|
74
78
|
Sparsam.validate(self.class, self, mode)
|
75
79
|
end
|
76
80
|
|
data/lib/sparsam/deserializer.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module Sparsam
|
2
2
|
module Deserializer
|
3
|
+
# rubocop:disable Airbnb/OptArgParameters
|
3
4
|
def self.deserialize(klass, serialized_string, prot = Sparsam::CompactProtocol)
|
5
|
+
# rubocop:enable Airbnb/OptArgParameters
|
4
6
|
s = Sparsam::Serializer.new(prot, serialized_string)
|
5
7
|
if klass <= Sparsam::Union
|
6
8
|
s.deserializeUnion(klass)
|
data/lib/sparsam/exceptions.rb
CHANGED
@@ -7,33 +7,37 @@ module Sparsam
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
class MissingMandatory < Exception
|
10
|
+
class MissingMandatory < ::Sparsam::Exception
|
11
11
|
attr_reader :struct_name, :field_name
|
12
12
|
|
13
|
+
# rubocop:disable Airbnb/OptArgParameters
|
13
14
|
def initialize(msg, struct_name = nil, field_name = nil)
|
15
|
+
# rubocop:enable Airbnb/OptArgParameters
|
14
16
|
@struct_name = struct_name
|
15
17
|
@field_name = field_name
|
16
18
|
super(msg)
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
20
|
-
class TypeMismatch < Exception
|
22
|
+
class TypeMismatch < ::Sparsam::Exception
|
21
23
|
attr_reader :struct_name, :field_name
|
22
24
|
|
25
|
+
# rubocop:disable Airbnb/OptArgParameters
|
23
26
|
def initialize(msg, struct_name = nil, field_name = nil)
|
27
|
+
# rubocop:enable Airbnb/OptArgParameters
|
24
28
|
@struct_name = struct_name
|
25
29
|
@field_name = field_name
|
26
30
|
super(msg)
|
27
31
|
end
|
28
32
|
end
|
29
33
|
|
30
|
-
class UnionException < Exception
|
34
|
+
class UnionException < ::Sparsam::Exception
|
31
35
|
def initialize(msg)
|
32
36
|
super
|
33
37
|
end
|
34
38
|
end
|
35
39
|
|
36
|
-
class UnknownTypeException < Exception
|
40
|
+
class UnknownTypeException < ::Sparsam::Exception
|
37
41
|
def initialize(msg)
|
38
42
|
super
|
39
43
|
end
|
data/lib/sparsam/struct.rb
CHANGED
data/lib/sparsam/types.rb
CHANGED
data/lib/sparsam/union.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
# -*- coding: UTF-8 -*-
|
2
|
+
|
2
3
|
require 'sparsam/base_type'
|
3
4
|
|
4
5
|
module Sparsam
|
5
6
|
class Union
|
6
7
|
include ::Sparsam::BaseType
|
7
8
|
|
9
|
+
# rubocop:disable Airbnb/OptArgParameters
|
8
10
|
def initialize(name = nil, value = nil)
|
11
|
+
# rubocop:enable Airbnb/OptArgParameters
|
9
12
|
if name
|
10
13
|
if name.is_a? Hash
|
11
14
|
if name.size > 1
|
data/lib/sparsam.rb
CHANGED
data/spec/sparsam_spec.rb
CHANGED
@@ -72,10 +72,10 @@ describe 'Sparsam' do
|
|
72
72
|
data.un_field.id_i32.should == 1000
|
73
73
|
data.us_s.size.should == 3
|
74
74
|
ids = Set.new([1, 2, 3])
|
75
|
-
data.us_s.each
|
75
|
+
data.us_s.each do |val|
|
76
76
|
ids.delete(val.id_i32)
|
77
77
|
val.id_s.should == "id_s default"
|
78
|
-
|
78
|
+
end
|
79
79
|
ids.size.should == 0
|
80
80
|
end
|
81
81
|
|
@@ -97,67 +97,67 @@ describe 'Sparsam' do
|
|
97
97
|
it "will throw exceptions when strict validation received a non-conforming type" do
|
98
98
|
data = EasilyInvalid.new
|
99
99
|
data.tail = SS.new
|
100
|
-
expect
|
100
|
+
expect do
|
101
101
|
Sparsam.validate(NotSS, data, Sparsam::STRICT)
|
102
|
-
|
102
|
+
end.to raise_error(Sparsam::TypeMismatch)
|
103
103
|
|
104
|
-
expect
|
104
|
+
expect do
|
105
105
|
Sparsam.validate(EasilyInvalid, data, Sparsam::STRICT)
|
106
|
-
|
106
|
+
end.to raise_error(Sparsam::TypeMismatch)
|
107
107
|
|
108
108
|
data = EasilyInvalid.new
|
109
109
|
data.s_self = Set.new([EasilyInvalid.new, SS.new])
|
110
|
-
expect
|
110
|
+
expect do
|
111
111
|
Sparsam.validate(EasilyInvalid, data, Sparsam::STRICT)
|
112
|
-
|
112
|
+
end.to raise_error(Sparsam::TypeMismatch)
|
113
113
|
|
114
114
|
data = EasilyInvalid.new
|
115
115
|
data.l_self = [EasilyInvalid.new, SS.new]
|
116
|
-
expect
|
116
|
+
expect do
|
117
117
|
Sparsam.validate(EasilyInvalid, data, Sparsam::STRICT)
|
118
|
-
|
118
|
+
end.to raise_error(Sparsam::TypeMismatch)
|
119
119
|
|
120
120
|
data = EasilyInvalid.new
|
121
121
|
data.mappy1 = { SS.new => 123 }
|
122
|
-
expect
|
122
|
+
expect do
|
123
123
|
Sparsam.validate(EasilyInvalid, data, Sparsam::STRICT)
|
124
|
-
|
124
|
+
end.to raise_error(Sparsam::TypeMismatch)
|
125
125
|
|
126
126
|
data = EasilyInvalid.new
|
127
127
|
data.mappy2 = { 123 => SS.new }
|
128
|
-
expect
|
128
|
+
expect do
|
129
129
|
Sparsam.validate(EasilyInvalid, data, Sparsam::STRICT)
|
130
|
-
|
130
|
+
end.to raise_error(Sparsam::TypeMismatch)
|
131
131
|
|
132
132
|
data = EasilyInvalid.new
|
133
133
|
data.mappy3 = { SS.new => SS.new }
|
134
|
-
expect
|
134
|
+
expect do
|
135
135
|
Sparsam.validate(EasilyInvalid, data, Sparsam::STRICT)
|
136
|
-
|
136
|
+
end.to raise_error(Sparsam::TypeMismatch)
|
137
137
|
|
138
138
|
data = EasilyInvalid.new
|
139
139
|
data.mappy3 = { EasilyInvalid.new => SS.new }
|
140
|
-
expect
|
140
|
+
expect do
|
141
141
|
Sparsam.validate(EasilyInvalid, data, Sparsam::STRICT)
|
142
|
-
|
142
|
+
end.to raise_error(Sparsam::TypeMismatch)
|
143
143
|
|
144
144
|
data = EasilyInvalid.new
|
145
145
|
data.mappy3 = { SS.new => EasilyInvalid.new }
|
146
|
-
expect
|
146
|
+
expect do
|
147
147
|
Sparsam.validate(EasilyInvalid, data, Sparsam::STRICT)
|
148
|
-
|
148
|
+
end.to raise_error(Sparsam::TypeMismatch)
|
149
149
|
|
150
150
|
data = EasilyInvalid.new
|
151
151
|
data.mappy3 = { EasilyInvalid.new => EasilyInvalid.new, SS.new => EasilyInvalid.new }
|
152
|
-
expect
|
152
|
+
expect do
|
153
153
|
Sparsam.validate(EasilyInvalid, data, Sparsam::STRICT)
|
154
|
-
|
154
|
+
end.to raise_error(Sparsam::TypeMismatch)
|
155
155
|
|
156
156
|
data = EasilyInvalid.new
|
157
157
|
data.id_i32 = "I'm pretty sure this is not an I32 LOL"
|
158
|
-
expect
|
158
|
+
expect do
|
159
159
|
Sparsam.validate(EasilyInvalid, data, Sparsam::STRICT)
|
160
|
-
|
160
|
+
end.to raise_error(Sparsam::TypeMismatch)
|
161
161
|
end
|
162
162
|
|
163
163
|
it "includes additional data in TypeMismatch errors" do
|
@@ -182,24 +182,24 @@ describe 'Sparsam' do
|
|
182
182
|
|
183
183
|
data = EasilyInvalid.new
|
184
184
|
data.sure = [{ Set.new([1]) => { 1 => Set.new([[{ EasilyInvalid.new => 123 }]]) } }]
|
185
|
-
expect
|
185
|
+
expect do
|
186
186
|
Sparsam.validate(EasilyInvalid, data, Sparsam::RECURSIVE)
|
187
|
-
|
187
|
+
end.to raise_error(Sparsam::TypeMismatch)
|
188
188
|
end
|
189
189
|
|
190
190
|
it "will throw exceptions when recursive validation is passed wrong data" do
|
191
191
|
data = EasilyInvalid.new
|
192
192
|
data.required_stuff = MiniRequired.new
|
193
|
-
expect
|
193
|
+
expect do
|
194
194
|
Sparsam.validate(EasilyInvalid, data, Sparsam::RECURSIVE)
|
195
|
-
|
195
|
+
end.to raise_error(Sparsam::MissingMandatory)
|
196
196
|
|
197
197
|
data = EasilyInvalid.new
|
198
198
|
data.tail = EasilyInvalid.new
|
199
199
|
data.tail.s_self = Set.new([SS.new])
|
200
|
-
expect
|
200
|
+
expect do
|
201
201
|
Sparsam.validate(EasilyInvalid, data, Sparsam::RECURSIVE)
|
202
|
-
|
202
|
+
end.to raise_error(Sparsam::TypeMismatch)
|
203
203
|
end
|
204
204
|
|
205
205
|
it "will throw exceptions when passed data that doesn't match type" do
|
@@ -266,9 +266,9 @@ describe 'Sparsam' do
|
|
266
266
|
end
|
267
267
|
|
268
268
|
it "will throw errors when given junk data" do
|
269
|
-
expect
|
269
|
+
expect do
|
270
270
|
Sparsam::Deserializer.deserialize(SS, "wolololololol")
|
271
|
-
|
271
|
+
end.to raise_error(Sparsam::Exception)
|
272
272
|
end
|
273
273
|
|
274
274
|
it "will throw errors when deserializing data with incorrect types" do
|
@@ -277,9 +277,9 @@ describe 'Sparsam' do
|
|
277
277
|
data = NotSS.new
|
278
278
|
data.id_s = "I am not an INT"
|
279
279
|
bad_type = data.serialize
|
280
|
-
expect
|
280
|
+
expect do
|
281
281
|
Sparsam::Deserializer.deserialize(SS, bad_type)
|
282
|
-
|
282
|
+
end.to raise_error(Sparsam::TypeMismatch)
|
283
283
|
end
|
284
284
|
|
285
285
|
it "can deserialize objects with fields it doesn't know about" do
|
@@ -297,17 +297,17 @@ describe 'Sparsam' do
|
|
297
297
|
end
|
298
298
|
|
299
299
|
it 'only allows one field to be set in a union' do
|
300
|
-
expect
|
300
|
+
expect do
|
301
301
|
UN.new({ :id_i32 => 1000, :id_s => "woops" })
|
302
|
-
|
302
|
+
end.to raise_error(Sparsam::UnionException)
|
303
303
|
|
304
304
|
d = UN.new({ :id_i32 => 1000 })
|
305
305
|
d.id_s = "woops"
|
306
306
|
d.id_s
|
307
307
|
|
308
|
-
expect
|
308
|
+
expect do
|
309
309
|
d.id_i32
|
310
|
-
|
310
|
+
end.to raise_error(Sparsam::UnionException)
|
311
311
|
|
312
312
|
d.instance_variables.should eq([:@setfield, :@id_s])
|
313
313
|
end
|
@@ -354,10 +354,10 @@ describe 'Sparsam' do
|
|
354
354
|
data.un_field.id_i32.should == 1000
|
355
355
|
data.us_s.size.should == 3
|
356
356
|
ids = Set.new([1, 2, 3])
|
357
|
-
data.us_s.each
|
357
|
+
data.us_s.each do |val|
|
358
358
|
ids.delete(val.id_i32)
|
359
359
|
val.id_s.should == "id_s default"
|
360
|
-
|
360
|
+
end
|
361
361
|
ids.size.should == 0
|
362
362
|
end
|
363
363
|
|
@@ -372,9 +372,9 @@ describe 'Sparsam' do
|
|
372
372
|
|
373
373
|
it "doesn't segfault on malformed data" do
|
374
374
|
really_bad = "\x0f\x00\x05\x0b\x00\x00\x00\x01\x00\x00\x00\x03\x00"
|
375
|
-
expect
|
375
|
+
expect do
|
376
376
|
Sparsam::Deserializer.deserialize(SS, really_bad, Sparsam::BinaryProtocol)
|
377
|
-
|
377
|
+
end.to raise_error(Sparsam::Exception)
|
378
378
|
end
|
379
379
|
|
380
380
|
it "handles all sorts of type issues without crashing" do
|
@@ -434,18 +434,18 @@ describe 'Sparsam' do
|
|
434
434
|
|
435
435
|
# Validation doesn't do range checking, though serialization does
|
436
436
|
unless val_type.to_s =~ /bigint/
|
437
|
-
expect
|
437
|
+
expect do
|
438
438
|
Sparsam.validate(s.class, s, Sparsam::STRICT)
|
439
|
-
|
439
|
+
end.to(
|
440
440
|
raise_error(Sparsam::TypeMismatch),
|
441
441
|
"assigning #{field} : #{type} a value of " \
|
442
442
|
"#{val.inspect} : #{val_type} did not raise TypeMismatch"
|
443
443
|
)
|
444
444
|
end
|
445
445
|
|
446
|
-
expect
|
446
|
+
expect do
|
447
447
|
s.serialize
|
448
|
-
|
448
|
+
end.to(
|
449
449
|
raise_error(Sparsam::TypeMismatch),
|
450
450
|
"assigning #{field} : #{type} a value of " \
|
451
451
|
"#{val.inspect} : #{val_type} did not raise TypeMismatch"
|
@@ -471,16 +471,16 @@ describe 'Sparsam' do
|
|
471
471
|
[max_val, ~max_val].each do |val|
|
472
472
|
s.send(:"#{field}=", val)
|
473
473
|
|
474
|
-
expect
|
474
|
+
expect do
|
475
475
|
s.serialize
|
476
|
-
|
476
|
+
end.not_to raise_error, "#{field} of #{size} bits unable to hold #{val}"
|
477
477
|
end
|
478
478
|
|
479
479
|
[max_val + 1, ~(max_val + 1)].each do |val|
|
480
480
|
s.send(:"#{field}=", val)
|
481
|
-
expect
|
481
|
+
expect do
|
482
482
|
s.serialize
|
483
|
-
|
483
|
+
end.to(
|
484
484
|
raise_error(RangeError),
|
485
485
|
"#{field} of #{size} bits apparently able to hold value #{val} in defiance of nature"
|
486
486
|
)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sparsam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airbnb Thrift Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -53,33 +53,33 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '11.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop
|
56
|
+
name: rubocop-airbnb
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop-
|
70
|
+
name: rubocop-rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '0'
|
83
83
|
description: Ruby bindings for the Apache Thrift RPC system
|
84
84
|
email:
|
85
85
|
- foundation.performance-eng@airbnb.com
|