hexdump 0.3.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +5 -6
  3. data/.gitignore +1 -0
  4. data/.yardopts +1 -1
  5. data/ChangeLog.md +79 -6
  6. data/Gemfile +3 -0
  7. data/LICENSE.txt +1 -1
  8. data/README.md +500 -137
  9. data/benchmark.rb +29 -22
  10. data/gemspec.yml +2 -1
  11. data/hexdump.gemspec +1 -4
  12. data/lib/hexdump/chars.rb +46 -0
  13. data/lib/hexdump/core_ext/file.rb +68 -6
  14. data/lib/hexdump/core_ext/io.rb +2 -2
  15. data/lib/hexdump/core_ext/kernel.rb +5 -0
  16. data/lib/hexdump/core_ext/string.rb +2 -2
  17. data/lib/hexdump/core_ext/string_io.rb +2 -2
  18. data/lib/hexdump/core_ext.rb +5 -4
  19. data/lib/hexdump/format_string.rb +43 -0
  20. data/lib/hexdump/hexdump.rb +766 -75
  21. data/lib/hexdump/mixin.rb +192 -0
  22. data/lib/hexdump/module_methods.rb +132 -0
  23. data/lib/hexdump/numeric/binary.rb +55 -0
  24. data/lib/hexdump/numeric/char_or_int.rb +95 -0
  25. data/lib/hexdump/numeric/decimal.rb +56 -0
  26. data/lib/hexdump/numeric/exceptions.rb +11 -0
  27. data/lib/hexdump/numeric/hexadecimal.rb +59 -0
  28. data/lib/hexdump/numeric/octal.rb +55 -0
  29. data/lib/hexdump/numeric.rb +5 -0
  30. data/lib/hexdump/reader.rb +313 -0
  31. data/lib/hexdump/theme/ansi.rb +82 -0
  32. data/lib/hexdump/theme/rule.rb +159 -0
  33. data/lib/hexdump/theme.rb +61 -0
  34. data/lib/hexdump/type.rb +233 -0
  35. data/lib/hexdump/types.rb +108 -0
  36. data/lib/hexdump/version.rb +1 -1
  37. data/lib/hexdump.rb +14 -3
  38. data/spec/chars_spec.rb +76 -0
  39. data/spec/core_ext_spec.rb +10 -6
  40. data/spec/format_string_spec.rb +22 -0
  41. data/spec/hexdump_class_spec.rb +1708 -0
  42. data/spec/hexdump_module_spec.rb +23 -0
  43. data/spec/mixin_spec.rb +37 -0
  44. data/spec/numeric/binary_spec.rb +239 -0
  45. data/spec/numeric/char_or_int_spec.rb +210 -0
  46. data/spec/numeric/decimal_spec.rb +317 -0
  47. data/spec/numeric/hexadecimal_spec.rb +320 -0
  48. data/spec/numeric/octal_spec.rb +239 -0
  49. data/spec/reader_spec.rb +866 -0
  50. data/spec/spec_helper.rb +2 -0
  51. data/spec/theme/ansi_spec.rb +242 -0
  52. data/spec/theme/rule_spec.rb +199 -0
  53. data/spec/theme_spec.rb +94 -0
  54. data/spec/type_spec.rb +317 -0
  55. data/spec/types_spec.rb +904 -0
  56. metadata +42 -12
  57. data/.gemtest +0 -0
  58. data/lib/hexdump/dumper.rb +0 -419
  59. data/lib/hexdump/extensions.rb +0 -2
  60. data/spec/dumper_spec.rb +0 -329
  61. data/spec/hexdump_spec.rb +0 -30
@@ -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[:int64])
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[:int64_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[:int64_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[:int64_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[:uint64])
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[:uint64_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[:uint64_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[:uint64_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