[BioRuby-cvs] bioruby/test/unit/bio test_sequence.rb,1.5,1.6
Mitsuteru C. Nakao
nakao at pub.open-bio.org
Sun Feb 5 17:39:29 UTC 2006
Update of /home/repository/bioruby/bioruby/test/unit/bio
In directory pub.open-bio.org:/tmp/cvs-serv30733/test/unit/bio
Modified Files:
test_sequence.rb
Log Message:
* test_common.rb: added.
* test_compat.rb: added.
* test_sequence.rb: moved some test codes to test_common.rb or test_compat.rb.
Index: test_sequence.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/test/unit/bio/test_sequence.rb,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** test_sequence.rb 26 Nov 2005 06:51:45 -0000 1.5
--- test_sequence.rb 5 Feb 2006 17:39:27 -0000 1.6
***************
*** 1,6 ****
#
! # test/unit/bio/tc_sequence.rb - Unit test for Bio::Sequencce
#
# Copyright (C) 2004 Moses Hohman <mmhohman at northwestern.edu>
#
# This library is free software; you can redistribute it and/or
--- 1,7 ----
#
! # test/unit/bio/test_sequence.rb - Unit test for Bio::Sequencce
#
# Copyright (C) 2004 Moses Hohman <mmhohman at northwestern.edu>
+ # Copyright (C) 2006 Mitsuteru C. Nakao <n at bioruby.org>
#
# This library is free software; you can redistribute it and/or
***************
*** 30,33 ****
--- 31,35 ----
module Bio
class TestSequence < Test::Unit::TestCase
+
def setup
@na = Sequence::NA.new('atgcatgcatgcatgcaaaa')
***************
*** 36,61 ****
end
- def test_to_s_returns_self_as_string
- s = "abcefghijklmnop"
- sequence = Sequence.new(s)
- assert_equal(s, sequence.to_s, "wrong value")
- assert_instance_of(String, sequence.to_s, "not a String")
- end
-
- def test_subseq_returns_nil_blank_sequence_default_end
- sequence = Sequence.new("")
- assert_nil(sequence.subseq(5))
- end
- def test_subseq_returns_nil_start_less_than_one
- sequence = Sequence.new("blahblah")
- assert_nil(sequence.subseq(0))
- end
-
- def test_subseq_returns_subsequence
- sequence = Sequence.new("hahasubhehe")
- assert_equal("sub", sequence.subseq(5,7))
- end
-
# "main" method tests translated into unit tests
--- 38,42 ----
***************
*** 125,154 ****
end
- # Test Sequence#to_fasta
-
- def test_to_fasta
- sequence = Sequence.new("agtc"*10)
- header = "the header"
- assert_equal(">the header\n" + ("agtc"*5) + "\n" + ("agtc"*5) + "\n", sequence.to_fasta(header, 20))
- end
-
- # Test Sequence#window_wearch
-
- def test_window_search_with_width_3_default_step_no_residual
- sequence = Sequence.new("agtca")
- windows = []
- returned_value = sequence.window_search(3) { |window| windows << window }
- assert_equal(["agt", "gtc", "tca"], windows, "windows wrong")
- assert_equal("", returned_value, "returned value wrong")
- end
-
- # added
- def test_window_search_with_width_3_step_two_with_residual
- sequence = Sequence::NA.new("agtcat")
- windows = []
- returned_value = sequence.window_search(3, 2) { |window| windows << window }
- assert_equal(["agt", "tca"], windows, "windows wrong")
- assert_equal("t", returned_value, "returned value wrong")
- end
# Test Sequence#total
--- 106,109 ----
More information about the bioruby-cvs
mailing list