Debugging Leaf, FullLeaf, DiffLeaf

Added unit new tests
diff --git a/test/test_leaf.cc b/test/test_leaf.cc
index 7c6095a..d2c8289 100644
--- a/test/test_leaf.cc
+++ b/test/test_leaf.cc
@@ -24,8 +24,11 @@
 #include <boost/test/output_test_stream.hpp> 
 using boost::test_tools::output_test_stream;
 
+#include <boost/make_shared.hpp>
+
 #include "../model/sync-full-leaf.h"
 #include "../model/sync-diff-leaf.h"
+#include "../model/sync-std-name-info.h"
 
 using namespace Sync;
 using namespace std;
@@ -35,7 +38,62 @@
 
 BOOST_AUTO_TEST_CASE (LeafBase)
 {
-  // Leaf test;
+  NameInfoConstPtr name = StdNameInfo::FindOrCreate ("/test/name");
+  BOOST_CHECK (name != 0);
+
+  // find the same name
+  BOOST_CHECK (name.get () == StdNameInfo::FindOrCreate ("/test/name").get ());
+  BOOST_CHECK_EQUAL (name.use_count (), 2);
+
+  BOOST_CHECK_NO_THROW (DiffLeaf x (name, SeqNo (12)));
+  BOOST_CHECK_EQUAL (name.use_count (), 2);
+  
+  BOOST_CHECK_NO_THROW (DiffLeaf x (name));
+  BOOST_CHECK_EQUAL (name.use_count (), 2);
+
+  DiffLeaf updateLeaf (name, SeqNo (12));
+  BOOST_CHECK_EQUAL (name.use_count (), 3);
+
+  DiffLeaf removeLeaf (name);
+  BOOST_CHECK_EQUAL (name.use_count (), 4);
+
+  BOOST_CHECK_EQUAL (updateLeaf.getOperation (), UPDATE);
+  BOOST_CHECK_EQUAL (updateLeaf.getSeq ().getSession (), 0);
+  BOOST_CHECK_EQUAL (updateLeaf.getSeq ().getSeq (), 12);
+  
+  BOOST_CHECK_EQUAL (removeLeaf.getOperation (), REMOVE);
+  BOOST_CHECK_EQUAL (removeLeaf.getSeq ().getSession (), 0);
+  BOOST_CHECK_EQUAL (removeLeaf.getSeq ().getSeq (), 0);
+  
+  BOOST_REQUIRE_NO_THROW (FullLeaf x (name, SeqNo (12)));
+  FullLeaf fullLeaf (name, SeqNo (12));
+  BOOST_CHECK_EQUAL (name.use_count (), 5);
+}
+
+BOOST_AUTO_TEST_CASE (LeafDigest)
+{
+  BOOST_CHECK_EQUAL (StdNameInfo::FindOrCreate ("/test/name").use_count (), 2);
+  NameInfoConstPtr name = StdNameInfo::FindOrCreate ("/test/name");
+  FullLeaf fullLeaf (name, SeqNo (12));
+
+  // fullLeafDigest = hash ( hash(name), hash (session, seqNo) )
+  
+  // Digest manualDigest;
+
+  // Digest manualNameDigest;
+  // manualNameDigest << "/test/name";
+  // manualNameDigest.finalize ();
+
+  // Digest manualSeqNoDigest;
+  // manualSeqNoDigest << 0 << 12;
+  // manualSeqNoDigest.finalize ();
+
+  // manualDigest << manualNameDigest << manualSeqNoDigest;
+  // manualDigest.finalize ();
+
+  output_test_stream output;
+  output << fullLeaf.getDigest ();
+  BOOST_CHECK (output.is_equal ("991f8cf6262dfe0f519c63f6e9b92fe69e741a9b", true));
 }
 
 BOOST_AUTO_TEST_SUITE_END()