]> git.donarmstrong.com Git - biopieces.git/blobdiff - code_ruby/test/maasha/test_seq.rb
added Seq.type_guess to ruby code
[biopieces.git] / code_ruby / test / maasha / test_seq.rb
index 5e79a0ff4b5a048e1da3c300b45a317743093207..93737d44280dbf02d8c029048ada0d2a51816998 100755 (executable)
@@ -39,7 +39,48 @@ class TestSeq < Test::Unit::TestCase
 
   def test_Seq_is_protein_with_protein_sequence_type_returns_true
     @entry.type = 'protein'
-    assert(@entry.is_protein? == true)
+    assert_equal(true, @entry.is_protein?)
+  end
+
+  def test_Seq_type_guess_without_sequence_raises
+    assert_raise(SeqError) { @entry.type_guess }
+  end
+
+  def test_Seq_type_guess_with_protein_returns_protein
+    @entry.seq = 'atcatcrFgatcg'
+    assert_equal('protein', @entry.type_guess)
+  end
+
+  def test_Seq_type_guess_with_rna_returns_rna
+    @entry.seq = 'atcatcrUgatcg'
+    assert_equal('rna', @entry.type_guess)
+  end
+
+  def test_Seq_type_guess_with_dna_returns_dna
+    @entry.seq = 'atcatcgatcg'
+    assert_equal('dna', @entry.type_guess)
+  end
+
+  def test_Seq_type_guess_EM_without_sequence_raises
+    assert_raise(SeqError) { @entry.type_guess! }
+  end
+
+  def test_Seq_type_guess_EM_with_protein_returns_protein
+    @entry.seq = 'atcatcrFgatcg'
+    @entry.type_guess!
+    assert_equal('protein', @entry.type)
+  end
+
+  def test_Seq_type_guess_EM_with_rna_returns_rna
+    @entry.seq = 'atcatcrUgatcg'
+    @entry.type_guess!
+    assert_equal('rna', @entry.type)
+  end
+
+  def test_Seq_type_guess_EM_with_dna_returns_dna
+    @entry.seq = 'atcatcgatcg'
+    @entry.type_guess!
+    assert_equal('dna', @entry.type)
   end
 
   def test_Seq_length_is_correct