Debugging and test suites of FullState and DiffState

Digest checking is still missing from unit tests
diff --git a/model/sync-full-state.cc b/model/sync-full-state.cc
index 7e4a30f..801bfbf 100644
--- a/model/sync-full-state.cc
+++ b/model/sync-full-state.cc
@@ -65,7 +65,7 @@
   if (m_digest == 0)
     {
       m_digest = make_shared<Digest> ();
-      BOOST_FOREACH (LeafConstPtr leaf, m_leaves)
+      BOOST_FOREACH (LeafConstPtr leaf, m_leaves.get<ordered> ())
         {
           FullLeafConstPtr fullLeaf = dynamic_pointer_cast<const FullLeaf> (leaf);
           BOOST_ASSERT (fullLeaf != 0);
diff --git a/model/sync-name-info.h b/model/sync-name-info.h
index bc04c33..ebe946b 100644
--- a/model/sync-name-info.h
+++ b/model/sync-name-info.h
@@ -47,11 +47,22 @@
    */
   size_t
   getHashId () const { return m_id; }
-  
+
+  /**
+   * @brief Check if two names are equal
+   * @param info name to check with
+   */
   virtual bool
   operator == (const NameInfo &info) const = 0;
 
   /**
+   * @brief Check if two names are in order
+   * @param info name to check with
+   */
+  virtual bool
+  operator < (const NameInfo &info) const = 0;
+
+  /**
    * @brief Calculates digest of the name
    */
   const Digest &
diff --git a/model/sync-state-leaf-container.h b/model/sync-state-leaf-container.h
index 8f44fc9..2c7e8b9 100644
--- a/model/sync-state-leaf-container.h
+++ b/model/sync-state-leaf-container.h
@@ -24,10 +24,11 @@
 #define SYNC_STATE_LEAF_CONTAINER
 
 #include "sync-leaf.h"
+#include "sync-name-info.h"
 
 #include <boost/multi_index_container.hpp>
 // #include <boost/multi_index/tag.hpp>
-// #include <boost/multi_index/ordered_index.hpp>
+#include <boost/multi_index/ordered_index.hpp>
 // #include <boost/multi_index/composite_key.hpp>
 #include <boost/multi_index/hashed_index.hpp>
 // #include <boost/multi_index/random_access_index.hpp>
@@ -48,6 +49,7 @@
 };
 
 struct hashed { };
+struct ordered { };
 
 /**
  * \ingroup sync
@@ -61,7 +63,11 @@
         mi::tag<hashed>,
         mi::const_mem_fun<Leaf, const NameInfo&, &Leaf::getInfo>,
         NameInfoHash
-      >
+        >,
+      mi::ordered_unique<
+        mi::tag<ordered>,
+        mi::const_mem_fun<Leaf, const NameInfo&, &Leaf::getInfo>
+        >
     >
    >
 {
diff --git a/model/sync-state.h b/model/sync-state.h
index edff566..0576af2 100644
--- a/model/sync-state.h
+++ b/model/sync-state.h
@@ -58,6 +58,13 @@
   virtual void
   remove (NameInfoConstPtr info) = 0;
 
+  /**
+   * @brief Get state leaves
+   */
+  const LeafContainer &
+  getLeaves () const 
+  { return m_leaves; }
+  
 protected:
   LeafContainer m_leaves;
 };
diff --git a/model/sync-std-name-info.cc b/model/sync-std-name-info.cc
index 5b57fbe..53fcdac 100644
--- a/model/sync-std-name-info.cc
+++ b/model/sync-std-name-info.cc
@@ -54,15 +54,13 @@
 bool
 StdNameInfo::operator == (const NameInfo &info) const
 {
-  try
-    {
-      return m_name == dynamic_cast<const StdNameInfo&> (info).m_name;
-    }
-  catch (...)
-    {
-      return false;
-    }
+  return m_name == dynamic_cast<const StdNameInfo&> (info).m_name;
+}
+
+bool
+StdNameInfo::operator < (const NameInfo &info) const
+{
+  return m_name < dynamic_cast<const StdNameInfo&> (info).m_name;
 }
 
 } // Sync
-
diff --git a/model/sync-std-name-info.h b/model/sync-std-name-info.h
index 34b853a..1821fb4 100644
--- a/model/sync-std-name-info.h
+++ b/model/sync-std-name-info.h
@@ -44,6 +44,9 @@
   virtual bool
   operator == (const NameInfo &info) const;
 
+  virtual bool
+  operator < (const NameInfo &info) const;
+
   virtual std::string
   toString () const;