Fix leafDataFromValue

Leafrefs were not working correctly, when pointing to a data node not in
the tree. Because of this I had to rework the thing a little bit (I
basically copied the algorithm from cla-sysrepo, where I had the same
issue). I also changed the name. And also added test, both versions of
leafref included.

Funnily enough, it seems that I was already fixing this before, but for
some reason the bug appeared again while using netconf-cli, oh well, now
the tests should cover that hopefully.

Change-Id: I8a102c54bf58a4221610c8a83d26979fb7b4461d
diff --git a/src/libyang_utils.hpp b/src/libyang_utils.hpp
index d8bf4ad..a33e70b 100644
--- a/src/libyang_utils.hpp
+++ b/src/libyang_utils.hpp
@@ -9,5 +9,5 @@
 #include "ast_values.hpp"
 #include "datastore_access.hpp"
 
-leaf_data_ leafValueFromValue(const libyang::S_Value& value, LY_DATA_TYPE type);
+leaf_data_ leafValueFromNode(libyang::S_Data_Node_Leaf_List node);
 void lyNodesToTree(DatastoreAccess::Tree& res, const std::vector<std::shared_ptr<libyang::Data_Node>> items, std::optional<std::string> ignoredXPathPrefix = std::nullopt);