Sha256: 17102d3f163521d028d8821fd0f06c2c91db3f31d0360dff79268a24100d7751

Contents?: true

Size: 603 Bytes

Versions: 1

Compression:

Stored size: 603 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" }

    context "when only given a String" do
      it "should pack elements using Array#pack codes" do
        expect(subject.pack('vZ*')).to eq(packed)
      end
    end

    context "otherwise" do
      it "should pack fields using Binary::Template" do
        expect(subject.pack(:uint16_le, :string)).to eq(packed)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ronin-support-0.5.2 spec/formatting/binary/array_spec.rb