Browse Source

[1959] A couple of minor changes to cover second part of the review.

Marcin Siodelski 12 years ago
parent
commit
ad297b1088

+ 17 - 5
tests/tools/perfdhcp/stats_mgr.h

@@ -214,15 +214,27 @@ public:
         /// }
         /// \endcode
         typedef boost::multi_index_container<
+            // Container holds shared_ptr<Pkt4> or shared_ptr<Pkt6> objects.
             boost::shared_ptr<T>,
+            // List container indexes.
             boost::multi_index::indexed_by<
+                // Sequenced index provides the way to use this container
+                // in the same way as std::list.
                 boost::multi_index::sequenced<>,
+                // The other index keeps products of transaction id.
                 boost::multi_index::hashed_non_unique<
-                        boost::multi_index::global_fun<
-                            const boost::shared_ptr<T>&,
-                            uint32_t,
-                            &ExchangeStats::hashTransid
-                        >
+                    // Specify hash function to get the product of
+                    // transaction id. This product is obtained by calling
+                    // hashTransid() function.
+                    boost::multi_index::global_fun<
+                        // Hashing function takes shared_ptr<Pkt4> or
+                        // shared_ptr<Pkt6> as argument.
+                        const boost::shared_ptr<T>&,
+                        // ... and returns uint32 value.
+                        uint32_t,
+                        // ... and here is a reference to it.
+                        &ExchangeStats::hashTransid
+                    >
                 >
             >
         > PktList;

+ 6 - 2
tests/tools/perfdhcp/test_control.h

@@ -108,7 +108,7 @@ public:
         /// \brief Destriuctor of the socket wrapper class.
         ///
         /// Destructor closes all open sockets on all interfaces.
-        /// TODO: close only the socket being wrapped by this class.
+        /// \todo close only the socket being wrapped by this class.
         ~TestControlSocket();
 
         /// \brief Return name of the interface where socket is bound to.
@@ -254,7 +254,9 @@ protected:
     /// \brief Factory function to create IA_NA option.
     ///
     /// This factory function creates DHCPv6 IA_NA option instance.
-    /// \TODO: add support for IA Address options.
+    ///
+    /// \todo add support for IA Address options.
+    ///
     /// \param u universe (V6 or V4).
     /// \param type option-type.
     /// \param buf option-buffer.
@@ -323,6 +325,8 @@ protected:
     /// from the MAC address, this function uses \ref generateMacAddress
     /// internally to randomize the DUID.
     ///
+    /// \todo add support for other types of DUID.
+    ///
     /// \param randomized number of bytes randomized.
     /// \throw isc::BadValue if \ref generateMacAddress throws.
     /// \return vector representing DUID.

+ 8 - 2
tests/tools/perfdhcp/tests/command_options_unittest.cc

@@ -86,7 +86,10 @@ protected:
         // DUID_LLT value, two octets of hardware type, 4 octets
         // of time value and 6 octets of variable link layer (MAC)
         // address.
-        const int duid_llt_size = 14; 
+        const int duid_llt_size = 14;
+        // DUID is not given from the command line but it is supposed
+        // to be initialized by the CommandOptions private method
+        // generateDuidTemplate().
         std::vector<uint8_t> v2 = opt.getDuidTemplate();
         ASSERT_EQ(duid_llt_size, opt.getDuidTemplate().size());
         EXPECT_TRUE(std::equal(v2.begin(), v2.begin() + 4,
@@ -548,6 +551,9 @@ TEST_F(CommandOptionsTest, Interface) {
     // In order to make this test portable we need to know
     // at least one interface name on OS where test is run.
     // Interface Manager has ability to detect interfaces.
+    // Altough we don't call initIsInterface explicitely
+    // here it is called by CommandOptions object interally
+    // so this function is covered by the test.
     dhcp::IfaceMgr& iface_mgr = dhcp::IfaceMgr::instance();
     const dhcp::IfaceMgr::IfaceCollection& ifaces = iface_mgr.getIfaces();
     std::string iface_name;
@@ -568,7 +574,7 @@ TEST_F(CommandOptionsTest, Interface) {
         // exception is expected to be thrown.
         EXPECT_THROW(process("perfdhcp -4"), isc::InvalidParameter);
     }
-}    
+}
 
 TEST_F(CommandOptionsTest, Server) {
     CommandOptions& opt = CommandOptions::instance();