Sha256: 4f23e5502b842d5c2383a2174c6a51498ca476e27e429a5ae5c2cec461314cf9

Contents?: true

Size: 504 Bytes

Versions: 3

Compression:

Stored size: 504 Bytes

Contents

require 'spec_helper'
require 'ronin/formatting/extensions/binary/array'

describe Array do
  subject { [0x1234, "hello"] }

  it "should provide Array#pack" do
    should respond_to(:pack)
  end

  describe "#pack" do
    let(:packed) { "\x34\x12hello\0" }

    it "should pack elements using Array#pack codes" do
      subject.pack('vZ*').should == packed
    end

    it "should pack elements using Binary::Template types" do
      subject.pack(:uint16_le, :string).should == packed
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ronin-support-0.5.0 spec/formatting/binary/array_spec.rb
ronin-support-0.5.0.rc2 spec/formatting/binary/array_spec.rb
ronin-support-0.5.0.rc1 spec/formatting/binary/array_spec.rb