Sha256: 2a43af919f53aa04750973cb41e7a05588f9cd0c0c1fe80a91936f1f68d80fd3

Contents?: true

Size: 1.81 KB

Versions: 18

Compression:

Stored size: 1.81 KB

Contents

#
# test/unit/bio/data/test_na.rb - Unit test for Bio::NucleicAcid
#
# Copyright::  Copyright (C) 2005,2006 Mitsuteru Nakao <n@bioruby.org>
# License::    The Ruby License
#
#  $Id: test_na.rb,v 1.9 2007/04/05 23:35:43 trevor Exp $
#

require 'pathname'
libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
$:.unshift(libpath) unless $:.include?(libpath)

require 'test/unit'
require 'bio/data/na'

module Bio

  class TestNAConstants  < Test::Unit::TestCase
    def test_NAMES
      assert_equal('a', Bio::NucleicAcid::NAMES['a'])
    end

    def test_NAMES_1_to_name
      assert_equal('Adenine', Bio::NucleicAcid::NAMES['A'])
    end

    def test_WEIGHT
      mw = 135.15
      assert_equal(mw, Bio::NucleicAcid::WEIGHT['a'])
      assert_equal(mw, Bio::NucleicAcid::WEIGHT[:adenine])
    end
  end


  class TestNA < Test::Unit::TestCase

    def setup
      @obj = Bio::NucleicAcid.new
    end

    def test_to_re
      re = /[tcy][agr][atw][gcw][tgk][acm][tgcyskb][atgrwkd][agcmrsv][atgcyrwskmbdhvn]atgc/
      str = 'yrwskmbdvnatgc'
      str0 = str.clone
      assert_equal(re, @obj.to_re(str))
      assert_equal(str0, str)
      assert_equal(re, Bio::NucleicAcid.to_re(str))
    end


    def test_weight
      mw = 135.15
      assert_equal(mw, @obj.weight('a'))
      assert_equal(mw, Bio::NucleicAcid.weight('a'))
    end

    def test_weight_rna
      mw = 135.15
      assert_equal(mw, @obj.weight('A', true))
      assert_equal(mw, Bio::NucleicAcid.weight('A', true))
    end

    
    def test_accessor
      assert_equal('Adenine', @obj['A'])
    end
    
    def test_names
      assert_equal(Bio::NucleicAcid::NAMES, @obj.names)
    end
    def test_na
      assert_equal(Bio::NucleicAcid::NAMES, @obj.na)
    end

    def test_name
      assert_equal('Adenine', @obj.name('A'))
    end
  end
end

Version data entries

18 entries across 18 versions & 5 rubygems

Version Path
bioruby-bio-1.2.9.9001 test/unit/bio/data/test_na.rb
bioruby-bio-1.2.9.9501 test/unit/bio/data/test_na.rb
bioruby-bio-1.3.0.5000 test/unit/bio/data/test_na.rb
bioruby-bio-1.3.0.9901 test/unit/bio/data/test_na.rb
bioruby-bio-1.3.0 test/unit/bio/data/test_na.rb
bioruby-bio-1.3.1.5000 test/unit/bio/data/test_na.rb
jandot-bio-1.2.1 test/unit/bio/data/test_na.rb
ngoto-bio-1.2.9.9001 test/unit/bio/data/test_na.rb
ngoto-bio-1.2.9.9501 test/unit/bio/data/test_na.rb
ngoto-bio-1.3.0.5000 test/unit/bio/data/test_na.rb
ngoto-bio-1.3.0 test/unit/bio/data/test_na.rb
ngoto-bio-1.3.1.5000 test/unit/bio/data/test_na.rb
wwood-bioruby-1.2.11 test/unit/bio/data/test_na.rb
bio-1.3.1 test/unit/bio/data/test_na.rb
bio-1.2.0 test/unit/bio/data/test_na.rb
bio-1.2.1 test/unit/bio/data/test_na.rb
bio-1.1.0 test/unit/bio/data/test_na.rb
bio-1.3.0 test/unit/bio/data/test_na.rb