]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#65,!30] Updated test utils (mostly comments)
authorTomek Mrugalski <tomasz@isc.org>
Tue, 23 Oct 2018 18:23:57 +0000 (20:23 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 24 Oct 2018 13:50:51 +0000 (15:50 +0200)
src/lib/yang/testutils/translator_test.cc
src/lib/yang/testutils/translator_test.h

index 304554a86e31f34ca7a7778101877ed8c3d06746..0020e863a47ea1fa120bdd7f059a03a70bd8efb7 100644 (file)
@@ -256,14 +256,20 @@ YangRepr::set(const Tree& tree, S_Session session) const {
 bool
 YangRepr::validate(S_Session session, std::ostream& errs) const {
     try {
+        // Try to validate. If it succeeds, then we're done here.
         session->validate();
         return (true);
     } catch (const std::exception& ex) {
         errs << "validate fails with " << ex.what() << endl;
     }
     try {
+        // If we get here, it means the validate() threw exceptions.
         S_Errors s_errors = session->get_last_errors();
         if (!s_errors) {
+
+            // This is really weird. An exception was thrown, but
+            // get_last_errors() didn't return anything. Maybe we're out of
+            // memory or something?
             errs << "no errors" << endl;
             return (false);
         }
index 103602118665e02b50929b18dacde4ad590c080d..0cb5f8b1a913abf913bd20558b1f6e8fff763573 100644 (file)
@@ -16,6 +16,9 @@ namespace yang {
 namespace test {
 
 /// @brief Yang/sysrepo datastore textual representation class.
+///
+/// This class allows to store a configuration tree in YANG format.
+/// It is used in tests to conduct operations on whole configurations.
 class YangRepr {
 public:
 
@@ -25,7 +28,7 @@ public:
     YangRepr(const std::string& model) : model_(model) {
     }
 
-    /// @brief The item class.
+    /// @brief A struct representing a single entry.
     struct YangReprItem {
         /// @brief Constructor with content.
         ///
@@ -38,10 +41,11 @@ public:
             : xpath_(xpath), value_(value), type_(type), settable_(settable) {
         }
 
-        /// @brief Factory from session.
+        /// @brief Retrieves configuration parameter from sysrepo
         ///
-        /// @param xpath The xpath.
+        /// @param xpath The xpath of an element to be retrieved
         /// @param session Sysrepo session.
+        /// @return YangReprItem instance representing configuration parameter
         static YangReprItem get(const std::string& xpath, S_Session session);
 
         /// @brief The xpath.
@@ -57,6 +61,9 @@ public:
         bool settable_;
 
         /// @brief The equal operator ignoring settable.
+        ///
+        /// @param other the other object to compare with
+        /// @return true if equal
         bool operator==(const YangReprItem& other) const {
             return ((xpath_ == other.xpath_) &&
                     (value_ == other.value_) &&
@@ -64,6 +71,9 @@ public:
         }
 
         /// @brief The unequal operator ignoring settable.
+        ///
+        /// @param other the other object to compare with
+        /// @return false if equal
         bool operator!=(const YangReprItem& other) const {
             return (!(*this == other));
         }
@@ -77,17 +87,19 @@ public:
     /// @param session Sysrepo session.
     Tree get(S_Session session) const;
 
-    /// @brief Verify tree.
+    /// @brief Verifies a tree.
     ///
     /// @param expected The expected value.
     /// @param session Sysrepo session.
     /// @param errs Error stream.
-    /// @return True if verification succeeds, false with errors displayed
+    /// @return true if verification succeeds, false with errors displayed
     /// on errs if it fails.
     bool verify(const Tree& expected, S_Session session,
                 std::ostream& errs) const;
 
-    /// @brief Set tree to session.
+    /// @brief Sets specified tree in a sysrepo.
+    ///
+    /// The actual access parameters are specified within session.
     ///
     /// @param tree The tree to install.
     /// @param session Sysrepo session.