diff --git a/src/bin/netconf/netconf.h b/src/bin/netconf/netconf.h index 125c5a7b1a..1881ea9208 100644 --- a/src/bin/netconf/netconf.h +++ b/src/bin/netconf/netconf.h @@ -116,9 +116,6 @@ public: static void logChanges(S_Session sess, const std::string& model); #endif - /// @brief Cancel flag. - bool cancel_; - protected: /// @brief Get and display Kea server configuration. /// diff --git a/src/bin/netconf/tests/control_socket_unittests.cc b/src/bin/netconf/tests/control_socket_unittests.cc index 9e7700a111..ae7ee02bda 100644 --- a/src/bin/netconf/tests/control_socket_unittests.cc +++ b/src/bin/netconf/tests/control_socket_unittests.cc @@ -504,6 +504,7 @@ public: /// @brief Test fixture class for http control sockets. class HttpControlSocketTest : public ThreadedTest { public: + /// @brief Constructor HttpControlSocketTest() : ThreadedTest(), io_service_() { } @@ -597,12 +598,6 @@ public: /// @brief Pointer to listener. HttpListenerPtr listener_; - - /// @brief Done flag (stopping thread). - bool done_; - - /// @brief Finished flag (stopped thread). - bool finished_; }; /// @brief Create the reflecting listener. diff --git a/src/bin/perfdhcp/stats_mgr.h b/src/bin/perfdhcp/stats_mgr.h index 0ca1695ad2..1130f244b1 100644 --- a/src/bin/perfdhcp/stats_mgr.h +++ b/src/bin/perfdhcp/stats_mgr.h @@ -72,7 +72,8 @@ public: /// \param name name of the counter used in log file. CustomCounter(const std::string& name) : counter_(0), - name_(name) { }; + name_(name) { + } /// \brief Increment operator. const CustomCounter& operator++() { @@ -96,15 +97,19 @@ public: /// /// Method returns counter value. /// - /// \return counter value. - uint64_t getValue() const { return(counter_); } + /// \return counter value. + uint64_t getValue() const { + return (counter_); + } /// \brief Return counter name. /// /// Method returns counter name. /// - /// \return counter name. - const std::string& getName() const { return(name_); } + /// \return counter name. + const std::string& getName() const { + return (name_); + } private: /// \brief Default constructor. @@ -112,7 +117,8 @@ private: /// Default constructor is private because we don't want client /// class to call it because we want client class to specify /// counter's name. - CustomCounter() { }; + CustomCounter() : counter_(0) { + } uint64_t counter_; ///< Counter's value. std::string name_; ///< Counter's name. diff --git a/src/hooks/dhcp/high_availability/tests/ha_config_unittest.cc b/src/hooks/dhcp/high_availability/tests/ha_config_unittest.cc index 8c965af248..a1fc75bf43 100644 --- a/src/hooks/dhcp/high_availability/tests/ha_config_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/ha_config_unittest.cc @@ -80,6 +80,7 @@ public: } result.replace(where, from.size(), repl); } + return (result); } }; diff --git a/src/lib/dhcpsrv/pgsql_host_data_source.h b/src/lib/dhcpsrv/pgsql_host_data_source.h index 7fb251054a..4d8ba40983 100644 --- a/src/lib/dhcpsrv/pgsql_host_data_source.h +++ b/src/lib/dhcpsrv/pgsql_host_data_source.h @@ -67,9 +67,10 @@ public: /// @throw isc::db::DbOpenError Error opening the database /// @throw isc::db::DbOperationError An operation on the open database has /// failed. - PgSqlHostDataSource(const db::DatabaseConnection::ParameterMap& parameters); + PgSqlHostDataSource(const db::DatabaseConnection::ParameterMap& parameters); /// @brief Virtual destructor. + /// /// Frees database resources and closes the database connection through /// the destruction of member impl_. virtual ~PgSqlHostDataSource(); diff --git a/src/lib/dhcpsrv/tests/cfg_multi_threading_unittest.cc b/src/lib/dhcpsrv/tests/cfg_multi_threading_unittest.cc index 72eff79f22..5f9edbfac2 100644 --- a/src/lib/dhcpsrv/tests/cfg_multi_threading_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_multi_threading_unittest.cc @@ -20,6 +20,14 @@ namespace { /// @brief Test fixture class for @c MultiThreadingConfigParser class CfgMultiThreadingTest : public ::testing::Test { +public: + + /// @brief Constructor + CfgMultiThreadingTest() = default; + + /// @brief Destructor + virtual ~CfgMultiThreadingTest() = default; + protected: /// @brief Setup for each test. diff --git a/src/lib/dhcpsrv/tests/d2_client_unittest.cc b/src/lib/dhcpsrv/tests/d2_client_unittest.cc index 66c3060119..f246c152d8 100644 --- a/src/lib/dhcpsrv/tests/d2_client_unittest.cc +++ b/src/lib/dhcpsrv/tests/d2_client_unittest.cc @@ -340,6 +340,13 @@ TEST(D2ClientMgr, ipv6Config) { /// @brief Test class for execerising manager functions that are /// influenced by DDNS parameters. class D2ClientMgrParamsTest : public ::testing::Test { +public: + /// @brief Constructor + D2ClientMgrParamsTest() = default; + + /// @brief Destructor + virtual ~D2ClientMgrParamsTest() = default; + private: /// @brief Prepares the class for a test. virtual void SetUp() { diff --git a/src/lib/dhcpsrv/tests/dhcp_queue_control_parser_unittest.cc b/src/lib/dhcpsrv/tests/dhcp_queue_control_parser_unittest.cc index 5d19ef3ebd..e10dccd137 100644 --- a/src/lib/dhcpsrv/tests/dhcp_queue_control_parser_unittest.cc +++ b/src/lib/dhcpsrv/tests/dhcp_queue_control_parser_unittest.cc @@ -23,8 +23,14 @@ namespace { /// @brief Test fixture class for @c DHCPQueueControlParser class DHCPQueueControlParserTest : public ::testing::Test { -protected: +public: + /// @brief Constructor + DHCPQueueControlParserTest() = default; + /// @brief Destructor + virtual ~DHCPQueueControlParserTest() = default; + +protected: /// @brief Setup for each test. /// /// Clears the configuration in the @c CfgMgr. @@ -34,7 +40,6 @@ protected: /// /// Clears the configuration in the @c CfgMgr. virtual void TearDown(); - }; void diff --git a/src/lib/dhcpsrv/tests/host_data_source_factory_unittest.cc b/src/lib/dhcpsrv/tests/host_data_source_factory_unittest.cc index 5f5fa03e11..103550fcd5 100644 --- a/src/lib/dhcpsrv/tests/host_data_source_factory_unittest.cc +++ b/src/lib/dhcpsrv/tests/host_data_source_factory_unittest.cc @@ -74,6 +74,13 @@ factory0(const DatabaseConnection::ParameterMap&) { // @brief Test fixture class class HostDataSourceFactoryTest : public ::testing::Test { +public: + /// @brief Constructor + HostDataSourceFactoryTest() = default; + + /// @brief Destructor + virtual ~HostDataSourceFactoryTest() = default; + private: // @brief Prepares the class for a test. virtual void SetUp() { diff --git a/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc b/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc index 4a82130fec..4545902356 100644 --- a/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc +++ b/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc @@ -42,8 +42,14 @@ namespace { /// @brief Test fixture class for @c HostReservationParser. class HostReservationParserTest : public ::testing::Test { -protected: +public: + /// @brief Constructor + HostReservationParserTest() = default; + /// @brief Destructor + virtual ~HostReservationParserTest() = default; + +protected: /// @brief Setup for each test. /// /// Clears the configuration in the @c CfgMgr. diff --git a/src/lib/dhcpsrv/tests/host_reservations_list_parser_unittest.cc b/src/lib/dhcpsrv/tests/host_reservations_list_parser_unittest.cc index 31c0c796b1..c10adde0bf 100644 --- a/src/lib/dhcpsrv/tests/host_reservations_list_parser_unittest.cc +++ b/src/lib/dhcpsrv/tests/host_reservations_list_parser_unittest.cc @@ -32,8 +32,14 @@ namespace { /// @brief Test fixture class for @c HostReservationsListParser. class HostReservationsListParserTest : public ::testing::Test { -protected: +public: + /// @brief Constructor + HostReservationsListParserTest() = default; + /// @brief Destructor + virtual ~HostReservationsListParserTest() = default; + +protected: /// @brief Setup for each test. /// /// Clears the configuration in the @c CfgMgr. It also initializes diff --git a/src/lib/dhcpsrv/tests/lease_file_loader_unittest.cc b/src/lib/dhcpsrv/tests/lease_file_loader_unittest.cc index 8e49695122..2c0170cf5d 100644 --- a/src/lib/dhcpsrv/tests/lease_file_loader_unittest.cc +++ b/src/lib/dhcpsrv/tests/lease_file_loader_unittest.cc @@ -39,7 +39,7 @@ public: /// @brief Destructor /// /// Removes any configuration that may have been added in CfgMgr. - ~LeaseFileLoaderTest(); + virtual ~LeaseFileLoaderTest(); /// @brief Prepends the absolute path to the file specified /// as an argument. diff --git a/src/lib/dhcpsrv/tests/multi_threading_config_parser_unittest.cc b/src/lib/dhcpsrv/tests/multi_threading_config_parser_unittest.cc index 1f3b994bbd..e24a7064ec 100644 --- a/src/lib/dhcpsrv/tests/multi_threading_config_parser_unittest.cc +++ b/src/lib/dhcpsrv/tests/multi_threading_config_parser_unittest.cc @@ -23,6 +23,14 @@ namespace { /// @brief Test fixture class for @c MultiThreadingConfigParser class MultiThreadingConfigParserTest : public ::testing::Test { +public: + + /// @brief Constructor + MultiThreadingConfigParserTest() = default; + + /// @brief Destructor + virtual ~MultiThreadingConfigParserTest() = default; + protected: /// @brief Setup for each test. diff --git a/src/lib/dhcpsrv/tests/ncr_generator_unittest.cc b/src/lib/dhcpsrv/tests/ncr_generator_unittest.cc index 905df55479..ca6881c015 100644 --- a/src/lib/dhcpsrv/tests/ncr_generator_unittest.cc +++ b/src/lib/dhcpsrv/tests/ncr_generator_unittest.cc @@ -49,6 +49,9 @@ public: : d2_mgr_(CfgMgr::instance().getD2ClientMgr()), lease_() { } + /// @brief Destructor + virtual ~NCRGeneratorTest() = default; + /// @brief Initializes the lease pointer used by the tests and starts D2. /// /// This method initializes the pointer to the lease which will be used diff --git a/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc b/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc index 00583740c7..a46afde1e6 100644 --- a/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc @@ -27,7 +27,16 @@ namespace { /// @brief Test fixture class for @c TimerMgr. class TimerMgrTest : public ::testing::Test { +public: + + /// @brief Constructor + TimerMgrTest() = default; + + /// @brief Destructor + virtual ~TimerMgrTest() = default; + private: + /// @brief Prepares the class for a test. virtual void SetUp(); diff --git a/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.h b/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.h index 8444f93704..ddaa38d7f4 100644 --- a/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.h +++ b/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.h @@ -682,6 +682,14 @@ public: /// @brief Test fixture class for @c HostMgr class. class HostMgrTest : public ::testing::Test { +public: + + /// @brief Constructor + HostMgrTest() = default; + + /// @brief Destructor + virtual ~HostMgrTest() = default; + protected: /// @brief Prepares the class for a test. diff --git a/src/lib/dhcpsrv/testutils/memory_host_data_source.h b/src/lib/dhcpsrv/testutils/memory_host_data_source.h index b2d06f48f2..69e68233e6 100644 --- a/src/lib/dhcpsrv/testutils/memory_host_data_source.h +++ b/src/lib/dhcpsrv/testutils/memory_host_data_source.h @@ -24,8 +24,12 @@ namespace test { class MemHostDataSource : public virtual BaseHostDataSource { public: + /// @brief Constructor. + MemHostDataSource() : next_host_id_(0) { + } + /// @brief Destructor. - virtual ~MemHostDataSource() { } + virtual ~MemHostDataSource() = default; /// BaseHostDataSource methods. diff --git a/src/lib/eval/tests/dependency_unittest.cc b/src/lib/eval/tests/dependency_unittest.cc index 1f99bfdc7c..19f9121fff 100644 --- a/src/lib/eval/tests/dependency_unittest.cc +++ b/src/lib/eval/tests/dependency_unittest.cc @@ -29,8 +29,13 @@ namespace { /// of the dependency of classification expressions. class DependencyTest : public ::testing::Test { public: + /// @brief Constructor + DependencyTest() : result_(true) { + } - /// @brief Reset expression and result. + /// @brief Destructor + /// + /// Reset expression and result. ~DependencyTest() { e_.reset(); result_ = false; diff --git a/src/lib/process/tests/logging_info_unittests.cc b/src/lib/process/tests/logging_info_unittests.cc index 865d6426b3..f2b7531d97 100644 --- a/src/lib/process/tests/logging_info_unittests.cc +++ b/src/lib/process/tests/logging_info_unittests.cc @@ -51,6 +51,12 @@ TEST(LoggingDestination, equals) { class LoggingInfoTest : public ::testing::Test { public: + /// @brief Constructor + LoggingInfoTest() = default; + + /// @brief Destructor + virtual ~LoggingInfoTest() = default; + /// @brief Setup the test. virtual void SetUp() { Daemon::setVerbose(false); diff --git a/src/lib/util/buffer.h b/src/lib/util/buffer.h index 128db99980..aa59488ad6 100644 --- a/src/lib/util/buffer.h +++ b/src/lib/util/buffer.h @@ -337,7 +337,7 @@ public: } /// \brief Destructor - ~ OutputBuffer() { + ~OutputBuffer() { free(buffer_); } //@} diff --git a/src/lib/util/io/socketsession.cc b/src/lib/util/io/socketsession.cc index 573931a30e..6dea2ee9f3 100644 --- a/src/lib/util/io/socketsession.cc +++ b/src/lib/util/io/socketsession.cc @@ -76,7 +76,10 @@ const size_t INITIAL_BUFSIZE = 512; const int SOCKSESSION_BUFSIZE = (DEFAULT_HEADER_BUFLEN + MAX_DATASIZE) * 2; struct SocketSessionForwarder::ForwarderImpl { - ForwarderImpl() : fd_(-1), buf_(DEFAULT_HEADER_BUFLEN) {} + ForwarderImpl() : sock_un_len_(0), fd_(-1), buf_(DEFAULT_HEADER_BUFLEN) { + memset(&sock_un_, 0, sizeof(sock_un_)); + } + struct sockaddr_un sock_un_; socklen_t sock_un_len_; int fd_; diff --git a/src/lib/util/tests/fd_tests.cc b/src/lib/util/tests/fd_tests.cc index f2ffb98e97..82606f7993 100644 --- a/src/lib/util/tests/fd_tests.cc +++ b/src/lib/util/tests/fd_tests.cc @@ -24,19 +24,22 @@ namespace { const size_t TEST_DATA_SIZE = 8 * 1024 * 1024; class FDTest : public ::testing::Test { - public: - unsigned char *data, *buffer; - FDTest() : - // We do not care what is inside, we just need it to be the same - data(new unsigned char[TEST_DATA_SIZE]), - buffer(NULL) - { - memset(data, 0, TEST_DATA_SIZE); - } - ~ FDTest() { - delete[] data; - delete[] buffer; - } +public: + unsigned char *data, *buffer; + + /// @brief Constructor + FDTest() : + // We do not care what is inside, we just need it to be the same + data(new unsigned char[TEST_DATA_SIZE]), + buffer(NULL) { + memset(data, 0, TEST_DATA_SIZE); + } + + /// @brief Destructor + ~FDTest() { + delete[] data; + delete[] buffer; + } }; // Test we read what was sent diff --git a/src/lib/util/tests/pid_file_unittest.cc b/src/lib/util/tests/pid_file_unittest.cc index 08b1881eb7..640a7d8d26 100644 --- a/src/lib/util/tests/pid_file_unittest.cc +++ b/src/lib/util/tests/pid_file_unittest.cc @@ -20,6 +20,13 @@ const char* TESTNAME = "pid_file.test"; class PIDFileTest : public ::testing::Test { public: + + /// @brief Constructor + PIDFileTest() = default; + + /// @brief Destructor + virtual ~PIDFileTest() = default; + /// @brief Prepends the absolute path to the file specified /// as an argument. /// diff --git a/src/lib/util/tests/stopwatch_unittest.cc b/src/lib/util/tests/stopwatch_unittest.cc index ed5649a66e..28d6c99989 100644 --- a/src/lib/util/tests/stopwatch_unittest.cc +++ b/src/lib/util/tests/stopwatch_unittest.cc @@ -101,6 +101,14 @@ StopwatchMock::getCurrentTime() const { /// @brief Test fixture class for testing @c StopwatchImpl. class StopwatchTest : public ::testing::Test { +public: + + /// @brief Constructor + StopwatchTest() = default; + + /// @brief Destructor + virtual ~StopwatchTest() = default; + protected: /// @brief Set up the test.