refactored PathScene into SequenceBrowserWidget
[mussa.git] / alg / test / test_glseqbrowser.cpp
1 #include <boost/test/auto_unit_test.hpp>
2 #include <boost/assign/std/vector.hpp>
3 using namespace boost::assign;
4
5 #include <string>
6 #include <list>
7 #include <vector>
8
9 #include "alg/annotation_colors.hpp"
10 #include "alg/glseqbrowser.hpp"
11 #include "alg/sequence.hpp"
12
13 using namespace std;
14
15 BOOST_AUTO_TEST_CASE ( gltracks_connect )
16 {
17   string s0("AAGGCCTT");
18   string s1("TTGGCCAA");
19   string s2("GATTACAA");
20   Sequence seq0(s0);
21   Sequence seq1(s1);
22   Sequence seq2(s2);
23
24   GlSeqBrowser gt;
25   gt.push_sequence(seq0);
26   gt.push_sequence(seq1);
27   gt.push_sequence(seq2);
28
29   // make up some sample data
30   vector<bool> rc;
31   rc += false, false, false;
32   vector<int> path;
33                 path += 1,1,1; gt.link(path, rc, 1);
34   path.clear(); path += 1,1,3; gt.link(path, rc, 1); 
35   path.clear(); path += 2,3,3; gt.link(path, rc, 1); 
36   path.clear(); path += 3,3,3; gt.link(path, rc, 1);
37
38   BOOST_CHECK_EQUAL( gt.path_segments.size(), 2 );
39   GlSeqBrowser::segment_key p(1, 1);
40   GlSeqBrowser::pair_segment_map::iterator psm_i = gt.path_segments[0].find(p);
41   BOOST_CHECK( psm_i != gt.path_segments[0].end() );
42   BOOST_CHECK_EQUAL( psm_i->second.path_ids.size(), 2 );
43
44   gt.clear();
45   BOOST_CHECK_EQUAL( gt.path_segments.size(), 0 );
46 }
47