more error messages for loading an annotation.
[mussa.git] / alg / test / test_mussa.cpp
index 74f8a9c658e55047f7a8b2e24e4502eafd99e423..16068473c01500185aedec71871fd90cd1818374 100644 (file)
@@ -1,3 +1,4 @@
+#define BOOST_AUTO_TEST_MAIN
 #include <boost/test/auto_unit_test.hpp>
 #include <boost/filesystem/path.hpp>
 #include <boost/filesystem/operations.hpp>
@@ -160,6 +161,14 @@ BOOST_AUTO_TEST_CASE( mussa_mupa_is_file_not_directory )
   BOOST_CHECK_THROW(m1.load_mupa_file( curdir ), mussa_load_error );
 }
 
+// catch error if annotation isn't a file
+BOOST_AUTO_TEST_CASE( mussa_annotation_is_not_file )
+{
+  Mussa m1;
+  fs::path full_path(fs::path(EXAMPLE_DIR, fs::native) / "directory.mupa");
+  BOOST_CHECK_THROW( m1.load_mupa_file( full_path ), mussa_load_error );
+}
+
 BOOST_AUTO_TEST_CASE( mussa_load_analysis )
 {
   fs::path example_dir(EXAMPLE_DIR, fs::native);
@@ -462,7 +471,6 @@ BOOST_AUTO_TEST_CASE( three_way_local_alignment )
       result_i != result.end();
       ++result_i)
   {
-    std::cout << "path ";
     ConservedPath::path_element first_element = *(result_i->begin());
     for (ConservedPath::path_type::iterator element_i = result_i->begin();
          element_i != result_i->end();
@@ -472,12 +480,23 @@ BOOST_AUTO_TEST_CASE( three_way_local_alignment )
       BOOST_CHECK_EQUAL( s0[*element_i], s1[*element_i] );
       BOOST_CHECK_EQUAL( s1[*element_i], s2[*element_i] );
       BOOST_CHECK_EQUAL( s0[*element_i], s2[*element_i] );
-      std::cout << *element_i << " " << s0[*element_i];
     }
-    std::cout << std::endl;
   }   
 }
 
+BOOST_AUTO_TEST_CASE( mussa_window_larger_than_sequence )
+{
+  string s0("AGCAGGG");
+  string s1("CAGCGGG");
+  
+  Mussa analysis;
+  analysis.append_sequence(s0);
+  analysis.append_sequence(s1);
+  analysis.set_threshold(23);
+  analysis.set_window(30);
+  BOOST_CHECK_THROW(analysis.analyze(), seqcomp_error);
+}
+
 BOOST_AUTO_TEST_CASE( subanalysis )
 {
   Sequence s1("AATGAAGATTTTAATGCTTTAATTTTGTTTTGTAAACTTCGAATTTCCAAAATTTGAAA");