]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3736] Suppress cppcheck warnings about the SetUp/TearDown unused.
authorMarcin Siodelski <marcin@isc.org>
Fri, 6 Mar 2015 20:42:00 +0000 (21:42 +0100)
committerMarcin Siodelski <marcin@isc.org>
Fri, 6 Mar 2015 20:42:00 +0000 (21:42 +0100)
src/bin/dhcp4/tests/config_parser_unittest.cc
src/bin/dhcp4/tests/dhcp4_test_utils.cc
src/bin/dhcp6/tests/config_parser_unittest.cc
src/lib/dhcpsrv/tests/host_mgr_unittest.cc

index 2be8a29747132180c828908a7de16b496258d47c..7cb289ca06d2fd36978b81a7bb0fa59f36c50fe2 100644 (file)
@@ -73,9 +73,19 @@ TEST(Dhcp4SpecTest, basicSpec) {
 }
 
 class Dhcp4ParserTest : public ::testing::Test {
+protected:
+    // Check that no hooks libraries are loaded.  This is a pre-condition for
+    // a number of tests, so is checked in one place.  As this uses an
+    // ASSERT call - and it is not clear from the documentation that Gtest
+    // predicates can be used in a constructor - the check is placed in SetUp.
+    virtual void SetUp() {
+        std::vector<std::string> libraries = HooksManager::getLibraryNames();
+        ASSERT_TRUE(libraries.empty());
+    }
+
 public:
     Dhcp4ParserTest()
-    :rcode_(-1) {
+    : rcode_(-1) {
         // Open port 0 means to not do anything at all. We don't want to
         // deal with sockets here, just check if configuration handling
         // is sane.
@@ -85,15 +95,7 @@ public:
         resetConfiguration();
     }
 
-    // Check that no hooks libraries are loaded.  This is a pre-condition for
-    // a number of tests, so is checked in one place.  As this uses an
-    // ASSERT call - and it is not clear from the documentation that Gtest
-    // predicates can be used in a constructor - the check is placed in SetUp.
-    void SetUp() {
-        std::vector<std::string> libraries = HooksManager::getLibraryNames();
-        ASSERT_TRUE(libraries.empty());
-    }
-
+public:
     // Checks if global parameter of name have expected_value
     void checkGlobalUint32(string name, uint32_t expected_value) {
         const Uint32StoragePtr uint32_defaults =
index c93463211b6e5f013fb6e8d6b79ee4a7e6202dd3..68857f5dd55c5a577ecd1a2eb7c5e0d79c03b5f5 100644 (file)
@@ -388,7 +388,9 @@ Dhcpv4SrvTest::createPacketFromBuffer(const Pkt4Ptr& src_pkt,
     return (::testing::AssertionSuccess());
 }
 
-void Dhcpv4SrvTest::TearDown() {
+void
+// cppcheck-suppress unusedFunction
+Dhcpv4SrvTest::TearDown() {
 
     CfgMgr::instance().clear();
 
index 0f511b4feef04821242d2786e2e16149b91713e1..b9b4ec1940ed1c89a89dae3718e5b8b916c4f7df 100644 (file)
@@ -71,6 +71,16 @@ TEST(Dhcp6SpecTest, basicSpec) {
 }
 
 class Dhcp6ParserTest : public ::testing::Test {
+protected:
+    // Check that no hooks libraries are loaded.  This is a pre-condition for
+    // a number of tests, so is checked in one place.  As this uses an
+    // ASSERT call - and it is not clear from the documentation that Gtest
+    // predicates can be used in a constructor - the check is placed in SetUp.
+    virtual void SetUp() {
+        std::vector<std::string> libraries = HooksManager::getLibraryNames();
+        ASSERT_TRUE(libraries.empty());
+    }
+
 public:
     Dhcp6ParserTest() :rcode_(-1), srv_(0) {
         // srv_(0) means to not open any sockets. We don't want to
@@ -99,15 +109,6 @@ public:
         resetConfiguration();
     }
 
-    // Check that no hooks libraries are loaded.  This is a pre-condition for
-    // a number of tests, so is checked in one place.  As this uses an
-    // ASSERT call - and it is not clear from the documentation that Gtest
-    // predicates can be used in a constructor - the check is placed in SetUp.
-    void SetUp() {
-        std::vector<std::string> libraries = HooksManager::getLibraryNames();
-        ASSERT_TRUE(libraries.empty());
-    }
-
     ~Dhcp6ParserTest() {
         // Reset configuration database after each test.
         resetConfiguration();
index a9b8a84a70631a6f38dcb52d8efcf93d7e3cb25d..a447f7d255b8ea2f26bae2859f3af9857705ac25 100644 (file)
@@ -52,6 +52,7 @@ protected:
 };
 
 void
+// cppcheck-suppress unusedFunction
 HostMgrTest::SetUp() {
     // Remove all configuration which may be dangling from the previous test.
     CfgMgr::instance().clear();