Sha256: b06923229152e85b528ec9a0aa0745e59cd78536b153a4adf1cf7f147041e354

Contents?: true

Size: 1.43 KB

Versions: 2

Compression:

Stored size: 1.43 KB

Contents

require File.dirname(__FILE__) + '/test_helper.rb'

class ScbiMultiGzReaderTest < Test::Unit::TestCase

  def setup

  end

  def test_zcat

    # test a file with multiple gz streams

    #file=ScbiZcatFile.new('/tmp/pair2.fastq.gz')
    file=ScbiZcatFile.new(File.join(File.dirname(__FILE__),'minitest.fastq.gz'))
    
    i=0
    printing=0

    loop do
      res=file.readline

      break if res.nil?
      # #puts res
      # if res.index('M00707:28:000000000-AFRC1:1:1102:16433:15968')
      #   printing=10
      # end
      # if printing>0
      #   puts res
      #   #sleep 2
      #   printing-=1
      # end

      
      i = i+1
    end

    file.close

    #assert_equal(2813668,i)
    assert_equal(28,i)

  end
  
  def test_zcat_while

    # test a file with multiple gz streams

    #file=ScbiZcatFile.new('/tmp/pair2.fastq.gz')
    file=ScbiZcatFile.new(File.join(File.dirname(__FILE__),'minitest.fastq.gz'))
    
    i=0
    printing=0

    begin
      res=file.readline

      assert_equal(false,res.nil?)
      
      i = i+1
    end while !file.eof?

    file.close

    #assert_equal(2813668,i)
    assert_equal(28,i)

  end

  def test_gz_file?

    # test a file with multiple gz streams

    res=ScbiZcatFile.gz_file?(File.join(File.dirname(__FILE__),'minitest.fastq.gz'))
    assert_equal(true,res)
    
    res=ScbiZcatFile.gz_file?(File.join(File.dirname(__FILE__),'minitest.fastq'))
    assert_equal(false,res)
    

  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scbi_zcat-0.0.2 test/scbi_zcat_test.rb
scbi_zcat-0.0.1 test/scbi_zcat_test.rb