]> git.donarmstrong.com Git - biopieces.git/blobdiff - code_ruby/test/maasha/seq/test_backtrack.rb
rewrite of FASTQ internals
[biopieces.git] / code_ruby / test / maasha / seq / test_backtrack.rb
index 645258eb4bd02c083ea0fafea5bf5937c37c39d2..f244aab38a5ea1cc1ecf0ba283283746229238a7 100644 (file)
@@ -1,5 +1,5 @@
 #!/usr/bin/env ruby
-$:.unshift File.join(File.dirname(__FILE__),'..','lib')
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
 
 # Copyright (C) 2007-2011 Martin A. Hansen.
 
@@ -26,6 +26,7 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib')
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 require 'test/unit'
+require 'test/helper'
 require 'maasha/seq'
 
 class BackTrackTest < Test::Unit::TestCase
@@ -36,125 +37,125 @@ class BackTrackTest < Test::Unit::TestCase
     @seq.extend(BackTrack)
   end
 
-  def test_BackTrack_patscan_with_bad_pattern_raises
+  test "#patscan with bad pattern raises" do
     ["", "X", "1"].each { |pattern|
       assert_raise(BackTrackError) { @seq.patscan(pattern) }
     }
   end
 
-  def test_BackTrack_patscan_with_OK_pattern_dont_raise
+  test "#patscan with OK pattern dont raise" do
     ["N", "atcg"].each { |pattern|
       assert_nothing_raised { @seq.patscan(pattern) }
     }
   end
 
-  def test_BackTrack_patscan_with_bad_start_raises
+  test "#patscan with bad start raises" do
     [-1, 20].each { |start| 
       assert_raise(BackTrackError) { @seq.patscan("N", start) }
     }
   end
 
-  def test_BackTrack_patscan_with_OK_start_dont_raise
+  test "#patscan with OK start dont raise" do
     [0, 19].each { |start| 
       assert_nothing_raised { @seq.patscan("N", start) }
     }
   end
 
-  def test_BackTrack_patscan_with_bad_stop_raises
+  test "#patscan with bad stop raises" do
     [-1, 20].each { |stop|
       assert_raise(BackTrackError) { @seq.patscan("N", [0, stop]) }
     }
   end
 
-  def test_BackTrack_patscan_with_OK_stop_dont_raise
+  test "#patscan with OK stop dont raise" do
     [0, 19].each { |stop|
       assert_nothing_raised { @seq.patscan("N", [0, stop]) }
     }
   end
 
-  def test_BackTrack_patscan_with_stop_returns_correctly
+  test "#patscan with stop returns correctly" do
     assert_nil(@seq.patmatch("G", [0, 2]))
     assert_equal("3:1:g", @seq.patmatch("G", [0, 3]).to_s)
   end
 
-  def test_BackTrack_patscan_with_bad_mis_raises
+  test "#patscan with bad mis raises" do
     [-1, 6].each { |mis| 
       assert_raise(BackTrackError) { @seq.patscan("N", 0, mis) }
     }
   end
 
-  def test_BackTrack_patscan_with_OK_mis_dont_raise
+  test "#patscan with OK mis dont raise" do
     [0, 5].each { |mis| 
       assert_nothing_raised { @seq.patscan("N", 0, mis) }
     }
   end
 
-  def test_BackTrack_patscan_with_bad_ins_raises
+  test "#patscan with bad ins raises" do
     [-1, 6].each { |ins| 
       assert_raise(BackTrackError) { @seq.patscan("N", 0, 0, ins) }
     }
   end
 
-  def test_BackTrack_patscan_with_OK_ins_dont_raise
+  test "#patscan with OK ins dont raise" do
     [0, 5].each { |ins| 
       assert_nothing_raised { @seq.patscan("N", 0, 0, ins) }
     }
   end
 
-  def test_BackTrack_patscan_with_bad_del_raises
+  test "#patscan with bad del raises" do
     [-1, 6].each { |del| 
       assert_raise(BackTrackError) { @seq.patscan("N", 0, 0, 0, del) }
     }
   end
 
-  def test_BackTrack_patscan_with_OK_del_dont_raise
+  test "#patscan with OK del dont raise" do
     [0, 5].each { |del| 
       assert_nothing_raised { @seq.patscan("N", 0, 0, 0, del) }
     }
   end
 
-  def test_BackTrack_patscan_perfect_left_is_ok
+  test "#patscan perfect left is ok" do
     assert_equal("0:7:tacgatg", @seq.patscan("TACGATG").first.to_s)
   end
 
-  def test_BackTrack_patscan_perfect_right_is_ok
+  test "#patscan perfect right is ok" do
     assert_equal("13:7:tgcacgg", @seq.patscan("TGCACGG").first.to_s)
   end
 
-  def test_BackTrack_patscan_ambiguity_is_ok
+  test "#patscan ambiguity is ok" do
     assert_equal("13:7:tgcacgg", @seq.patscan("TGCACNN").first.to_s)
   end
 
-  def test_BackTrack_patscan_start_is_ok
+  test "#patscan start is ok" do
     assert_equal("10:1:g", @seq.patscan("N", 10).first.to_s)
     assert_equal("19:1:g", @seq.patscan("N", 10).last.to_s)
   end
 
-  def test_BackTrack_patscan_mis_left_is_ok
+  test "#patscan mis left is ok" do
     assert_equal("0:7:tacgatg", @seq.patscan("Aacgatg", 0, 1).first.to_s)
   end
 
-  def test_BackTrack_patscan_mis_right_is_ok
+  test "#patscan mis right is ok" do
     assert_equal("13:7:tgcacgg", @seq.patscan("tgcacgA", 0, 1).first.to_s)
   end
 
-  def test_BackTrack_patscan_ins_left_is_ok
+  test "#patscan ins left is ok" do
     assert_equal("0:7:tacgatg", @seq.patscan("Atacgatg", 0, 0, 1).first.to_s)
   end
 
-  def test_BackTrack_patscan_ins_right_is_ok
+  test "#patscan ins right is ok" do
     assert_equal("13:7:tgcacgg", @seq.patscan("tgcacggA", 0, 0, 1).first.to_s)
   end
 
-  def test_BackTrack_patscan_del_left_is_ok
+  test "#patscan del left is ok" do
     assert_equal("0:7:tacgatg", @seq.patscan("acgatg", 0, 0, 0, 1).first.to_s)
   end
 
-  def test_BackTrack_patscan_del_right_is_ok
+  test "#patscan del right is ok" do
     assert_equal("12:8:atgcacgg", @seq.patscan("tgcacgg", 0, 0, 0, 1).first.to_s)
   end
 
-  def test_BackTrack_patscan_ambiguity_mis_ins_del_all_ok
+  test "#patscan ambiguity mis ins del all ok" do
     assert_equal("0:20:tacgatgctagcatgcacgg", @seq.patscan("tacatgcNagGatgcCacgg", 0, 1, 1, 1).first.to_s)
   end
 end