hexdump 0.2.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/ruby.yml +29 -0
- data/.gitignore +4 -0
- data/.yardopts +1 -1
- data/ChangeLog.md +98 -1
- data/Gemfile +12 -0
- data/LICENSE.txt +1 -1
- data/README.md +490 -118
- data/Rakefile +7 -32
- data/benchmark.rb +54 -0
- data/gemspec.yml +9 -6
- data/hexdump.gemspec +57 -11
- data/lib/hexdump/chars.rb +46 -0
- data/lib/hexdump/core_ext/file.rb +84 -0
- data/lib/hexdump/core_ext/io.rb +7 -0
- data/lib/hexdump/core_ext/kernel.rb +7 -0
- data/lib/hexdump/core_ext/string.rb +7 -0
- data/lib/hexdump/core_ext/string_io.rb +9 -0
- data/lib/hexdump/core_ext.rb +5 -0
- data/lib/hexdump/extensions.rb +2 -4
- data/lib/hexdump/format_string.rb +43 -0
- data/lib/hexdump/hexdump.rb +769 -81
- data/lib/hexdump/mixin.rb +198 -0
- data/lib/hexdump/module_methods.rb +132 -0
- data/lib/hexdump/numeric/binary.rb +55 -0
- data/lib/hexdump/numeric/char_or_int.rb +90 -0
- data/lib/hexdump/numeric/decimal.rb +56 -0
- data/lib/hexdump/numeric/exceptions.rb +11 -0
- data/lib/hexdump/numeric/hexadecimal.rb +59 -0
- data/lib/hexdump/numeric/octal.rb +55 -0
- data/lib/hexdump/numeric.rb +5 -0
- data/lib/hexdump/reader.rb +314 -0
- data/lib/hexdump/theme/ansi.rb +81 -0
- data/lib/hexdump/theme/rule.rb +159 -0
- data/lib/hexdump/theme.rb +61 -0
- data/lib/hexdump/type.rb +232 -0
- data/lib/hexdump/types.rb +108 -0
- data/lib/hexdump/version.rb +4 -0
- data/lib/hexdump.rb +14 -2
- data/spec/chars_spec.rb +76 -0
- data/spec/core_ext_spec.rb +24 -0
- data/spec/hexdump_class_spec.rb +1708 -0
- data/spec/hexdump_module_spec.rb +23 -0
- data/spec/mixin_spec.rb +37 -0
- data/spec/numeric/binary_spec.rb +239 -0
- data/spec/numeric/char_or_int_spec.rb +210 -0
- data/spec/numeric/decimal_spec.rb +317 -0
- data/spec/numeric/hexadecimal_spec.rb +320 -0
- data/spec/numeric/octal_spec.rb +239 -0
- data/spec/reader_spec.rb +863 -0
- data/spec/spec_helper.rb +0 -1
- data/spec/theme/ansi_spec.rb +242 -0
- data/spec/theme/rule_spec.rb +199 -0
- data/spec/theme_spec.rb +94 -0
- data/spec/type_spec.rb +317 -0
- data/spec/types_spec.rb +904 -0
- metadata +91 -84
- data/.gemtest +0 -0
- data/benchmarks/hexdump.rb +0 -45
- data/lib/hexdump/dumper.rb +0 -441
- data/lib/hexdump/extensions/file.rb +0 -22
- data/lib/hexdump/extensions/io.rb +0 -7
- data/lib/hexdump/extensions/string.rb +0 -7
- data/lib/hexdump/extensions/string_io.rb +0 -9
- data/spec/dumper_spec.rb +0 -260
- data/spec/extensions_spec.rb +0 -20
- data/spec/hexdump_spec.rb +0 -29
data/spec/type_spec.rb
ADDED
@@ -0,0 +1,317 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'hexdump/type'
|
3
|
+
|
4
|
+
describe Hexdump::Type do
|
5
|
+
describe "#initialize" do
|
6
|
+
let(:size) { 4 }
|
7
|
+
let(:signed) { true }
|
8
|
+
|
9
|
+
subject { described_class.new(size: size, signed: signed) }
|
10
|
+
|
11
|
+
it "must set #size" do
|
12
|
+
expect(subject.size).to eq(size)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "must not set #endian" do
|
16
|
+
expect(subject.endian).to be(nil)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "must set #signed?" do
|
20
|
+
expect(subject.signed?).to eq(signed)
|
21
|
+
end
|
22
|
+
|
23
|
+
context "when given endian:" do
|
24
|
+
let(:endian) { :big }
|
25
|
+
|
26
|
+
subject do
|
27
|
+
described_class.new(size: size, endian: endian, signed: signed)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "must set #endian" do
|
31
|
+
expect(subject.endian).to eq(endian)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "#signed?" do
|
37
|
+
let(:size) { 4 }
|
38
|
+
|
39
|
+
subject { described_class.new(size: size, signed: signed) }
|
40
|
+
|
41
|
+
context "when initialized with signed: true" do
|
42
|
+
let(:signed) { true }
|
43
|
+
|
44
|
+
it do
|
45
|
+
expect(subject.signed?).to be(true)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context "when initialized with signed: false" do
|
50
|
+
let(:signed) { false }
|
51
|
+
|
52
|
+
it do
|
53
|
+
expect(subject.signed?).to be(false)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "#unsigned?" do
|
59
|
+
let(:size) { 4 }
|
60
|
+
|
61
|
+
subject { described_class.new(size: size, signed: signed) }
|
62
|
+
|
63
|
+
context "when initialized with signed: true" do
|
64
|
+
let(:signed) { true }
|
65
|
+
|
66
|
+
it do
|
67
|
+
expect(subject.unsigned?).to be(false)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context "when initialized with signed: false" do
|
72
|
+
let(:signed) { false }
|
73
|
+
|
74
|
+
it do
|
75
|
+
expect(subject.unsigned?).to be(true)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe Hexdump::Type::UInt do
|
81
|
+
subject { described_class.new(size: 4) }
|
82
|
+
|
83
|
+
describe "#initialize" do
|
84
|
+
it "must default #signed? to false" do
|
85
|
+
expect(subject.signed?).to be(false)
|
86
|
+
end
|
87
|
+
|
88
|
+
it "must default #endian to NATIVE_ENDIAN" do
|
89
|
+
expect(subject.endian).to eq(Hexdump::Type::NATIVE_ENDIAN)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe Hexdump::Type::UInt8 do
|
95
|
+
it { expect(subject).kind_of?(Hexdump::Type::UInt) }
|
96
|
+
|
97
|
+
describe "#initialize" do
|
98
|
+
it "must default #signed? to false" do
|
99
|
+
expect(subject.signed?).to be(false)
|
100
|
+
end
|
101
|
+
|
102
|
+
it "must default #size to 1" do
|
103
|
+
expect(subject.size).to be(1)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "must default #endian to nil" do
|
107
|
+
expect(subject.endian).to be(nil)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
describe Hexdump::Type::UInt16 do
|
113
|
+
it { expect(subject).kind_of?(Hexdump::Type::UInt) }
|
114
|
+
|
115
|
+
describe "#initialize" do
|
116
|
+
it "must default #signed? to false" do
|
117
|
+
expect(subject.signed?).to be(false)
|
118
|
+
end
|
119
|
+
|
120
|
+
it "must default #size to 2" do
|
121
|
+
expect(subject.size).to be(2)
|
122
|
+
end
|
123
|
+
|
124
|
+
it "must default #endian to NATIVE_ENDIAN" do
|
125
|
+
expect(subject.endian).to eq(Hexdump::Type::NATIVE_ENDIAN)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
describe Hexdump::Type::UInt32 do
|
131
|
+
it { expect(subject).kind_of?(Hexdump::Type::UInt) }
|
132
|
+
|
133
|
+
describe "#initialize" do
|
134
|
+
it "must default #signed? to false" do
|
135
|
+
expect(subject.signed?).to be(false)
|
136
|
+
end
|
137
|
+
|
138
|
+
it "must default #size to 4" do
|
139
|
+
expect(subject.size).to be(4)
|
140
|
+
end
|
141
|
+
|
142
|
+
it "must default #endian to NATIVE_ENDIAN" do
|
143
|
+
expect(subject.endian).to eq(Hexdump::Type::NATIVE_ENDIAN)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
describe Hexdump::Type::UInt64 do
|
149
|
+
it { expect(subject).kind_of?(Hexdump::Type::UInt) }
|
150
|
+
|
151
|
+
describe "#initialize" do
|
152
|
+
it "must default #signed? to false" do
|
153
|
+
expect(subject.signed?).to be(false)
|
154
|
+
end
|
155
|
+
|
156
|
+
it "must default #size to 8" do
|
157
|
+
expect(subject.size).to be(8)
|
158
|
+
end
|
159
|
+
|
160
|
+
it "must default #endian to NATIVE_ENDIAN" do
|
161
|
+
expect(subject.endian).to eq(Hexdump::Type::NATIVE_ENDIAN)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
describe Hexdump::Type::Int do
|
167
|
+
subject { described_class.new(size: 4) }
|
168
|
+
|
169
|
+
describe "#initialize" do
|
170
|
+
it "must default #signed? to true" do
|
171
|
+
expect(subject.signed?).to be(true)
|
172
|
+
end
|
173
|
+
|
174
|
+
it "must default #endian to NATIVE_ENDIAN" do
|
175
|
+
expect(subject.endian).to eq(Hexdump::Type::NATIVE_ENDIAN)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
describe Hexdump::Type::Int8 do
|
181
|
+
it { expect(subject).kind_of?(Hexdump::Type::Int) }
|
182
|
+
|
183
|
+
describe "#initialize" do
|
184
|
+
it "must default #signed? to true" do
|
185
|
+
expect(subject.signed?).to be(true)
|
186
|
+
end
|
187
|
+
|
188
|
+
it "must default #size to 1" do
|
189
|
+
expect(subject.size).to be(1)
|
190
|
+
end
|
191
|
+
|
192
|
+
it "must default #endian to nil" do
|
193
|
+
expect(subject.endian).to be(nil)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
describe Hexdump::Type::Int16 do
|
199
|
+
it { expect(subject).kind_of?(Hexdump::Type::Int) }
|
200
|
+
|
201
|
+
describe "#initialize" do
|
202
|
+
it "must default #signed? to true" do
|
203
|
+
expect(subject.signed?).to be(true)
|
204
|
+
end
|
205
|
+
|
206
|
+
it "must default #size to 2" do
|
207
|
+
expect(subject.size).to be(2)
|
208
|
+
end
|
209
|
+
|
210
|
+
it "must default #endian to NATIVE_ENDIAN" do
|
211
|
+
expect(subject.endian).to eq(Hexdump::Type::NATIVE_ENDIAN)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
describe Hexdump::Type::Int32 do
|
217
|
+
it { expect(subject).kind_of?(Hexdump::Type::Int) }
|
218
|
+
|
219
|
+
describe "#initialize" do
|
220
|
+
it "must default #signed? to true" do
|
221
|
+
expect(subject.signed?).to be(true)
|
222
|
+
end
|
223
|
+
|
224
|
+
it "must default #size to 4" do
|
225
|
+
expect(subject.size).to be(4)
|
226
|
+
end
|
227
|
+
|
228
|
+
it "must default #endian to NATIVE_ENDIAN" do
|
229
|
+
expect(subject.endian).to eq(Hexdump::Type::NATIVE_ENDIAN)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
describe Hexdump::Type::Int64 do
|
235
|
+
it { expect(subject).kind_of?(Hexdump::Type::Int) }
|
236
|
+
|
237
|
+
describe "#initialize" do
|
238
|
+
it "must default #signed? to true" do
|
239
|
+
expect(subject.signed?).to be(true)
|
240
|
+
end
|
241
|
+
|
242
|
+
it "must default #size to 8" do
|
243
|
+
expect(subject.size).to be(8)
|
244
|
+
end
|
245
|
+
|
246
|
+
it "must default #endian to NATIVE_ENDIAN" do
|
247
|
+
expect(subject.endian).to eq(Hexdump::Type::NATIVE_ENDIAN)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
describe Hexdump::Type::Char do
|
253
|
+
describe "#initialize" do
|
254
|
+
it "must set #signed? to true" do
|
255
|
+
expect(subject.signed?).to be(true)
|
256
|
+
end
|
257
|
+
|
258
|
+
it "must set #size to 1" do
|
259
|
+
expect(subject.size).to eq(1)
|
260
|
+
end
|
261
|
+
|
262
|
+
it "must set #endian to nil" do
|
263
|
+
expect(subject.endian).to be(nil)
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
describe Hexdump::Type::UChar do
|
269
|
+
describe "#initialize" do
|
270
|
+
it "must set #signed? to false" do
|
271
|
+
expect(subject.signed?).to be(false)
|
272
|
+
end
|
273
|
+
|
274
|
+
it "must set #size to 1" do
|
275
|
+
expect(subject.size).to eq(1)
|
276
|
+
end
|
277
|
+
|
278
|
+
it "must set #endian to nil" do
|
279
|
+
expect(subject.endian).to be(nil)
|
280
|
+
end
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
describe Hexdump::Type::Float do
|
285
|
+
subject { described_class.new(size: 4) }
|
286
|
+
|
287
|
+
describe "#initialize" do
|
288
|
+
it "must default #signed? to true" do
|
289
|
+
expect(subject.signed?).to be(true)
|
290
|
+
end
|
291
|
+
|
292
|
+
it "must default #endian to NATIVE_ENDIAN" do
|
293
|
+
expect(subject.endian).to eq(Hexdump::Type::NATIVE_ENDIAN)
|
294
|
+
end
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
298
|
+
describe Hexdump::Type::Float32 do
|
299
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Float) }
|
300
|
+
|
301
|
+
describe "#initialize" do
|
302
|
+
it "must default #size to 4" do
|
303
|
+
expect(subject.size).to be(4)
|
304
|
+
end
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
308
|
+
describe Hexdump::Type::Float64 do
|
309
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Float) }
|
310
|
+
|
311
|
+
describe "#initialize" do
|
312
|
+
it "must default #size to 8" do
|
313
|
+
expect(subject.size).to be(8)
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
317
|
+
end
|
data/spec/types_spec.rb
ADDED
@@ -0,0 +1,904 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'hexdump/types'
|
3
|
+
|
4
|
+
describe "Hexdump::TYPES" do
|
5
|
+
subject { Hexdump::TYPES }
|
6
|
+
|
7
|
+
describe "byte" do
|
8
|
+
it "must be an alias to uint8" do
|
9
|
+
expect(subject[:byte]).to be(subject[:uint8])
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "char" do
|
14
|
+
subject { super()[:char] }
|
15
|
+
|
16
|
+
it { expect(subject).to_not be(nil) }
|
17
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Char) }
|
18
|
+
|
19
|
+
it "size must equal 1" do
|
20
|
+
expect(subject.size).to eq(1)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "must not have endian-ness" do
|
24
|
+
expect(subject.endian).to be(nil)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "must be signed" do
|
28
|
+
expect(subject.signed?).to be(true)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "uchar" do
|
33
|
+
subject { super()[:uchar] }
|
34
|
+
|
35
|
+
it { expect(subject).to_not be(nil) }
|
36
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::UChar) }
|
37
|
+
|
38
|
+
it "size must equal 1" do
|
39
|
+
expect(subject.size).to eq(1)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "must not have endian-ness" do
|
43
|
+
expect(subject.endian).to be(nil)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "must not be signed" do
|
47
|
+
expect(subject.signed?).to be(false)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "int8" do
|
52
|
+
subject { super()[:int8] }
|
53
|
+
|
54
|
+
it { expect(subject).to_not be(nil) }
|
55
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Int8) }
|
56
|
+
|
57
|
+
it "size must equal 1" do
|
58
|
+
expect(subject.size).to eq(1)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "must not have endian-ness" do
|
62
|
+
expect(subject.endian).to be(nil)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "must be signed" do
|
66
|
+
expect(subject.signed?).to be(true)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "uint8" do
|
71
|
+
subject { super()[:uint8] }
|
72
|
+
|
73
|
+
it { expect(subject).to_not be(nil) }
|
74
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::UInt8) }
|
75
|
+
|
76
|
+
it "size must equal 1" do
|
77
|
+
expect(subject.size).to eq(1)
|
78
|
+
end
|
79
|
+
|
80
|
+
it "must not have endian-ness" do
|
81
|
+
expect(subject.endian).to be(nil)
|
82
|
+
end
|
83
|
+
|
84
|
+
it "must not be signed" do
|
85
|
+
expect(subject.signed?).to be(false)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe "int16" do
|
90
|
+
subject { super()[:int16] }
|
91
|
+
|
92
|
+
it { expect(subject).to_not be(nil) }
|
93
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Int16) }
|
94
|
+
|
95
|
+
it "size must equal 2" do
|
96
|
+
expect(subject.size).to eq(2)
|
97
|
+
end
|
98
|
+
|
99
|
+
it "must be signed" do
|
100
|
+
expect(subject.signed?).to be(true)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe "int16_le" do
|
105
|
+
subject { super()[:int16_le] }
|
106
|
+
|
107
|
+
it { expect(subject).to_not be(nil) }
|
108
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Int16) }
|
109
|
+
|
110
|
+
it "size must equal 2" do
|
111
|
+
expect(subject.size).to eq(2)
|
112
|
+
end
|
113
|
+
|
114
|
+
it "must be signed" do
|
115
|
+
expect(subject.signed?).to be(true)
|
116
|
+
end
|
117
|
+
|
118
|
+
it "endian must be little" do
|
119
|
+
expect(subject.endian).to eq(:little)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
describe "int16_be" do
|
124
|
+
subject { super()[:int16_be] }
|
125
|
+
|
126
|
+
it { expect(subject).to_not be(nil) }
|
127
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Int16) }
|
128
|
+
|
129
|
+
it "size must equal 2" do
|
130
|
+
expect(subject.size).to eq(2)
|
131
|
+
end
|
132
|
+
|
133
|
+
it "must be signed" do
|
134
|
+
expect(subject.signed?).to be(true)
|
135
|
+
end
|
136
|
+
|
137
|
+
it "endian must be big" do
|
138
|
+
expect(subject.endian).to eq(:big)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
describe "int16_ne" do
|
143
|
+
subject { super()[:int16_ne] }
|
144
|
+
|
145
|
+
it { expect(subject).to_not be(nil) }
|
146
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Int16) }
|
147
|
+
|
148
|
+
it "size must equal 2" do
|
149
|
+
expect(subject.size).to eq(2)
|
150
|
+
end
|
151
|
+
|
152
|
+
it "must be signed" do
|
153
|
+
expect(subject.signed?).to be(true)
|
154
|
+
end
|
155
|
+
|
156
|
+
it "endian must be big" do
|
157
|
+
expect(subject.endian).to eq(:big)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
describe "uint16" do
|
162
|
+
subject { super()[:uint16] }
|
163
|
+
|
164
|
+
it { expect(subject).to_not be(nil) }
|
165
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::UInt16) }
|
166
|
+
|
167
|
+
it "size must equal 2" do
|
168
|
+
expect(subject.size).to eq(2)
|
169
|
+
end
|
170
|
+
|
171
|
+
it "must not be signed" do
|
172
|
+
expect(subject.signed?).to be(false)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
describe "uint16_le" do
|
177
|
+
subject { super()[:uint16_le] }
|
178
|
+
|
179
|
+
it { expect(subject).to_not be(nil) }
|
180
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::UInt16) }
|
181
|
+
|
182
|
+
it "size must equal 2" do
|
183
|
+
expect(subject.size).to eq(2)
|
184
|
+
end
|
185
|
+
|
186
|
+
it "must be signed" do
|
187
|
+
expect(subject.signed?).to be(false)
|
188
|
+
end
|
189
|
+
|
190
|
+
it "endian must be little" do
|
191
|
+
expect(subject.endian).to eq(:little)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
describe "uint16_be" do
|
196
|
+
subject { super()[:uint16_be] }
|
197
|
+
|
198
|
+
it { expect(subject).to_not be(nil) }
|
199
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::UInt16) }
|
200
|
+
|
201
|
+
it "size must equal 2" do
|
202
|
+
expect(subject.size).to eq(2)
|
203
|
+
end
|
204
|
+
|
205
|
+
it "must be signed" do
|
206
|
+
expect(subject.signed?).to be(false)
|
207
|
+
end
|
208
|
+
|
209
|
+
it "endian must be big" do
|
210
|
+
expect(subject.endian).to eq(:big)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
describe "uint16_ne" do
|
215
|
+
subject { super()[:uint16_ne] }
|
216
|
+
|
217
|
+
it { expect(subject).to_not be(nil) }
|
218
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::UInt16) }
|
219
|
+
|
220
|
+
it "size must equal 2" do
|
221
|
+
expect(subject.size).to eq(2)
|
222
|
+
end
|
223
|
+
|
224
|
+
it "must be signed" do
|
225
|
+
expect(subject.signed?).to be(false)
|
226
|
+
end
|
227
|
+
|
228
|
+
it "endian must be big" do
|
229
|
+
expect(subject.endian).to eq(:big)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
describe "short" do
|
234
|
+
it "must be an alias to int16" do
|
235
|
+
expect(subject[:short]).to be(subject[:int16])
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
describe "short_le" do
|
240
|
+
it "must be an alias to int16_le" do
|
241
|
+
expect(subject[:short_le]).to be(subject[:int16_le])
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
describe "short_be" do
|
246
|
+
it "must be an alias to int16_be" do
|
247
|
+
expect(subject[:short_be]).to be(subject[:int16_be])
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
describe "short_ne" do
|
252
|
+
it "must be an alias to int16_ne" do
|
253
|
+
expect(subject[:short_ne]).to be(subject[:int16_ne])
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
describe "ushort" do
|
258
|
+
it "must be an alias to uint16" do
|
259
|
+
expect(subject[:ushort]).to be(subject[:uint16])
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
describe "ushort_le" do
|
264
|
+
it "must be an alias to uint16_le" do
|
265
|
+
expect(subject[:ushort_le]).to be(subject[:uint16_le])
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
describe "ushort_be" do
|
270
|
+
it "must be an alias to uint16_be" do
|
271
|
+
expect(subject[:ushort_be]).to be(subject[:uint16_be])
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
describe "ushort_ne" do
|
276
|
+
it "must be an alias to uint16_ne" do
|
277
|
+
expect(subject[:ushort_ne]).to be(subject[:uint16_ne])
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
describe "int32" do
|
282
|
+
subject { super()[:int32] }
|
283
|
+
|
284
|
+
it { expect(subject).to_not be(nil) }
|
285
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Int32) }
|
286
|
+
|
287
|
+
it "size must equal 4" do
|
288
|
+
expect(subject.size).to eq(4)
|
289
|
+
end
|
290
|
+
|
291
|
+
it "must be signed" do
|
292
|
+
expect(subject.signed?).to be(true)
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
describe "int32_le" do
|
297
|
+
subject { super()[:int32_le] }
|
298
|
+
|
299
|
+
it { expect(subject).to_not be(nil) }
|
300
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Int32) }
|
301
|
+
|
302
|
+
it "size must equal 4" do
|
303
|
+
expect(subject.size).to eq(4)
|
304
|
+
end
|
305
|
+
|
306
|
+
it "must be signed" do
|
307
|
+
expect(subject.signed?).to be(true)
|
308
|
+
end
|
309
|
+
|
310
|
+
it "endian must be little" do
|
311
|
+
expect(subject.endian).to eq(:little)
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
describe "int32_be" do
|
316
|
+
subject { super()[:int32_be] }
|
317
|
+
|
318
|
+
it { expect(subject).to_not be(nil) }
|
319
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Int32) }
|
320
|
+
|
321
|
+
it "size must equal 4" do
|
322
|
+
expect(subject.size).to eq(4)
|
323
|
+
end
|
324
|
+
|
325
|
+
it "must be signed" do
|
326
|
+
expect(subject.signed?).to be(true)
|
327
|
+
end
|
328
|
+
|
329
|
+
it "endian must be big" do
|
330
|
+
expect(subject.endian).to eq(:big)
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
describe "int32_ne" do
|
335
|
+
subject { super()[:int32_ne] }
|
336
|
+
|
337
|
+
it { expect(subject).to_not be(nil) }
|
338
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Int32) }
|
339
|
+
|
340
|
+
it "size must equal 4" do
|
341
|
+
expect(subject.size).to eq(4)
|
342
|
+
end
|
343
|
+
|
344
|
+
it "must be signed" do
|
345
|
+
expect(subject.signed?).to be(true)
|
346
|
+
end
|
347
|
+
|
348
|
+
it "endian must be big" do
|
349
|
+
expect(subject.endian).to eq(:big)
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
describe "uint32" do
|
354
|
+
subject { super()[:uint32] }
|
355
|
+
|
356
|
+
it { expect(subject).to_not be(nil) }
|
357
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::UInt32) }
|
358
|
+
|
359
|
+
it "size must equal 4" do
|
360
|
+
expect(subject.size).to eq(4)
|
361
|
+
end
|
362
|
+
|
363
|
+
it "must not be signed" do
|
364
|
+
expect(subject.signed?).to be(false)
|
365
|
+
end
|
366
|
+
end
|
367
|
+
|
368
|
+
describe "uint32_le" do
|
369
|
+
subject { super()[:uint32_le] }
|
370
|
+
|
371
|
+
it { expect(subject).to_not be(nil) }
|
372
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::UInt32) }
|
373
|
+
|
374
|
+
it "size must equal 4" do
|
375
|
+
expect(subject.size).to eq(4)
|
376
|
+
end
|
377
|
+
|
378
|
+
it "must be signed" do
|
379
|
+
expect(subject.signed?).to be(false)
|
380
|
+
end
|
381
|
+
|
382
|
+
it "endian must be little" do
|
383
|
+
expect(subject.endian).to eq(:little)
|
384
|
+
end
|
385
|
+
end
|
386
|
+
|
387
|
+
describe "uint32_be" do
|
388
|
+
subject { super()[:uint32_be] }
|
389
|
+
|
390
|
+
it { expect(subject).to_not be(nil) }
|
391
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::UInt32) }
|
392
|
+
|
393
|
+
it "size must equal 4" do
|
394
|
+
expect(subject.size).to eq(4)
|
395
|
+
end
|
396
|
+
|
397
|
+
it "must be signed" do
|
398
|
+
expect(subject.signed?).to be(false)
|
399
|
+
end
|
400
|
+
|
401
|
+
it "endian must be big" do
|
402
|
+
expect(subject.endian).to eq(:big)
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
406
|
+
describe "uint32_ne" do
|
407
|
+
subject { super()[:uint32_ne] }
|
408
|
+
|
409
|
+
it { expect(subject).to_not be(nil) }
|
410
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::UInt32) }
|
411
|
+
|
412
|
+
it "size must equal 4" do
|
413
|
+
expect(subject.size).to eq(4)
|
414
|
+
end
|
415
|
+
|
416
|
+
it "must be signed" do
|
417
|
+
expect(subject.signed?).to be(false)
|
418
|
+
end
|
419
|
+
|
420
|
+
it "endian must be big" do
|
421
|
+
expect(subject.endian).to eq(:big)
|
422
|
+
end
|
423
|
+
end
|
424
|
+
|
425
|
+
describe "int" do
|
426
|
+
it "must be an alias to int32" do
|
427
|
+
expect(subject[:int]).to be(subject[:int32])
|
428
|
+
end
|
429
|
+
end
|
430
|
+
|
431
|
+
describe "int_le" do
|
432
|
+
it "must be an alias to int32_le" do
|
433
|
+
expect(subject[:int_le]).to be(subject[:int32_le])
|
434
|
+
end
|
435
|
+
end
|
436
|
+
|
437
|
+
describe "int_be" do
|
438
|
+
it "must be an alias to int32_be" do
|
439
|
+
expect(subject[:int_be]).to be(subject[:int32_be])
|
440
|
+
end
|
441
|
+
end
|
442
|
+
|
443
|
+
describe "int_ne" do
|
444
|
+
it "must be an alias to int32_ne" do
|
445
|
+
expect(subject[:int_ne]).to be(subject[:int32_ne])
|
446
|
+
end
|
447
|
+
end
|
448
|
+
|
449
|
+
describe "long" do
|
450
|
+
it "must be an alias to int32" do
|
451
|
+
expect(subject[:long]).to be(subject[:int32])
|
452
|
+
end
|
453
|
+
end
|
454
|
+
|
455
|
+
describe "long_le" do
|
456
|
+
it "must be an alias to int32_le" do
|
457
|
+
expect(subject[:long_le]).to be(subject[:int32_le])
|
458
|
+
end
|
459
|
+
end
|
460
|
+
|
461
|
+
describe "long_be" do
|
462
|
+
it "must be an alias to int32_be" do
|
463
|
+
expect(subject[:long_be]).to be(subject[:int32_be])
|
464
|
+
end
|
465
|
+
end
|
466
|
+
|
467
|
+
describe "long_ne" do
|
468
|
+
it "must be an alias to int32_ne" do
|
469
|
+
expect(subject[:long_ne]).to be(subject[:int32_ne])
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
473
|
+
describe "uint" do
|
474
|
+
it "must be an alias to uint32" do
|
475
|
+
expect(subject[:uint]).to be(subject[:uint32])
|
476
|
+
end
|
477
|
+
end
|
478
|
+
|
479
|
+
describe "uint_le" do
|
480
|
+
it "must be an alias to uint32_le" do
|
481
|
+
expect(subject[:uint_le]).to be(subject[:uint32_le])
|
482
|
+
end
|
483
|
+
end
|
484
|
+
|
485
|
+
describe "uint_be" do
|
486
|
+
it "must be an alias to uint32_be" do
|
487
|
+
expect(subject[:uint_be]).to be(subject[:uint32_be])
|
488
|
+
end
|
489
|
+
end
|
490
|
+
|
491
|
+
describe "uint_ne" do
|
492
|
+
it "must be an alias to uint32_ne" do
|
493
|
+
expect(subject[:uint_ne]).to be(subject[:uint32_ne])
|
494
|
+
end
|
495
|
+
end
|
496
|
+
|
497
|
+
describe "ulong" do
|
498
|
+
it "must be an alias to uint32" do
|
499
|
+
expect(subject[:ulong]).to be(subject[:uint32])
|
500
|
+
end
|
501
|
+
end
|
502
|
+
|
503
|
+
describe "ulong_le" do
|
504
|
+
it "must be an alias to uint32_le" do
|
505
|
+
expect(subject[:ulong_le]).to be(subject[:uint32_le])
|
506
|
+
end
|
507
|
+
end
|
508
|
+
|
509
|
+
describe "ulong_be" do
|
510
|
+
it "must be an alias to uint32_be" do
|
511
|
+
expect(subject[:ulong_be]).to be(subject[:uint32_be])
|
512
|
+
end
|
513
|
+
end
|
514
|
+
|
515
|
+
describe "ulong_ne" do
|
516
|
+
it "must be an alias to uint32_ne" do
|
517
|
+
expect(subject[:ulong_ne]).to be(subject[:uint32_ne])
|
518
|
+
end
|
519
|
+
end
|
520
|
+
|
521
|
+
describe "int64" do
|
522
|
+
subject { super()[:int64] }
|
523
|
+
|
524
|
+
it { expect(subject).to_not be(nil) }
|
525
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Int64) }
|
526
|
+
|
527
|
+
it "size must equal 8" do
|
528
|
+
expect(subject.size).to eq(8)
|
529
|
+
end
|
530
|
+
|
531
|
+
it "must be signed" do
|
532
|
+
expect(subject.signed?).to be(true)
|
533
|
+
end
|
534
|
+
end
|
535
|
+
|
536
|
+
describe "int64_le" do
|
537
|
+
subject { super()[:int64_le] }
|
538
|
+
|
539
|
+
it { expect(subject).to_not be(nil) }
|
540
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Int64) }
|
541
|
+
|
542
|
+
it "size must equal 8" do
|
543
|
+
expect(subject.size).to eq(8)
|
544
|
+
end
|
545
|
+
|
546
|
+
it "must be signed" do
|
547
|
+
expect(subject.signed?).to be(true)
|
548
|
+
end
|
549
|
+
|
550
|
+
it "endian must be little" do
|
551
|
+
expect(subject.endian).to eq(:little)
|
552
|
+
end
|
553
|
+
end
|
554
|
+
|
555
|
+
describe "int64_be" do
|
556
|
+
subject { super()[:int64_be] }
|
557
|
+
|
558
|
+
it { expect(subject).to_not be(nil) }
|
559
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Int64) }
|
560
|
+
|
561
|
+
it "size must equal 8" do
|
562
|
+
expect(subject.size).to eq(8)
|
563
|
+
end
|
564
|
+
|
565
|
+
it "must be signed" do
|
566
|
+
expect(subject.signed?).to be(true)
|
567
|
+
end
|
568
|
+
|
569
|
+
it "endian must be big" do
|
570
|
+
expect(subject.endian).to eq(:big)
|
571
|
+
end
|
572
|
+
end
|
573
|
+
|
574
|
+
describe "int64_ne" do
|
575
|
+
subject { super()[:int64_ne] }
|
576
|
+
|
577
|
+
it { expect(subject).to_not be(nil) }
|
578
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Int64) }
|
579
|
+
|
580
|
+
it "size must equal 8" do
|
581
|
+
expect(subject.size).to eq(8)
|
582
|
+
end
|
583
|
+
|
584
|
+
it "must be signed" do
|
585
|
+
expect(subject.signed?).to be(true)
|
586
|
+
end
|
587
|
+
|
588
|
+
it "endian must be big" do
|
589
|
+
expect(subject.endian).to eq(:big)
|
590
|
+
end
|
591
|
+
end
|
592
|
+
|
593
|
+
describe "uint64" do
|
594
|
+
subject { super()[:uint64] }
|
595
|
+
|
596
|
+
it { expect(subject).to_not be(nil) }
|
597
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::UInt64) }
|
598
|
+
|
599
|
+
it "size must equal 8" do
|
600
|
+
expect(subject.size).to eq(8)
|
601
|
+
end
|
602
|
+
|
603
|
+
it "must not be signed" do
|
604
|
+
expect(subject.signed?).to be(false)
|
605
|
+
end
|
606
|
+
end
|
607
|
+
|
608
|
+
describe "uint64_le" do
|
609
|
+
subject { super()[:uint64_le] }
|
610
|
+
|
611
|
+
it { expect(subject).to_not be(nil) }
|
612
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::UInt64) }
|
613
|
+
|
614
|
+
it "size must equal 8" do
|
615
|
+
expect(subject.size).to eq(8)
|
616
|
+
end
|
617
|
+
|
618
|
+
it "must be signed" do
|
619
|
+
expect(subject.signed?).to be(false)
|
620
|
+
end
|
621
|
+
|
622
|
+
it "endian must be little" do
|
623
|
+
expect(subject.endian).to eq(:little)
|
624
|
+
end
|
625
|
+
end
|
626
|
+
|
627
|
+
describe "uint64_be" do
|
628
|
+
subject { super()[:uint64_be] }
|
629
|
+
|
630
|
+
it { expect(subject).to_not be(nil) }
|
631
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::UInt64) }
|
632
|
+
|
633
|
+
it "size must equal 8" do
|
634
|
+
expect(subject.size).to eq(8)
|
635
|
+
end
|
636
|
+
|
637
|
+
it "must be signed" do
|
638
|
+
expect(subject.signed?).to be(false)
|
639
|
+
end
|
640
|
+
|
641
|
+
it "endian must be big" do
|
642
|
+
expect(subject.endian).to eq(:big)
|
643
|
+
end
|
644
|
+
end
|
645
|
+
|
646
|
+
describe "uint64_ne" do
|
647
|
+
subject { super()[:uint64_ne] }
|
648
|
+
|
649
|
+
it { expect(subject).to_not be(nil) }
|
650
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::UInt64) }
|
651
|
+
|
652
|
+
it "size must equal 8" do
|
653
|
+
expect(subject.size).to eq(8)
|
654
|
+
end
|
655
|
+
|
656
|
+
it "must be signed" do
|
657
|
+
expect(subject.signed?).to be(false)
|
658
|
+
end
|
659
|
+
|
660
|
+
it "endian must be big" do
|
661
|
+
expect(subject.endian).to eq(:big)
|
662
|
+
end
|
663
|
+
end
|
664
|
+
|
665
|
+
describe "long_long" do
|
666
|
+
it "must be an alias to int64" do
|
667
|
+
expect(subject[:long_long]).to be(subject[:int64])
|
668
|
+
end
|
669
|
+
end
|
670
|
+
|
671
|
+
describe "long_long_le" do
|
672
|
+
it "must be an alias to int64_le" do
|
673
|
+
expect(subject[:long_long_le]).to be(subject[:int64_le])
|
674
|
+
end
|
675
|
+
end
|
676
|
+
|
677
|
+
describe "long_long_be" do
|
678
|
+
it "must be an alias to int64_be" do
|
679
|
+
expect(subject[:long_long_be]).to be(subject[:int64_be])
|
680
|
+
end
|
681
|
+
end
|
682
|
+
|
683
|
+
describe "long_long_ne" do
|
684
|
+
it "must be an alias to int64_ne" do
|
685
|
+
expect(subject[:long_long_ne]).to be(subject[:int64_ne])
|
686
|
+
end
|
687
|
+
end
|
688
|
+
|
689
|
+
describe "ulong_long" do
|
690
|
+
it "must be an alias to uint64" do
|
691
|
+
expect(subject[:ulong_long]).to be(subject[:uint64])
|
692
|
+
end
|
693
|
+
end
|
694
|
+
|
695
|
+
describe "ulong_long_le" do
|
696
|
+
it "must be an alias to uint64_le" do
|
697
|
+
expect(subject[:ulong_long_le]).to be(subject[:uint64_le])
|
698
|
+
end
|
699
|
+
end
|
700
|
+
|
701
|
+
describe "ulong_long_be" do
|
702
|
+
it "must be an alias to uint64_be" do
|
703
|
+
expect(subject[:ulong_long_be]).to be(subject[:uint64_be])
|
704
|
+
end
|
705
|
+
end
|
706
|
+
|
707
|
+
describe "ulong_long_ne" do
|
708
|
+
it "must be an alias to uint64_ne" do
|
709
|
+
expect(subject[:ulong_long_ne]).to be(subject[:uint64_ne])
|
710
|
+
end
|
711
|
+
end
|
712
|
+
|
713
|
+
describe "#float32" do
|
714
|
+
subject { super()[:float32] }
|
715
|
+
|
716
|
+
it { expect(subject).to_not be(nil) }
|
717
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Float32) }
|
718
|
+
|
719
|
+
it "size must equal 4" do
|
720
|
+
expect(subject.size).to eq(4)
|
721
|
+
end
|
722
|
+
|
723
|
+
it "must be signed" do
|
724
|
+
expect(subject.signed?).to be(true)
|
725
|
+
end
|
726
|
+
end
|
727
|
+
|
728
|
+
describe "#float32_le" do
|
729
|
+
subject { super()[:float32_le] }
|
730
|
+
|
731
|
+
it { expect(subject).to_not be(nil) }
|
732
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Float32) }
|
733
|
+
|
734
|
+
it "size must equal 4" do
|
735
|
+
expect(subject.size).to eq(4)
|
736
|
+
end
|
737
|
+
|
738
|
+
it "must be signed" do
|
739
|
+
expect(subject.signed?).to be(true)
|
740
|
+
end
|
741
|
+
|
742
|
+
it "endian must be little" do
|
743
|
+
expect(subject.endian).to eq(:little)
|
744
|
+
end
|
745
|
+
end
|
746
|
+
|
747
|
+
describe "#float32_be" do
|
748
|
+
subject { super()[:float32_be] }
|
749
|
+
|
750
|
+
it { expect(subject).to_not be(nil) }
|
751
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Float32) }
|
752
|
+
|
753
|
+
it "size must equal 4" do
|
754
|
+
expect(subject.size).to eq(4)
|
755
|
+
end
|
756
|
+
|
757
|
+
it "must be signed" do
|
758
|
+
expect(subject.signed?).to be(true)
|
759
|
+
end
|
760
|
+
|
761
|
+
it "endian must be big" do
|
762
|
+
expect(subject.endian).to eq(:big)
|
763
|
+
end
|
764
|
+
end
|
765
|
+
|
766
|
+
describe "#float32_ne" do
|
767
|
+
subject { super()[:float32_ne] }
|
768
|
+
|
769
|
+
it { expect(subject).to_not be(nil) }
|
770
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Float32) }
|
771
|
+
|
772
|
+
it "size must equal 4" do
|
773
|
+
expect(subject.size).to eq(4)
|
774
|
+
end
|
775
|
+
|
776
|
+
it "must be signed" do
|
777
|
+
expect(subject.signed?).to be(true)
|
778
|
+
end
|
779
|
+
|
780
|
+
it "endian must be big" do
|
781
|
+
expect(subject.endian).to eq(:big)
|
782
|
+
end
|
783
|
+
end
|
784
|
+
|
785
|
+
describe "#float64" do
|
786
|
+
subject { super()[:float64] }
|
787
|
+
|
788
|
+
it { expect(subject).to_not be(nil) }
|
789
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Float64) }
|
790
|
+
|
791
|
+
it "size must equal 8" do
|
792
|
+
expect(subject.size).to eq(8)
|
793
|
+
end
|
794
|
+
|
795
|
+
it "must be signed" do
|
796
|
+
expect(subject.signed?).to be(true)
|
797
|
+
end
|
798
|
+
end
|
799
|
+
|
800
|
+
describe "#float64_le" do
|
801
|
+
subject { super()[:float64_le] }
|
802
|
+
|
803
|
+
it { expect(subject).to_not be(nil) }
|
804
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Float64) }
|
805
|
+
|
806
|
+
it "size must equal 8" do
|
807
|
+
expect(subject.size).to eq(8)
|
808
|
+
end
|
809
|
+
|
810
|
+
it "must be signed" do
|
811
|
+
expect(subject.signed?).to be(true)
|
812
|
+
end
|
813
|
+
|
814
|
+
it "endian must be little" do
|
815
|
+
expect(subject.endian).to eq(:little)
|
816
|
+
end
|
817
|
+
end
|
818
|
+
|
819
|
+
describe "#float64_be" do
|
820
|
+
subject { super()[:float64_be] }
|
821
|
+
|
822
|
+
it { expect(subject).to_not be(nil) }
|
823
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Float64) }
|
824
|
+
|
825
|
+
it "size must equal 8" do
|
826
|
+
expect(subject.size).to eq(8)
|
827
|
+
end
|
828
|
+
|
829
|
+
it "must be signed" do
|
830
|
+
expect(subject.signed?).to be(true)
|
831
|
+
end
|
832
|
+
|
833
|
+
it "endian must be big" do
|
834
|
+
expect(subject.endian).to eq(:big)
|
835
|
+
end
|
836
|
+
end
|
837
|
+
|
838
|
+
describe "#float64_ne" do
|
839
|
+
subject { super()[:float64_ne] }
|
840
|
+
|
841
|
+
it { expect(subject).to_not be(nil) }
|
842
|
+
it { expect(subject).to be_kind_of(Hexdump::Type::Float64) }
|
843
|
+
|
844
|
+
it "size must equal 8" do
|
845
|
+
expect(subject.size).to eq(8)
|
846
|
+
end
|
847
|
+
|
848
|
+
it "must be signed" do
|
849
|
+
expect(subject.signed?).to be(true)
|
850
|
+
end
|
851
|
+
|
852
|
+
it "endian must be big" do
|
853
|
+
expect(subject.endian).to eq(:big)
|
854
|
+
end
|
855
|
+
end
|
856
|
+
|
857
|
+
describe "float" do
|
858
|
+
it "must be an alias to float32" do
|
859
|
+
expect(subject[:float]).to be(subject[:float32])
|
860
|
+
end
|
861
|
+
end
|
862
|
+
|
863
|
+
describe "float_le" do
|
864
|
+
it "must be an alias to float32_le" do
|
865
|
+
expect(subject[:float_le]).to be(subject[:float32_le])
|
866
|
+
end
|
867
|
+
end
|
868
|
+
|
869
|
+
describe "float_be" do
|
870
|
+
it "must be an alias to float32_be" do
|
871
|
+
expect(subject[:float_be]).to be(subject[:float32_be])
|
872
|
+
end
|
873
|
+
end
|
874
|
+
|
875
|
+
describe "float_ne" do
|
876
|
+
it "must be an alias to float32_ne" do
|
877
|
+
expect(subject[:float_ne]).to be(subject[:float32_ne])
|
878
|
+
end
|
879
|
+
end
|
880
|
+
|
881
|
+
describe "double" do
|
882
|
+
it "must be an alias to float64" do
|
883
|
+
expect(subject[:double]).to be(subject[:float64])
|
884
|
+
end
|
885
|
+
end
|
886
|
+
|
887
|
+
describe "double_le" do
|
888
|
+
it "must be an alias to float64_le" do
|
889
|
+
expect(subject[:double_le]).to be(subject[:float64_le])
|
890
|
+
end
|
891
|
+
end
|
892
|
+
|
893
|
+
describe "double_be" do
|
894
|
+
it "must be an alias to float64_be" do
|
895
|
+
expect(subject[:double_be]).to be(subject[:float64_be])
|
896
|
+
end
|
897
|
+
end
|
898
|
+
|
899
|
+
describe "double_ne" do
|
900
|
+
it "must be an alias to float64_ne" do
|
901
|
+
expect(subject[:double_ne]).to be(subject[:float64_ne])
|
902
|
+
end
|
903
|
+
end
|
904
|
+
end
|