Parse key values as leaf_data

Change-Id: Ib70a47dd4bcea0426d3b2063a845d4ce075d81f4
diff --git a/tests/cd.cpp b/tests/cd.cpp
index 1d03e78..8b569b7 100644
--- a/tests/cd.cpp
+++ b/tests/cd.cpp
@@ -24,8 +24,11 @@
     schema->addContainer("/example:a/example:a2", "example:a3");
     schema->addContainer("/example:b/example:b2", "example:b3");
     schema->addList("/", "example:list", {"number"});
+    schema->addLeaf("/example:list", "example:number", yang::LeafDataTypes::Int32);
     schema->addContainer("/example:list", "example:contInList");
     schema->addList("/", "example:twoKeyList", {"number", "name"});
+    schema->addLeaf("/example:twoKeyList", "example:number", yang::LeafDataTypes::Int32);
+    schema->addLeaf("/example:twoKeyList", "example:name", yang::LeafDataTypes::String);
     Parser parser(schema);
     std::string input;
     std::ostringstream errorStream;
@@ -98,16 +101,16 @@
             SECTION("example:list[number=1]")
             {
                 input = "cd example:list[number=1]";
-                auto keys = std::map<std::string, std::string>{
-                    {"number", "1"}};
+                auto keys = std::map<std::string, leaf_data_>{
+                    {"number", int32_t{1}}};
                 expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, listElement_("list", keys)));
             }
 
             SECTION("example:list[number=1]/contInList")
             {
                 input = "cd example:list[number=1]/contInList";
-                auto keys = std::map<std::string, std::string>{
-                    {"number", "1"}};
+                auto keys = std::map<std::string, leaf_data_>{
+                    {"number", int32_t{1}}};
                 expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, listElement_("list", keys)));
                 expected.m_path.m_nodes.push_back(dataNode_(container_("contInList")));
             }
@@ -115,9 +118,9 @@
             SECTION("example:twoKeyList[number=4][name='abcd']")
             {
                 input = "cd example:twoKeyList[number=4][name='abcd']";
-                auto keys = std::map<std::string, std::string>{
-                    {"number", "4"},
-                    {"name", "abcd"}};
+                auto keys = std::map<std::string, leaf_data_>{
+                    {"number", int32_t{4}},
+                    {"name", std::string{"abcd"}}};
                 expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, listElement_("twoKeyList", keys)));
             }
         }
diff --git a/tests/enum_completion.cpp b/tests/enum_completion.cpp
index a8ec4d2..d7dfd58 100644
--- a/tests/enum_completion.cpp
+++ b/tests/enum_completion.cpp
@@ -19,6 +19,7 @@
     schema->addLeafEnum("/", "mod:leafEnum", {"lala", "lol", "data", "coze"});
     schema->addLeafEnum("/mod:contA", "mod:leafInCont", {"abc", "def"});
     schema->addList("/", "mod:list", {"number"});
+    schema->addLeaf("/mod:list", "mod:number", yang::LeafDataTypes::Int32);
     schema->addLeafEnum("/mod:list", "mod:leafInList", {"ano", "anoda", "ne", "katoda"});
     Parser parser(schema);
     std::string input;
diff --git a/tests/leaf_editing.cpp b/tests/leaf_editing.cpp
index d7703c0..61704f6 100644
--- a/tests/leaf_editing.cpp
+++ b/tests/leaf_editing.cpp
@@ -47,6 +47,7 @@
     schema->addLeafEnum("/", "mod:leafEnum", {"lol", "data", "coze"});
     schema->addLeaf("/mod:contA", "mod:leafInCont", yang::LeafDataTypes::String);
     schema->addList("/", "mod:list", {"number"});
+    schema->addLeaf("/mod:list", "mod:number", yang::LeafDataTypes::Int32);
     schema->addLeaf("/mod:list", "mod:leafInList", yang::LeafDataTypes::String);
     schema->addLeafRef("/", "mod:refToString", "/mod:leafString");
     schema->addLeafRef("/", "mod:refToInt8", "/mod:leafInt8");
@@ -100,8 +101,8 @@
         SECTION("set mod:list[number=1]/leafInList \"another_data\"")
         {
             input = "set mod:list[number=1]/leafInList \"another_data\"";
-            auto keys = std::map<std::string, std::string>{
-                {"number", "1"}};
+            auto keys = std::map<std::string, leaf_data_>{
+                {"number", int32_t{1}}};
             expected.m_path.m_nodes.push_back(dataNode_{module_{"mod"}, listElement_("list", keys)});
             expected.m_path.m_nodes.push_back(dataNode_{leaf_("leafInList")});
             expected.m_data = std::string("another_data");
diff --git a/tests/list_manipulation.cpp b/tests/list_manipulation.cpp
index 3fa7a8b..5100c61 100644
--- a/tests/list_manipulation.cpp
+++ b/tests/list_manipulation.cpp
@@ -14,6 +14,7 @@
     auto schema = std::make_shared<StaticSchema>();
     schema->addModule("mod");
     schema->addList("/", "mod:list", {"number"});
+    schema->addLeaf("/mod:list", "mod:number", yang::LeafDataTypes::Int32);
     schema->addLeaf("/mod:list", "mod:leafInList", yang::LeafDataTypes::String);
     Parser parser(schema);
     std::string input;
@@ -25,8 +26,8 @@
         SECTION("mod:list[number=3]")
         {
             input = "mod:list[number=3]";
-            auto keys = std::map<std::string, std::string>{
-                {"number", "3"}};
+            auto keys = std::map<std::string, leaf_data_>{
+                {"number", int32_t{3}}};
             expectedPath.m_nodes.push_back(dataNode_{module_{"mod"}, listElement_("list", keys)});
         }
 
diff --git a/tests/ls.cpp b/tests/ls.cpp
index 0df428b..8709f13 100644
--- a/tests/ls.cpp
+++ b/tests/ls.cpp
@@ -25,8 +25,11 @@
     schema->addContainer("/example:a/example:a2", "example:a3");
     schema->addContainer("/example:b/example:b2", "example:b3");
     schema->addList("/", "example:list", {"number"});
+    schema->addLeaf("/example:list", "example:number", yang::LeafDataTypes::Int32);
     schema->addContainer("/example:list", "example:contInList");
     schema->addList("/", "example:twoKeyList", {"number", "name"});
+    schema->addLeaf("/example:twoKeyList", "example:number", yang::LeafDataTypes::Int32);
+    schema->addLeaf("/example:twoKeyList", "example:name", yang::LeafDataTypes::String);
     Parser parser(schema);
     std::string input;
     std::ostringstream errorStream;
@@ -153,8 +156,8 @@
             SECTION("ls example:list[number=342]/contInList")
             {
                 input = "ls example:list[number=342]/contInList";
-                auto keys = std::map<std::string, std::string>{
-                    {"number", "342"}};
+                auto keys = std::map<std::string, leaf_data_>{
+                    {"number", int32_t{342}}};
                 expected.m_path = dataPath_{Scope::Relative, {dataNode_(module_{"example"}, listElement_{"list", keys}),
                                                                 dataNode_(container_{"contInList"})}};
             }
diff --git a/tests/path_completion.cpp b/tests/path_completion.cpp
index 115cfdd..77dae51 100644
--- a/tests/path_completion.cpp
+++ b/tests/path_completion.cpp
@@ -36,10 +36,15 @@
     schema->addContainer("/example:ano/example:a2", "example:a3");
     schema->addContainer("/example:bota/example:b2", "example:b3");
     schema->addList("/", "example:list", {"number"});
-    schema->addList("/", "example:ovoce", {"name"});
-    schema->addList("/", "example:ovocezelenina", {"name"});
+    schema->addLeaf("/example:list", "example:number", yang::LeafDataTypes::Int32);
     schema->addContainer("/example:list", "example:contInList");
+    schema->addList("/", "example:ovoce", {"name"});
+    schema->addLeaf("/example:ovoce", "example:name", yang::LeafDataTypes::String);
+    schema->addList("/", "example:ovocezelenina", {"name"});
+    schema->addLeaf("/example:ovocezelenina", "example:name", yang::LeafDataTypes::String);
     schema->addList("/", "example:twoKeyList", {"number", "name"});
+    schema->addLeaf("/example:twoKeyList", "example:name", yang::LeafDataTypes::String);
+    schema->addLeaf("/example:twoKeyList", "example:number", yang::LeafDataTypes::Int32);
     schema->addLeaf("/", "example:leafInt", yang::LeafDataTypes::Int32);
     Parser parser(schema);
     std::string input;
@@ -111,13 +116,13 @@
         SECTION("ls /example:list[number=3]/")
         {
             input = "ls /example:list[number=3]/";
-            expected = {"example:contInList/"};
+            expected = {"example:contInList/", "example:number "};
         }
 
         SECTION("ls /example:list[number=3]/c")
         {
             input = "ls /example:list[number=3]/e";
-            expected = {"example:contInList/"};
+            expected = {"example:contInList/", "example:number "};
         }
 
         SECTION("ls /example:list[number=3]/a")
diff --git a/tests/path_utils.cpp b/tests/path_utils.cpp
index f8dc250..c23984d 100644
--- a/tests/path_utils.cpp
+++ b/tests/path_utils.cpp
@@ -25,7 +25,7 @@
             {
                 path.m_scope = Scope::Relative;
             }
-            path.m_nodes.push_back(dataNode_{module_{"example-schema"}, listElement_{"twoKeyList", {{"first", "a"}, {"second", "b"}}}});
+            path.m_nodes.push_back(dataNode_{module_{"example-schema"}, listElement_{"twoKeyList", {{"first", std::string{"a"}}, {"second", std::string{"b"}}}}});
             expected += "example-schema:twoKeyList[first='a'][second='b']";
         }
         REQUIRE(pathToDataString(path, Prefixes::WhenNeeded) == expected);
diff --git a/tests/presence_containers.cpp b/tests/presence_containers.cpp
index ba8938e..d634daf 100644
--- a/tests/presence_containers.cpp
+++ b/tests/presence_containers.cpp
@@ -22,6 +22,7 @@
     schema->addContainer("/mod:a/mod:a2", "mod:a3", yang::ContainerTraits::Presence);
     schema->addContainer("/mod:b", "mod:b2", yang::ContainerTraits::Presence);
     schema->addList("/", "mod:list", {"quote"});
+    schema->addLeaf("/mod:list", "mod:quote", yang::LeafDataTypes::String);
     schema->addContainer("/mod:list", "mod:contInList", yang::ContainerTraits::Presence);
     Parser parser(schema);
     std::string input;
@@ -52,24 +53,24 @@
         SECTION("mod:list[quote='lol']/contInList")
         {
             input = "mod:list[quote='lol']/contInList";
-            auto keys = std::map<std::string, std::string>{
-                {"quote", "lol"}};
+            auto keys = std::map<std::string, leaf_data_>{
+                {"quote", std::string{"lol"}}};
             expectedPath.m_nodes = {{{module_{"mod"}}, listElement_("list", keys)}, {container_("contInList")}};
         }
 
         SECTION("mod:list[quote='double\"quote']/contInList")
         {
             input = "mod:list[quote='double\"quote']/contInList";
-            auto keys = std::map<std::string, std::string>{
-                {"quote", "double\"quote"}};
+            auto keys = std::map<std::string, leaf_data_>{
+                {"quote", std::string{"double\"quote"}}};
             expectedPath.m_nodes = {{{module_{"mod"}}, listElement_("list", keys)}, {container_("contInList")}};
         }
 
         SECTION("mod:list[quote=\"single'quote\"]/contInList")
         {
             input = "mod:list[quote=\"single'quote\"]/contInList";
-            auto keys = std::map<std::string, std::string>{
-                {"quote", "single'quote"}};
+            auto keys = std::map<std::string, leaf_data_>{
+                {"quote", std::string{"single'quote"}}};
             expectedPath.m_nodes = {{{module_{"mod"}}, listElement_("list", keys)}, {container_("contInList")}};
         }