-#define BOOST_AUTO_TEST_MAIN
-#include <boost/test/auto_unit_test.hpp>
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MODULE test_mussa
+#include <boost/test/unit_test.hpp>
+
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
namespace fs = boost::filesystem;
m.nway();
}
+BOOST_AUTO_TEST_CASE( mussa_load_mupa_crlf )
+{
+ fs::path example_path(EXAMPLE_DIR, fs::native);
+ fs::path seq_path(example_path / "seq" / "mouse_mck_pro.fa");
+ fs::path annot_path(example_path / "mm_mck3test.annot");
+
+ std::string mupa(
+ "# hello\015\012"
+ "ANA_NAME load_mupa_crlf\015\012");
+ mupa += "SEQUENCE " + seq_path.native_file_string() + "\015\012";
+ mupa += "ANNOTATION " + annot_path.native_file_string() + "\015\012";
+
+ istringstream mupa_stream(mupa);
+ Mussa m;
+ fs::path base;
+ m.load_mupa_stream( mupa_stream, base );
+ // Should run with no exceptions
+}
+
+BOOST_AUTO_TEST_CASE( mussa_load_mupa_comment_character )
+{
+ fs::path mupa_path(EXAMPLE_DIR, fs::native);
+ fs::path seq_path = fs::initial_path() / "seq" / "mouse_mck_pro.fa";
+ fs::path annot_path = fs::initial_path() / "mm_mck3test.annot";
+
+ std::string mupa(
+ "# hello\015\012"
+ "ANA_NAME load_mupa_crlf\015\012");
+ mupa += "#SEQUENCE " + seq_path.native_file_string() + "\015\012";
+ mupa += "#ANNOTATION " + annot_path.native_file_string() + "\015\012";
+
+ istringstream mupa_stream(mupa);
+ Mussa m;
+ fs::path base;
+ m.load_mupa_stream( mupa_stream, base );
+ // Should run with no exceptions
+}
+
+BOOST_AUTO_TEST_CASE( mussa_load_mupa_exception )
+{
+ std::string mupa(
+ "# hello\015\012"
+ "ANA_NAME load_mupa_crlf\015\012"
+ "mwahhaha I broke you!\n"
+ );
+
+ istringstream mupa_stream(mupa);
+ Mussa m;
+ fs::path base;
+ BOOST_CHECK_THROW(m.load_mupa_stream( mupa_stream, base ), mussa_load_error);
+}
+
BOOST_AUTO_TEST_CASE( mussa_load_mupa )
{
fs::path mupa_path(EXAMPLE_DIR, fs::native);