2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-04 07:55:18 +00:00

[#1845] initialize all members in constructors

This commit is contained in:
Razvan Becheriu
2021-06-09 12:57:37 +03:00
parent 50f0d8c558
commit 8daf8ebf2b
24 changed files with 141 additions and 38 deletions

View File

@@ -116,9 +116,6 @@ public:
static void logChanges(S_Session sess, const std::string& model); static void logChanges(S_Session sess, const std::string& model);
#endif #endif
/// @brief Cancel flag.
bool cancel_;
protected: protected:
/// @brief Get and display Kea server configuration. /// @brief Get and display Kea server configuration.
/// ///

View File

@@ -504,6 +504,7 @@ public:
/// @brief Test fixture class for http control sockets. /// @brief Test fixture class for http control sockets.
class HttpControlSocketTest : public ThreadedTest { class HttpControlSocketTest : public ThreadedTest {
public: public:
/// @brief Constructor
HttpControlSocketTest() HttpControlSocketTest()
: ThreadedTest(), io_service_() { : ThreadedTest(), io_service_() {
} }
@@ -597,12 +598,6 @@ public:
/// @brief Pointer to listener. /// @brief Pointer to listener.
HttpListenerPtr listener_; HttpListenerPtr listener_;
/// @brief Done flag (stopping thread).
bool done_;
/// @brief Finished flag (stopped thread).
bool finished_;
}; };
/// @brief Create the reflecting listener. /// @brief Create the reflecting listener.

View File

@@ -72,7 +72,8 @@ public:
/// \param name name of the counter used in log file. /// \param name name of the counter used in log file.
CustomCounter(const std::string& name) : CustomCounter(const std::string& name) :
counter_(0), counter_(0),
name_(name) { }; name_(name) {
}
/// \brief Increment operator. /// \brief Increment operator.
const CustomCounter& operator++() { const CustomCounter& operator++() {
@@ -96,15 +97,19 @@ public:
/// ///
/// Method returns counter value. /// Method returns counter value.
/// ///
/// \return counter value. /// \return counter value.
uint64_t getValue() const { return(counter_); } uint64_t getValue() const {
return (counter_);
}
/// \brief Return counter name. /// \brief Return counter name.
/// ///
/// Method returns counter name. /// Method returns counter name.
/// ///
/// \return counter name. /// \return counter name.
const std::string& getName() const { return(name_); } const std::string& getName() const {
return (name_);
}
private: private:
/// \brief Default constructor. /// \brief Default constructor.
@@ -112,7 +117,8 @@ private:
/// Default constructor is private because we don't want client /// Default constructor is private because we don't want client
/// class to call it because we want client class to specify /// class to call it because we want client class to specify
/// counter's name. /// counter's name.
CustomCounter() { }; CustomCounter() : counter_(0) {
}
uint64_t counter_; ///< Counter's value. uint64_t counter_; ///< Counter's value.
std::string name_; ///< Counter's name. std::string name_; ///< Counter's name.

View File

@@ -80,6 +80,7 @@ public:
} }
result.replace(where, from.size(), repl); result.replace(where, from.size(), repl);
} }
return (result);
} }
}; };

View File

@@ -67,9 +67,10 @@ public:
/// @throw isc::db::DbOpenError Error opening the database /// @throw isc::db::DbOpenError Error opening the database
/// @throw isc::db::DbOperationError An operation on the open database has /// @throw isc::db::DbOperationError An operation on the open database has
/// failed. /// failed.
PgSqlHostDataSource(const db::DatabaseConnection::ParameterMap& parameters); PgSqlHostDataSource(const db::DatabaseConnection::ParameterMap& parameters);
/// @brief Virtual destructor. /// @brief Virtual destructor.
///
/// Frees database resources and closes the database connection through /// Frees database resources and closes the database connection through
/// the destruction of member impl_. /// the destruction of member impl_.
virtual ~PgSqlHostDataSource(); virtual ~PgSqlHostDataSource();

View File

@@ -20,6 +20,14 @@ namespace {
/// @brief Test fixture class for @c MultiThreadingConfigParser /// @brief Test fixture class for @c MultiThreadingConfigParser
class CfgMultiThreadingTest : public ::testing::Test { class CfgMultiThreadingTest : public ::testing::Test {
public:
/// @brief Constructor
CfgMultiThreadingTest() = default;
/// @brief Destructor
virtual ~CfgMultiThreadingTest() = default;
protected: protected:
/// @brief Setup for each test. /// @brief Setup for each test.

View File

@@ -340,6 +340,13 @@ TEST(D2ClientMgr, ipv6Config) {
/// @brief Test class for execerising manager functions that are /// @brief Test class for execerising manager functions that are
/// influenced by DDNS parameters. /// influenced by DDNS parameters.
class D2ClientMgrParamsTest : public ::testing::Test { class D2ClientMgrParamsTest : public ::testing::Test {
public:
/// @brief Constructor
D2ClientMgrParamsTest() = default;
/// @brief Destructor
virtual ~D2ClientMgrParamsTest() = default;
private: private:
/// @brief Prepares the class for a test. /// @brief Prepares the class for a test.
virtual void SetUp() { virtual void SetUp() {

View File

@@ -23,8 +23,14 @@ namespace {
/// @brief Test fixture class for @c DHCPQueueControlParser /// @brief Test fixture class for @c DHCPQueueControlParser
class DHCPQueueControlParserTest : public ::testing::Test { class DHCPQueueControlParserTest : public ::testing::Test {
protected: public:
/// @brief Constructor
DHCPQueueControlParserTest() = default;
/// @brief Destructor
virtual ~DHCPQueueControlParserTest() = default;
protected:
/// @brief Setup for each test. /// @brief Setup for each test.
/// ///
/// Clears the configuration in the @c CfgMgr. /// Clears the configuration in the @c CfgMgr.
@@ -34,7 +40,6 @@ protected:
/// ///
/// Clears the configuration in the @c CfgMgr. /// Clears the configuration in the @c CfgMgr.
virtual void TearDown(); virtual void TearDown();
}; };
void void

View File

@@ -74,6 +74,13 @@ factory0(const DatabaseConnection::ParameterMap&) {
// @brief Test fixture class // @brief Test fixture class
class HostDataSourceFactoryTest : public ::testing::Test { class HostDataSourceFactoryTest : public ::testing::Test {
public:
/// @brief Constructor
HostDataSourceFactoryTest() = default;
/// @brief Destructor
virtual ~HostDataSourceFactoryTest() = default;
private: private:
// @brief Prepares the class for a test. // @brief Prepares the class for a test.
virtual void SetUp() { virtual void SetUp() {

View File

@@ -42,8 +42,14 @@ namespace {
/// @brief Test fixture class for @c HostReservationParser. /// @brief Test fixture class for @c HostReservationParser.
class HostReservationParserTest : public ::testing::Test { class HostReservationParserTest : public ::testing::Test {
protected: public:
/// @brief Constructor
HostReservationParserTest() = default;
/// @brief Destructor
virtual ~HostReservationParserTest() = default;
protected:
/// @brief Setup for each test. /// @brief Setup for each test.
/// ///
/// Clears the configuration in the @c CfgMgr. /// Clears the configuration in the @c CfgMgr.

View File

@@ -32,8 +32,14 @@ namespace {
/// @brief Test fixture class for @c HostReservationsListParser. /// @brief Test fixture class for @c HostReservationsListParser.
class HostReservationsListParserTest : public ::testing::Test { class HostReservationsListParserTest : public ::testing::Test {
protected: public:
/// @brief Constructor
HostReservationsListParserTest() = default;
/// @brief Destructor
virtual ~HostReservationsListParserTest() = default;
protected:
/// @brief Setup for each test. /// @brief Setup for each test.
/// ///
/// Clears the configuration in the @c CfgMgr. It also initializes /// Clears the configuration in the @c CfgMgr. It also initializes

View File

@@ -39,7 +39,7 @@ public:
/// @brief Destructor /// @brief Destructor
/// ///
/// Removes any configuration that may have been added in CfgMgr. /// Removes any configuration that may have been added in CfgMgr.
~LeaseFileLoaderTest(); virtual ~LeaseFileLoaderTest();
/// @brief Prepends the absolute path to the file specified /// @brief Prepends the absolute path to the file specified
/// as an argument. /// as an argument.

View File

@@ -23,6 +23,14 @@ namespace {
/// @brief Test fixture class for @c MultiThreadingConfigParser /// @brief Test fixture class for @c MultiThreadingConfigParser
class MultiThreadingConfigParserTest : public ::testing::Test { class MultiThreadingConfigParserTest : public ::testing::Test {
public:
/// @brief Constructor
MultiThreadingConfigParserTest() = default;
/// @brief Destructor
virtual ~MultiThreadingConfigParserTest() = default;
protected: protected:
/// @brief Setup for each test. /// @brief Setup for each test.

View File

@@ -49,6 +49,9 @@ public:
: d2_mgr_(CfgMgr::instance().getD2ClientMgr()), lease_() { : d2_mgr_(CfgMgr::instance().getD2ClientMgr()), lease_() {
} }
/// @brief Destructor
virtual ~NCRGeneratorTest() = default;
/// @brief Initializes the lease pointer used by the tests and starts D2. /// @brief Initializes the lease pointer used by the tests and starts D2.
/// ///
/// This method initializes the pointer to the lease which will be used /// This method initializes the pointer to the lease which will be used

View File

@@ -27,7 +27,16 @@ namespace {
/// @brief Test fixture class for @c TimerMgr. /// @brief Test fixture class for @c TimerMgr.
class TimerMgrTest : public ::testing::Test { class TimerMgrTest : public ::testing::Test {
public:
/// @brief Constructor
TimerMgrTest() = default;
/// @brief Destructor
virtual ~TimerMgrTest() = default;
private: private:
/// @brief Prepares the class for a test. /// @brief Prepares the class for a test.
virtual void SetUp(); virtual void SetUp();

View File

@@ -682,6 +682,14 @@ public:
/// @brief Test fixture class for @c HostMgr class. /// @brief Test fixture class for @c HostMgr class.
class HostMgrTest : public ::testing::Test { class HostMgrTest : public ::testing::Test {
public:
/// @brief Constructor
HostMgrTest() = default;
/// @brief Destructor
virtual ~HostMgrTest() = default;
protected: protected:
/// @brief Prepares the class for a test. /// @brief Prepares the class for a test.

View File

@@ -24,8 +24,12 @@ namespace test {
class MemHostDataSource : public virtual BaseHostDataSource { class MemHostDataSource : public virtual BaseHostDataSource {
public: public:
/// @brief Constructor.
MemHostDataSource() : next_host_id_(0) {
}
/// @brief Destructor. /// @brief Destructor.
virtual ~MemHostDataSource() { } virtual ~MemHostDataSource() = default;
/// BaseHostDataSource methods. /// BaseHostDataSource methods.

View File

@@ -29,8 +29,13 @@ namespace {
/// of the dependency of classification expressions. /// of the dependency of classification expressions.
class DependencyTest : public ::testing::Test { class DependencyTest : public ::testing::Test {
public: public:
/// @brief Constructor
DependencyTest() : result_(true) {
}
/// @brief Reset expression and result. /// @brief Destructor
///
/// Reset expression and result.
~DependencyTest() { ~DependencyTest() {
e_.reset(); e_.reset();
result_ = false; result_ = false;

View File

@@ -51,6 +51,12 @@ TEST(LoggingDestination, equals) {
class LoggingInfoTest : public ::testing::Test { class LoggingInfoTest : public ::testing::Test {
public: public:
/// @brief Constructor
LoggingInfoTest() = default;
/// @brief Destructor
virtual ~LoggingInfoTest() = default;
/// @brief Setup the test. /// @brief Setup the test.
virtual void SetUp() { virtual void SetUp() {
Daemon::setVerbose(false); Daemon::setVerbose(false);

View File

@@ -337,7 +337,7 @@ public:
} }
/// \brief Destructor /// \brief Destructor
~ OutputBuffer() { ~OutputBuffer() {
free(buffer_); free(buffer_);
} }
//@} //@}

View File

@@ -76,7 +76,10 @@ const size_t INITIAL_BUFSIZE = 512;
const int SOCKSESSION_BUFSIZE = (DEFAULT_HEADER_BUFLEN + MAX_DATASIZE) * 2; const int SOCKSESSION_BUFSIZE = (DEFAULT_HEADER_BUFLEN + MAX_DATASIZE) * 2;
struct SocketSessionForwarder::ForwarderImpl { 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_; struct sockaddr_un sock_un_;
socklen_t sock_un_len_; socklen_t sock_un_len_;
int fd_; int fd_;

View File

@@ -24,19 +24,22 @@ namespace {
const size_t TEST_DATA_SIZE = 8 * 1024 * 1024; const size_t TEST_DATA_SIZE = 8 * 1024 * 1024;
class FDTest : public ::testing::Test { class FDTest : public ::testing::Test {
public: public:
unsigned char *data, *buffer; unsigned char *data, *buffer;
FDTest() :
// We do not care what is inside, we just need it to be the same /// @brief Constructor
data(new unsigned char[TEST_DATA_SIZE]), FDTest() :
buffer(NULL) // We do not care what is inside, we just need it to be the same
{ data(new unsigned char[TEST_DATA_SIZE]),
memset(data, 0, TEST_DATA_SIZE); buffer(NULL) {
} memset(data, 0, TEST_DATA_SIZE);
~ FDTest() { }
delete[] data;
delete[] buffer; /// @brief Destructor
} ~FDTest() {
delete[] data;
delete[] buffer;
}
}; };
// Test we read what was sent // Test we read what was sent

View File

@@ -20,6 +20,13 @@ const char* TESTNAME = "pid_file.test";
class PIDFileTest : public ::testing::Test { class PIDFileTest : public ::testing::Test {
public: public:
/// @brief Constructor
PIDFileTest() = default;
/// @brief Destructor
virtual ~PIDFileTest() = default;
/// @brief Prepends the absolute path to the file specified /// @brief Prepends the absolute path to the file specified
/// as an argument. /// as an argument.
/// ///

View File

@@ -101,6 +101,14 @@ StopwatchMock::getCurrentTime() const {
/// @brief Test fixture class for testing @c StopwatchImpl. /// @brief Test fixture class for testing @c StopwatchImpl.
class StopwatchTest : public ::testing::Test { class StopwatchTest : public ::testing::Test {
public:
/// @brief Constructor
StopwatchTest() = default;
/// @brief Destructor
virtual ~StopwatchTest() = default;
protected: protected:
/// @brief Set up the test. /// @brief Set up the test.