Update mussa to build on ubuntu 10.04 with qt 4.6.2 +boost 1.40.0.1
[mussa.git] / alg / test / test_annotations.cpp
index 8bb0bea6407778ae365ecd61dc757a3f1dcd58e1..5a92f096fd317cfe0e26fcf0f05b63ff49a2fa7f 100644 (file)
@@ -1,5 +1,6 @@
-#define BOOST_AUTO_TEST_MAIN
-#include <boost/test/auto_unit_test.hpp>
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MODULE test_annotations
+#include <boost/test/unit_test.hpp>
 
 #include <boost/shared_ptr.hpp>
 #include "annotations.hpp"
@@ -53,6 +54,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"));
@@ -61,4 +72,5 @@ BOOST_AUTO_TEST_CASE( annotations_has_key )
   BOOST_CHECK_EQUAL(asp->has_key("header"), true);
   BOOST_CHECK_EQUAL(asp->has_key("name"), true);
   BOOST_CHECK_EQUAL(asp->has_key("secret"), false);
-}
\ No newline at end of file
+}
+