add test for basic cd parsing

Change-Id: If35d62e323d48db11dc4128fb5c2898ef4ef63a6
diff --git a/src/CTree.cpp b/src/CTree.cpp
index 994515a..7d89cf3 100644
--- a/src/CTree.cpp
+++ b/src/CTree.cpp
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/
+ * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/
  *
  * Written by Václav Kubernát <kubervac@fit.cvut.cz>
  *
@@ -17,21 +18,47 @@
         return prefix + '/' + suffix;
 }
 
-const std::unordered_set<std::string>& CTree::children(const std::string& node) const
+bool TreeNode::operator<(const TreeNode& b) const
+{
+    return this->m_name < b.m_name;
+}
+
+CTree::CTree()
+{
+    m_nodes.emplace("", std::unordered_map<std::string, NODE_TYPE>());
+}
+
+const std::unordered_map<std::string, NODE_TYPE>& CTree::children(const std::string& node) const
 {
     return m_nodes.at(node);
 }
 
-bool CTree::checkNode(const std::string& location, const std::string& node) const
+bool CTree::nodeExists(const std::string& location, const std::string& node) const
 {
-    if (node == ".." || node.empty())
+    if (node.empty())
         return true;
-    const auto& childrenRef = children(location); //first, get a reference to all children
-    if (childrenRef.find(node) == childrenRef.end()) { //find the desired node, if it isn't present throw an exception
-        throw InvalidNodeException(node);
-    }
-    return true;
+    const auto& childrenRef = children(location);
+
+    return childrenRef.find(node) != childrenRef.end();
 }
+
+bool CTree::isContainer(const std::string& location, const std::string& node) const
+{
+    if (!nodeExists(location, node))
+        return false;
+    return children(location).at(node) == TYPE_CONTAINER;
+}
+
+void CTree::addContainer(const std::string& location, const std::string& name)
+{
+    m_nodes.at(location).emplace(name, TYPE_CONTAINER);
+
+    //create a new set of children for the new node
+    std::string key = joinPaths(location, name);
+    m_nodes.emplace(key, std::unordered_map<std::string, NODE_TYPE>());
+}
+
+
 void CTree::changeNode(const std::string& node)
 {
     if (node.empty()) {
@@ -44,21 +71,3 @@
 {
     return m_curDir;
 }
-
-void CTree::addNode(const std::string& location, const std::string& name)
-{
-    m_nodes.at(location).insert(name);
-
-    //create a new set of children for the new node
-    m_nodes.emplace(joinPaths(location, name), std::unordered_set<std::string>());
-}
-void CTree::initDefault()
-{
-    m_nodes.emplace("", std::unordered_set<std::string>());
-    addNode("", "aaa");
-    addNode("", "bbb");
-    addNode("", "ccc");
-    addNode("aaa", "aaabbb");
-    addNode("aaa", "aaauuu");
-    addNode("bbb", "bbbuuu");
-}