diff options
author | Razvan Becheriu <razvan@isc.org> | 2024-01-12 15:31:50 +0100 |
---|---|---|
committer | Razvan Becheriu <razvan@isc.org> | 2024-01-22 16:49:59 +0100 |
commit | 1b4d7b0293bca6657d1f798e6e4e65ce95d2dca4 (patch) | |
tree | fc89d85f5dd097dd85a2921ce1382980e012a423 /src/lib/dhcp/tests/libdhcp++_unittest.cc | |
parent | [#3119] replace const auto with auto const (diff) | |
download | kea-1b4d7b0293bca6657d1f798e6e4e65ce95d2dca4.tar.xz kea-1b4d7b0293bca6657d1f798e6e4e65ce95d2dca4.zip |
[#3119] use range based for loop or BOOST_FOREACH
Diffstat (limited to 'src/lib/dhcp/tests/libdhcp++_unittest.cc')
-rw-r--r-- | src/lib/dhcp/tests/libdhcp++_unittest.cc | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/lib/dhcp/tests/libdhcp++_unittest.cc b/src/lib/dhcp/tests/libdhcp++_unittest.cc index 3c6262c063..c9d0d32207 100644 --- a/src/lib/dhcp/tests/libdhcp++_unittest.cc +++ b/src/lib/dhcp/tests/libdhcp++_unittest.cc @@ -1603,7 +1603,8 @@ TEST_F(LibDhcpTest, fuseLongOptionWithLongSuboption) { ASSERT_EQ(1, col.size()); ASSERT_EQ(1, col.begin()->second->getOptions().size()); uint8_t index = 0; - for (auto const& option : col.begin()->second->getOptions()) { + auto const& options = col.begin()->second->getOptions(); + for (auto const& option : options) { for (auto const& value : option.second->getData()) { ASSERT_EQ(index, value); index++; @@ -3217,12 +3218,11 @@ TEST_F(LibDhcpTest, getOptionDefByName6) { // Get all definitions. const OptionDefContainerPtr defs = LibDHCP::getOptionDefs(DHCP6_OPTION_SPACE); // For each definition try to find it using option name. - for (OptionDefContainer::const_iterator def = defs->begin(); - def != defs->end(); ++def) { + for (auto const& def : *defs) { OptionDefinitionPtr def_by_name = - LibDHCP::getOptionDef(DHCP6_OPTION_SPACE, (*def)->getName()); + LibDHCP::getOptionDef(DHCP6_OPTION_SPACE, def->getName()); ASSERT_TRUE(def_by_name); - ASSERT_TRUE(**def == *def_by_name); + ASSERT_TRUE(*def == *def_by_name); } } @@ -3232,12 +3232,11 @@ TEST_F(LibDhcpTest, getOptionDefByName4) { // Get all definitions. const OptionDefContainerPtr defs = LibDHCP::getOptionDefs(DHCP4_OPTION_SPACE); // For each definition try to find it using option name. - for (OptionDefContainer::const_iterator def = defs->begin(); - def != defs->end(); ++def) { + for (auto const& def : *defs) { OptionDefinitionPtr def_by_name = - LibDHCP::getOptionDef(DHCP4_OPTION_SPACE, (*def)->getName()); + LibDHCP::getOptionDef(DHCP4_OPTION_SPACE, def->getName()); ASSERT_TRUE(def_by_name); - ASSERT_TRUE(**def == *def_by_name); + ASSERT_TRUE(*def == *def_by_name); } } @@ -3247,13 +3246,12 @@ TEST_F(LibDhcpTest, getVendorOptionDefByName6) { const OptionDefContainerPtr& defs = LibDHCP::getVendorOptionDefs(Option::V6, VENDOR_ID_CABLE_LABS); ASSERT_TRUE(defs); - for (OptionDefContainer::const_iterator def = defs->begin(); - def != defs->end(); ++def) { + for (auto const& def : *defs) { OptionDefinitionPtr def_by_name = LibDHCP::getVendorOptionDef(Option::V6, VENDOR_ID_CABLE_LABS, - (*def)->getName()); + def->getName()); ASSERT_TRUE(def_by_name); - ASSERT_TRUE(**def == *def_by_name); + ASSERT_TRUE(*def == *def_by_name); } } @@ -3263,13 +3261,12 @@ TEST_F(LibDhcpTest, getVendorOptionDefByName4) { const OptionDefContainerPtr& defs = LibDHCP::getVendorOptionDefs(Option::V4, VENDOR_ID_CABLE_LABS); ASSERT_TRUE(defs); - for (OptionDefContainer::const_iterator def = defs->begin(); - def != defs->end(); ++def) { + for (auto const& def : *defs) { OptionDefinitionPtr def_by_name = LibDHCP::getVendorOptionDef(Option::V4, VENDOR_ID_CABLE_LABS, - (*def)->getName()); + def->getName()); ASSERT_TRUE(def_by_name); - ASSERT_TRUE(**def == *def_by_name); + ASSERT_TRUE(*def == *def_by_name); } } |