Getting closer to a subanalysis mode
[mussa.git] / alg / test / test_sequence_location.cpp
diff --git a/alg/test/test_sequence_location.cpp b/alg/test/test_sequence_location.cpp
new file mode 100644 (file)
index 0000000..7154652
--- /dev/null
@@ -0,0 +1,34 @@
+#include <boost/test/auto_unit_test.hpp>
+
+#include "alg/sequence_location.hpp"
+#include "alg/sequence.hpp"
+
+BOOST_AUTO_TEST_CASE( basic_sequence_location )
+{
+  Sequence s("AAGGCCTT");
+
+  SequenceLocation sl(s, 0, 2);
+
+  BOOST_CHECK_EQUAL( sl.getLeft(), 0 );
+  BOOST_CHECK_EQUAL( sl.getRight(), 2 );
+  BOOST_CHECK_EQUAL( sl.getCount(), 2 );
+
+  sl.setLeft(1);
+  sl.setRight(3);
+
+  BOOST_CHECK_EQUAL( sl.getLeft(), 1 );
+  BOOST_CHECK_EQUAL( sl.getRight(), 3 );
+  BOOST_CHECK_EQUAL( sl.getCount(), 2 );
+}
+
+BOOST_AUTO_TEST_CASE( memory_test )
+{
+  SequenceLocation *sl;
+  // storing references is a bad idea
+  {
+    Sequence s("AAGGCCTT");
+    sl = new SequenceLocation(s, 0, 2);
+  }
+
+  BOOST_CHECK_EQUAL(sl->getSequence(), "AAGGCCTT");
+}