From: martinahansen Date: Wed, 2 Jan 2013 09:51:15 +0000 (+0000) Subject: added test for align dir X-Git-Url: https://git.donarmstrong.com/?p=biopieces.git;a=commitdiff_plain;h=0372a3bb5769a504a052fb29827dfa9388c38509 added test for align dir git-svn-id: http://biopieces.googlecode.com/svn/trunk@2050 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/code_ruby/test/maasha/align/test_matches.rb b/code_ruby/test/maasha/align/test_matches.rb new file mode 100755 index 0000000..115e85f --- /dev/null +++ b/code_ruby/test/maasha/align/test_matches.rb @@ -0,0 +1,60 @@ +#!/usr/bin/env ruby +$:.unshift File.join(File.dirname(__FILE__),'..','lib') + +# Copyright (C) 2012 Martin A. Hansen. + +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# http://www.gnu.org/copyleft/gpl.html + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + +# This software is part of the Biopieces framework (www.biopieces.org). + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + +require 'test/unit' +require 'maasha/align/matches' +require 'pp' + +class MatchesTest < Test::Unit::TestCase + def test_Matches_find_with_no_match_returns_correctly + assert_equal("[]", Matches.find("atcg", "atcg", 0, 0, 3, 3, 8).to_s) + end + + def test_Matches_find_with_one_match_returns_correctly + assert_equal("[q: 2 3 s: 0 1 l: 2 s: 0.0]", Matches.find("01cg", "cg23", 0, 0, 3, 3, 2).to_s) + assert_equal("[q: 0 1 s: 2 3 l: 2 s: 0.0]", Matches.find("cg23", "01cg", 0, 0, 3, 3, 2).to_s) + end + + def test_Matches_find_with_two_matches_returns_correctly + assert_equal("[q: 0 1 s: 0 1 l: 2 s: 0.0, q: 3 4 s: 3 4 l: 2 s: 0.0]", Matches.find("atXcg", "atYcg", 0, 0, 4, 4, 2).to_s) + assert_equal("[q: 0 1 s: 0 1 l: 2 s: 0.0, q: 3 4 s: 3 4 l: 2 s: 0.0]", Matches.find("atYcg", "atXcg", 0, 0, 4, 4, 2).to_s) + end + + def test_Matches_find_dont_expand_match_outside_space + assert_equal("[q: 1 2 s: 1 2 l: 2 s: 0.0]", Matches.find("atcg", "atcg", 1, 1, 2, 2, 2).to_s) + end + + def test_Matches_find_right_expands_correctly + assert_equal("[q: 0 3 s: 0 3 l: 4 s: 0.0]", Matches.find("atcg", "atcg", 0, 0, 3, 3, 3).to_s) + end + +# def test_Matches_find_left_expands_correctly +# flunk +# assert_equal("[q: 1 2 s: 1 2 l: 2 s: 0.0]", Matches.find("ccccc", "cccc", 0, 0, 3, 3, 2).to_s) +# end +end + diff --git a/code_ruby/test/maasha/align/test_mem.rb b/code_ruby/test/maasha/align/test_mem.rb new file mode 100755 index 0000000..04c6b8f --- /dev/null +++ b/code_ruby/test/maasha/align/test_mem.rb @@ -0,0 +1,36 @@ +#!/usr/bin/env ruby +$:.unshift File.join(File.dirname(__FILE__),'..','lib') + +# Copyright (C) 2013 Martin A. Hansen. + +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# http://www.gnu.org/copyleft/gpl.html + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + +# This software is part of the Biopieces framework (www.biopieces.org). + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + +require 'test/unit' +require 'maasha/align/mem' +require 'pp' + +class MemTest < Test::Unit::TestCase + def test_Matches_find_with_no_match_returns_correctly + assert_equal("[]", Matches.find("atcg", "atcg", 0, 0, 3, 3, 8).to_s) + end +end