Sha256: 755f9dc47663fa487cca44bf74af2398d35f371e52f3688b4deb2b708cc6cf6f

Contents?: true

Size: 1.68 KB

Versions: 15

Compression:

Stored size: 1.68 KB

Contents

#
# test/unit/bio/sequence/test_compat.rb - Unit test for Bio::Sequencce::Compat
#
# Copyright::   Copyright (C) 2006 Mitsuteru C. Nakao <n@bioruby.org>
# License::     The Ruby License
#
#  $Id:$
#

# loading helper routine for testing bioruby
require 'pathname'
load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 3,
                            'bioruby_test_helper.rb')).cleanpath.to_s

# libraries needed for the tests
require 'test/unit'
require 'bio/sequence'
require 'bio/sequence/compat'

module Bio; module TestSequenceCompat
  
  class TSequence < String
    include Bio::Sequence::Common
  end


  class TestSequenceCompat < Test::Unit::TestCase

    def setup
      @obj  = TSequence.new('atgcatgcatgcatgcaaaa')
    end

    def test_to_s
      str = 'atgcatgcatgcatgcaaaa'
      assert_equal(str, @obj.to_s)
    end
  end


  class TestSequenceCommonCompat < Test::Unit::TestCase

    # Test Sequence#to_fasta    
    def test_to_fasta
      sequence = TSequence.new("agtc" * 10)
      header = "the header"
      str = ">the header\n" + ("agtc" * 5) + "\n" + ("agtc" * 5) + "\n"
      assert_equal(str, sequence.to_fasta(header, 20))
    end

  end


  require 'bio/sequence/na'

  class TestSequenceNACompat < Test::Unit::TestCase
    def test_na_self_randomize
      composition = Bio::Sequence::NA.new("acgtacgt").composition
      assert(Bio::Sequence::NA.randomize(composition))
    end
  end 

  require 'bio/sequence/aa'  

  class TestSequenceNACompat < Test::Unit::TestCase
    def test_aa_self_randomize
      composition = Bio::Sequence::AA.new("WWDTGAK").composition
      assert(Bio::Sequence::AA.randomize(composition))
    end
  end

end; end #module Bio; module TestSequenceCompat

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
bio-2.0.5 test/unit/bio/sequence/test_compat.rb
bio-2.0.4 test/unit/bio/sequence/test_compat.rb
bio-2.0.3 test/unit/bio/sequence/test_compat.rb
bio-2.0.2 test/unit/bio/sequence/test_compat.rb
bio-2.0.1 test/unit/bio/sequence/test_compat.rb
bio-2.0.0 test/unit/bio/sequence/test_compat.rb
bio-1.6.0.pre.20181210 test/unit/bio/sequence/test_compat.rb
bio-1.5.2 test/unit/bio/sequence/test_compat.rb
bio-1.5.1 test/unit/bio/sequence/test_compat.rb
bio-1.5.0 test/unit/bio/sequence/test_compat.rb
bio-1.4.3.0001 test/unit/bio/sequence/test_compat.rb
bio-1.4.3 test/unit/bio/sequence/test_compat.rb
bio-1.4.2 test/unit/bio/sequence/test_compat.rb
bio-1.4.1 test/unit/bio/sequence/test_compat.rb
bio-1.4.0 test/unit/bio/sequence/test_compat.rb