29 lines
381 B
Ruby
29 lines
381 B
Ruby
require 'iounpack'
|
|
|
|
describe IOUnpack do
|
|
it 'has nothing to read, if empty directives' do
|
|
expect( IOUnpack.new('').len).to eql(0)
|
|
end
|
|
|
|
<<EOF.each_line do |l|
|
|
1 c
|
|
2 cc
|
|
2 c2
|
|
2 cc
|
|
2 c c
|
|
3 cc c
|
|
4 cc c2
|
|
4 c3c
|
|
14 c13c
|
|
14 c13 c
|
|
16 q>q<
|
|
19 q>2c3
|
|
19 q>2 c3
|
|
EOF
|
|
/\A(\d+) (.*)/
|
|
it "wants read #$2 bytes for '#$1'" do
|
|
expect( IOUnpack.new('cc').len).to eql(2)
|
|
end
|
|
end
|
|
end
|