Add move command for moving (leaf)list instances
Change-Id: I0bff25209f74601a450c12a810200b3c124d65f2
diff --git a/tests/pretty_printers.hpp b/tests/pretty_printers.hpp
index 429a0e9..69c06f5 100644
--- a/tests/pretty_printers.hpp
+++ b/tests/pretty_printers.hpp
@@ -26,7 +26,7 @@
return s;
}
-std::ostream& operator<<(std::ostream& s, const DatastoreAccess::Tree& map)
+std::ostream& operator<<(std::ostream& s, const ListInstance& map)
{
s << std::endl
<< "{";
@@ -37,6 +37,16 @@
return s;
}
+std::ostream& operator<<(std::ostream& s, const DatastoreAccess::Tree& tree)
+{
+ s << "DatastoreAccess::Tree {\n";
+ for (const auto& [xpath, value] : tree) {
+ s << " {" << xpath << ", " << leafDataToString(value) << "}\n";
+ }
+ s << "}\n";
+ return s;
+}
+
std::ostream& operator<<(std::ostream& s, const yang::LeafDataType& type)
{
s << std::endl
@@ -133,3 +143,30 @@
s << "\nls_ {\n " << ls.m_path << "}\n";
return s;
}
+
+std::ostream& operator<<(std::ostream& s, const move_& move)
+{
+ s << "\nmove_ {\n";
+ s << " path: " << move.m_source;
+ s << " mode: ";
+ if (std::holds_alternative<yang::move::Absolute>(move.m_destination)) {
+ if (std::get<yang::move::Absolute>(move.m_destination) == yang::move::Absolute::Begin) {
+ s << "Absolute::Begin";
+ } else {
+ s << "Absolute::End";
+ }
+ } else {
+ const yang::move::Relative& relative = std::get<yang::move::Relative>(move.m_destination);
+ s << "Relative {\n";
+ s << " position: ";
+ if (relative.m_position == yang::move::Relative::Position::After) {
+ s << "Position::After\n";
+ } else {
+ s << "Position::Before\n";
+ }
+ s << " path: ";
+ s << relative.m_path;
+ }
+ s << "\n}\n";
+ return s;
+}