From 55105f6831a4484e9624a4591098eb93872fac46 Mon Sep 17 00:00:00 2001 From: martinahansen Date: Wed, 5 Dec 2012 10:21:36 +0000 Subject: [PATCH] refactorying PatternMatcher to Dynamic git-svn-id: http://biopieces.googlecode.com/svn/trunk@2032 74ccb610-7750-0410-82ae-013aeee3265d --- .../test/maasha/seq/test_patternmatcher.rb | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/code_ruby/test/maasha/seq/test_patternmatcher.rb b/code_ruby/test/maasha/seq/test_patternmatcher.rb index 8327117..8e1121e 100755 --- a/code_ruby/test/maasha/seq/test_patternmatcher.rb +++ b/code_ruby/test/maasha/seq/test_patternmatcher.rb @@ -26,25 +26,24 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib') # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< require 'maasha/seq' -require 'maasha/seq/patternmatcher' +require 'maasha/seq/dynamic' require 'test/unit' require 'pp' class Seq - include PatternMatcher + include Dynamic end -class TestPatternMatcher < Test::Unit::TestCase - +class TestDynamic < Test::Unit::TestCase def setup @p = Seq.new("test", "atcg") end - def test_PatternMatcher_no_match_returns_nil + def test_Dynamic_no_match_returns_nil assert_nil(@p.patmatch("gggg")) end - def test_PatternMatcher_patmatch_perfect_returns_correctly + def test_Dynamic_patmatch_perfect_returns_correctly m = @p.patmatch("atcg") assert_equal(0, m.beg) assert_equal("atcg", m.match) @@ -54,7 +53,7 @@ class TestPatternMatcher < Test::Unit::TestCase assert_equal(4, m.length) end - def test_PatternMatcher_patmatch_perfect_with_ambiguity_codes_returns_correctly + def test_Dynamic_patmatch_perfect_with_ambiguity_codes_returns_correctly m = @p.patmatch("nnnn") assert_equal(0, m.beg) assert_equal("atcg", m.match) @@ -64,11 +63,11 @@ class TestPatternMatcher < Test::Unit::TestCase assert_equal(4, m.length) end - def test_PatternMatcher_patmatch_with_one_mismatch_and_edit_dist_zero_returns_nil + def test_Dynamic_patmatch_with_one_mismatch_and_edit_dist_zero_returns_nil assert_nil(@p.patmatch("aCcg")) end - def test_PatternMatcher_patmatch_with_one_mismatch_and_edit_dist_one_returns_correctly + def test_Dynamic_patmatch_with_one_mismatch_and_edit_dist_one_returns_correctly m = @p.patmatch("aCcg", 0, 1) assert_equal(0, m.beg) assert_equal("atcg", m.match) @@ -78,15 +77,15 @@ class TestPatternMatcher < Test::Unit::TestCase assert_equal(4, m.length) end - def test_PatternMatcher_patmatch_with_two_mismatch_and_edit_dist_one_returns_nil + def test_Dynamic_patmatch_with_two_mismatch_and_edit_dist_one_returns_nil assert_nil(@p.patmatch("aGcA", 0, 1)) end - def test_PatternMatcher_patmatch_with_one_insertion_and_edit_dist_zero_returns_nil + def test_Dynamic_patmatch_with_one_insertion_and_edit_dist_zero_returns_nil assert_nil(@p.patmatch("atGcg")) end - def test_PatternMatcher_patmatch_with_one_insertion_and_edit_dist_one_returns_correctly + def test_Dynamic_patmatch_with_one_insertion_and_edit_dist_one_returns_correctly m = @p.patmatch("atGcg", 0, 1) assert_equal(0, m.beg) assert_equal("atcg", m.match) @@ -96,11 +95,11 @@ class TestPatternMatcher < Test::Unit::TestCase assert_equal(4, m.length) end - def test_PatternMatcher_patmatch_with_two_insertions_and_edit_dist_one_returns_nil + def test_Dynamic_patmatch_with_two_insertions_and_edit_dist_one_returns_nil assert_nil(@p.patmatch("atGcTg", 0, 1)) end - def test_PatternMatcher_patmatch_with_two_insertions_and_edit_dist_two_returns_correctly + def test_Dynamic_patmatch_with_two_insertions_and_edit_dist_two_returns_correctly m = @p.patmatch("atGcTg", 0, 2) assert_equal(0, m.beg) assert_equal("atcg", m.match) @@ -110,11 +109,11 @@ class TestPatternMatcher < Test::Unit::TestCase assert_equal(4, m.length) end - def test_PatternMatcher_patmatch_with_one_deletion_and_edit_distance_zero_returns_nil + def test_Dynamic_patmatch_with_one_deletion_and_edit_distance_zero_returns_nil assert_nil(@p.patmatch("acg")) end - def test_PatternMatcher_patmatch_with_one_deletion_and_edit_distance_one_returns_correctly + def test_Dynamic_patmatch_with_one_deletion_and_edit_distance_one_returns_correctly m = @p.patmatch("acg", 0, 1) assert_equal(0, m.beg) assert_equal("atcg", m.match) @@ -124,12 +123,12 @@ class TestPatternMatcher < Test::Unit::TestCase assert_equal(4, m.length) end - def test_PatternMatcher_patscan_locates_three_patterns_ok + def test_Dynamic_patscan_locates_three_patterns_ok p = Seq.new("test", "ataacgagctagctagctagctgactac") assert_equal(3, p.patscan("tag").count) end - def test_PatternMatcher_patscan_with_pos_locates_two_patterns_ok + def test_Dynamic_patscan_with_pos_locates_two_patterns_ok p = Seq.new("test", "ataacgagctagctagctagctgactac") assert_equal(2, p.patscan("tag", 10).count) end -- 2.39.5