bindata 2.4.10 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog.rdoc +39 -0
  3. data/LICENSE +25 -0
  4. data/NEWS.rdoc +5 -0
  5. data/README.md +6 -9
  6. data/bindata.gemspec +9 -4
  7. data/examples/NBT.txt +1 -1
  8. data/examples/list.rb +1 -1
  9. data/lib/bindata/alignment.rb +15 -7
  10. data/lib/bindata/array.rb +54 -54
  11. data/lib/bindata/base.rb +14 -25
  12. data/lib/bindata/base_primitive.rb +24 -20
  13. data/lib/bindata/bits.rb +15 -15
  14. data/lib/bindata/buffer.rb +89 -11
  15. data/lib/bindata/choice.rb +9 -6
  16. data/lib/bindata/count_bytes_remaining.rb +1 -1
  17. data/lib/bindata/delayed_io.rb +18 -10
  18. data/lib/bindata/dsl.rb +37 -35
  19. data/lib/bindata/float.rb +3 -3
  20. data/lib/bindata/framework.rb +8 -10
  21. data/lib/bindata/int.rb +14 -16
  22. data/lib/bindata/io.rb +276 -253
  23. data/lib/bindata/name.rb +1 -1
  24. data/lib/bindata/params.rb +9 -7
  25. data/lib/bindata/primitive.rb +3 -3
  26. data/lib/bindata/registry.rb +18 -18
  27. data/lib/bindata/rest.rb +1 -1
  28. data/lib/bindata/sanitize.rb +9 -16
  29. data/lib/bindata/section.rb +97 -0
  30. data/lib/bindata/skip.rb +140 -51
  31. data/lib/bindata/string.rb +9 -9
  32. data/lib/bindata/stringz.rb +12 -10
  33. data/lib/bindata/struct.rb +92 -68
  34. data/lib/bindata/trace.rb +35 -42
  35. data/lib/bindata/transform/brotli.rb +35 -0
  36. data/lib/bindata/transform/lz4.rb +35 -0
  37. data/lib/bindata/transform/lzma.rb +35 -0
  38. data/lib/bindata/transform/xor.rb +19 -0
  39. data/lib/bindata/transform/xz.rb +35 -0
  40. data/lib/bindata/transform/zlib.rb +33 -0
  41. data/lib/bindata/transform/zstd.rb +35 -0
  42. data/lib/bindata/uint8_array.rb +2 -2
  43. data/lib/bindata/version.rb +1 -1
  44. data/lib/bindata/virtual.rb +4 -7
  45. data/lib/bindata/warnings.rb +1 -1
  46. data/lib/bindata.rb +1 -0
  47. data/test/alignment_test.rb +8 -8
  48. data/test/array_test.rb +98 -96
  49. data/test/base_primitive_test.rb +47 -47
  50. data/test/base_test.rb +24 -24
  51. data/test/bits_test.rb +15 -15
  52. data/test/buffer_test.rb +31 -22
  53. data/test/choice_test.rb +32 -32
  54. data/test/count_bytes_remaining_test.rb +8 -8
  55. data/test/delayed_io_test.rb +91 -30
  56. data/test/float_test.rb +8 -8
  57. data/test/int_test.rb +14 -14
  58. data/test/io_test.rb +110 -302
  59. data/test/lazy_test.rb +38 -38
  60. data/test/params_test.rb +19 -19
  61. data/test/primitive_test.rb +26 -26
  62. data/test/record_test.rb +99 -99
  63. data/test/registry_test.rb +43 -43
  64. data/test/rest_test.rb +5 -5
  65. data/test/section_test.rb +111 -0
  66. data/test/skip_test.rb +71 -26
  67. data/test/string_test.rb +60 -60
  68. data/test/stringz_test.rb +34 -26
  69. data/test/struct_test.rb +167 -92
  70. data/test/system_test.rb +159 -41
  71. data/test/test_helper.rb +24 -13
  72. data/test/uint8_array_test.rb +6 -6
  73. data/test/virtual_test.rb +7 -7
  74. data/test/warnings_test.rb +14 -2
  75. metadata +19 -22
  76. data/.gitignore +0 -2
  77. data/.travis.yml +0 -15
  78. data/BSDL +0 -22
  79. data/COPYING +0 -52
  80. data/INSTALL +0 -12
  81. data/lib/bindata/offset.rb +0 -94
  82. data/test/offset_test.rb +0 -100
data/test/lazy_test.rb CHANGED
@@ -41,33 +41,33 @@ describe BinData::LazyEvaluator, "with no parents" do
41
41
  }
42
42
 
43
43
  it "evaluates raw value when instantiated" do
44
- lazy_eval(5).must_equal 5
44
+ _(lazy_eval(5)).must_equal 5
45
45
  end
46
46
 
47
47
  it "evaluates raw value" do
48
- lazy_eval(5).must_equal 5
48
+ _(lazy_eval(5)).must_equal 5
49
49
  end
50
50
 
51
51
  it "evaluates value" do
52
- lazy_eval(lambda { 5 }).must_equal 5
52
+ _(lazy_eval(lambda { 5 })).must_equal 5
53
53
  end
54
54
 
55
55
  it "evaluates overrides" do
56
- lazy_eval(lambda { o1 }, o1: 'o1').must_equal 'o1'
56
+ _(lazy_eval(lambda { o1 }, o1: 'o1')).must_equal 'o1'
57
57
  end
58
58
 
59
59
  it "does not resolve any unknown methods" do
60
- lambda { lazy_eval(lambda { unknown }) }.must_raise NameError
61
- lambda { lazy_eval(lambda { m1 }) }.must_raise NameError
62
- lambda { lazy_eval(lambda { p1 }) }.must_raise NameError
60
+ _ { lazy_eval(lambda { unknown }) }.must_raise NameError
61
+ _ { lazy_eval(lambda { m1 }) }.must_raise NameError
62
+ _ { lazy_eval(lambda { p1 }) }.must_raise NameError
63
63
  end
64
64
 
65
65
  it "does not have a parent" do
66
- lazy_eval(lambda { parent }).must_be_nil
66
+ _(lazy_eval(lambda { parent })).must_be_nil
67
67
  end
68
68
 
69
69
  it "does not resolve #index" do
70
- lambda { lazy_eval(lambda { index }) }.must_raise NoMethodError
70
+ _ { lazy_eval(lambda { index }) }.must_raise NoMethodError
71
71
  end
72
72
  end
73
73
 
@@ -91,51 +91,51 @@ describe BinData::LazyEvaluator, "with one parent" do
91
91
  }
92
92
 
93
93
  it "evaluates raw value" do
94
- lazy_eval(5).must_equal 5
94
+ _(lazy_eval(5)).must_equal 5
95
95
  end
96
96
 
97
97
  it "evaluates value" do
98
- lazy_eval(lambda { 5 }).must_equal 5
98
+ _(lazy_eval(lambda { 5 })).must_equal 5
99
99
  end
100
100
 
101
101
  it "evaluates overrides before params" do
102
- lazy_eval(lambda { p1 }, p1: 'o1').must_equal 'o1'
102
+ _(lazy_eval(lambda { p1 }, p1: 'o1')).must_equal 'o1'
103
103
  end
104
104
 
105
105
  it "evaluates overrides before methods" do
106
- lazy_eval(lambda { m1 }, m1: 'o1').must_equal 'o1'
106
+ _(lazy_eval(lambda { m1 }, m1: 'o1')).must_equal 'o1'
107
107
  end
108
108
 
109
109
  it "does not resolve any unknown methods" do
110
- lambda { lazy_eval(lambda { unknown }) }.must_raise NoMethodError
110
+ _ { lazy_eval(lambda { unknown }) }.must_raise NoMethodError
111
111
  end
112
112
 
113
113
  it "resolves parameters in the parent" do
114
- lazy_eval(lambda { p1 }).must_equal 'Pp1'
114
+ _(lazy_eval(lambda { p1 })).must_equal 'Pp1'
115
115
  end
116
116
 
117
117
  it "resolves methods in the parent" do
118
- lazy_eval(lambda { m1 }).must_equal 'Pm1'
118
+ _(lazy_eval(lambda { m1 })).must_equal 'Pm1'
119
119
  end
120
120
 
121
121
  it "invokes methods in the parent" do
122
- lazy_eval(lambda { echo(p1, m1) }).must_equal ['Pp1', 'Pm1']
122
+ _(lazy_eval(lambda { echo(p1, m1) })).must_equal ['Pp1', 'Pm1']
123
123
  end
124
124
 
125
125
  it "invokes private methods in the parent" do
126
- lazy_eval(lambda { m2 }).must_equal 'Pm2'
126
+ _(lazy_eval(lambda { m2 })).must_equal 'Pm2'
127
127
  end
128
128
 
129
129
  it "resolves parameters in preference to methods in the parent" do
130
- lazy_eval(lambda { com1 }).must_equal 'PpC'
130
+ _(lazy_eval(lambda { com1 })).must_equal 'PpC'
131
131
  end
132
132
 
133
133
  it "has a parent" do
134
- lazy_eval(lambda { parent }).wont_be_nil
134
+ _(lazy_eval(lambda { parent })).wont_be_nil
135
135
  end
136
136
 
137
137
  it "does not resolve #index" do
138
- lambda { lazy_eval(lambda { index }) }.must_raise NoMethodError
138
+ _ { lazy_eval(lambda { index }) }.must_raise NoMethodError
139
139
  end
140
140
  end
141
141
 
@@ -167,58 +167,58 @@ describe BinData::LazyEvaluator, "with nested parents" do
167
167
  }
168
168
 
169
169
  it "accepts symbols as a shortcut to lambdas" do
170
- lazy_eval(:p1).must_equal 'Pp1'
171
- lazy_eval(:p2).must_equal 'PPp2'
172
- lazy_eval(:m1).must_equal 'Pm1'
173
- lazy_eval(:m2).must_equal 'PPm2'
170
+ _(lazy_eval(:p1)).must_equal 'Pp1'
171
+ _(lazy_eval(:p2)).must_equal 'PPp2'
172
+ _(lazy_eval(:m1)).must_equal 'Pm1'
173
+ _(lazy_eval(:m2)).must_equal 'PPm2'
174
174
  end
175
175
 
176
176
  it "does not resolve any unknown methods" do
177
- lambda { lazy_eval(lambda { unknown }) }.must_raise NoMethodError
177
+ _ { lazy_eval(lambda { unknown }) }.must_raise NoMethodError
178
178
  end
179
179
 
180
180
  it "resolves parameters in the parent" do
181
- lazy_eval(lambda { p1 }).must_equal 'Pp1'
181
+ _(lazy_eval(lambda { p1 })).must_equal 'Pp1'
182
182
  end
183
183
 
184
184
  it "resolves methods in the parent" do
185
- lazy_eval(lambda { m1 }).must_equal 'Pm1'
185
+ _(lazy_eval(lambda { m1 })).must_equal 'Pm1'
186
186
  end
187
187
 
188
188
  it "resolves parameters in the parent's parent" do
189
- lazy_eval(lambda { p2 }).must_equal 'PPp2'
189
+ _(lazy_eval(lambda { p2 })).must_equal 'PPp2'
190
190
  end
191
191
 
192
192
  it "resolves methods in the parent's parent" do
193
- lazy_eval(lambda { m2 }).must_equal 'PPm2'
193
+ _(lazy_eval(lambda { m2 })).must_equal 'PPm2'
194
194
  end
195
195
 
196
196
  it "invokes methods in the parent" do
197
- lazy_eval(lambda { echo(m1) }).must_equal ['P', 'Pm1']
197
+ _(lazy_eval(lambda { echo(m1) })).must_equal ['P', 'Pm1']
198
198
  end
199
199
 
200
200
  it "invokes methods in the parent's parent" do
201
- lazy_eval(lambda { parent.echo(m1) }, { m1: 'o1'}).must_equal ['PP', 'o1']
201
+ _(lazy_eval(lambda { parent.echo(m1) }, { m1: 'o1'})).must_equal ['PP', 'o1']
202
202
  end
203
203
 
204
204
  it "invokes methods in the parent's parent" do
205
- lazy_eval(lambda { echo2(m1) }).must_equal ['PP2', 'Pm1']
205
+ _(lazy_eval(lambda { echo2(m1) })).must_equal ['PP2', 'Pm1']
206
206
  end
207
207
 
208
208
  it "resolves parameters in preference to methods in the parent" do
209
- lazy_eval(lambda { com1 }).must_equal 'PpC'
209
+ _(lazy_eval(lambda { com1 })).must_equal 'PpC'
210
210
  end
211
211
 
212
212
  it "resolves methods in the parent explicitly" do
213
- lazy_eval(lambda { parent.m1 }).must_equal 'PPm1'
213
+ _(lazy_eval(lambda { parent.m1 })).must_equal 'PPm1'
214
214
  end
215
215
 
216
216
  it "cascades lambdas " do
217
- lazy_eval(lambda { sym1 }).must_equal 'PPm2'
218
- lazy_eval(lambda { sym2 }).must_equal 'PPm2'
217
+ _(lazy_eval(lambda { sym1 })).must_equal 'PPm2'
218
+ _(lazy_eval(lambda { sym2 })).must_equal 'PPm2'
219
219
  end
220
220
 
221
221
  it "does not resolve #index" do
222
- lambda { lazy_eval(lambda { index }) }.must_raise NoMethodError
222
+ _ { lazy_eval(lambda { index }) }.must_raise NoMethodError
223
223
  end
224
224
  end
data/test/params_test.rb CHANGED
@@ -5,15 +5,15 @@ require File.expand_path(File.join(File.dirname(__FILE__), "test_helper"))
5
5
 
6
6
  describe BinData::Base, "parameters" do
7
7
  it "fails when parameter name is invalid" do
8
- lambda {
8
+ _ {
9
9
  class InvalidParameterNameBase < BinData::Base
10
- optional_parameter :eval # i.e. Kernel#eval
10
+ optional_parameter :lazy_eval # from LazyEvaluator
11
11
  end
12
12
  }.must_raise NameError
13
13
  end
14
14
 
15
15
  it "fails when parameter has nil value" do
16
- lambda { BinData::Base.new(a: nil) }.must_raise ArgumentError
16
+ _ { BinData::Base.new(a: nil) }.must_raise ArgumentError
17
17
  end
18
18
  end
19
19
 
@@ -32,17 +32,17 @@ end
32
32
  describe BinData::Base, "#get_parameter" do
33
33
  it "retrieves parameter values" do
34
34
  obj = BinData::Base.new(a: 3)
35
- obj.get_parameter(:a).must_equal 3
35
+ _(obj.get_parameter(:a)).must_equal 3
36
36
  end
37
37
 
38
38
  it "retrieves parameter values with string keys" do
39
39
  obj = BinData::Base.new('a' => 3)
40
- obj.get_parameter(:a).must_equal 3
40
+ _(obj.get_parameter(:a)).must_equal 3
41
41
  end
42
42
 
43
43
  it "returns nil for non existing parameters" do
44
44
  obj = BinData::Base.new
45
- obj.get_parameter(:a).must_be_nil
45
+ _(obj.get_parameter(:a)).must_be_nil
46
46
  end
47
47
 
48
48
  it "wont eval parameters" do
@@ -54,12 +54,12 @@ end
54
54
  describe BinData::Base, "#eval_parameter" do
55
55
  it "evals the parameter" do
56
56
  obj = BinData::Base.new(a: -> { 3 })
57
- obj.eval_parameter(:a).must_equal 3
57
+ _(obj.eval_parameter(:a)).must_equal 3
58
58
  end
59
59
 
60
60
  it "returns nil for a non existing parameter" do
61
61
  obj = BinData::Base.new
62
- obj.eval_parameter(:a).must_be_nil
62
+ _(obj.eval_parameter(:a)).must_be_nil
63
63
  end
64
64
  end
65
65
 
@@ -71,11 +71,11 @@ describe BinData::Base, ".mandatory_parameters" do
71
71
 
72
72
  it "fails when not all mandatory parameters are present" do
73
73
  params = {p1: "a", xx: "b" }
74
- lambda { MandatoryBase.new(params) }.must_raise ArgumentError
74
+ _ { MandatoryBase.new(params) }.must_raise ArgumentError
75
75
  end
76
76
 
77
77
  it "fails when no mandatory parameters are present" do
78
- lambda { MandatoryBase.new() }.must_raise ArgumentError
78
+ _ { MandatoryBase.new() }.must_raise ArgumentError
79
79
  end
80
80
  end
81
81
 
@@ -86,12 +86,12 @@ describe BinData::Base, ".default_parameters" do
86
86
 
87
87
  it "uses default parameters when not specified" do
88
88
  obj = DefaultBase.new
89
- obj.eval_parameter(:p1).must_equal "a"
89
+ _(obj.eval_parameter(:p1)).must_equal "a"
90
90
  end
91
91
 
92
92
  it "can override default parameters" do
93
93
  obj = DefaultBase.new(p1: "b")
94
- obj.eval_parameter(:p1).must_equal "b"
94
+ _(obj.eval_parameter(:p1)).must_equal "b"
95
95
  end
96
96
  end
97
97
 
@@ -102,9 +102,9 @@ describe BinData::Base, ".mutually_exclusive_parameters" do
102
102
  end
103
103
 
104
104
  it "fails when any two of those parameters are present" do
105
- lambda { MutexParamBase.new(p1: "a", p2: "b") }.must_raise ArgumentError
106
- lambda { MutexParamBase.new(p1: "a", p3: "c") }.must_raise ArgumentError
107
- lambda { MutexParamBase.new(p2: "b", p3: "c") }.must_raise ArgumentError
105
+ _ { MutexParamBase.new(p1: "a", p2: "b") }.must_raise ArgumentError
106
+ _ { MutexParamBase.new(p1: "a", p3: "c") }.must_raise ArgumentError
107
+ _ { MutexParamBase.new(p2: "b", p3: "c") }.must_raise ArgumentError
108
108
  end
109
109
  end
110
110
 
@@ -119,8 +119,8 @@ describe BinData::Base, "subclassing" do
119
119
 
120
120
  it "inherits parameters" do
121
121
  accepted = ParamLevel2Base.accepted_parameters.all
122
- accepted.must_include :p1
123
- accepted.must_include :p2
122
+ _(accepted).must_include :p1
123
+ _(accepted).must_include :p2
124
124
  end
125
125
  end
126
126
 
@@ -138,7 +138,7 @@ describe BinData::Base, "subclassing when skipping a level" do
138
138
 
139
139
  it "inherits parameters" do
140
140
  accepted = ParamLevel3Base.accepted_parameters.all
141
- accepted.must_include :p1
142
- accepted.must_include :p2
141
+ _(accepted).must_include :p1
142
+ _(accepted).must_include :p2
143
143
  end
144
144
  end
@@ -4,7 +4,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), "test_helper"))
4
4
 
5
5
  describe BinData::Primitive do
6
6
  it "is not registered" do
7
- lambda {
7
+ _ {
8
8
  BinData::RegisteredClasses.lookup("Primitive")
9
9
  }.must_raise BinData::UnRegisteredTypeError
10
10
  end
@@ -18,14 +18,14 @@ describe BinData::Primitive, "all subclasses" do
18
18
  let(:obj) { SubClassOfPrimitive.new }
19
19
 
20
20
  it "raise errors on unimplemented methods" do
21
- lambda { obj.set(nil) }.must_raise NotImplementedError
22
- lambda { obj.get }.must_raise NotImplementedError
21
+ _ { obj.set(nil) }.must_raise NotImplementedError
22
+ _ { obj.get }.must_raise NotImplementedError
23
23
  end
24
24
  end
25
25
 
26
26
  describe BinData::Primitive, "when defining with errors" do
27
27
  it "fails on non registered types" do
28
- lambda {
28
+ _ {
29
29
  class BadTypePrimitive < BinData::Primitive
30
30
  non_registered_type :a
31
31
  end
@@ -33,7 +33,7 @@ describe BinData::Primitive, "when defining with errors" do
33
33
  end
34
34
 
35
35
  it "fails on duplicate names" do
36
- lambda {
36
+ _ {
37
37
  class DuplicateNamePrimitive < BinData::Primitive
38
38
  int8 :a
39
39
  int8 :b
@@ -43,15 +43,15 @@ describe BinData::Primitive, "when defining with errors" do
43
43
  end
44
44
 
45
45
  it "fails when field name shadows an existing method" do
46
- lambda {
46
+ _ {
47
47
  class ExistingNamePrimitive < BinData::Primitive
48
48
  int8 :object_id
49
49
  end
50
- }.must_raise_on_line NameError, 2, "field 'object_id' shadows an existing method in ExistingNamePrimitive"
50
+ }.must_raise_on_line SyntaxError, 2, "field 'object_id' shadows an existing method in ExistingNamePrimitive"
51
51
  end
52
52
 
53
53
  it "fails on unknown endian" do
54
- lambda {
54
+ _ {
55
55
  class BadEndianPrimitive < BinData::Primitive
56
56
  endian 'a bad value'
57
57
  end
@@ -71,30 +71,30 @@ describe BinData::Primitive do
71
71
 
72
72
  it "assigns value" do
73
73
  obj.value = 5
74
- obj.value.must_equal 5
74
+ _(obj.value).must_equal 5
75
75
  end
76
76
 
77
77
  it "produces binary string" do
78
78
  obj.assign(5)
79
- obj.to_binary_s.must_equal_binary "\x05\x00"
79
+ _(obj.to_binary_s).must_equal_binary "\x05\x00"
80
80
  end
81
81
 
82
82
  it "reads value" do
83
83
  obj.read("\x00\x01")
84
- obj.must_equal 0x100
84
+ _(obj).must_equal 0x100
85
85
  end
86
86
 
87
87
  it "accepts standard parameters" do
88
88
  obj = PrimitiveWithEndian.new(initial_value: 2)
89
- obj.to_binary_s.must_equal_binary "\x02\x00"
89
+ _(obj.to_binary_s).must_equal_binary "\x02\x00"
90
90
  end
91
91
 
92
92
  it "returns num_bytes" do
93
- obj.num_bytes.must_equal 2
93
+ _(obj.num_bytes).must_equal 2
94
94
  end
95
95
 
96
96
  it "raises error on missing methods" do
97
- lambda {
97
+ _ {
98
98
  obj.does_not_exist
99
99
  }.must_raise NoMethodError
100
100
  end
@@ -102,16 +102,16 @@ describe BinData::Primitive do
102
102
  it "uses read value whilst reading" do
103
103
  obj = PrimitiveWithEndian.new(value: 2)
104
104
  obj.read "\x05\x00"
105
- obj.must_equal 2
105
+ _(obj).must_equal 2
106
106
 
107
107
  obj.stub :reading?, true do
108
- obj.must_equal 5
108
+ _(obj).must_equal 5
109
109
  end
110
110
  end
111
111
 
112
112
  it "behaves as primitive" do
113
113
  obj.assign(5)
114
- (2 + obj).must_equal 7
114
+ _((2 + obj)).must_equal 7
115
115
  end
116
116
  end
117
117
 
@@ -124,7 +124,7 @@ describe BinData::Primitive, "requiring custom parameters" do
124
124
 
125
125
  it "passes parameters correctly" do
126
126
  obj = PrimitiveWithCustom.new(iv: 5)
127
- obj.must_equal 5
127
+ _(obj).must_equal 5
128
128
  end
129
129
  end
130
130
 
@@ -138,12 +138,12 @@ describe BinData::Primitive, "with custom mandatory parameters" do
138
138
  end
139
139
 
140
140
  it "raises error if mandatory parameter is not supplied" do
141
- lambda { MandatoryPrimitive.new }.must_raise ArgumentError
141
+ _ { MandatoryPrimitive.new }.must_raise ArgumentError
142
142
  end
143
143
 
144
144
  it "uses mandatory parameter" do
145
145
  obj = MandatoryPrimitive.new(arg1: 5)
146
- obj.must_equal 5
146
+ _(obj).must_equal 5
147
147
  end
148
148
  end
149
149
 
@@ -158,12 +158,12 @@ describe BinData::Primitive, "with custom default parameters" do
158
158
 
159
159
  it "uses default parameter" do
160
160
  obj = DefaultPrimitive.new
161
- obj.must_equal 5
161
+ _(obj).must_equal 5
162
162
  end
163
163
 
164
164
  it "overrides default parameter" do
165
165
  obj = DefaultPrimitive.new(arg1: 7)
166
- obj.must_equal 7
166
+ _(obj).must_equal 7
167
167
  end
168
168
  end
169
169
 
@@ -180,12 +180,12 @@ describe BinData::Primitive, "subclassed with default parameter" do
180
180
 
181
181
  it "overrides initial_value" do
182
182
  a = ChildDerivedPrimitive.new(initial_value: 7)
183
- a.to_binary_s.must_equal_binary "\000\007"
183
+ _(a.to_binary_s).must_equal_binary "\000\007"
184
184
  end
185
185
 
186
186
  it "uses default parameter" do
187
187
  a = ChildDerivedPrimitive.new
188
- a.to_binary_s.must_equal_binary "\000\005"
188
+ _(a.to_binary_s).must_equal_binary "\000\005"
189
189
  end
190
190
  end
191
191
 
@@ -199,12 +199,12 @@ describe BinData::Primitive, "with mutating #get and #set" do
199
199
  it "#assign applies mutator" do
200
200
  obj = MutatingPrimitive.new
201
201
  obj.assign(-50)
202
- obj.snapshot.must_equal 50
202
+ _(obj.snapshot).must_equal 50
203
203
  end
204
204
 
205
205
  it "#to_binary_s applies mutator" do
206
206
  obj = MutatingPrimitive.new
207
207
  obj.assign(-50)
208
- obj.to_binary_s.must_equal_binary "\062\000"
208
+ _(obj.to_binary_s).must_equal_binary "\062\000"
209
209
  end
210
210
  end