Add getdefault to Annotations
[mussa.git] / alg / test / test_annotations.cpp
index 8bb0bea6407778ae365ecd61dc757a3f1dcd58e1..970d516ee93613e1166be1ef2a701650b661aab8 100644 (file)
@@ -53,6 +53,16 @@ BOOST_AUTO_TEST_CASE( annotations_get_metadata )
   BOOST_CHECK_THROW( asp->get("not there"), annotations_key_error ); 
 }
 
+
+BOOST_AUTO_TEST_CASE( annotations_getdefault_metadata )
+{
+  boost::shared_ptr<Annotations> asp(new Annotations("asp"));
+  asp->set("header", "> amsp");
+  
+  BOOST_CHECK_EQUAL( asp->size(), 2 );
+  BOOST_CHECK_EQUAL( asp->getdefault("header", "foo"), "> amsp" );
+  BOOST_CHECK_EQUAL( asp->getdefault("not there", "foo"), "foo" ); 
+}
 BOOST_AUTO_TEST_CASE( annotations_has_key )
 {
   boost::shared_ptr<Annotations> asp(new Annotations("asp"));