Getting closer to a subanalysis mode
[mussa.git] / alg / test / test_sequence_location.cpp
1 #include <boost/test/auto_unit_test.hpp>
2
3 #include "alg/sequence_location.hpp"
4 #include "alg/sequence.hpp"
5
6 BOOST_AUTO_TEST_CASE( basic_sequence_location )
7 {
8   Sequence s("AAGGCCTT");
9
10   SequenceLocation sl(s, 0, 2);
11
12   BOOST_CHECK_EQUAL( sl.getLeft(), 0 );
13   BOOST_CHECK_EQUAL( sl.getRight(), 2 );
14   BOOST_CHECK_EQUAL( sl.getCount(), 2 );
15
16   sl.setLeft(1);
17   sl.setRight(3);
18
19   BOOST_CHECK_EQUAL( sl.getLeft(), 1 );
20   BOOST_CHECK_EQUAL( sl.getRight(), 3 );
21   BOOST_CHECK_EQUAL( sl.getCount(), 2 );
22 }
23
24 BOOST_AUTO_TEST_CASE( memory_test )
25 {
26   SequenceLocation *sl;
27   // storing references is a bad idea
28   {
29     Sequence s("AAGGCCTT");
30     sl = new SequenceLocation(s, 0, 2);
31   }
32
33   BOOST_CHECK_EQUAL(sl->getSequence(), "AAGGCCTT");
34 }