045c7e2f2542554726a8c9d848c2ab39ac3bc138
[mussa.git] / alg / test / test_paircomp.cpp
1 #define BOOST_AUTO_TEST_MAIN
2 #include <boost/test/auto_unit_test.hpp>
3 #include <boost/filesystem/path.hpp>
4 namespace fs = boost::filesystem;
5
6 #include <string>
7 #include <iostream>
8
9 #include "alg/sequence.hpp"
10 #include "paircomp.hh"
11
12 using namespace std;
13
14 BOOST_AUTO_TEST_CASE( simple_nxn_comparison )
15 {
16   std::string s(10, 'A');
17   Sequence s1(s);
18   Sequence s2(s);
19   
20   paircomp::ImmutableComparison *cmp;
21   // Make sure we called the string constructor correctly
22   BOOST_REQUIRE_EQUAL( s1.size(), 10 );
23   BOOST_REQUIRE_EQUAL( s2.size(), 10 );
24   cmp = paircomp::simple_nxn_comparison<Sequence>(s1, s2, 10, 0.10);
25   
26   BOOST_CHECK_EQUAL( cmp->is_empty(), false);
27   const paircomp::_MatchContainer *matches = cmp->get_matches(0);
28   BOOST_REQUIRE( matches != 0);
29   BOOST_CHECK_EQUAL( matches->num, 1 );
30 }
31
32 BOOST_AUTO_TEST_CASE( simple_nxn_comparison_mixed_case )
33 {
34   Sequence s1("AtGGcT");
35   Sequence s2("aTggCt");
36   
37   paircomp::ImmutableComparison *cmp;
38   // Make sure we called the string constructor correctly
39   BOOST_REQUIRE_EQUAL( s1.size(), 6 );
40   BOOST_REQUIRE_EQUAL( s2.size(), 6 );
41   cmp = paircomp::simple_nxn_comparison<Sequence>(s1, s2, 6, 1.0);
42   
43   BOOST_CHECK_EQUAL( cmp->is_empty(), false);
44   const paircomp::_MatchContainer *matches = cmp->get_matches(0);
45   BOOST_REQUIRE( matches != 0);
46   BOOST_CHECK_EQUAL( matches->num, 1 );  
47 }