Sha256: 15ada6023036ba1cbd06a0df3bb8fb6c2e9f1d8519e40f2f6ffda609e797f6d4

Contents?: true

Size: 699 Bytes

Versions: 1

Compression:

Stored size: 699 Bytes

Contents

require 'rspec/expectations'
require 'bio-bgzf'
require 'tempfile'

describe Bio::BGZF do
  it "should be able to pack strings to BGZF blocks" do
    Bio::BGZF.should respond_to(:pack).with(1).argument
    Bio::BGZF.pack("asdfghjkl").should be_instance_of String
  end

  it "should be able to iteratively read BGZF blocks from stream" do
    str = ''
    1000.times { str += (Random.rand(26) + 65).chr }

    file = Tempfile.new 'bgzfstring'
    str.chars.each_slice(42).map(&:join).each do |s|
        file.write(Bio::BGZF.pack s)
    end
    file.flush
    file.rewind

    str2 = ''
    r = Bio::BGZF::Reader.new(file)
    r.each_block {|block| str2 += block }

    str2.should == str
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bio-bgzf-0.1.0 spec/bio-bgzf_spec.rb