Sha256: e200dbd83a5a573706039647aec09795c47ae71089a0796808c8fb232e015238

Contents?: true

Size: 1.75 KB

Versions: 15

Compression:

Stored size: 1.75 KB

Contents

#
# test/unit/bio/util/restriction_enzyme/test_string_formatting.rb - Unit test for Bio::RestrictionEnzyme::StringFormatting
#
# Author::    Trevor Wennblom  <mailto:trevor@corevx.com>
# Copyright:: Copyright (c) 2005-2007 Midwinter Laboratories, LLC (http://midwinterlabs.com)
# License::   The Ruby License
#
#  $Id:$
#

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

# libraries needed for the tests
require 'test/unit'
require 'bio/util/restriction_enzyme/string_formatting'

module Bio; module TestRestrictionEnzyme #:nodoc:

class TestStringFormatting < Test::Unit::TestCase #:nodoc:

  include Bio::RestrictionEnzyme::StringFormatting

  def setup
    @t = String
    @obj_1 = @t.new('gata')
    @obj_2 = @t.new('garraxt')
    @obj_3 = @t.new('gArraXT')
    @obj_4 = @t.new('nnnnnnngarraxtnn')
  end

  def test_strip_padding
    assert_equal('gata', strip_padding(@obj_1))
    assert_equal('garraxt', strip_padding(@obj_2))
    assert_equal('gArraXT', strip_padding(@obj_3))
    assert_equal('garraxt', strip_padding(@obj_4))
  end

  def test_left_padding
    assert_equal('', left_padding(@obj_1))
    assert_equal('', left_padding(@obj_2))
    assert_equal('', left_padding(@obj_3))
    assert_equal('nnnnnnn', left_padding(@obj_4))
  end

  def test_right_padding
    assert_equal('', right_padding(@obj_1))
    assert_equal('', right_padding(@obj_2))
    assert_equal('', right_padding(@obj_3))
    assert_equal('nn', right_padding(@obj_4))
  end

  def test_add_spacing
    assert_equal('n^n g^a t^a', add_spacing('n^ng^at^a') )
    assert_equal('n^n g^a r r a x t^n', add_spacing('n^ng^arraxt^n') )
  end

end

end; end

Version data entries

15 entries across 15 versions & 1 rubygems

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