Browse Source

[4283] Fixed a few unused constant pending (i.e., ignored by default) warnings

Francis Dupont 8 years ago
parent
commit
14a753b76e

+ 2 - 3
src/lib/dhcpsrv/tests/csv_lease_file4_unittest.cc

@@ -25,8 +25,7 @@ namespace {
 const uint8_t HWADDR0[] = { 0, 1, 2, 3, 4, 5 };
 const uint8_t HWADDR1[] = { 0xd, 0xe, 0xa, 0xd, 0xb, 0xe, 0xe, 0xf };
 
-const uint8_t CLIENTID0[] = { 1, 2, 3, 4 };
-const uint8_t CLIENTID1[] = { 0xa, 0xb, 0xc, 0xd };
+const uint8_t CLIENTID[] = { 1, 2, 3, 4 };
 
 /// @brief Test fixture class for @c CSVLeaseFile4 validation.
 class CSVLeaseFile4Test : public ::testing::Test {
@@ -219,7 +218,7 @@ TEST_F(CSVLeaseFile4Test, recreate) {
     // Create second lease, with non-NULL client id.
     lease.reset(new Lease4(IOAddress("192.0.3.10"),
                            hwaddr1_,
-                           CLIENTID0, sizeof(CLIENTID0),
+                           CLIENTID, sizeof(CLIENTID),
                            100, 60, 90, 0, 7));
     {
     SCOPED_TRACE("Second write");

+ 1 - 1
src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc

@@ -32,7 +32,7 @@ namespace {
 /// @brief Holds a type of the last identifier in @c IdentifierType enum.
 ///
 /// This value must be updated when new identifiers are added to the enum.
-const Host::IdentifierType LAST_IDENTIFIER_TYPE = Host::IDENT_CIRCUIT_ID;
+// const Host::IdentifierType LAST_IDENTIFIER_TYPE = Host::IDENT_CIRCUIT_ID;
 
 /// @brief Test fixture class for @c HostReservationParser.
 class HostReservationParserTest : public ::testing::Test {

+ 4 - 18
src/lib/dhcpsrv/tests/lease_unittest.cc

@@ -70,10 +70,6 @@ TEST_F(Lease4Test, constructor) {
      // Get current time for the use in Lease.
     const time_t current_time = time(NULL);
 
-    // Other random constants.
-    const uint32_t SUBNET_ID = 42;
-    const uint32_t VALID_LIFETIME = 500;
-
     // We want to check that various addresses work, so let's iterate over
     // these.
     const uint32_t ADDRESS[] = {
@@ -108,10 +104,6 @@ TEST_F(Lease4Test, copyConstructor) {
     // Get current time for the use in Lease4.
     const time_t current_time = time(NULL);
 
-    // Other random constants.
-    const uint32_t SUBNET_ID = 42;
-    const uint32_t VALID_LIFETIME = 500;
-
     // Create the lease
     Lease4 lease(0xffffffff, hwaddr_, clientid_, VALID_LIFETIME, 0, 0, current_time,
                  SUBNET_ID);
@@ -149,10 +141,6 @@ TEST_F(Lease4Test, operatorAssign) {
     // Get the current time for the use in Lease4.
     const time_t current_time = time(NULL);
 
-    // Other random constants.
-    const uint32_t SUBNET_ID = 42;
-    const uint32_t VALID_LIFETIME = 500;
-
     // Create the lease
     Lease4 lease(0xffffffff, hwaddr_, clientid_, VALID_LIFETIME, 0, 0, current_time,
                  SUBNET_ID);
@@ -257,8 +245,6 @@ TEST_F(Lease4Test, operatorEquals) {
     // Random values for the tests
     const uint32_t ADDRESS = 0x01020304;
     const time_t current_time = time(NULL);
-    const uint32_t SUBNET_ID = 42;
-    const uint32_t VALID_LIFETIME = 500;
 
     // Check when the leases are equal.
     Lease4 lease1(ADDRESS, hwaddr_, clientid_, VALID_LIFETIME, current_time, 0,
@@ -504,7 +490,7 @@ TEST(Lease6Test, Lease6ConstructorDefault) {
     // Other values
     uint8_t llt[] = {0, 1, 2, 3, 4, 5, 6, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf};
     DuidPtr duid(new DUID(llt, sizeof(llt)));
-    uint32_t iaid = 7;      // Just a number
+    uint32_t iaid = IAID;   // Just a number
     SubnetID subnet_id = 8; // Just another number
 
     for (int i = 0; i < sizeof(ADDRESS) / sizeof(ADDRESS[0]); ++i) {
@@ -551,7 +537,7 @@ TEST(Lease6Test, Lease6ConstructorWithFQDN) {
     // Other values
     uint8_t llt[] = {0, 1, 2, 3, 4, 5, 6, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf};
     DuidPtr duid(new DUID(llt, sizeof(llt)));
-    uint32_t iaid = 7;      // Just a number
+    uint32_t iaid = IAID;   // Just a number
     SubnetID subnet_id = 8; // Just another number
 
     for (int i = 0; i < sizeof(ADDRESS) / sizeof(ADDRESS[0]); ++i) {
@@ -593,7 +579,7 @@ TEST(Lease6Test, operatorEquals) {
     const IOAddress addr("2001:db8:1::456");
     uint8_t duid_array[] = {0, 1, 2, 3, 4, 5, 6, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf};
     DuidPtr duid(new DUID(duid_array, sizeof(duid_array)));
-    uint32_t iaid = 7; // just a number
+    uint32_t iaid = IAID;   // just a number
     SubnetID subnet_id = 8; // just another number
 
     // Check for equality.
@@ -723,7 +709,7 @@ TEST(Lease6Test, Lease6Expired) {
     const IOAddress addr("2001:db8:1::456");
     const uint8_t duid_array[] = {0, 1, 2, 3, 4, 5, 6, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf};
     const DuidPtr duid(new DUID(duid_array, sizeof(duid_array)));
-    const uint32_t iaid = 7;        // Just a number
+    const uint32_t iaid = IAID;     // Just a number
     const SubnetID subnet_id = 8;   // Just another number
     Lease6 lease(Lease::TYPE_NA, addr, duid, iaid, 100, 200, 50, 80,
                                subnet_id);