]> git.donarmstrong.com Git - biopieces.git/blobdiff - code_ruby/test/maasha/test_seq.rb
added Seq.shuffle method and tests
[biopieces.git] / code_ruby / test / maasha / test_seq.rb
index 171e6b1ae9157205527a0613ef68fe65686bf4e7..f966a5fa47b2387c74f1c2a785b6f8e49082f1be 100755 (executable)
@@ -9,7 +9,8 @@ class TestSeq < Test::Unit::TestCase
     @entry = Seq.new
   end
 
-  #  def test_Seq# autoremoves whitespace, newlines, and carriage returns
+  #  # autoremoves whitespace, newlines, and carriage returns
+  #  def test_Seq_strip
   #    dna = Seq.new
   #    dna.seq = "A\tT\r\tC\nG  "
   #    assert_equal(dna.seq, "ATCG")
@@ -277,6 +278,19 @@ class TestSeq < Test::Unit::TestCase
     end
   end
 
+  def test_Seq_shuffle_returns_correctly
+    orig       = "actgactgactgatcgatcgatcgatcgtactg" 
+    @entry.seq = "actgactgactgatcgatcgatcgatcgtactg"
+    entry_shuf = @entry.shuffle
+    assert_equal(orig, @entry.seq)
+    assert_not_equal(@entry.seq, entry_shuf.seq)
+  end
+
+  def test_Seq_shuffle_bang_returns_correctly
+    @entry.seq = "actgactgactgatcgatcgatcgatcgtactg"
+    assert_not_equal(@entry.seq, @entry.shuffle!.seq)
+  end
+
   def test_Seq_subseq_with_start_lt_0_raises
     @entry.seq = "ATCG"
     assert_raise(SeqError) { @entry.subseq(-1, 1) }
@@ -520,12 +534,12 @@ class TestSeq < Test::Unit::TestCase
   end
 
   def test_Seq_qual_valid_returns_correctly
-    tests = [["sanger",      0, 40, 33],
-             ["454",         0, 40, 64],
-             ["solexa",     -5, 40, 64],
-             ["illumina13",  0, 40, 64],
-             ["illumina15",  0, 40, 64],
-             ["illumina18",  0, 41, 33]]
+    tests = [["sanger",      0, 93, 33],
+             ["454",         0, 62, 64],
+             ["solexa",     -5, 62, 64],
+             ["illumina13",  0, 62, 64],
+             ["illumina15",  0, 62, 64],
+             ["illumina18",  0, 93, 33]]
 
     tests.each do |test|
       @entry.qual = (test[1] + test[-1]).chr + (test[2] + test[-1]).chr