update the annotation grammer to make species name optional
[mussa.git] / alg / test / test_sequence.cpp
index f98f236394099793b9050784bef6a830668a2fda..1f3256ee3997bec9e32d767dfb4614aac61c9cf5 100644 (file)
@@ -139,6 +139,33 @@ BOOST_AUTO_TEST_CASE( annotation_load )
   //BOOST_CHECK_EQUAL( annots
 }
 
+BOOST_AUTO_TEST_CASE( annotation_load_no_species_name )
+{
+  string annot_data = "0 10 name   type\n"
+                      "10 20 myf7\n"
+                      "20 30 myod\n"
+                      "50\t55 anothername\n"
+                      "60 50 backward\n"
+                      ">ident3 asdf\n"
+                      "GCT\n"
+                      "gCTn\n"
+                      "75\t90\tname2\ttype2\n"
+                      "100 120 name-asdf type!@#$%\n"
+                      ;
+  string s(100, 'A');
+  s += "GCTGCTAATT";
+  Sequence seq(s);
+                     
+  //istringstream annot_stream(annot_data);
+  seq.parse_annot(annot_data, 0, 0);
+  std::list<annot> annots_list = seq.annotations();
+  std::vector<annot> annots(annots_list.begin(), annots_list.end());
+  BOOST_REQUIRE_EQUAL( annots.size(), 8);
+  BOOST_CHECK_EQUAL( annots[0].start, 0 );
+  BOOST_CHECK_EQUAL( annots[0].end, 10 );
+  BOOST_CHECK_EQUAL( annots[0].type, "type");
+}
+
 // ticket:83 when you try to load a sequence from a file that doesn't
 // have fasta headers it crashes. 
 BOOST_AUTO_TEST_CASE( sequence_past_end )