Add support for `empty` YANG leaf type

Change-Id: I87eafae9df9accdaa4579ace769996e70da6cb1c
diff --git a/tests/datastore_access.cpp b/tests/datastore_access.cpp
index 51bcd81..088fc4b 100644
--- a/tests/datastore_access.cpp
+++ b/tests/datastore_access.cpp
@@ -359,6 +359,17 @@
         REQUIRE(datastore.getItems("/example-schema:blob") == expected);
     }
 
+    SECTION("empty")
+    {
+        datastore.setLeaf("/example-schema:dummy", empty_{});
+        REQUIRE_CALL(mock, write("/example-schema:dummy", std::nullopt, ""s));
+        datastore.commitChanges();
+        DatastoreAccess::Tree expected {
+            {"/example-schema:dummy", empty_{}},
+        };
+        REQUIRE(datastore.getItems("/example-schema:dummy") == expected);
+    }
+
     SECTION("operational data")
     {
         MockDataSupplier mockOpsData;
diff --git a/tests/example-schema.yang b/tests/example-schema.yang
index 5d84eda..ef9d02d 100644
--- a/tests/example-schema.yang
+++ b/tests/example-schema.yang
@@ -243,4 +243,8 @@
     leaf blob {
         type binary;
     }
+
+    leaf dummy {
+        type empty;
+    }
 }
diff --git a/tests/leaf_editing.cpp b/tests/leaf_editing.cpp
index 64abbf2..666c975 100644
--- a/tests/leaf_editing.cpp
+++ b/tests/leaf_editing.cpp
@@ -70,7 +70,9 @@
         yang::TypeInfo{createEnum({"wlan0", "wlan1"})},
         yang::TypeInfo{yang::LeafRef{"/mod:portSettings/mod:port", std::make_unique<yang::TypeInfo>(schema->leafType("/mod:portSettings/mod:port"))}},
         yang::TypeInfo{yang::LeafRef{"/mod:activeMappedPort", std::make_unique<yang::TypeInfo>(schema->leafType("/mod:activeMappedPort"))}},
+        yang::TypeInfo{yang::Empty{}},
     }});
+    schema->addLeaf("/", "mod:dummy", yang::Empty{});
 
     Parser parser(schema);
     std::string input;
@@ -325,6 +327,10 @@
                             expected.m_data = enum_("utf3");
                         }
                     }
+                    SECTION("4. empty")
+                    {
+                        expected.m_data = empty_{};
+                    }
                 }
             }
 
@@ -448,6 +454,12 @@
                     expected.m_data = identityRef_{"pizza"};
                 }
             }
+            SECTION("empty")
+            {
+                input = "set mod:dummy ";
+                expected.m_path.m_nodes.push_back(dataNode_{module_{"mod"}, leaf_("dummy")});
+                expected.m_data = empty_{};
+            }
         }
 
         command_ command = parser.parseCommand(input, errorStream);
@@ -584,6 +596,11 @@
             input = "set mod:intOrString true";
         }
 
+        SECTION("no space for empty data")
+        {
+            input = "set mod:dummy";
+        }
+
         REQUIRE_THROWS_AS(parser.parseCommand(input, errorStream), InvalidCommandException);
         REQUIRE(errorStream.str().find(expectedError) != std::string::npos);
     }
diff --git a/tests/mock/sysrepo_subscription.cpp b/tests/mock/sysrepo_subscription.cpp
index 2c0d64b..0d4fe33 100644
--- a/tests/mock/sysrepo_subscription.cpp
+++ b/tests/mock/sysrepo_subscription.cpp
@@ -83,6 +83,11 @@
         v->set(xpath.c_str(), (what.m_prefix->m_name + what.m_value).c_str(), SR_IDENTITYREF_T);
     }
 
+    void operator()(const empty_)
+    {
+        v->set(xpath.c_str(), nullptr, SR_LEAF_EMPTY_T);
+    }
+
     void operator()(const std::string& what)
     {
         v->set(xpath.c_str(), what.c_str());
diff --git a/tests/yang.cpp b/tests/yang.cpp
index 009465b..79bad71 100644
--- a/tests/yang.cpp
+++ b/tests/yang.cpp
@@ -369,9 +369,14 @@
             type leafref {
                 path "../activeMappedPort";
             }
+            type empty;
         }
     }
 
+    leaf dummyLeaf {
+        type empty;
+    }
+
     leaf clockSpeed {
         type int64;
         config false;
@@ -800,6 +805,7 @@
                                 std::make_unique<yang::TypeInfo>(enums)
                         })
                     }},
+                    yang::TypeInfo{yang::Empty{}},
                 }};
             }
 
@@ -844,6 +850,7 @@
                         {"example-schema"s, "obsoleteLeafWithObsoleteType"},
                         {"example-schema"s, "myRpc"},
                         {"example-schema"s, "systemStats"},
+                        {"example-schema"s, "dummyLeaf"},
                         {"example-schema"s, "subLeaf"}};
                 }
 
@@ -893,6 +900,7 @@
                         {"example-schema"s, "clockSpeed"},
                         {"example-schema"s, "deprecatedLeaf"},
                         {"example-schema"s, "direction"},
+                        {"example-schema"s, "dummyLeaf"},
                         {"example-schema"s, "duration"},
                         {"example-schema"s, "ethernet"},
                         {"example-schema"s, "foodDrinkIdentLeaf"},
@@ -951,6 +959,7 @@
                         {boost::none, "/example-schema:deprecatedLeaf"},
                         {boost::none, "/example-schema:direction"},
                         {boost::none, "/example-schema:duration"},
+                        {boost::none, "/example-schema:dummyLeaf"},
                         {boost::none, "/example-schema:foodDrinkIdentLeaf"},
                         {boost::none, "/example-schema:foodIdentLeaf"},
                         {boost::none, "/example-schema:interface/caseEthernet/ethernet"},