There can be only one (filename convention)
[mussa.git] / alg / test / test_nway.cpp
diff --git a/alg/test/test_nway.cpp b/alg/test/test_nway.cpp
new file mode 100644 (file)
index 0000000..d67753c
--- /dev/null
@@ -0,0 +1,58 @@
+#include <boost/test/auto_unit_test.hpp>
+
+#include <string>
+#include <iostream>
+
+#include "alg/mussa.hpp"
+#include "alg/nway_paths.hpp"
+#include "alg/sequence.hpp"
+
+using namespace std;
+
+//! there should be no matches
+BOOST_AUTO_TEST_CASE( nway_null )
+{
+  string s0("AAAANNNN");
+  string s1("GGGGNNNN");
+  string s2("TTTTNNNN");
+
+  Mussa analysis;
+  analysis.add_a_seq(s0);
+  analysis.add_a_seq(s1);
+  analysis.add_a_seq(s2);
+  analysis.analyze(4,3);
+  NwayPaths npath = analysis.paths();
+  // there should be no paths for these sequences
+  for (std::list<ConservedPath >::iterator pathz_i = npath.pathz.begin();
+       pathz_i != npath.pathz.end();
+       ++pathz_i)
+  {
+    BOOST_CHECK_EQUAL( pathz_i->size(), 0);
+  }
+}
+
+BOOST_AUTO_TEST_CASE( nway_test )
+{
+  string s0("ATATGCGC");
+  string s1("GGGGGGGC");
+  Sequence seq1(s1);
+
+  Mussa analysis;
+  analysis.add_a_seq(s0);
+  analysis.add_a_seq(s1);
+  analysis.analyze(4,3);
+  NwayPaths npath = analysis.paths();
+  for (std::list<ConservedPath >::iterator pathz_i = npath.pathz.begin();
+       pathz_i != npath.pathz.end();
+       ++pathz_i)
+  {
+    for( ConservedPath::iterator path_i = pathz_i->begin();
+         path_i != pathz_i->end();
+         ++path_i)
+    {      
+      BOOST_CHECK( *path_i == 4 || *path_i == -4);
+    }
+  }
+}
+
+