2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-03 23:45:27 +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);
#endif
/// @brief Cancel flag.
bool cancel_;
protected:
/// @brief Get and display Kea server configuration.
///

View File

@@ -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.

View File

@@ -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++() {
@@ -97,14 +98,18 @@ public:
/// Method returns counter value.
///
/// \return counter value.
uint64_t getValue() const { return(counter_); }
uint64_t getValue() const {
return (counter_);
}
/// \brief Return counter name.
///
/// Method returns counter name.
///
/// \return counter name.
const std::string& getName() const { return(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.

View File

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

View File

@@ -70,6 +70,7 @@ public:
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();

View File

@@ -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.

View File

@@ -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() {

View File

@@ -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

View File

@@ -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() {

View File

@@ -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.

View File

@@ -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

View File

@@ -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.

View File

@@ -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.

View File

@@ -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

View File

@@ -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();

View File

@@ -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.

View File

@@ -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.

View File

@@ -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;

View File

@@ -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);

View File

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

View File

@@ -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_;

View File

@@ -24,16 +24,19 @@ namespace {
const size_t TEST_DATA_SIZE = 8 * 1024 * 1024;
class FDTest : public ::testing::Test {
public:
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)
{
buffer(NULL) {
memset(data, 0, TEST_DATA_SIZE);
}
~ FDTest() {
/// @brief Destructor
~FDTest() {
delete[] data;
delete[] buffer;
}

View File

@@ -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.
///

View File

@@ -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.