Sha256: 7ec4bc1946427c17a7a3ac50e1a19d48ae2f55d74e2007c5457d8a89e7c2f516

Contents?: true

Size: 680 Bytes

Versions: 1

Compression:

Stored size: 680 Bytes

Contents

require 'spec_helper'
require 'ffi/bit_masks'

describe FFI::BitMasks do
  it "should have a VERSION constant" do
    expect(subject.const_get('VERSION')).not_to be_empty
  end

  describe "#bit_mask" do
    subject do
      mod = Module.new
      mod.extend FFI::Library
      mod.extend FFI::BitMasks
    end

    let(:flags) { {:foo => 0x1, :bar => 0x2, :baz => 0x4} }

    it "should return a BitMask object" do
      expect(subject.bit_mask(:flags,flags).flags).to eq(flags)
    end

    it "should define a typedef for the bitmask" do
      bitmask = subject.bit_mask(:flags,flags)

      expect(subject.find_type(:flags)).to be_kind_of(FFI::Type::Mapped)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffi-bit_masks-0.1.1 spec/bit_masks_spec.rb