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