bindata 0.10.0 → 0.11.0
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.
Potentially problematic release.
This version of bindata might be problematic. Click here for more details.
- data/ChangeLog +7 -1
- data/INSTALL +4 -0
- data/Rakefile +17 -0
- data/TODO +1 -22
- data/lib/bindata.rb +4 -2
- data/lib/bindata/array.rb +24 -81
- data/lib/bindata/base.rb +36 -25
- data/lib/bindata/base_primitive.rb +9 -0
- data/lib/bindata/choice.rb +26 -40
- data/lib/bindata/deprecated.rb +148 -0
- data/lib/bindata/lazy.rb +1 -3
- data/lib/bindata/params.rb +21 -92
- data/lib/bindata/primitive.rb +18 -42
- data/lib/bindata/record.rb +23 -54
- data/lib/bindata/registry.rb +33 -21
- data/lib/bindata/sanitize.rb +193 -47
- data/lib/bindata/string.rb +2 -14
- data/lib/bindata/struct.rb +36 -82
- data/lib/bindata/trace.rb +1 -2
- data/lib/bindata/wrapper.rb +139 -0
- data/setup.rb +1585 -0
- data/spec/array_spec.rb +7 -22
- data/spec/base_primitive_spec.rb +11 -2
- data/spec/base_spec.rb +24 -2
- data/spec/bits_spec.rb +1 -1
- data/spec/choice_spec.rb +2 -2
- data/spec/deprecated_spec.rb +96 -0
- data/spec/float_spec.rb +1 -1
- data/spec/int_spec.rb +1 -1
- data/spec/io_spec.rb +1 -1
- data/spec/lazy_spec.rb +1 -1
- data/spec/primitive_spec.rb +1 -10
- data/spec/record_spec.rb +8 -17
- data/spec/registry_spec.rb +41 -21
- data/spec/rest_spec.rb +1 -1
- data/spec/spec_common.rb +1 -1
- data/spec/string_spec.rb +1 -9
- data/spec/stringz_spec.rb +1 -1
- data/spec/struct_spec.rb +16 -11
- data/spec/system_spec.rb +18 -3
- data/spec/wrapper_spec.rb +84 -0
- data/tasks/pkg.rake +36 -0
- data/tasks/rdoc.rake +8 -0
- data/tasks/rspec.rake +17 -0
- metadata +43 -38
- data/spec/sanitize_spec.rb +0 -95
data/spec/rest_spec.rb
CHANGED
data/spec/spec_common.rb
CHANGED
data/spec/string_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require File.expand_path(File.dirname(__FILE__)
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "spec_common"))
|
4
4
|
require 'bindata/io'
|
5
5
|
require 'bindata/string'
|
6
6
|
|
@@ -21,14 +21,6 @@ describe BinData::String, "with mutually exclusive parameters" do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
describe BinData::String, "with deprecated parameters" do
|
25
|
-
it "should substitude :trim_padding for :trim_value" do
|
26
|
-
obj = BinData::String.new(:trim_value => true)
|
27
|
-
obj.value = "abc\0"
|
28
|
-
obj.value.should == "abc"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
24
|
describe BinData::String, "when assigning" do
|
33
25
|
before(:each) do
|
34
26
|
@small = BinData::String.new(:length => 3, :pad_char => "A")
|
data/spec/stringz_spec.rb
CHANGED
data/spec/struct_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require File.expand_path(File.dirname(__FILE__)
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "spec_common"))
|
4
4
|
require 'bindata'
|
5
5
|
|
6
6
|
describe BinData::Struct, "when initializing" do
|
@@ -79,15 +79,15 @@ describe BinData::Struct, "with multiple fields" do
|
|
79
79
|
end
|
80
80
|
|
81
81
|
it "should return num_bytes" do
|
82
|
-
@obj.
|
83
|
-
@obj.
|
82
|
+
@obj.a.num_bytes.should == 1
|
83
|
+
@obj.b.num_bytes.should == 1
|
84
84
|
@obj.num_bytes.should == 2
|
85
85
|
end
|
86
86
|
|
87
87
|
it "should identify accepted parameters" do
|
88
|
-
BinData::Struct.
|
89
|
-
BinData::Struct.
|
90
|
-
BinData::Struct.
|
88
|
+
BinData::Struct.accepted_parameters.all.should include(:fields)
|
89
|
+
BinData::Struct.accepted_parameters.all.should include(:hide)
|
90
|
+
BinData::Struct.accepted_parameters.all.should include(:endian)
|
91
91
|
end
|
92
92
|
|
93
93
|
it "should return field names" do
|
@@ -103,9 +103,9 @@ describe BinData::Struct, "with multiple fields" do
|
|
103
103
|
it "should clear individual elements" do
|
104
104
|
@obj.a = 6
|
105
105
|
@obj.b = 7
|
106
|
-
@obj.clear
|
107
|
-
@obj.should be_clear
|
108
|
-
@obj.should_not be_clear
|
106
|
+
@obj.a.clear
|
107
|
+
@obj.a.should be_clear
|
108
|
+
@obj.b.should_not be_clear
|
109
109
|
end
|
110
110
|
|
111
111
|
it "should write ordered" do
|
@@ -138,6 +138,11 @@ describe BinData::Struct, "with multiple fields" do
|
|
138
138
|
@obj.b.should == 4
|
139
139
|
end
|
140
140
|
|
141
|
+
it "should assign from nil" do
|
142
|
+
@obj.assign(nil)
|
143
|
+
@obj.should be_clear
|
144
|
+
end
|
145
|
+
|
141
146
|
it "should assign from Struct" do
|
142
147
|
src = BinData::Struct.new(@params)
|
143
148
|
src.a = 3
|
@@ -183,8 +188,8 @@ describe BinData::Struct, "with nested structs" do
|
|
183
188
|
end
|
184
189
|
|
185
190
|
it "should return num_bytes" do
|
186
|
-
@obj.
|
187
|
-
@obj.
|
191
|
+
@obj.b.num_bytes.should == 2
|
192
|
+
@obj.c.num_bytes.should == 2
|
188
193
|
@obj.num_bytes.should == 5
|
189
194
|
end
|
190
195
|
|
data/spec/system_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require File.expand_path(File.dirname(__FILE__)
|
4
|
-
require File.expand_path(File.dirname(__FILE__)
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "spec_common"))
|
4
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "example"))
|
5
5
|
require 'bindata'
|
6
6
|
|
7
7
|
describe "lambdas with index" do
|
@@ -64,7 +64,7 @@ describe "lambdas with parent" do
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
describe "
|
67
|
+
describe BinData::Record, "with choice field" do
|
68
68
|
before(:all) do
|
69
69
|
eval <<-END
|
70
70
|
class TupleRecord < BinData::Record
|
@@ -289,3 +289,18 @@ describe "Evaluating custom parameters" do
|
|
289
289
|
obj.c.eval_parameter(:custom).should == 5
|
290
290
|
end
|
291
291
|
end
|
292
|
+
|
293
|
+
describe BinData::Record, "with custom sized integers" do
|
294
|
+
before(:all) do
|
295
|
+
eval <<-END
|
296
|
+
class CustomIntRecord < BinData::Record
|
297
|
+
int40be :a
|
298
|
+
end
|
299
|
+
END
|
300
|
+
end
|
301
|
+
|
302
|
+
it "should read as expected" do
|
303
|
+
str = "\x00\x00\x00\x00\x05"
|
304
|
+
CustomIntRecord.read(str).should == {"a" => 5}
|
305
|
+
end
|
306
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "spec_common"))
|
4
|
+
require 'bindata'
|
5
|
+
require 'bindata/wrapper'
|
6
|
+
|
7
|
+
describe BinData::Wrapper, "with errors" do
|
8
|
+
it "should not wrap more than one type" do
|
9
|
+
lambda {
|
10
|
+
eval <<-END
|
11
|
+
class WrappedMultipleTypes < BinData::Wrapper
|
12
|
+
uint8
|
13
|
+
uint8
|
14
|
+
end
|
15
|
+
END
|
16
|
+
}.should raise_error(SyntaxError)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe BinData::Wrapper, "around a Primitive" do
|
21
|
+
before(:all) do
|
22
|
+
eval <<-END
|
23
|
+
class WrappedPrimitive < BinData::Wrapper
|
24
|
+
default_parameter :a => 3
|
25
|
+
|
26
|
+
uint8 :initial_value => :a
|
27
|
+
end
|
28
|
+
END
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should access custom parameter" do
|
32
|
+
obj = WrappedPrimitive.new
|
33
|
+
obj.value.should == 3
|
34
|
+
obj.should == 3
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should be able to override custom default parameter" do
|
38
|
+
obj = WrappedPrimitive.new(:a => 5)
|
39
|
+
obj.value.should == 5
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should be able to override parameter" do
|
43
|
+
obj = WrappedPrimitive.new(:initial_value => 7)
|
44
|
+
obj.value.should == 7
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe BinData::Wrapper, "around an Array" do
|
49
|
+
before(:all) do
|
50
|
+
eval <<-END
|
51
|
+
class WrappedIntArray < BinData::Wrapper
|
52
|
+
endian :big
|
53
|
+
default_parameter :initial_element_value => 0
|
54
|
+
array :type => [:uint16, {:initial_value => :initial_element_value}]
|
55
|
+
end
|
56
|
+
END
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should forward parameters" do
|
60
|
+
obj = WrappedIntArray.new(:initial_length => 7)
|
61
|
+
obj.length.should == 7
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should be able to override default parameters" do
|
65
|
+
obj = WrappedIntArray.new(:initial_length => 3, :initial_element_value => 5)
|
66
|
+
obj.to_binary_s.should == "\x00\x05\x00\x05\x00\x05"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe BinData::Wrapper, "around a Choice" do
|
71
|
+
before(:all) do
|
72
|
+
eval <<-END
|
73
|
+
class WrappedChoice < BinData::Wrapper
|
74
|
+
endian :big
|
75
|
+
choice :choices => { 'a' => :uint8, 'b' => :uint16 }
|
76
|
+
end
|
77
|
+
END
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should forward parameters" do
|
81
|
+
obj = WrappedChoice.new(:selection => 'b')
|
82
|
+
obj.num_bytes.should == 2
|
83
|
+
end
|
84
|
+
end
|
data/tasks/pkg.rake
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
begin
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rake/gempackagetask'
|
4
|
+
|
5
|
+
SPEC = Gem::Specification.new do |s|
|
6
|
+
s.name = 'bindata'
|
7
|
+
s.version = CURRENT_VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.summary = 'A declarative way to read and write binary file formats'
|
10
|
+
s.author = 'Dion Mendel'
|
11
|
+
s.email = 'dion@lostrealm.com'
|
12
|
+
s.homepage = 'http://bindata.rubyforge.org'
|
13
|
+
s.rubyforge_project = 'bindata'
|
14
|
+
s.require_path = 'lib'
|
15
|
+
s.has_rdoc = true
|
16
|
+
s.extra_rdoc_files = ['README']
|
17
|
+
s.rdoc_options << '--main' << 'README'
|
18
|
+
s.files = PKG_FILES
|
19
|
+
end
|
20
|
+
|
21
|
+
Rake::GemPackageTask.new(SPEC) do |pkg|
|
22
|
+
pkg.need_tar_gz = true
|
23
|
+
end
|
24
|
+
|
25
|
+
file "bindata.gemspec" => ["Rakefile", "lib/bindata.rb"] do |t|
|
26
|
+
require 'yaml'
|
27
|
+
open(t.name, "w") { |f| f.puts SPEC.to_yaml }
|
28
|
+
end
|
29
|
+
|
30
|
+
CLOBBER.include("bindata.gemspec")
|
31
|
+
|
32
|
+
desc "Create a stand-alone gemspec"
|
33
|
+
task :gemspec => "bindata.gemspec"
|
34
|
+
rescue LoadError
|
35
|
+
puts "RubyGems must be installed to build the package"
|
36
|
+
end
|
data/tasks/rdoc.rake
ADDED
data/tasks/rspec.rake
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
require 'spec/rake/spectask'
|
4
|
+
|
5
|
+
Spec::Rake::SpecTask.new("spec") do |t|
|
6
|
+
t.warning = false
|
7
|
+
t.rcov = false
|
8
|
+
t.spec_files = FileList['spec/**/*_spec.rb'].exclude("spec/deprecated_spec.rb")
|
9
|
+
end
|
10
|
+
|
11
|
+
Spec::Rake::SpecTask.new("rcov") do |t|
|
12
|
+
t.warning = true
|
13
|
+
t.rcov = true
|
14
|
+
end
|
15
|
+
rescue LoadError
|
16
|
+
puts "Rspec must be installed to run tests"
|
17
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bindata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dion Mendel
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-28 00:00:00 +08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -19,65 +19,70 @@ executables: []
|
|
19
19
|
|
20
20
|
extensions: []
|
21
21
|
|
22
|
-
extra_rdoc_files:
|
23
|
-
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README
|
24
24
|
files:
|
25
|
-
- ChangeLog
|
26
25
|
- INSTALL
|
27
|
-
- README
|
28
|
-
- GPL
|
29
|
-
- NEWS
|
30
26
|
- TODO
|
27
|
+
- GPL
|
28
|
+
- Rakefile
|
31
29
|
- COPYING
|
30
|
+
- NEWS
|
31
|
+
- README
|
32
|
+
- ChangeLog
|
32
33
|
- examples/gzip.rb
|
34
|
+
- spec/primitive_spec.rb
|
35
|
+
- spec/record_spec.rb
|
33
36
|
- spec/float_spec.rb
|
34
|
-
- spec/
|
35
|
-
- spec/
|
37
|
+
- spec/int_spec.rb
|
38
|
+
- spec/registry_spec.rb
|
36
39
|
- spec/lazy_spec.rb
|
37
|
-
- spec/
|
38
|
-
- spec/choice_spec.rb
|
39
|
-
- spec/base_primitive_spec.rb
|
40
|
+
- spec/deprecated_spec.rb
|
40
41
|
- spec/array_spec.rb
|
42
|
+
- spec/bits_spec.rb
|
43
|
+
- spec/io_spec.rb
|
44
|
+
- spec/struct_spec.rb
|
41
45
|
- spec/stringz_spec.rb
|
42
|
-
- spec/
|
46
|
+
- spec/rest_spec.rb
|
47
|
+
- spec/base_spec.rb
|
48
|
+
- spec/wrapper_spec.rb
|
49
|
+
- spec/choice_spec.rb
|
43
50
|
- spec/example.rb
|
44
51
|
- spec/system_spec.rb
|
45
|
-
- spec/int_spec.rb
|
46
52
|
- spec/string_spec.rb
|
47
|
-
- spec/struct_spec.rb
|
48
53
|
- spec/spec_common.rb
|
49
|
-
- spec/
|
50
|
-
-
|
51
|
-
- spec/rest_spec.rb
|
52
|
-
- spec/record_spec.rb
|
53
|
-
- lib/bindata
|
54
|
-
- lib/bindata/params.rb
|
55
|
-
- lib/bindata/int.rb
|
56
|
-
- lib/bindata/choice.rb
|
57
|
-
- lib/bindata/trace.rb
|
58
|
-
- lib/bindata/registry.rb
|
54
|
+
- spec/base_primitive_spec.rb
|
55
|
+
- lib/bindata/array.rb
|
59
56
|
- lib/bindata/base_primitive.rb
|
60
|
-
- lib/bindata/
|
61
|
-
- lib/bindata/stringz.rb
|
62
|
-
- lib/bindata/bits.rb
|
63
|
-
- lib/bindata/record.rb
|
64
|
-
- lib/bindata/primitive.rb
|
57
|
+
- lib/bindata/int.rb
|
65
58
|
- lib/bindata/rest.rb
|
66
|
-
- lib/bindata/
|
67
|
-
- lib/bindata/array.rb
|
59
|
+
- lib/bindata/struct.rb
|
68
60
|
- lib/bindata/lazy.rb
|
61
|
+
- lib/bindata/choice.rb
|
69
62
|
- lib/bindata/string.rb
|
70
63
|
- lib/bindata/float.rb
|
64
|
+
- lib/bindata/base.rb
|
65
|
+
- lib/bindata/primitive.rb
|
66
|
+
- lib/bindata/registry.rb
|
67
|
+
- lib/bindata/bits.rb
|
68
|
+
- lib/bindata/deprecated.rb
|
69
|
+
- lib/bindata/params.rb
|
71
70
|
- lib/bindata/sanitize.rb
|
71
|
+
- lib/bindata/trace.rb
|
72
|
+
- lib/bindata/stringz.rb
|
72
73
|
- lib/bindata/io.rb
|
74
|
+
- lib/bindata/record.rb
|
75
|
+
- lib/bindata/wrapper.rb
|
73
76
|
- lib/bindata.rb
|
77
|
+
- tasks/rdoc.rake
|
78
|
+
- tasks/pkg.rake
|
79
|
+
- tasks/rspec.rake
|
80
|
+
- setup.rb
|
74
81
|
has_rdoc: true
|
75
82
|
homepage: http://bindata.rubyforge.org
|
76
83
|
post_install_message:
|
77
84
|
rdoc_options:
|
78
|
-
-
|
79
|
-
- lib/bindata
|
80
|
-
- -m
|
85
|
+
- --main
|
81
86
|
- README
|
82
87
|
require_paths:
|
83
88
|
- lib
|
@@ -96,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
101
|
requirements: []
|
97
102
|
|
98
103
|
rubyforge_project: bindata
|
99
|
-
rubygems_version: 1.
|
104
|
+
rubygems_version: 1.3.1
|
100
105
|
signing_key:
|
101
106
|
specification_version: 2
|
102
107
|
summary: A declarative way to read and write binary file formats
|
data/spec/sanitize_spec.rb
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require File.expand_path(File.dirname(__FILE__)) + '/spec_common'
|
4
|
-
require 'bindata/sanitize'
|
5
|
-
require 'bindata/int'
|
6
|
-
|
7
|
-
describe BinData::SanitizedParameters, "with bad input" do
|
8
|
-
before(:each) do
|
9
|
-
@mock = mock("dummy class")
|
10
|
-
@mock.stub!(:accepted_internal_parameters).and_return([:a, :b, :c])
|
11
|
-
@params = {:a => 1, :b => 2, :c => 3, :d => 4, :e => 5}
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should convert keys to symbols" do
|
15
|
-
the_params = {'a' => 1, 'b' => 2, 'e' => 5}
|
16
|
-
sanitized = BinData::SanitizedParameters.new(@mock, the_params)
|
17
|
-
sanitized.parameters.should == {:a => 1, :b => 2, :e => 5}
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should raise error if parameter has nil value" do
|
21
|
-
the_params = {'a' => 1, 'b' => nil, 'e' => 5}
|
22
|
-
lambda {
|
23
|
-
BinData::SanitizedParameters.new(@mock, the_params)
|
24
|
-
}.should raise_error(ArgumentError)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe BinData::SanitizedParameters do
|
29
|
-
before(:each) do
|
30
|
-
@mock = mock("dummy class")
|
31
|
-
@mock.stub!(:accepted_internal_parameters).and_return([:a, :b, :c])
|
32
|
-
@params = {:a => 1, :b => 2, :c => 3, :d => 4, :e => 5}
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should respond_to keys" do
|
36
|
-
sanitized = BinData::SanitizedParameters.new(@mock, @params)
|
37
|
-
sanitized.should respond_to(:keys)
|
38
|
-
keys = sanitized.keys.collect { |k| k.to_s }
|
39
|
-
keys.sort.should == ['a', 'b', 'c', 'd', 'e']
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should respond_to has_key?" do
|
43
|
-
sanitized = BinData::SanitizedParameters.new(@mock, @params)
|
44
|
-
sanitized.should respond_to(:has_key?)
|
45
|
-
sanitized.should have_key(:a)
|
46
|
-
sanitized.should have_key(:e)
|
47
|
-
sanitized.should_not have_key(:z)
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should respond_to []" do
|
51
|
-
sanitized = BinData::SanitizedParameters.new(@mock, @params)
|
52
|
-
sanitized.should respond_to(:[])
|
53
|
-
sanitized[:a].should == 1
|
54
|
-
sanitized[:d].should == 4
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe BinData::Sanitizer do
|
59
|
-
before(:each) do
|
60
|
-
@sanitizer = BinData::Sanitizer.new
|
61
|
-
end
|
62
|
-
|
63
|
-
it "should raise error on unknown types" do
|
64
|
-
lambda {
|
65
|
-
@sanitizer.lookup_class(:does_not_exist)
|
66
|
-
}.should raise_error(TypeError)
|
67
|
-
end
|
68
|
-
|
69
|
-
it "should lookup when endian is set" do
|
70
|
-
@sanitizer.with_endian(:little) do
|
71
|
-
the_class = @sanitizer.lookup_class(:int16)
|
72
|
-
the_class.should == BinData::Int16le
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
it "should nest with_endian calls" do
|
77
|
-
@sanitizer.with_endian(:little) do
|
78
|
-
the_class = @sanitizer.lookup_class(:int16)
|
79
|
-
the_class.should == BinData::Int16le
|
80
|
-
|
81
|
-
@sanitizer.with_endian(:big) do
|
82
|
-
the_class = @sanitizer.lookup_class(:int16)
|
83
|
-
the_class.should == BinData::Int16be
|
84
|
-
end
|
85
|
-
|
86
|
-
the_class = @sanitizer.lookup_class(:int16)
|
87
|
-
the_class.should == BinData::Int16le
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
it "should sanitize parameters" do
|
92
|
-
params = @sanitizer.sanitized_params(BinData::Int8, {:value => 3})
|
93
|
-
params.should have_key(:value)
|
94
|
-
end
|
95
|
-
end
|