From: Francis Dupont Date: Sat, 6 Jun 2026 17:30:37 +0000 (+0200) Subject: [#4329] Ported signed/unsigned to bin X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f49ff8a6b4b75064d5d4e32cc56cbc89cd4b6657;p=thirdparty%2Fkea.git [#4329] Ported signed/unsigned to bin --- diff --git a/src/bin/d2/tests/check_exists_add_unittests.cc b/src/bin/d2/tests/check_exists_add_unittests.cc index 9552bc6ed9..e4ad347e6a 100644 --- a/src/bin/d2/tests/check_exists_add_unittests.cc +++ b/src/bin/d2/tests/check_exists_add_unittests.cc @@ -1653,7 +1653,7 @@ TEST_F(CheckExistsAddTransactionTest, addingFwdAddrsHandler_BuildRequestExceptio ASSERT_NO_THROW(name_add->addingFwdAddrsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_add->getUpdateAttempts()); + EXPECT_EQ(0U, name_add->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_add->getForwardChangeCompleted()); @@ -1691,7 +1691,7 @@ TEST_F(CheckExistsAddTransactionTest, replacingFwdAddrsHandler_BuildRequestExcep ASSERT_NO_THROW(name_add->replacingFwdAddrsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_add->getUpdateAttempts()); + EXPECT_EQ(0U, name_add->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_add->getForwardChangeCompleted()); @@ -1730,7 +1730,7 @@ TEST_F(CheckExistsAddTransactionTest, replacingRevPtrsHandler_BuildRequestExcept ASSERT_NO_THROW(name_add->replacingRevPtrsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_add->getUpdateAttempts()); + EXPECT_EQ(0U, name_add->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_add->getForwardChangeCompleted()); @@ -1745,5 +1745,4 @@ TEST_F(CheckExistsAddTransactionTest, replacingRevPtrsHandler_BuildRequestExcept name_add->getNextEvent()); } - } diff --git a/src/bin/d2/tests/check_exists_remove_unittests.cc b/src/bin/d2/tests/check_exists_remove_unittests.cc index 01c745190c..fac36a8b2f 100644 --- a/src/bin/d2/tests/check_exists_remove_unittests.cc +++ b/src/bin/d2/tests/check_exists_remove_unittests.cc @@ -657,7 +657,6 @@ TEST_F(CheckExistsRemoveTransactionTest, removingFwdAddrsHandler_FqdnNotInUse) { name_remove->getNextEvent()); } - // Tests removingFwdAddrsHandler with the following scenario: // // The request includes a forward and reverse change. @@ -701,7 +700,6 @@ TEST_F(CheckExistsRemoveTransactionTest, removingFwdAddrsHandler_OtherRcode) { name_remove->getNextEvent()); } - // Tests removingFwdAddrsHandler with the following scenario: // // The request includes a forward and reverse change. @@ -1516,7 +1514,6 @@ TEST_F(CheckExistsRemoveTransactionTest, processRemoveOkHandler) { EXPECT_EQ(StateModel::END_ST, name_remove->getCurrState()); EXPECT_EQ(StateModel::END_EVT, name_remove->getNextEvent()); - // Create and prep transaction, poised to run the handler but with an // invalid event. ASSERT_NO_THROW(name_remove = @@ -1734,7 +1731,7 @@ TEST_F(CheckExistsRemoveTransactionTest, ASSERT_NO_THROW(name_remove->removingFwdAddrsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_remove->getUpdateAttempts()); + EXPECT_EQ(0U, name_remove->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_remove->getForwardChangeCompleted()); @@ -1774,7 +1771,7 @@ TEST_F(CheckExistsRemoveTransactionTest, ASSERT_NO_THROW(name_remove->removingFwdRRsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_remove->getUpdateAttempts()); + EXPECT_EQ(0U, name_remove->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_remove->getForwardChangeCompleted()); @@ -1814,7 +1811,7 @@ TEST_F(CheckExistsRemoveTransactionTest, ASSERT_NO_THROW(name_remove->removingRevPtrsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_remove->getUpdateAttempts()); + EXPECT_EQ(0U, name_remove->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_remove->getForwardChangeCompleted()); diff --git a/src/bin/d2/tests/d2_cfg_mgr_unittests.cc b/src/bin/d2/tests/d2_cfg_mgr_unittests.cc index 051388895f..6f6e0d9ab2 100644 --- a/src/bin/d2/tests/d2_cfg_mgr_unittests.cc +++ b/src/bin/d2/tests/d2_cfg_mgr_unittests.cc @@ -279,8 +279,8 @@ TEST_F(D2CfgMgrTest, validParamsEntry) { EXPECT_EQ(isc::asiolink::IOAddress("192.0.0.1"), d2_params_->getIpAddress()); - EXPECT_EQ(777, d2_params_->getPort()); - EXPECT_EQ(333, d2_params_->getDnsServerTimeout()); + EXPECT_EQ(777U, d2_params_->getPort()); + EXPECT_EQ(333U, d2_params_->getDnsServerTimeout()); EXPECT_EQ(dhcp_ddns::NCR_UDP, d2_params_->getNcrProtocol()); EXPECT_EQ(dhcp_ddns::FMT_JSON, d2_params_->getNcrFormat()); @@ -339,7 +339,7 @@ TEST_F(D2CfgMgrTest, defaultValues) { RUN_CONFIG_OK(config); ASSERT_NO_THROW(deflt = defaults->get("port")); ASSERT_TRUE(deflt); - EXPECT_EQ(deflt->intValue(), d2_params_->getPort()); + EXPECT_EQ(deflt->intValue(), static_cast(d2_params_->getPort())); // Check that omitting timeout gets you its default config = @@ -356,7 +356,7 @@ TEST_F(D2CfgMgrTest, defaultValues) { RUN_CONFIG_OK(config); ASSERT_NO_THROW(deflt = defaults->get("dns-server-timeout")); ASSERT_TRUE(deflt); - EXPECT_EQ(deflt->intValue(), d2_params_->getDnsServerTimeout()); + EXPECT_EQ(deflt->intValue(), static_cast(d2_params_->getDnsServerTimeout())); // Check that omitting protocol gets you its default config = @@ -590,8 +590,8 @@ TEST_F(D2CfgMgrTest, fullConfig) { EXPECT_EQ(isc::asiolink::IOAddress("192.168.1.33"), d2_params->getIpAddress()); - EXPECT_EQ(88, d2_params->getPort()); - EXPECT_EQ(333, d2_params->getDnsServerTimeout()); + EXPECT_EQ(88U, d2_params->getPort()); + EXPECT_EQ(333U, d2_params->getDnsServerTimeout()); EXPECT_EQ(dhcp_ddns::NCR_UDP, d2_params->getNcrProtocol()); EXPECT_EQ(dhcp_ddns::FMT_JSON, d2_params->getNcrFormat()); @@ -599,10 +599,10 @@ TEST_F(D2CfgMgrTest, fullConfig) { ConstElementPtr ctrl_sock = context->getUnixControlSocketInfo(); ASSERT_TRUE(ctrl_sock); ASSERT_EQ(Element::list, ctrl_sock->getType()); - ASSERT_EQ(ctrl_sock->size(), 1); + ASSERT_EQ(ctrl_sock->size(), 1U); ctrl_sock = ctrl_sock->get(0); ASSERT_EQ(Element::map, ctrl_sock->getType()); - EXPECT_EQ(2, ctrl_sock->size()); + EXPECT_EQ(2U, ctrl_sock->size()); ASSERT_TRUE(ctrl_sock->get("socket-type")); EXPECT_EQ("\"unix\"", ctrl_sock->get("socket-type")->str()); ASSERT_TRUE(ctrl_sock->get("socket-name")); @@ -610,7 +610,7 @@ TEST_F(D2CfgMgrTest, fullConfig) { // Verify that the hooks libraries can be retrieved. const HookLibsCollection libs = context->getHooksConfig().get(); - ASSERT_EQ(1, libs.size()); + ASSERT_EQ(1U, libs.size()); EXPECT_EQ(string(CALLOUT_LIBRARY), libs[0].libname_); ASSERT_TRUE(libs[0].parameters_); EXPECT_EQ("{ \"param1\": \"foo\" }", libs[0].parameters_->str()); @@ -1076,7 +1076,7 @@ TEST_F(D2CfgMgrTest, comments) { // Check global user context. ConstElementPtr ctx = d2_context->getContext(); ASSERT_TRUE(ctx); - ASSERT_EQ(1, ctx->size()); + ASSERT_EQ(1U, ctx->size()); ASSERT_TRUE(ctx->get("comment")); EXPECT_EQ("\"D2 config\"", ctx->get("comment")->str()); @@ -1084,12 +1084,12 @@ TEST_F(D2CfgMgrTest, comments) { ConstElementPtr socket = d2_context->getUnixControlSocketInfo(); ASSERT_TRUE(socket); ASSERT_EQ(Element::list, socket->getType()); - ASSERT_EQ(socket->size(), 1); + ASSERT_EQ(socket->size(), 1U); socket = socket->get(0); ASSERT_TRUE(socket); ConstElementPtr ctx_socket = socket->get("user-context"); ASSERT_TRUE(ctx_socket); - ASSERT_EQ(1, ctx_socket->size()); + ASSERT_EQ(1U, ctx_socket->size()); ASSERT_TRUE(ctx_socket->get("comment")); EXPECT_EQ("\"Indirect comment\"", ctx_socket->get("comment")->str()); @@ -1097,13 +1097,13 @@ TEST_F(D2CfgMgrTest, comments) { socket = d2_context->getHttpControlSocketInfo(); ASSERT_TRUE(socket); ASSERT_EQ(Element::list, socket->getType()); - ASSERT_EQ(socket->size(), 1); + ASSERT_EQ(socket->size(), 1U); socket = socket->get(0); ASSERT_TRUE(socket); /// @todo use the configuration object. ctx_socket = socket->get("user-context"); ASSERT_TRUE(ctx_socket); - ASSERT_EQ(1, ctx_socket->size()); + ASSERT_EQ(1U, ctx_socket->size()); ASSERT_TRUE(ctx_socket->get("comment")); EXPECT_EQ("\"HTTP control socket\"", ctx_socket->get("comment")->str()); @@ -1112,27 +1112,27 @@ TEST_F(D2CfgMgrTest, comments) { ASSERT_TRUE(auth); ConstElementPtr ctx_auth = auth->get("user-context"); ASSERT_TRUE(ctx_auth); - ASSERT_EQ(1, ctx_auth->size()); + ASSERT_EQ(1U, ctx_auth->size()); ASSERT_TRUE(ctx_auth->get("comment")); EXPECT_EQ("\"basic HTTP authentication\"", ctx_auth->get("comment")->str()); // Authentication client. ConstElementPtr clients = auth->get("clients"); ASSERT_TRUE(clients); - ASSERT_EQ(1, clients->size()); + ASSERT_EQ(1U, clients->size()); ConstElementPtr client; ASSERT_NO_THROW(client = clients->get(0)); ASSERT_TRUE(client); ConstElementPtr ctx_client = client->get("user-context"); ASSERT_TRUE(ctx_client); - ASSERT_EQ(1, ctx_client->size()); + ASSERT_EQ(1U, ctx_client->size()); ASSERT_TRUE(ctx_client->get("comment")); EXPECT_EQ("\"admin is authorized\"", ctx_client->get("comment")->str()); // Check TSIG keys. TSIGKeyInfoMapPtr keys = d2_context->getKeys(); ASSERT_TRUE(keys); - ASSERT_EQ(1, keys->size()); + ASSERT_EQ(1U, keys->size()); // Check the TSIG key. TSIGKeyInfoMap::iterator gotkey = keys->find("d2_key.example.com"); @@ -1143,7 +1143,7 @@ TEST_F(D2CfgMgrTest, comments) { // Check the TSIG key user context. ConstElementPtr key_ctx = key->getContext(); ASSERT_TRUE(key_ctx); - ASSERT_EQ(1, key_ctx->size()); + ASSERT_EQ(1U, key_ctx->size()); ASSERT_TRUE(key_ctx->get("comment")); EXPECT_EQ("\"Indirect comment\"", key_ctx->get("comment")->str()); @@ -1153,7 +1153,7 @@ TEST_F(D2CfgMgrTest, comments) { EXPECT_EQ("forward-ddns", mgr->getName()); DdnsDomainMapPtr domains = mgr->getDomains(); ASSERT_TRUE(domains); - ASSERT_EQ(1, domains->size()); + ASSERT_EQ(1U, domains->size()); // Check the DDNS domain. DdnsDomainMap::iterator gotdns = domains->find("example.com"); @@ -1164,14 +1164,14 @@ TEST_F(D2CfgMgrTest, comments) { // Check the DNS server. DnsServerInfoStoragePtr servers = domain->getServers(); ASSERT_TRUE(servers); - ASSERT_EQ(1, servers->size()); + ASSERT_EQ(1U, servers->size()); DnsServerInfoPtr server = (*servers)[0]; ASSERT_TRUE(server); // Check the DNS server user context. ConstElementPtr srv_ctx = server->getContext(); ASSERT_TRUE(srv_ctx); - ASSERT_EQ(1, srv_ctx->size()); + ASSERT_EQ(1U, srv_ctx->size()); ASSERT_TRUE(srv_ctx->get("version")); EXPECT_EQ("1", srv_ctx->get("version")->str()); } @@ -1190,8 +1190,8 @@ TEST_F(D2CfgMgrTest, listenOnANYAddresses) { EXPECT_EQ("listening on 0.0.0.0, port 777, using UDP", d2_params_->getConfigSummary()); - EXPECT_EQ(777, d2_params_->getPort()); - EXPECT_EQ(333, d2_params_->getDnsServerTimeout()); + EXPECT_EQ(777U, d2_params_->getPort()); + EXPECT_EQ(333U, d2_params_->getDnsServerTimeout()); EXPECT_EQ(dhcp_ddns::NCR_UDP, d2_params_->getNcrProtocol()); EXPECT_EQ(dhcp_ddns::FMT_JSON, d2_params_->getNcrFormat()); diff --git a/src/bin/d2/tests/d2_command_unittest.cc b/src/bin/d2/tests/d2_command_unittest.cc index fbe20fbabd..f47be3193d 100644 --- a/src/bin/d2/tests/d2_command_unittest.cc +++ b/src/bin/d2/tests/d2_command_unittest.cc @@ -668,7 +668,7 @@ TEST_F(CtrlChannelD2Test, statusGet) { ASSERT_NO_THROW(response = Element::fromJSON(response_txt)); ASSERT_TRUE(response); ASSERT_EQ(Element::map, response->getType()); - EXPECT_EQ(2, response->size()); + EXPECT_EQ(2U, response->size()); ConstElementPtr result = response->get("result"); ASSERT_TRUE(result); ASSERT_EQ(Element::integer, result->getType()); @@ -749,7 +749,7 @@ TEST_F(CtrlChannelD2Test, configHashGet) { ASSERT_TRUE(hash); ASSERT_EQ(Element::string, hash->getType()); // SHA-256 -> 64 hex digits. - EXPECT_EQ(64, hash->stringValue().size()); + EXPECT_EQ(64U, hash->stringValue().size()); } // Verify that the "config-test" command will do what we expect. @@ -832,7 +832,7 @@ TEST_F(CtrlChannelD2Test, configTest) { ASSERT_TRUE(d2_context); TSIGKeyInfoMapPtr keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); ASSERT_GT(UnixCommandMgr::instance().getControlSocketFD(), -1); @@ -862,7 +862,7 @@ TEST_F(CtrlChannelD2Test, configTest) { d2_context = cfg_mgr->getD2CfgContext(); keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); // Create a valid config with two keys and no command channel. os.str(""); @@ -894,7 +894,7 @@ TEST_F(CtrlChannelD2Test, configTest) { d2_context = cfg_mgr->getD2CfgContext(); keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); } // Verify that the "config-set" command will do what we expect. @@ -978,7 +978,7 @@ TEST_F(CtrlChannelD2Test, configSet) { ASSERT_TRUE(d2_context); TSIGKeyInfoMapPtr keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); ASSERT_GT(UnixCommandMgr::instance().getControlSocketFD(), -1); @@ -1008,7 +1008,7 @@ TEST_F(CtrlChannelD2Test, configSet) { d2_context = cfg_mgr->getD2CfgContext(); keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); // Create a valid config with two keys and no command channel. os.str(""); @@ -1041,7 +1041,7 @@ TEST_F(CtrlChannelD2Test, configSet) { d2_context = cfg_mgr->getD2CfgContext(); keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(2, keys->size()); + EXPECT_EQ(2U, keys->size()); } // Tests if config-write can be called without any parameters. @@ -1231,7 +1231,7 @@ TEST_F(CtrlChannelD2Test, configReloadFileValid) { ASSERT_TRUE(d2_params); EXPECT_EQ("192.168.77.1", d2_params->getIpAddress().toText()); - EXPECT_EQ(777, d2_params->getPort()); + EXPECT_EQ(777U, d2_params->getPort()); EXPECT_FALSE(d2_cfg_mgr->forwardUpdatesEnabled()); EXPECT_FALSE(d2_cfg_mgr->reverseUpdatesEnabled()); diff --git a/src/bin/d2/tests/d2_controller_unittests.cc b/src/bin/d2/tests/d2_controller_unittests.cc index 3646c7a29e..180b1ee73a 100644 --- a/src/bin/d2/tests/d2_controller_unittests.cc +++ b/src/bin/d2/tests/d2_controller_unittests.cc @@ -229,7 +229,7 @@ TEST_F(D2ControllerTest, invalidConfigReload) { ASSERT_TRUE(d2_params); EXPECT_EQ("127.0.0.1", d2_params->getIpAddress().toText()); - EXPECT_EQ(5031, d2_params->getPort()); + EXPECT_EQ(5031U, d2_params->getPort()); EXPECT_TRUE(d2_cfg_mgr->forwardUpdatesEnabled()); EXPECT_TRUE(d2_cfg_mgr->reverseUpdatesEnabled()); @@ -267,7 +267,7 @@ TEST_F(D2ControllerTest, validConfigReload) { ASSERT_TRUE(d2_params); EXPECT_EQ("192.168.77.1", d2_params->getIpAddress().toText()); - EXPECT_EQ(777, d2_params->getPort()); + EXPECT_EQ(777U, d2_params->getPort()); EXPECT_FALSE(d2_cfg_mgr->forwardUpdatesEnabled()); EXPECT_FALSE(d2_cfg_mgr->reverseUpdatesEnabled()); diff --git a/src/bin/d2/tests/d2_http_command_unittest.cc b/src/bin/d2/tests/d2_http_command_unittest.cc index dfd8fef0e6..ccd9278812 100644 --- a/src/bin/d2/tests/d2_http_command_unittest.cc +++ b/src/bin/d2/tests/d2_http_command_unittest.cc @@ -374,7 +374,7 @@ public: // Errors can be in a list. if (rsp->getType() == Element::list) { - ASSERT_EQ(1, rsp->size()); + ASSERT_EQ(1U, rsp->size()); rsp = rsp->get(0); } @@ -832,11 +832,11 @@ BaseCtrlChannelD2Test::testStatusGet() { ASSERT_NO_THROW(response_list = Element::fromJSON(response_txt)); ASSERT_TRUE(response_list); ASSERT_EQ(Element::list, response_list->getType()); - EXPECT_EQ(1, response_list->size()); + EXPECT_EQ(1U, response_list->size()); ConstElementPtr response = response_list->get(0); ASSERT_TRUE(response); ASSERT_EQ(Element::map, response->getType()); - EXPECT_EQ(2, response->size()); + EXPECT_EQ(2U, response->size()); ConstElementPtr result = response->get("result"); ASSERT_TRUE(result); ASSERT_EQ(Element::integer, result->getType()); @@ -933,7 +933,7 @@ BaseCtrlChannelD2Test::testConfigHashGet() { ASSERT_TRUE(hash); ASSERT_EQ(Element::string, hash->getType()); // SHA-256 -> 64 hex digits. - EXPECT_EQ(64, hash->stringValue().size()); + EXPECT_EQ(64U, hash->stringValue().size()); } TEST_F(HttpCtrlChannelD2Test, configHashGet) { @@ -985,7 +985,7 @@ TEST_F(HttpCtrlChannelD2Test, configTest) { ASSERT_TRUE(d2_context); TSIGKeyInfoMapPtr keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); ASSERT_TRUE(HttpCommandMgr::instance().getHttpListener()); @@ -1024,7 +1024,7 @@ TEST_F(HttpCtrlChannelD2Test, configTest) { d2_context = cfg_mgr->getD2CfgContext(); keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); // Create a valid config with two keys and no command channel. config_test_txt = @@ -1059,7 +1059,7 @@ TEST_F(HttpCtrlChannelD2Test, configTest) { d2_context = cfg_mgr->getD2CfgContext(); keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); } // Verify that the "config-test" command will do what we expect. @@ -1114,7 +1114,7 @@ TEST_F(HttpsCtrlChannelD2Test, configTest) { ASSERT_TRUE(d2_context); TSIGKeyInfoMapPtr keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); ASSERT_TRUE(HttpCommandMgr::instance().getHttpListener()); @@ -1153,7 +1153,7 @@ TEST_F(HttpsCtrlChannelD2Test, configTest) { d2_context = cfg_mgr->getD2CfgContext(); keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); // Create a valid config with two keys and no command channel. config_test_txt = @@ -1188,7 +1188,7 @@ TEST_F(HttpsCtrlChannelD2Test, configTest) { d2_context = cfg_mgr->getD2CfgContext(); keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); } // Verify that the "config-set" command will do what we expect. @@ -1232,7 +1232,7 @@ TEST_F(HttpCtrlChannelD2Test, configSet) { ASSERT_TRUE(d2_context); TSIGKeyInfoMapPtr keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); ASSERT_TRUE(HttpCommandMgr::instance().getHttpListener()); @@ -1271,7 +1271,7 @@ TEST_F(HttpCtrlChannelD2Test, configSet) { d2_context = cfg_mgr->getD2CfgContext(); keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); // Create a valid config with two keys and no command channel. config_set_txt = @@ -1314,7 +1314,7 @@ TEST_F(HttpCtrlChannelD2Test, configSet) { d2_context = cfg_mgr->getD2CfgContext(); keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(2, keys->size()); + EXPECT_EQ(2U, keys->size()); } // Verify that the "config-set" command will do what we expect. @@ -1369,7 +1369,7 @@ TEST_F(HttpsCtrlChannelD2Test, configSet) { ASSERT_TRUE(d2_context); TSIGKeyInfoMapPtr keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); ASSERT_TRUE(HttpCommandMgr::instance().getHttpListener()); @@ -1408,7 +1408,7 @@ TEST_F(HttpsCtrlChannelD2Test, configSet) { d2_context = cfg_mgr->getD2CfgContext(); keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); // Create a valid config with two keys and no command channel. config_set_txt = @@ -1451,7 +1451,7 @@ TEST_F(HttpsCtrlChannelD2Test, configSet) { d2_context = cfg_mgr->getD2CfgContext(); keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(2, keys->size()); + EXPECT_EQ(2U, keys->size()); } // Tests if config-write can be called without any parameters. @@ -1694,7 +1694,7 @@ BaseCtrlChannelD2Test::testConfigReloadFileValid() { ASSERT_TRUE(d2_params); EXPECT_EQ("192.168.77.1", d2_params->getIpAddress().toText()); - EXPECT_EQ(777, d2_params->getPort()); + EXPECT_EQ(777U, d2_params->getPort()); EXPECT_FALSE(d2_cfg_mgr->forwardUpdatesEnabled()); EXPECT_FALSE(d2_cfg_mgr->reverseUpdatesEnabled()); @@ -2125,7 +2125,7 @@ TEST_F(HttpCtrlChannelD2Test, noListenerChange) { ASSERT_TRUE(d2_context); TSIGKeyInfoMapPtr keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); ASSERT_TRUE(HttpCommandMgr::instance().getHttpListener()); auto const listener = HttpCommandMgr::instance().getHttpListener().get(); @@ -2156,7 +2156,7 @@ TEST_F(HttpCtrlChannelD2Test, noListenerChange) { d2_context = cfg_mgr->getD2CfgContext(); keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); } // Verify that the "config-set" command will reuse listener @@ -2211,7 +2211,7 @@ TEST_F(HttpsCtrlChannelD2Test, noListenerChange) { ASSERT_TRUE(d2_context); TSIGKeyInfoMapPtr keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); ASSERT_TRUE(HttpCommandMgr::instance().getHttpListener()); auto const listener = HttpCommandMgr::instance().getHttpListener().get(); @@ -2246,7 +2246,7 @@ TEST_F(HttpsCtrlChannelD2Test, noListenerChange) { d2_context = cfg_mgr->getD2CfgContext(); keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); } // Verify that the "config-set" command will exit with an error @@ -2290,7 +2290,7 @@ TEST_F(HttpCtrlChannelD2Test, handleHttpToHttpsSwitch) { ASSERT_TRUE(d2_context); TSIGKeyInfoMapPtr keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); ASSERT_TRUE(HttpCommandMgr::instance().getHttpListener()); auto const listener = HttpCommandMgr::instance().getHttpListener().get(); @@ -2344,7 +2344,7 @@ TEST_F(HttpCtrlChannelD2Test, handleHttpToHttpsSwitch) { d2_context = cfg_mgr->getD2CfgContext(); keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); } // Verify that the "config-set" command will exit with an error @@ -2399,7 +2399,7 @@ TEST_F(HttpsCtrlChannelD2Test, handleHttpsToHttpSwitch) { ASSERT_TRUE(d2_context); TSIGKeyInfoMapPtr keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); ASSERT_TRUE(HttpCommandMgr::instance().getHttpListener()); auto const listener = HttpCommandMgr::instance().getHttpListener().get(); @@ -2451,7 +2451,7 @@ TEST_F(HttpsCtrlChannelD2Test, handleHttpsToHttpSwitch) { d2_context = cfg_mgr->getD2CfgContext(); keys = d2_context->getKeys(); ASSERT_TRUE(keys); - EXPECT_EQ(1, keys->size()); + EXPECT_EQ(1U, keys->size()); } } // end of anonymous namespace diff --git a/src/bin/d2/tests/d2_process_unittests.cc b/src/bin/d2/tests/d2_process_unittests.cc index 5001744aaf..f92c2e4908 100644 --- a/src/bin/d2/tests/d2_process_unittests.cc +++ b/src/bin/d2/tests/d2_process_unittests.cc @@ -340,7 +340,7 @@ TEST_F(D2ProcessTest, queueFullRecovery) { // Verify that the request can be added to the queue and queue // size increments accordingly. ASSERT_NO_THROW(queue_mgr->enqueue(ncr)); - ASSERT_EQ(i+1, queue_mgr->getQueueSize()); + ASSERT_EQ(i + 1, queue_mgr->getQueueSize()); } // Since we are not really receiving, we will simulate QUEUE FULL @@ -557,7 +557,7 @@ TEST_F(D2ProcessTest, canShutdown) { dhcp_ddns::NameChangeRequestPtr ncr; ASSERT_NO_THROW(ncr = dhcp_ddns::NameChangeRequest::fromJSON(test_msg)); ASSERT_NO_THROW(queue_mgr->enqueue(ncr)); - ASSERT_EQ(1, queue_mgr->getQueueSize()); + ASSERT_EQ(1U, queue_mgr->getQueueSize()); // Queue Manager is stopped. Queue is not empty, no transactions. // SD_DRAIN_FIRST should be false, SD_NORMAL and SD_NOW should be true. @@ -570,8 +570,8 @@ TEST_F(D2ProcessTest, canShutdown) { const D2UpdateMgrPtr& update_mgr = getD2UpdateMgr(); ASSERT_TRUE(update_mgr); ASSERT_NO_THROW(update_mgr->sweep()); - ASSERT_EQ(0, queue_mgr->getQueueSize()); - ASSERT_EQ(1, update_mgr->getTransactionCount()); + ASSERT_EQ(0U, queue_mgr->getQueueSize()); + ASSERT_EQ(1U, update_mgr->getTransactionCount()); // Queue Manager is stopped. Queue is empty, one transaction. // Only SD_NOW should be true. diff --git a/src/bin/d2/tests/d2_queue_mgr_unittests.cc b/src/bin/d2/tests/d2_queue_mgr_unittests.cc index a8925ebdd3..6420288393 100644 --- a/src/bin/d2/tests/d2_queue_mgr_unittests.cc +++ b/src/bin/d2/tests/d2_queue_mgr_unittests.cc @@ -63,7 +63,7 @@ const char *valid_msgs[] = "}" }; -static const int VALID_MSG_CNT = sizeof(valid_msgs) / sizeof(char*); +static const size_t VALID_MSG_CNT = sizeof(valid_msgs) / sizeof(char*); const char* TEST_ADDRESS = "127.0.0.1"; const uint32_t LISTENER_PORT = 5301; @@ -101,7 +101,7 @@ TEST(D2QueueMgrBasicTest, construction3) { D2QueueMgrPtr queue_mgr; ASSERT_NO_THROW(queue_mgr.reset(new D2QueueMgr(io_service, 100))); // Verify queue max is the custom value. - EXPECT_EQ(100, queue_mgr->getMaxQueueSize()); + EXPECT_EQ(100U, queue_mgr->getMaxQueueSize()); } /// @brief Tests QueueMgr's basic queue functions @@ -121,7 +121,7 @@ TEST(D2QueueMgrBasicTest, basicQueue) { ASSERT_EQ(VALID_MSG_CNT, queue_mgr->getMaxQueueSize()); // Verify queue is empty after construction. - EXPECT_EQ(0, queue_mgr->getQueueSize()); + EXPECT_EQ(0U, queue_mgr->getQueueSize()); // Verify that peek and dequeue both throw when queue is empty. EXPECT_THROW(queue_mgr->peek(), D2QueueMgrQueueEmpty); @@ -132,7 +132,7 @@ TEST(D2QueueMgrBasicTest, basicQueue) { NameChangeRequestPtr ncr; // Iterate over the list of requests and add each to the queue. - for (int i = 0; i < VALID_MSG_CNT; i++) { + for (size_t i = 0; i < VALID_MSG_CNT; i++) { // Create the ncr and add to our reference list. ASSERT_NO_THROW(ncr = NameChangeRequest::fromJSON(valid_msgs[i])); ref_msgs.push_back(ncr); @@ -140,12 +140,12 @@ TEST(D2QueueMgrBasicTest, basicQueue) { // Verify that the request can be added to the queue and queue // size increments accordingly. EXPECT_NO_THROW(queue_mgr->enqueue(ncr)); - EXPECT_EQ(i+1, queue_mgr->getQueueSize()); + EXPECT_EQ(i + 1, queue_mgr->getQueueSize()); } // Loop through and verify that the queue contents match the // reference list. - for (int i = 0; i < VALID_MSG_CNT; i++) { + for (size_t i = 0; i < VALID_MSG_CNT; i++) { // Verify that peek on a non-empty queue returns first entry // without altering queue content. EXPECT_NO_THROW(ncr = queue_mgr->peek()); @@ -165,7 +165,7 @@ TEST(D2QueueMgrBasicTest, basicQueue) { } // Iterate over the list of requests and add each to the queue. - for (int i = 0; i < VALID_MSG_CNT; i++) { + for (size_t i = 0; i < VALID_MSG_CNT; i++) { // Create the ncr and add to our reference list. ASSERT_NO_THROW(ncr = NameChangeRequest::fromJSON(valid_msgs[i])); ref_msgs.push_back(ncr); @@ -375,7 +375,7 @@ TEST_F (QueueMgrUDPTest, liveFeed) { // Iterate over the list of requests sending and receiving // each one. Verify and dequeue as they arrive. - for (int i = 0; i < VALID_MSG_CNT; i++) { + for (size_t i = 0; i < VALID_MSG_CNT; i++) { // Create the ncr and add to our reference list. ASSERT_NO_THROW(send_ncr = NameChangeRequest::fromJSON(valid_msgs[i])); ASSERT_NO_THROW(sender_->sendRequest(send_ncr)); @@ -386,7 +386,7 @@ TEST_F (QueueMgrUDPTest, liveFeed) { // Verify that the request can be added to the queue and queue // size increments accordingly. - EXPECT_EQ(1, queue_mgr_->getQueueSize()); + EXPECT_EQ(1U, queue_mgr_->getQueueSize()); // Verify that peek shows the NCR we just sent EXPECT_NO_THROW(received_ncr = queue_mgr_->peek()); @@ -394,7 +394,7 @@ TEST_F (QueueMgrUDPTest, liveFeed) { // Verify that we and dequeue the request. EXPECT_NO_THROW(queue_mgr_->dequeue()); - EXPECT_EQ(0, queue_mgr_->getQueueSize()); + EXPECT_EQ(0U, queue_mgr_->getQueueSize()); } StatMap stats_ncr = { @@ -407,7 +407,7 @@ TEST_F (QueueMgrUDPTest, liveFeed) { // Iterate over the list of requests, sending and receiving // each one. Allow them to accumulate in the queue. - for (int i = 0; i < VALID_MSG_CNT; i++) { + for (size_t i = 0; i < VALID_MSG_CNT; i++) { // Create the ncr and add to our reference list. ASSERT_NO_THROW(send_ncr = NameChangeRequest::fromJSON(valid_msgs[i])); ASSERT_NO_THROW(sender_->sendRequest(send_ncr)); @@ -415,7 +415,7 @@ TEST_F (QueueMgrUDPTest, liveFeed) { // running two should do the send then the receive EXPECT_NO_THROW(io_service_->runOne()); EXPECT_NO_THROW(io_service_->runOne()); - EXPECT_EQ(i+1, queue_mgr_->getQueueSize()); + EXPECT_EQ(i + 1, queue_mgr_->getQueueSize()); } StatMap stats_ncr_new = { @@ -463,7 +463,7 @@ TEST_F (QueueMgrUDPTest, liveFeed) { // Verify that clearQueue works. EXPECT_NO_THROW(queue_mgr_->clearQueue()); - EXPECT_EQ(0, queue_mgr_->getQueueSize()); + EXPECT_EQ(0U, queue_mgr_->getQueueSize()); // Verify that we can again receive requests. // Send should be fine. @@ -472,7 +472,7 @@ TEST_F (QueueMgrUDPTest, liveFeed) { // Receive should succeed. EXPECT_NO_THROW(io_service_->runOne()); - EXPECT_EQ(1, queue_mgr_->getQueueSize()); + EXPECT_EQ(1U, queue_mgr_->getQueueSize()); } } // end of anonymous namespace diff --git a/src/bin/d2/tests/d2_simple_parser_unittest.cc b/src/bin/d2/tests/d2_simple_parser_unittest.cc index 8e1f4cdf54..29aad66bf4 100644 --- a/src/bin/d2/tests/d2_simple_parser_unittest.cc +++ b/src/bin/d2/tests/d2_simple_parser_unittest.cc @@ -283,7 +283,7 @@ TEST_F(D2SimpleParserTest, globalD2Defaults) { EXPECT_NO_THROW(num = D2SimpleParser::setAllDefaults(empty)); // We expect 5 parameters to be inserted. - EXPECT_EQ(num, 8); + EXPECT_EQ(num, 8U); // Let's go over all parameters we have defaults for. for (auto const& deflt : D2SimpleParser::D2_GLOBAL_DEFAULTS) { @@ -1014,7 +1014,7 @@ TEST_F(DnsServerInfoListParserTest, validServerList) { PARSE_OK(config); // Verify that the server storage contains the correct number of servers. - ASSERT_EQ(3, servers_->size()); + ASSERT_EQ(3U, servers_->size()); // Verify the first server exists and has the correct values. DnsServerInfoPtr server = (*servers_)[0]; @@ -1106,7 +1106,7 @@ TEST_F(DdnsDomainParserTest, validDomain) { // servers. const DnsServerInfoStoragePtr& servers = domain_->getServers(); ASSERT_TRUE(servers); - EXPECT_EQ(3, servers->size()); + EXPECT_EQ(3U, servers->size()); // Fetch each server and verify its contents. DnsServerInfoPtr server = (*servers)[0]; @@ -1182,7 +1182,7 @@ TEST_F(DdnsDomainListParserTest, validList) { // Verify that the domain list parses without error. PARSE_OK(config); ASSERT_TRUE(domains_); - EXPECT_EQ(2, domains_->size()); + EXPECT_EQ(2U, domains_->size()); // Verify that the first domain exists and can be retrieved. DdnsDomainMap::iterator gotit = domains_->find("example.com"); @@ -1196,7 +1196,7 @@ TEST_F(DdnsDomainListParserTest, validList) { // Verify the each of the first domain's servers DnsServerInfoStoragePtr servers = domain->getServers(); ASSERT_TRUE(servers); - EXPECT_EQ(3, servers->size()); + EXPECT_EQ(3U, servers->size()); DnsServerInfoPtr server = (*servers)[0]; ASSERT_TRUE(server); @@ -1236,7 +1236,7 @@ TEST_F(DdnsDomainListParserTest, validList) { // Verify the each of second domain's servers servers = domain->getServers(); ASSERT_TRUE(servers); - EXPECT_EQ(3, servers->size()); + EXPECT_EQ(3U, servers->size()); server = (*servers)[0]; ASSERT_TRUE(server); diff --git a/src/bin/d2/tests/d2_update_mgr_unittests.cc b/src/bin/d2/tests/d2_update_mgr_unittests.cc index c3de7544cd..ef1187874c 100644 --- a/src/bin/d2/tests/d2_update_mgr_unittests.cc +++ b/src/bin/d2/tests/d2_update_mgr_unittests.cc @@ -293,7 +293,7 @@ TEST(D2UpdateMgr, construction) { io_service, 100))); // Verify that max transactions is correct. - EXPECT_EQ(100, update_mgr->getMaxTransactions()); + EXPECT_EQ(100U, update_mgr->getMaxTransactions()); } /// @brief Tests the D2UpdateManager's transaction list services @@ -311,7 +311,7 @@ TEST_F(D2UpdateMgrTest, transactionList) { // Verify that we can add a transaction. EXPECT_NO_THROW(update_mgr_->makeTransaction(ncr)); - EXPECT_EQ(1, update_mgr_->getTransactionCount()); + EXPECT_EQ(1U, update_mgr_->getTransactionCount()); // Verify that we can find a transaction by key. EXPECT_NO_THROW(pos = update_mgr_->findTransaction(ncr->getDhcid())); @@ -330,11 +330,11 @@ TEST_F(D2UpdateMgrTest, transactionList) { // Verify that adding a transaction for the same key fails. EXPECT_THROW(update_mgr_->makeTransaction(ncr), D2UpdateMgrError); - EXPECT_EQ(1, update_mgr_->getTransactionCount()); + EXPECT_EQ(1U, update_mgr_->getTransactionCount()); // Verify the we can remove a transaction by key. EXPECT_NO_THROW(update_mgr_->removeTransaction(ncr->getDhcid())); - EXPECT_EQ(0, update_mgr_->getTransactionCount()); + EXPECT_EQ(0U, update_mgr_->getTransactionCount()); // Verify the we can try to remove a non-existent transaction without harm. EXPECT_NO_THROW(update_mgr_->removeTransaction(ncr->getDhcid())); @@ -360,7 +360,7 @@ TEST_F(D2UpdateMgrTest, bothEnabled) { ASSERT_NO_THROW(update_mgr_->makeTransaction(ncr)); // Verify we create a transaction with both directions turned on. - EXPECT_EQ(1, update_mgr_->getTransactionCount()); + EXPECT_EQ(1U, update_mgr_->getTransactionCount()); EXPECT_TRUE(ncr->isForwardChange()); EXPECT_TRUE(ncr->isReverseChange()); } @@ -386,7 +386,7 @@ TEST_F(D2UpdateMgrTest, reverseDisable) { ASSERT_NO_THROW(update_mgr_->makeTransaction(ncr)); // Verify we create a transaction with only forward turned on. - EXPECT_EQ(1, update_mgr_->getTransactionCount()); + EXPECT_EQ(1U, update_mgr_->getTransactionCount()); EXPECT_TRUE(ncr->isForwardChange()); EXPECT_FALSE(ncr->isReverseChange()); } @@ -412,7 +412,7 @@ TEST_F(D2UpdateMgrTest, forwardDisabled) { ASSERT_NO_THROW(update_mgr_->makeTransaction(ncr)); // Verify we create a transaction with only reverse turned on. - EXPECT_EQ(1, update_mgr_->getTransactionCount()); + EXPECT_EQ(1U, update_mgr_->getTransactionCount()); EXPECT_FALSE(ncr->isForwardChange()); EXPECT_TRUE(ncr->isReverseChange()); } @@ -440,7 +440,7 @@ TEST_F(D2UpdateMgrTest, bothDisabled) { ASSERT_NO_THROW(update_mgr_->makeTransaction(ncr)); // Verify that do not create a transaction. - EXPECT_EQ(0, update_mgr_->getTransactionCount()); + EXPECT_EQ(0U, update_mgr_->getTransactionCount()); } /// @brief Tests D2UpdateManager's checkFinishedTransactions method. @@ -523,7 +523,7 @@ TEST_F(D2UpdateMgrTest, pickNextJob) { } // Verify that the queue has been drained. - EXPECT_EQ(0, update_mgr_->getQueueCount()); + EXPECT_EQ(0U, update_mgr_->getQueueCount()); // Now verify that a subsequent request for a DCHID for which a // transaction is in progress, is not dequeued. @@ -531,7 +531,7 @@ TEST_F(D2UpdateMgrTest, pickNextJob) { dhcp_ddns::NameChangeRequestPtr subsequent_ncr(new dhcp_ddns::NameChangeRequest(*(canned_ncrs_[2]))); EXPECT_NO_THROW(queue_mgr_->enqueue(subsequent_ncr)); - EXPECT_EQ(1, update_mgr_->getQueueCount()); + EXPECT_EQ(1U, update_mgr_->getQueueCount()); // Verify that invoking pickNextJob: // 1. Does not throw @@ -539,7 +539,7 @@ TEST_F(D2UpdateMgrTest, pickNextJob) { // 3. Does not dequeue the entry EXPECT_NO_THROW(update_mgr_->pickNextJob()); EXPECT_EQ(canned_count_, update_mgr_->getTransactionCount()); - EXPECT_EQ(1, update_mgr_->getQueueCount()); + EXPECT_EQ(1U, update_mgr_->getQueueCount()); // Clear out the queue and transaction list. queue_mgr_->clearQueue(); @@ -560,8 +560,8 @@ TEST_F(D2UpdateMgrTest, pickNextJob) { // 2. Does not make a new transaction // 3. Does dequeue the entry EXPECT_NO_THROW(update_mgr_->pickNextJob()); - EXPECT_EQ(0, update_mgr_->getTransactionCount()); - EXPECT_EQ(0, update_mgr_->getQueueCount()); + EXPECT_EQ(0U, update_mgr_->getTransactionCount()); + EXPECT_EQ(0U, update_mgr_->getQueueCount()); // Make a reverse change NCR with an FQDN that has no reverse match. bogus_ncr.reset(new dhcp_ddns::NameChangeRequest(*(canned_ncrs_[0]))); @@ -574,8 +574,8 @@ TEST_F(D2UpdateMgrTest, pickNextJob) { // 2. Does not make a new transaction // 3. Does dequeue the entry EXPECT_NO_THROW(update_mgr_->pickNextJob()); - EXPECT_EQ(0, update_mgr_->getTransactionCount()); - EXPECT_EQ(0, update_mgr_->getQueueCount()); + EXPECT_EQ(0U, update_mgr_->getTransactionCount()); + EXPECT_EQ(0U, update_mgr_->getQueueCount()); } /// @brief Tests D2UpdateManager's pickNextJob method. @@ -606,11 +606,11 @@ TEST_F(D2UpdateMgrTest, pickNextJobSkips) { } ASSERT_EQ(2 + canned_count_, update_mgr_->getQueueCount()); - ASSERT_EQ(0, update_mgr_->getTransactionCount()); + ASSERT_EQ(0U, update_mgr_->getTransactionCount()); // Invoke pickNextJob once. EXPECT_NO_THROW(update_mgr_->pickNextJob()); - EXPECT_EQ(1, update_mgr_->getTransactionCount()); + EXPECT_EQ(1U, update_mgr_->getTransactionCount()); EXPECT_TRUE(update_mgr_->hasTransaction(canned_ncrs_[0]->getDhcid())); // Verify that the queue has all but one of the canned requests still queued. @@ -618,18 +618,18 @@ TEST_F(D2UpdateMgrTest, pickNextJobSkips) { // Empty the queue and transaction list. queue_mgr_->clearQueue(); - ASSERT_EQ(0, update_mgr_->getQueueCount()); + ASSERT_EQ(0U, update_mgr_->getQueueCount()); update_mgr_->clearTransactionList(); - EXPECT_EQ(0, update_mgr_->getTransactionCount()); + EXPECT_EQ(0U, update_mgr_->getTransactionCount()); // Add two no match requests. ASSERT_NO_THROW(queue_mgr_->enqueue(bogus_ncr)); ASSERT_NO_THROW(queue_mgr_->enqueue(bogus_ncr)); - ASSERT_EQ(2, update_mgr_->getQueueCount()); + ASSERT_EQ(2U, update_mgr_->getQueueCount()); // Invoking pickNextJob() should empty the queue without adding transactions. EXPECT_NO_THROW(update_mgr_->pickNextJob()); - EXPECT_EQ(0, update_mgr_->getQueueCount()); + EXPECT_EQ(0U, update_mgr_->getQueueCount()); } /// @brief Tests D2UpdateManager's sweep method. @@ -659,7 +659,7 @@ TEST_F(D2UpdateMgrTest, sweep) { } // Verify that the queue has been drained. - EXPECT_EQ(0, update_mgr_->getQueueCount()); + EXPECT_EQ(0U, update_mgr_->getQueueCount()); // Verify max transactions can't be less than current transaction count. EXPECT_THROW(update_mgr_->setMaxTransactions(1), D2UpdateMgrError); @@ -668,13 +668,13 @@ TEST_F(D2UpdateMgrTest, sweep) { dhcp_ddns::NameChangeRequestPtr subsequent_ncr(new dhcp_ddns::NameChangeRequest(*(canned_ncrs_[2]))); EXPECT_NO_THROW(queue_mgr_->enqueue(subsequent_ncr)); - EXPECT_EQ(1, update_mgr_->getQueueCount()); + EXPECT_EQ(1U, update_mgr_->getQueueCount()); // Verify that invoking sweep, does not dequeue the job nor make a // transaction for it. EXPECT_NO_THROW(update_mgr_->sweep()); EXPECT_EQ(canned_count_, update_mgr_->getTransactionCount()); - EXPECT_EQ(1, update_mgr_->getQueueCount()); + EXPECT_EQ(1U, update_mgr_->getQueueCount()); // Mark the transaction complete. completeTransaction(2, dhcp_ddns::ST_COMPLETED); @@ -683,20 +683,20 @@ TEST_F(D2UpdateMgrTest, sweep) { // dequeues the queued job and adds its transaction to the list. EXPECT_NO_THROW(update_mgr_->sweep()); EXPECT_EQ(canned_count_, update_mgr_->getTransactionCount()); - EXPECT_EQ(0, update_mgr_->getQueueCount()); + EXPECT_EQ(0U, update_mgr_->getQueueCount()); // Queue up a request from a new DHCID. dhcp_ddns::NameChangeRequestPtr another_ncr(new dhcp_ddns::NameChangeRequest(*(canned_ncrs_[0]))); another_ncr->setDhcid("AABBCCDDEEFF"); EXPECT_NO_THROW(queue_mgr_->enqueue(another_ncr)); - EXPECT_EQ(1, update_mgr_->getQueueCount()); + EXPECT_EQ(1U, update_mgr_->getQueueCount()); // Verify that sweep does not dequeue the new request as we are at // maximum transaction count. EXPECT_NO_THROW(update_mgr_->sweep()); EXPECT_EQ(canned_count_, update_mgr_->getTransactionCount()); - EXPECT_EQ(1, update_mgr_->getQueueCount()); + EXPECT_EQ(1U, update_mgr_->getQueueCount()); // Set max transactions to same as current transaction count. EXPECT_NO_THROW(update_mgr_->setMaxTransactions(canned_count_ + 1)); @@ -705,11 +705,11 @@ TEST_F(D2UpdateMgrTest, sweep) { // a transaction for it. EXPECT_NO_THROW(update_mgr_->sweep()); EXPECT_EQ(canned_count_ + 1, update_mgr_->getTransactionCount()); - EXPECT_EQ(0, update_mgr_->getQueueCount()); + EXPECT_EQ(0U, update_mgr_->getQueueCount()); // Verify that clearing transaction list works. EXPECT_NO_THROW(update_mgr_->clearTransactionList()); - EXPECT_EQ(0, update_mgr_->getTransactionCount()); + EXPECT_EQ(0U, update_mgr_->getTransactionCount()); } /// @brief Tests integration of NameAddTransaction @@ -744,7 +744,7 @@ TEST_F(D2UpdateMgrTest, addTransaction) { // and sent the DNS request. ASSERT_TRUE(trans->getCurrentServer()); ASSERT_TRUE(trans->isModelRunning()); - ASSERT_EQ(1, trans->getUpdateAttempts()); + ASSERT_EQ(1U, trans->getUpdateAttempts()); ASSERT_EQ(StateModel::NOP_EVT, trans->getNextEvent()); // Create a server based on the transaction's current server, and @@ -801,7 +801,7 @@ TEST_F(D2UpdateMgrTest, removeTransaction) { // and sent the DNS request. ASSERT_TRUE(trans->getCurrentServer()); ASSERT_TRUE(trans->isModelRunning()); - ASSERT_EQ(1, trans->getUpdateAttempts()); + ASSERT_EQ(1U, trans->getUpdateAttempts()); ASSERT_EQ(StateModel::NOP_EVT, trans->getNextEvent()); // Create a server based on the transaction's current server, and @@ -849,7 +849,7 @@ TEST_F(D2UpdateMgrTest, errorTransaction) { ASSERT_TRUE(trans); ASSERT_TRUE(trans->isModelRunning()); - ASSERT_EQ(1, trans->getUpdateAttempts()); + ASSERT_EQ(1U, trans->getUpdateAttempts()); ASSERT_EQ(StateModel::NOP_EVT, trans->getNextEvent()); ASSERT_TRUE(trans->getCurrentServer()); @@ -872,8 +872,6 @@ TEST_F(D2UpdateMgrTest, errorTransaction) { trans->getPrevState()); EXPECT_EQ(NameChangeTransaction::NO_MORE_SERVERS_EVT, trans->getLastEvent()); - - } /// @brief Tests processing of multiple transactions. @@ -883,10 +881,10 @@ TEST_F(D2UpdateMgrTest, errorTransaction) { /// transactions are a mix of both adds and removes. TEST_F(D2UpdateMgrTest, multiTransaction) { // Queue up all the requests. - int test_count = canned_count_; - for (int i = test_count; i > 0; i--) { - canned_ncrs_[i-1]->setReverseChange(true); - ASSERT_NO_THROW(queue_mgr_->enqueue(canned_ncrs_[i-1])); + unsigned test_count = canned_count_; + for (unsigned i = test_count; i > 0; i--) { + canned_ncrs_[i - 1]->setReverseChange(true); + ASSERT_NO_THROW(queue_mgr_->enqueue(canned_ncrs_[i - 1])); } // Create a server and start it listening. Note this relies on the fact @@ -899,7 +897,7 @@ TEST_F(D2UpdateMgrTest, multiTransaction) { // Run sweep and IO until everything is done. processAll(); - for (int i = 0; i < test_count; i++) { + for (unsigned i = 0; i < test_count; i++) { EXPECT_EQ(dhcp_ddns::ST_COMPLETED, canned_ncrs_[i]->getStatus()); } } @@ -911,10 +909,10 @@ TEST_F(D2UpdateMgrTest, multiTransaction) { /// transactions are a mix of both adds and removes. TEST_F(D2UpdateMgrTest, multiTransactionTimeout) { // Queue up all the requests. - int test_count = canned_count_; - for (int i = test_count; i > 0; i--) { - canned_ncrs_[i-1]->setReverseChange(true); - ASSERT_NO_THROW(queue_mgr_->enqueue(canned_ncrs_[i-1])); + unsigned test_count = canned_count_; + for (unsigned i = test_count; i > 0; i--) { + canned_ncrs_[i - 1]->setReverseChange(true); + ASSERT_NO_THROW(queue_mgr_->enqueue(canned_ncrs_[i - 1])); } // No server is running, so everything will time out. @@ -922,7 +920,7 @@ TEST_F(D2UpdateMgrTest, multiTransactionTimeout) { // Run sweep and IO until everything is done. processAll(); - for (int i = 0; i < test_count; i++) { + for (unsigned i = 0; i < test_count; i++) { EXPECT_EQ(dhcp_ddns::ST_FAILED, canned_ncrs_[i]->getStatus()); } } @@ -960,7 +958,7 @@ TEST_F(D2UpdateMgrTest, simpleAddTransaction) { // and sent the DNS request. ASSERT_TRUE(trans->getCurrentServer()); ASSERT_TRUE(trans->isModelRunning()); - ASSERT_EQ(1, trans->getUpdateAttempts()); + ASSERT_EQ(1U, trans->getUpdateAttempts()); ASSERT_EQ(StateModel::NOP_EVT, trans->getNextEvent()); // Create a server based on the transaction's current server, and @@ -1018,7 +1016,7 @@ TEST_F(D2UpdateMgrTest, simpleRemoveTransaction) { // and sent the DNS request. ASSERT_TRUE(trans->getCurrentServer()); ASSERT_TRUE(trans->isModelRunning()); - ASSERT_EQ(1, trans->getUpdateAttempts()); + ASSERT_EQ(1U, trans->getUpdateAttempts()); ASSERT_EQ(StateModel::NOP_EVT, trans->getNextEvent()); // Create a server based on the transaction's current server, and diff --git a/src/bin/d2/tests/nc_add_unittests.cc b/src/bin/d2/tests/nc_add_unittests.cc index dc96611085..c2a98211c4 100644 --- a/src/bin/d2/tests/nc_add_unittests.cc +++ b/src/bin/d2/tests/nc_add_unittests.cc @@ -1653,7 +1653,7 @@ TEST_F(NameAddTransactionTest, addingFwdAddrsHandler_BuildRequestException) { ASSERT_NO_THROW(name_add->addingFwdAddrsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_add->getUpdateAttempts()); + EXPECT_EQ(0U, name_add->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_add->getForwardChangeCompleted()); @@ -1691,7 +1691,7 @@ TEST_F(NameAddTransactionTest, replacingFwdAddrsHandler_BuildRequestException) { ASSERT_NO_THROW(name_add->replacingFwdAddrsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_add->getUpdateAttempts()); + EXPECT_EQ(0U, name_add->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_add->getForwardChangeCompleted()); @@ -1730,7 +1730,7 @@ TEST_F(NameAddTransactionTest, replacingRevPtrsHandler_BuildRequestException) { ASSERT_NO_THROW(name_add->replacingRevPtrsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_add->getUpdateAttempts()); + EXPECT_EQ(0U, name_add->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_add->getForwardChangeCompleted()); diff --git a/src/bin/d2/tests/nc_remove_unittests.cc b/src/bin/d2/tests/nc_remove_unittests.cc index e8eddb4415..4d5c246da3 100644 --- a/src/bin/d2/tests/nc_remove_unittests.cc +++ b/src/bin/d2/tests/nc_remove_unittests.cc @@ -1734,7 +1734,7 @@ TEST_F(NameRemoveTransactionTest, ASSERT_NO_THROW(name_remove->removingFwdAddrsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_remove->getUpdateAttempts()); + EXPECT_EQ(0U, name_remove->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_remove->getForwardChangeCompleted()); @@ -1774,7 +1774,7 @@ TEST_F(NameRemoveTransactionTest, ASSERT_NO_THROW(name_remove->removingFwdRRsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_remove->getUpdateAttempts()); + EXPECT_EQ(0U, name_remove->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_remove->getForwardChangeCompleted()); @@ -1814,7 +1814,7 @@ TEST_F(NameRemoveTransactionTest, ASSERT_NO_THROW(name_remove->removingRevPtrsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_remove->getUpdateAttempts()); + EXPECT_EQ(0U, name_remove->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_remove->getForwardChangeCompleted()); diff --git a/src/bin/d2/tests/simple_add_unittests.cc b/src/bin/d2/tests/simple_add_unittests.cc index 982435d64a..01daad5068 100644 --- a/src/bin/d2/tests/simple_add_unittests.cc +++ b/src/bin/d2/tests/simple_add_unittests.cc @@ -1102,7 +1102,7 @@ TEST_F(SimpleAddTransactionTest, replacingFwdAddrsHandler_BuildRequestException) ASSERT_NO_THROW(name_add->replacingFwdAddrsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_add->getUpdateAttempts()); + EXPECT_EQ(0U, name_add->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_add->getForwardChangeCompleted()); @@ -1138,7 +1138,7 @@ TEST_F(SimpleAddTransactionTest, replacingRevPtrsHandler_BuildRequestException) ASSERT_NO_THROW(name_add->replacingRevPtrsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_add->getUpdateAttempts()); + EXPECT_EQ(0U, name_add->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_add->getForwardChangeCompleted()); diff --git a/src/bin/d2/tests/simple_add_without_dhcid_unittests.cc b/src/bin/d2/tests/simple_add_without_dhcid_unittests.cc index ee64fdc582..3c1361b7cb 100644 --- a/src/bin/d2/tests/simple_add_without_dhcid_unittests.cc +++ b/src/bin/d2/tests/simple_add_without_dhcid_unittests.cc @@ -1102,7 +1102,7 @@ TEST_F(SimpleAddWithoutDHCIDTransactionTest, replacingFwdAddrsHandler_BuildReque ASSERT_NO_THROW(name_add->replacingFwdAddrsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_add->getUpdateAttempts()); + EXPECT_EQ(0U, name_add->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_add->getForwardChangeCompleted()); @@ -1138,7 +1138,7 @@ TEST_F(SimpleAddWithoutDHCIDTransactionTest, replacingRevPtrsHandler_BuildReques ASSERT_NO_THROW(name_add->replacingRevPtrsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_add->getUpdateAttempts()); + EXPECT_EQ(0U, name_add->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_add->getForwardChangeCompleted()); diff --git a/src/bin/d2/tests/simple_remove_unittests.cc b/src/bin/d2/tests/simple_remove_unittests.cc index 916fe5b039..7e94e58cf0 100644 --- a/src/bin/d2/tests/simple_remove_unittests.cc +++ b/src/bin/d2/tests/simple_remove_unittests.cc @@ -1185,7 +1185,7 @@ TEST_F(SimpleRemoveTransactionTest, removingFwdRRsHandler_BuildRequestException) ASSERT_NO_THROW(name_remove->removingFwdRRsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_remove->getUpdateAttempts()); + EXPECT_EQ(0U, name_remove->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_remove->getForwardChangeCompleted()); @@ -1221,7 +1221,7 @@ TEST_F(SimpleRemoveTransactionTest, removingRevPTRsHandler_BuildRequestException ASSERT_NO_THROW(name_remove->removingRevPtrsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_remove->getUpdateAttempts()); + EXPECT_EQ(0U, name_remove->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_remove->getForwardChangeCompleted()); diff --git a/src/bin/d2/tests/simple_remove_without_dhcid_unittests.cc b/src/bin/d2/tests/simple_remove_without_dhcid_unittests.cc index efcf0a8194..9e98bd4a28 100644 --- a/src/bin/d2/tests/simple_remove_without_dhcid_unittests.cc +++ b/src/bin/d2/tests/simple_remove_without_dhcid_unittests.cc @@ -1185,7 +1185,7 @@ TEST_F(SimpleRemoveWithoutDHCIDTransactionTest, removingFwdRRsHandler_BuildReque ASSERT_NO_THROW(name_remove->removingFwdRRsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_remove->getUpdateAttempts()); + EXPECT_EQ(0U, name_remove->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_remove->getForwardChangeCompleted()); @@ -1221,7 +1221,7 @@ TEST_F(SimpleRemoveWithoutDHCIDTransactionTest, removingRevPTRsHandler_BuildRequ ASSERT_NO_THROW(name_remove->removingRevPtrsHandler()); // Verify we did not attempt to send anything. - EXPECT_EQ(0, name_remove->getUpdateAttempts()); + EXPECT_EQ(0U, name_remove->getUpdateAttempts()); // Completion flags should be false. EXPECT_FALSE(name_remove->getForwardChangeCompleted()); diff --git a/src/bin/dhcp4/tests/classify_unittest.cc b/src/bin/dhcp4/tests/classify_unittest.cc index dd83067458..cc24266990 100644 --- a/src/bin/dhcp4/tests/classify_unittest.cc +++ b/src/bin/dhcp4/tests/classify_unittest.cc @@ -803,8 +803,8 @@ TEST_F(ClassifyTest, clientClassesInHostReservations) { EXPECT_EQ("1.2.3.4", resp->getSiaddr().toText()); // This client has no reservations for the classes associated with // DNS servers and Routers options. - EXPECT_EQ(0, client.config_.routers_.size()); - EXPECT_EQ(0, client.config_.dns_servers_.size()); + EXPECT_EQ(0U, client.config_.routers_.size()); + EXPECT_EQ(0U, client.config_.dns_servers_.size()); // Modify HW address to match the reservations. client.setHWAddress("aa:bb:cc:dd:ee:ff"); @@ -815,9 +815,9 @@ TEST_F(ClassifyTest, clientClassesInHostReservations) { // This time, the client matches 3 classes (for two it has reservations). EXPECT_EQ("1.2.3.4", resp->getSiaddr().toText()); - EXPECT_EQ(1, client.config_.routers_.size()); + EXPECT_EQ(1U, client.config_.routers_.size()); EXPECT_EQ("10.0.0.200", client.config_.routers_[0].toText()); - EXPECT_EQ(1, client.config_.dns_servers_.size()); + EXPECT_EQ(1U, client.config_.dns_servers_.size()); EXPECT_EQ("10.0.0.201", client.config_.dns_servers_[0].toText()); // This should also work for DHCPINFORM case. @@ -826,9 +826,9 @@ TEST_F(ClassifyTest, clientClassesInHostReservations) { resp = client.getContext().response_; EXPECT_EQ("1.2.3.4", resp->getSiaddr().toText()); - EXPECT_EQ(1, client.config_.routers_.size()); + EXPECT_EQ(1U, client.config_.routers_.size()); EXPECT_EQ("10.0.0.200", client.config_.routers_[0].toText()); - EXPECT_EQ(1, client.config_.dns_servers_.size()); + EXPECT_EQ(1U, client.config_.dns_servers_.size()); EXPECT_EQ("10.0.0.201", client.config_.dns_servers_[0].toText()); } @@ -1232,7 +1232,7 @@ TEST_F(ClassifyTest, precedencePool) { boost::dynamic_pointer_cast(opt); ASSERT_TRUE(servers); auto addrs = servers->getAddresses(); - ASSERT_EQ(1, addrs.size()); + ASSERT_EQ(1U, addrs.size()); EXPECT_EQ("10.0.0.1", addrs[0].toText()); } @@ -1308,7 +1308,7 @@ TEST_F(ClassifyTest, precedenceSubnet) { boost::dynamic_pointer_cast(opt); ASSERT_TRUE(servers); auto addrs = servers->getAddresses(); - ASSERT_EQ(1, addrs.size()); + ASSERT_EQ(1U, addrs.size()); EXPECT_EQ("10.0.0.2", addrs[0].toText()); } @@ -1383,7 +1383,7 @@ TEST_F(ClassifyTest, precedenceNetwork) { boost::dynamic_pointer_cast(opt); ASSERT_TRUE(servers); auto addrs = servers->getAddresses(); - ASSERT_EQ(1, addrs.size()); + ASSERT_EQ(1U, addrs.size()); EXPECT_EQ("10.0.0.3", addrs[0].toText()); } @@ -1438,7 +1438,7 @@ TEST_F(ClassifyTest, requiredNoTest) { boost::dynamic_pointer_cast(opt); ASSERT_TRUE(servers); auto addrs = servers->getAddresses(); - ASSERT_EQ(1, addrs.size()); + ASSERT_EQ(1U, addrs.size()); EXPECT_EQ("10.0.0.3", addrs[0].toText()); } @@ -1979,7 +1979,7 @@ TEST_F(ClassifyTest, vendorOptionClassTagTest) { ASSERT_TRUE(vendor_resp); // Should have options 1 and 3, but not 2. - EXPECT_EQ(2, vendor_resp->getOptions().size()); + EXPECT_EQ(2U, vendor_resp->getOptions().size()); EXPECT_TRUE(vendor_resp->getOption(101)); EXPECT_FALSE(vendor_resp->getOption(102)); EXPECT_TRUE(vendor_resp->getOption(103)); diff --git a/src/bin/dhcp4/tests/config_backend_unittest.cc b/src/bin/dhcp4/tests/config_backend_unittest.cc index f450b2670b..d6ad00e289 100644 --- a/src/bin/dhcp4/tests/config_backend_unittest.cc +++ b/src/bin/dhcp4/tests/config_backend_unittest.cc @@ -220,7 +220,7 @@ TEST_F(Dhcp4CBTest, mergeGlobals) { // decline-probation-period is an explicit member that should come // from the backend. - EXPECT_EQ(86400, staging_cfg->getDeclinePeriod()); + EXPECT_EQ(86400U, staging_cfg->getDeclinePeriod()); // Verify that the implicit globals from JSON are there. ASSERT_NO_FATAL_FAILURE(checkConfiguredGlobal(staging_cfg, "valid-lifetime", @@ -238,7 +238,7 @@ TEST_F(Dhcp4CBTest, mergeGlobals) { ASSERT_NO_FATAL_FAILURE(checkConfiguredGlobal(staging_cfg, hr_identifiers, true)); auto const& ex_hr_i = staging_cfg->getCfgHostOperations4()->getIdentifierTypes(); - EXPECT_EQ(ex_hr_i.size(), 2); + EXPECT_EQ(ex_hr_i.size(), 2U); EXPECT_EQ(ex_hr_i.front(), Host::IDENT_HWADDR); EXPECT_EQ(ex_hr_i.back(), Host::IDENT_FLEX); } @@ -298,18 +298,18 @@ TEST_F(Dhcp4CBTest, mergeOptionDefs) { // Definition "one" from first backend should be there. OptionDefinitionPtr found_def = option_defs->get("isc", "one"); ASSERT_TRUE(found_def); - EXPECT_EQ(101, found_def->getCode()); + EXPECT_EQ(101U, found_def->getCode()); EXPECT_EQ(OptionDataType::OPT_UINT16_TYPE, found_def->getType()); // Definition "two" from JSON config should be there. found_def = option_defs->get("isc", "two"); ASSERT_TRUE(found_def); - EXPECT_EQ(2, found_def->getCode()); + EXPECT_EQ(2U, found_def->getCode()); // Definition "three" from first backend should be there. found_def = option_defs->get("isc", "three"); ASSERT_TRUE(found_def); - EXPECT_EQ(3, found_def->getCode()); + EXPECT_EQ(3U, found_def->getCode()); // Definition "four" from first backend should not be there. found_def = option_defs->get("isc", "four"); diff --git a/src/bin/dhcp4/tests/config_parser_unittest.cc b/src/bin/dhcp4/tests/config_parser_unittest.cc index 7000e58e97..43cd957adb 100644 --- a/src/bin/dhcp4/tests/config_parser_unittest.cc +++ b/src/bin/dhcp4/tests/config_parser_unittest.cc @@ -1142,11 +1142,11 @@ TEST_F(Dhcp4ParserTest, unspecifiedRenewTimer) { EXPECT_TRUE(subnet->getT1().unspecified()); EXPECT_FALSE(subnet->getT2().unspecified()); - EXPECT_EQ(2000, subnet->getT2().get()); - EXPECT_EQ(4000, subnet->getValid().get()); + EXPECT_EQ(2000U, subnet->getT2().get()); + EXPECT_EQ(4000U, subnet->getValid().get()); // Check that subnet-id is 1 - EXPECT_EQ(1, subnet->getID()); + EXPECT_EQ(1U, subnet->getID()); } /// Check that the rebind-timer doesn't have to be specified, in which case @@ -1175,12 +1175,12 @@ TEST_F(Dhcp4ParserTest, unspecifiedRebindTimer) { getCfgSubnets4()->selectSubnet(IOAddress("192.0.2.200")); ASSERT_TRUE(subnet); EXPECT_FALSE(subnet->getT1().unspecified()); - EXPECT_EQ(1000, subnet->getT1().get()); + EXPECT_EQ(1000U, subnet->getT1().get()); EXPECT_TRUE(subnet->getT2().unspecified()); - EXPECT_EQ(4000, subnet->getValid().get()); + EXPECT_EQ(4000U, subnet->getValid().get()); // Check that subnet-id is 1 - EXPECT_EQ(1, subnet->getID()); + EXPECT_EQ(1U, subnet->getID()); } /// The goal of this test is to verify if configuration without any @@ -1234,14 +1234,14 @@ TEST_F(Dhcp4ParserTest, subnetGlobalDefaults) { ConstSubnet4Ptr subnet = CfgMgr::instance().getStagingCfg()-> getCfgSubnets4()->selectSubnet(IOAddress("192.0.2.200")); ASSERT_TRUE(subnet); - EXPECT_EQ(1000, subnet->getT1().get()); - EXPECT_EQ(2000, subnet->getT2().get()); - EXPECT_EQ(4000, subnet->getValid().get()); - EXPECT_EQ(3000, subnet->getValid().getMin()); - EXPECT_EQ(5000, subnet->getValid().getMax()); + EXPECT_EQ(1000U, subnet->getT1().get()); + EXPECT_EQ(2000U, subnet->getT2().get()); + EXPECT_EQ(4000U, subnet->getValid().get()); + EXPECT_EQ(3000U, subnet->getValid().getMin()); + EXPECT_EQ(5000U, subnet->getValid().getMax()); // Check that subnet-id is 1 - EXPECT_EQ(1, subnet->getID()); + EXPECT_EQ(1U, subnet->getID()); } // This test checks that it is possible to assign arbitrary ids for subnets. @@ -1288,15 +1288,15 @@ TEST_F(Dhcp4ParserTest, multipleSubnetsExplicitIDs) { const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(4, subnets->size()); // We expect 4 subnets + ASSERT_EQ(4U, subnets->size()); // We expect 4 subnets // Verify that subnet ids are as expected. // Now the subnet order is the subnet id one. auto subnet = subnets->begin(); - EXPECT_EQ(1, (*subnet)->getID()); - EXPECT_EQ(34, (*++subnet)->getID()); - EXPECT_EQ(100, (*++subnet)->getID()); - EXPECT_EQ(1024, (*++subnet)->getID()); + EXPECT_EQ(1U, (*subnet)->getID()); + EXPECT_EQ(34U, (*++subnet)->getID()); + EXPECT_EQ(100U, (*++subnet)->getID()); + EXPECT_EQ(1024U, (*++subnet)->getID()); // Repeat reconfiguration process 10 times and check that the subnet-id // is set to the same value. @@ -1427,7 +1427,7 @@ TEST_F(Dhcp4ParserTest, reconfigureRemoveSubnet) { const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(4, subnets->size()); // We expect 4 subnets + ASSERT_EQ(4U, subnets->size()); // We expect 4 subnets CfgMgr::instance().clear(); @@ -1440,13 +1440,13 @@ TEST_F(Dhcp4ParserTest, reconfigureRemoveSubnet) { subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(3, subnets->size()); // We expect 3 subnets now (4th is removed) + ASSERT_EQ(3U, subnets->size()); // We expect 3 subnets now (4th is removed) // Check subnet-ids of each subnet (it should be monotonously increasing) auto subnet = subnets->begin(); - EXPECT_EQ(1, (*subnet)->getID()); - EXPECT_EQ(2, (*++subnet)->getID()); - EXPECT_EQ(3, (*++subnet)->getID()); + EXPECT_EQ(1U, (*subnet)->getID()); + EXPECT_EQ(2U, (*++subnet)->getID()); + EXPECT_EQ(3U, (*++subnet)->getID()); CfgMgr::instance().clear(); @@ -1467,13 +1467,13 @@ TEST_F(Dhcp4ParserTest, reconfigureRemoveSubnet) { subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(3, subnets->size()); // We expect 4 subnets + ASSERT_EQ(3U, subnets->size()); // We expect 4 subnets subnet = subnets->begin(); - EXPECT_EQ(1, (*subnet)->getID()); + EXPECT_EQ(1U, (*subnet)->getID()); // The second subnet (with subnet-id = 2) is no longer there - EXPECT_EQ(3, (*++subnet)->getID()); - EXPECT_EQ(4, (*++subnet)->getID()); + EXPECT_EQ(3U, (*++subnet)->getID()); + EXPECT_EQ(4U, (*++subnet)->getID()); } /// @todo: implement subnet removal test as part of #3281. @@ -2081,11 +2081,11 @@ TEST_F(Dhcp4ParserTest, subnetLocal) { ConstSubnet4Ptr subnet = CfgMgr::instance().getStagingCfg()-> getCfgSubnets4()->selectSubnet(IOAddress("192.0.2.200")); ASSERT_TRUE(subnet); - EXPECT_EQ(1, subnet->getT1().get()); - EXPECT_EQ(2, subnet->getT2().get()); - EXPECT_EQ(4, subnet->getValid().get()); - EXPECT_EQ(3, subnet->getValid().getMin()); - EXPECT_EQ(5, subnet->getValid().getMax()); + EXPECT_EQ(1U, subnet->getT1().get()); + EXPECT_EQ(2U, subnet->getT2().get()); + EXPECT_EQ(4U, subnet->getValid().get()); + EXPECT_EQ(3U, subnet->getValid().getMin()); + EXPECT_EQ(5U, subnet->getValid().getMax()); } // This test checks if it is possible to define a subnet with an @@ -2286,12 +2286,12 @@ TEST_F(Dhcp4ParserTest, multiplePools) { const Subnet4Collection* subnets = CfgMgr::instance().getStagingCfg()->getCfgSubnets4()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(2, subnets->size()); // We expect 2 subnets + ASSERT_EQ(2U, subnets->size()); // We expect 2 subnets // Check the first subnet auto subnet = subnets->begin(); const PoolCollection& pools1 = (*subnet)->getPools(Lease::TYPE_V4); - ASSERT_EQ(2, pools1.size()); + ASSERT_EQ(2U, pools1.size()); EXPECT_EQ("type=V4, 192.0.2.0-192.0.2.15", pools1[0]->toText()); EXPECT_EQ("type=V4, 192.0.2.200-192.0.2.255", @@ -2302,7 +2302,7 @@ TEST_F(Dhcp4ParserTest, multiplePools) { // Check the second subnet ++subnet; const PoolCollection& pools2 = (*subnet)->getPools(Lease::TYPE_V4); - ASSERT_EQ(2, pools2.size()); + ASSERT_EQ(2U, pools2.size()); EXPECT_EQ("type=V4, 192.0.3.0-192.0.3.127", pools2[0]->toText()); EXPECT_EQ("type=V4, 192.0.3.128-192.0.3.255", @@ -2362,9 +2362,9 @@ TEST_F(Dhcp4ParserTest, poolPrefixLen) { ConstSubnet4Ptr subnet = CfgMgr::instance().getStagingCfg()-> getCfgSubnets4()->selectSubnet(IOAddress("192.0.2.200")); ASSERT_TRUE(subnet); - EXPECT_EQ(1000, subnet->getT1().get()); - EXPECT_EQ(2000, subnet->getT2().get()); - EXPECT_EQ(4000, subnet->getValid().get()); + EXPECT_EQ(1000U, subnet->getT1().get()); + EXPECT_EQ(2000U, subnet->getT2().get()); + EXPECT_EQ(4000U, subnet->getValid().get()); } // Goal of this test is to verify if invalid pool definitions @@ -2580,7 +2580,7 @@ TEST_F(Dhcp4ParserTest, optionDefIpv4Address) { // Verify that the option definition data is valid. EXPECT_EQ("foo", def->getName()); - EXPECT_EQ(100, def->getCode()); + EXPECT_EQ(100U, def->getCode()); EXPECT_FALSE(def->getArrayType()); EXPECT_EQ(OPT_IPV4_ADDRESS_TYPE, def->getType()); EXPECT_TRUE(def->getEncapsulatedSpace().empty()); @@ -2640,7 +2640,7 @@ TEST_F(Dhcp4ParserTest, optionDefRecord) { // Check the option data. EXPECT_EQ("foo", def->getName()); - EXPECT_EQ(100, def->getCode()); + EXPECT_EQ(100U, def->getCode()); EXPECT_EQ(OPT_RECORD_TYPE, def->getType()); EXPECT_FALSE(def->getArrayType()); EXPECT_TRUE(def->getEncapsulatedSpace().empty()); @@ -2649,7 +2649,7 @@ TEST_F(Dhcp4ParserTest, optionDefRecord) { // fields are present and they are of the expected types. const OptionDefinition::RecordFieldsCollection& record_fields = def->getRecordFields(); - ASSERT_EQ(4, record_fields.size()); + ASSERT_EQ(4U, record_fields.size()); EXPECT_EQ(OPT_UINT16_TYPE, record_fields[0]); EXPECT_EQ(OPT_IPV4_ADDRESS_TYPE, record_fields[1]); EXPECT_EQ(OPT_IPV6_ADDRESS_TYPE, record_fields[2]); @@ -2697,7 +2697,7 @@ TEST_F(Dhcp4ParserTest, optionDefMultiple) { // Check the option data. EXPECT_EQ("foo", def1->getName()); - EXPECT_EQ(100, def1->getCode()); + EXPECT_EQ(100U, def1->getCode()); EXPECT_EQ(OPT_UINT32_TYPE, def1->getType()); EXPECT_FALSE(def1->getArrayType()); EXPECT_TRUE(def1->getEncapsulatedSpace().empty()); @@ -2709,7 +2709,7 @@ TEST_F(Dhcp4ParserTest, optionDefMultiple) { // Check the option data. EXPECT_EQ("foo-2", def2->getName()); - EXPECT_EQ(101, def2->getCode()); + EXPECT_EQ(101U, def2->getCode()); EXPECT_EQ(OPT_IPV4_ADDRESS_TYPE, def2->getType()); EXPECT_FALSE(def2->getArrayType()); EXPECT_TRUE(def2->getEncapsulatedSpace().empty()); @@ -2763,7 +2763,7 @@ TEST_F(Dhcp4ParserTest, optionDefDuplicate) { string expected = "failed to create or run parser for configuration "; expected += "element option-def: option definition with code '100' "; expected += "already exists in option space 'isc'"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); // The new configuration should have inserted option 100, but // once configuration failed (on the duplicate option definition) @@ -2772,7 +2772,7 @@ TEST_F(Dhcp4ParserTest, optionDefDuplicate) { def = LibDHCP::getRuntimeOptionDef("isc", 233); ASSERT_TRUE(def); EXPECT_EQ("bar", def->getName()); - EXPECT_EQ(233, def->getCode()); + EXPECT_EQ(233U, def->getCode()); } // The goal of this test is to verify that the option definition @@ -2812,7 +2812,7 @@ TEST_F(Dhcp4ParserTest, optionDefArray) { // Check the option data. EXPECT_EQ("foo", def->getName()); - EXPECT_EQ(100, def->getCode()); + EXPECT_EQ(100U, def->getCode()); EXPECT_EQ(OPT_UINT32_TYPE, def->getType()); EXPECT_TRUE(def->getArrayType()); EXPECT_TRUE(def->getEncapsulatedSpace().empty()); @@ -2855,7 +2855,7 @@ TEST_F(Dhcp4ParserTest, optionDefEncapsulate) { // Check the option data. EXPECT_EQ("foo", def->getName()); - EXPECT_EQ(100, def->getCode()); + EXPECT_EQ(100U, def->getCode()); EXPECT_EQ(OPT_UINT32_TYPE, def->getType()); EXPECT_FALSE(def->getArrayType()); EXPECT_EQ("sub-opts-space", def->getEncapsulatedSpace()); @@ -3082,7 +3082,7 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) { // Check the option data. EXPECT_EQ("foo", def->getName()); - EXPECT_EQ(109, def->getCode()); + EXPECT_EQ(109U, def->getCode()); EXPECT_EQ(OPT_STRING_TYPE, def->getType()); EXPECT_FALSE(def->getArrayType()); @@ -3130,7 +3130,7 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) { // Check the option data. EXPECT_EQ("unassigned-option-170", def->getName()); - EXPECT_EQ(170, def->getCode()); + EXPECT_EQ(170U, def->getCode()); EXPECT_EQ(OPT_STRING_TYPE, def->getType()); EXPECT_FALSE(def->getArrayType()); } @@ -3170,10 +3170,10 @@ TEST_F(Dhcp4ParserTest, optionDataDefaultsGlobal) { getCfgSubnets4()->selectSubnet(IOAddress("192.0.2.200")); ASSERT_TRUE(subnet); OptionContainerPtr options = subnet->getCfgOption()->getAll(DHCP4_OPTION_SPACE); - ASSERT_EQ(0, options->size()); + ASSERT_EQ(0U, options->size()); options = CfgMgr::instance().getStagingCfg()->getCfgOption()->getAll(DHCP4_OPTION_SPACE); - ASSERT_EQ(2, options->size()); + ASSERT_EQ(2U, options->size()); // Get the search index. Index #1 is to search using option code. const OptionContainerTypeIndex& idx = options->get<1>(); @@ -3240,13 +3240,13 @@ TEST_F(Dhcp4ParserTest, optionDataDefaultsSubnet) { // These options are subnet options OptionContainerPtr options = CfgMgr::instance().getStagingCfg()->getCfgOption()->getAll(DHCP4_OPTION_SPACE); - ASSERT_EQ(0, options->size()); + ASSERT_EQ(0U, options->size()); ConstSubnet4Ptr subnet = CfgMgr::instance().getStagingCfg()-> getCfgSubnets4()->selectSubnet(IOAddress("192.0.2.200")); ASSERT_TRUE(subnet); options = subnet->getCfgOption()->getAll(DHCP4_OPTION_SPACE); - ASSERT_EQ(2, options->size()); + ASSERT_EQ(2U, options->size()); // Get the search index. Index #1 is to search using option code. const OptionContainerTypeIndex& idx = options->get<1>(); @@ -3327,12 +3327,12 @@ TEST_F(Dhcp4ParserTest, optionDataTwoSpaces) { OptionDescriptor desc1 = CfgMgr::instance().getStagingCfg()->getCfgOption()->get(DHCP4_OPTION_SPACE, 56); ASSERT_TRUE(desc1.option_); - EXPECT_EQ(56, desc1.option_->getType()); + EXPECT_EQ(56U, desc1.option_->getType()); // Try to get the option from the space isc. OptionDescriptor desc2 = CfgMgr::instance().getStagingCfg()->getCfgOption()->get("isc", 56); ASSERT_TRUE(desc2.option_); - EXPECT_EQ(56, desc1.option_->getType()); + EXPECT_EQ(56U, desc1.option_->getType()); // Try to get the non-existing option from the non-existing // option space and expect that option is not returned. OptionDescriptor desc3 = CfgMgr::instance().getStagingCfg()-> @@ -3459,24 +3459,24 @@ TEST_F(Dhcp4ParserTest, optionDataEncapsulate) { OptionContainerPtr options = CfgMgr::instance().getStagingCfg()->getCfgOption()->getAll(DHCP4_OPTION_SPACE); ASSERT_TRUE(options); - ASSERT_EQ(1, options->size()); + ASSERT_EQ(1U, options->size()); // Get the option. OptionDescriptor desc = CfgMgr::instance().getStagingCfg()->getCfgOption()->get(DHCP4_OPTION_SPACE, 222); EXPECT_TRUE(desc.option_); - EXPECT_EQ(222, desc.option_->getType()); + EXPECT_EQ(222U, desc.option_->getType()); // This option should comprise two sub-options. // One of them is 'foo' with code 1. OptionPtr option_foo = desc.option_->getOption(1); ASSERT_TRUE(option_foo); - EXPECT_EQ(1, option_foo->getType()); + EXPECT_EQ(1U, option_foo->getType()); // ...another one 'foo2' with code 2. OptionPtr option_foo2 = desc.option_->getOption(2); ASSERT_TRUE(option_foo2); - EXPECT_EQ(2, option_foo2->getType()); + EXPECT_EQ(2U, option_foo2->getType()); } // Goal of this test is to verify options configuration @@ -3521,7 +3521,7 @@ TEST_F(Dhcp4ParserTest, optionDataInSingleSubnet) { getCfgSubnets4()->selectSubnet(IOAddress("192.0.2.24")); ASSERT_TRUE(subnet); OptionContainerPtr options = subnet->getCfgOption()->getAll(DHCP4_OPTION_SPACE); - ASSERT_EQ(2, options->size()); + ASSERT_EQ(2U, options->size()); // Get the search index. Index #1 is to search using option code. const OptionContainerTypeIndex& idx = options->get<1>(); @@ -3670,7 +3670,7 @@ TEST_F(Dhcp4ParserTest, optionDataInMultipleSubnets) { getCfgSubnets4()->selectSubnet(IOAddress("192.0.2.100")); ASSERT_TRUE(subnet1); OptionContainerPtr options1 = subnet1->getCfgOption()->getAll(DHCP4_OPTION_SPACE); - ASSERT_EQ(1, options1->size()); + ASSERT_EQ(1U, options1->size()); // Get the search index. Index #1 is to search using option code. const OptionContainerTypeIndex& idx1 = options1->get<1>(); @@ -3695,7 +3695,7 @@ TEST_F(Dhcp4ParserTest, optionDataInMultipleSubnets) { getCfgSubnets4()->selectSubnet(IOAddress("192.0.3.102")); ASSERT_TRUE(subnet2); OptionContainerPtr options2 = subnet2->getCfgOption()->getAll(DHCP4_OPTION_SPACE); - ASSERT_EQ(1, options2->size()); + ASSERT_EQ(1U, options2->size()); const OptionContainerTypeIndex& idx2 = options2->get<1>(); std::pairgetCfgOption()->getAll(DHCP4_OPTION_SPACE); - ASSERT_EQ(2, options->size()); + ASSERT_EQ(2U, options->size()); // Get the search index. Index #1 is to search using option code. const OptionContainerTypeIndex& idx = options->get<1>(); @@ -3827,7 +3827,7 @@ TEST_F(Dhcp4ParserTest, optionDataMultiplePools) { OptionContainerPtr options1 = pool41->getCfgOption()->getAll(DHCP4_OPTION_SPACE); - ASSERT_EQ(1, options1->size()); + ASSERT_EQ(1U, options1->size()); // Get the search index. Index #1 is to search using option code. const OptionContainerTypeIndex& idx1 = options1->get<1>(); @@ -3854,7 +3854,7 @@ TEST_F(Dhcp4ParserTest, optionDataMultiplePools) { OptionContainerPtr options2 = pool42->getCfgOption()->getAll(DHCP4_OPTION_SPACE); - ASSERT_EQ(1, options2->size()); + ASSERT_EQ(1U, options2->size()); const OptionContainerTypeIndex& idx2 = options2->get<1>(); std::pairselectSubnet(IOAddress("192.0.2.5")); ASSERT_TRUE(subnet); OptionContainerPtr options = subnet->getCfgOption()->getAll(DHCP4_OPTION_SPACE); - ASSERT_EQ(1, options->size()); + ASSERT_EQ(1U, options->size()); // Get the search index. Index #1 is to search using option code. const OptionContainerTypeIndex& idx = options->get<1>(); @@ -3991,7 +3991,7 @@ TEST_F(Dhcp4ParserTest, stdOptionData) { ASSERT_TRUE(subnet); OptionContainerPtr options = subnet->getCfgOption()->getAll(DHCP4_OPTION_SPACE); ASSERT_TRUE(options); - ASSERT_EQ(1, options->size()); + ASSERT_EQ(1U, options->size()); // Get the search index. Index #1 is to search using option code. const OptionContainerTypeIndex& idx = options->get<1>(); @@ -4020,7 +4020,7 @@ TEST_F(Dhcp4ParserTest, stdOptionData) { // Get addresses from the option. Option4AddrLst::AddressContainer addrs = option_addrs->getAddresses(); // Verify that the addresses have been configured correctly. - ASSERT_EQ(3, addrs.size()); + ASSERT_EQ(3U, addrs.size()); EXPECT_EQ("192.0.2.10", addrs[0].toText()); EXPECT_EQ("192.0.2.1", addrs[1].toText()); EXPECT_EQ("192.0.2.3", addrs[2].toText()); @@ -4118,7 +4118,7 @@ TEST_F(Dhcp4ParserTest, slpOptions) { // Get options OptionContainerPtr options = CfgMgr::instance().getStagingCfg()-> getCfgOption()->getAll(DHCP4_OPTION_SPACE); - ASSERT_EQ(2, options->size()); + ASSERT_EQ(2U, options->size()); // Get the search index. Index #1 is to search using option code. const OptionContainerTypeIndex& idx = options->get<1>(); @@ -4251,7 +4251,7 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) { OptionContainerPtr options = CfgMgr::instance().getStagingCfg()->getCfgOption()->getAll(DHCP4_OPTION_SPACE); ASSERT_TRUE(options); - ASSERT_EQ(1, options->size()); + ASSERT_EQ(1U, options->size()); // Get the option. OptionDescriptor desc = CfgMgr::instance().getStagingCfg()-> @@ -4262,7 +4262,7 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) { // Option with the code 1 should be added as a sub-option. OptionPtr option_foo = desc.option_->getOption(1); ASSERT_TRUE(option_foo); - EXPECT_EQ(1, option_foo->getType()); + EXPECT_EQ(1U, option_foo->getType()); // This option comprises a single uint32_t value thus it is // represented by OptionInt class. Let's get the // object of this type. @@ -4270,12 +4270,12 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) { boost::dynamic_pointer_cast >(option_foo); ASSERT_TRUE(option_foo_uint32); // Validate the value according to the configuration. - EXPECT_EQ(1234, option_foo_uint32->getValue()); + EXPECT_EQ(1234U, option_foo_uint32->getValue()); // Option with the code 2 should be added as a sub-option. OptionPtr option_foo2 = desc.option_->getOption(2); ASSERT_TRUE(option_foo2); - EXPECT_EQ(2, option_foo2->getType()); + EXPECT_EQ(2U, option_foo2->getType()); // This option comprises the IPV4 address. Such option is // represented by OptionCustom object. OptionCustomPtr option_foo2_v4 = @@ -4334,12 +4334,12 @@ TEST_F(Dhcp4ParserTest, vendorOptionsHex) { OptionDescriptor desc1 = CfgMgr::instance().getStagingCfg()-> getCfgOption()->get(VENDOR_ID_CABLE_LABS, 100); ASSERT_TRUE(desc1.option_); - EXPECT_EQ(100, desc1.option_->getType()); + EXPECT_EQ(100U, desc1.option_->getType()); // Try to get the option from the vendor space 1234 OptionDescriptor desc2 = CfgMgr::instance().getStagingCfg()->getCfgOption()->get(1234, 100); ASSERT_TRUE(desc2.option_); - EXPECT_EQ(100, desc1.option_->getType()); + EXPECT_EQ(100U, desc1.option_->getType()); // Try to get the non-existing option from the non-existing // option space and expect that option is not returned. @@ -4393,7 +4393,7 @@ TEST_F(Dhcp4ParserTest, vendorOptionsCsv) { OptionDescriptor desc1 = CfgMgr::instance().getStagingCfg()-> getCfgOption()->get(VENDOR_ID_CABLE_LABS, 100); ASSERT_TRUE(desc1.option_); - EXPECT_EQ(100, desc1.option_->getType()); + EXPECT_EQ(100U, desc1.option_->getType()); // Try to get the non-existing option from the non-existing // option space and expect that option is not returned. @@ -4521,7 +4521,7 @@ TEST_F(Dhcp4ParserTest, LibrariesSpecified) { // Expect two libraries to be loaded in the correct order (load marker file // is present, no unload marker file). std::vector libraries = HooksManager::getLibraryNames(); - ASSERT_EQ(2, libraries.size()); + ASSERT_EQ(2U, libraries.size()); EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "12")); EXPECT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE)); @@ -4841,7 +4841,7 @@ TEST_F(Dhcp4ParserTest, classifySubnets) { const Subnet4Collection* subnets = CfgMgr::instance().getStagingCfg()->getCfgSubnets4()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(4, subnets->size()); // We expect 4 subnets + ASSERT_EQ(4U, subnets->size()); // We expect 4 subnets // Let's check if client belonging to alpha class is supported in subnet[0] // and not supported in any other subnet (except subnet[3], which allows @@ -4933,9 +4933,9 @@ TEST_F(Dhcp4ParserTest, classifyPools) { const Subnet4Collection* subnets = CfgMgr::instance().getStagingCfg()->getCfgSubnets4()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); const PoolCollection& pools = (*subnets->begin())->getPools(Lease::TYPE_V4); - ASSERT_EQ(4, pools.size()); // We expect 4 pools + ASSERT_EQ(4U, pools.size()); // We expect 4 pools // Let's check if client belonging to alpha class is supported in pool[0] // and not supported in any other pool (except pool[3], which allows @@ -5034,10 +5034,10 @@ TEST_F(Dhcp4ParserTest, d2ClientConfigValid) { // Verify that the configuration values are correct. EXPECT_TRUE(d2_client_config->getEnableUpdates()); EXPECT_EQ("192.168.2.1", d2_client_config->getServerIp().toText()); - EXPECT_EQ(777, d2_client_config->getServerPort()); + EXPECT_EQ(777U, d2_client_config->getServerPort()); EXPECT_EQ("192.168.2.2", d2_client_config->getSenderIp().toText()); - EXPECT_EQ(778, d2_client_config->getSenderPort()); - EXPECT_EQ(2048, d2_client_config->getMaxQueueSize()); + EXPECT_EQ(778U, d2_client_config->getSenderPort()); + EXPECT_EQ(2048U, d2_client_config->getMaxQueueSize()); EXPECT_EQ(dhcp_ddns::NCR_UDP, d2_client_config->getNcrProtocol()); EXPECT_EQ(dhcp_ddns::FMT_JSON, d2_client_config->getNcrFormat()); @@ -5198,7 +5198,7 @@ TEST_F(Dhcp4ParserTest, reservations) { const Subnet4Collection* subnets = CfgMgr::instance().getStagingCfg()->getCfgSubnets4()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(3, subnets->size()); + ASSERT_EQ(3U, subnets->size()); // Hosts configuration must be available. CfgHostsPtr hosts_cfg = CfgMgr::instance().getStagingCfg()->getCfgHosts(); @@ -5227,7 +5227,7 @@ TEST_F(Dhcp4ParserTest, reservations) { retrieveOption(*host, DHO_NAME_SERVERS); ASSERT_TRUE(opt_dns); Option4AddrLst::AddressContainer dns_addrs = opt_dns->getAddresses(); - ASSERT_EQ(1, dns_addrs.size()); + ASSERT_EQ(1U, dns_addrs.size()); EXPECT_EQ("192.0.3.95", dns_addrs[0].toText()); OptionUint8Ptr opt_ttl = retrieveOption(*host, DHO_DEFAULT_IP_TTL); @@ -5248,7 +5248,7 @@ TEST_F(Dhcp4ParserTest, reservations) { opt_dns = retrieveOption(*host, DHO_NAME_SERVERS); ASSERT_TRUE(opt_dns); dns_addrs = opt_dns->getAddresses(); - ASSERT_EQ(1, dns_addrs.size()); + ASSERT_EQ(1U, dns_addrs.size()); EXPECT_EQ("192.0.3.15", dns_addrs[0].toText()); opt_ttl = retrieveOption(*host, DHO_DEFAULT_IP_TTL); ASSERT_TRUE(opt_ttl); @@ -5283,7 +5283,7 @@ TEST_F(Dhcp4ParserTest, reservations) { opt_dns = retrieveOption(*host, DHO_NAME_SERVERS); ASSERT_TRUE(opt_dns); dns_addrs = opt_dns->getAddresses(); - ASSERT_EQ(1, dns_addrs.size()); + ASSERT_EQ(1U, dns_addrs.size()); EXPECT_EQ("192.0.4.11", dns_addrs[0].toText()); opt_ttl = retrieveOption(*host, DHO_DEFAULT_IP_TTL); ASSERT_TRUE(opt_ttl); @@ -5367,8 +5367,8 @@ TEST_F(Dhcp4ParserTest, reservationWithOptionDefinition) { OptionUint32Ptr opt_foo = retrieveOption(*host, "isc", 100); ASSERT_TRUE(opt_foo); - EXPECT_EQ(100, opt_foo->getType()); - EXPECT_EQ(123, opt_foo->getValue()); + EXPECT_EQ(100U, opt_foo->getType()); + EXPECT_EQ(123U, opt_foo->getValue()); } // This test verifies that the bogus host reservation would trigger a @@ -5552,7 +5552,7 @@ TEST_F(Dhcp4ParserTest, hostReservationPerSubnet) { ConstCfgSubnets4Ptr subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4(); ASSERT_TRUE(subnets); const Subnet4Collection* subnet_col = subnets->getAll(); - ASSERT_EQ(7, subnet_col->size()); // We expect 7 subnets + ASSERT_EQ(7U, subnet_col->size()); // We expect 7 subnets // Let's check if the parsed subnets have correct HR modes. @@ -5653,7 +5653,7 @@ TEST_F(Dhcp4ParserTest, hostReservationGlobal) { ConstCfgSubnets4Ptr subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4(); ASSERT_TRUE(subnets); const Subnet4Collection* subnet_col = subnets->getAll(); - ASSERT_EQ(2, subnet_col->size()); // We expect 2 subnets + ASSERT_EQ(2U, subnet_col->size()); // We expect 2 subnets // Let's check if the parsed subnets have correct HR modes. @@ -5694,7 +5694,7 @@ TEST_F(Dhcp4ParserTest, declineTimerDefault) { // The value of decline-probation-period must be equal to the // default value (86400). The default value is defined in GLOBAL4_DEFAULTS in // simple_parser4.cc. - EXPECT_EQ(86400, CfgMgr::instance().getStagingCfg()->getDeclinePeriod()); + EXPECT_EQ(86400U, CfgMgr::instance().getStagingCfg()->getDeclinePeriod()); } /// Check that the dhcp4o6-port default value has a default value if not @@ -5717,7 +5717,7 @@ TEST_F(Dhcp4ParserTest, dhcp4o6portDefault) { // The value of decline-probation-period must be equal to the // default value (0). The default value is defined in GLOBAL4_DEFAULTS in // simple_parser4.cc. - EXPECT_EQ(0, CfgMgr::instance().getStagingCfg()->getDhcp4o6Port()); + EXPECT_EQ(0U, CfgMgr::instance().getStagingCfg()->getDhcp4o6Port()); } /// Check that the decline-probation-period value can be set properly. @@ -5739,7 +5739,7 @@ TEST_F(Dhcp4ParserTest, declineTimer) { // The value of decline-probation-period must be equal to the // value specified. - EXPECT_EQ(12345, + EXPECT_EQ(12345U, CfgMgr::instance().getStagingCfg()->getDeclinePeriod()); } @@ -5799,12 +5799,12 @@ TEST_F(Dhcp4ParserTest, expiredLeasesProcessing) { ASSERT_TRUE(cfg); // Verify that parameters are correct. - EXPECT_EQ(20, cfg->getReclaimTimerWaitTime()); - EXPECT_EQ(35, cfg->getFlushReclaimedTimerWaitTime()); - EXPECT_EQ(1800, cfg->getHoldReclaimedTime()); - EXPECT_EQ(50, cfg->getMaxReclaimLeases()); - EXPECT_EQ(100, cfg->getMaxReclaimTime()); - EXPECT_EQ(10, cfg->getUnwarnedReclaimCycles()); + EXPECT_EQ(20U, cfg->getReclaimTimerWaitTime()); + EXPECT_EQ(35U, cfg->getFlushReclaimedTimerWaitTime()); + EXPECT_EQ(1800U, cfg->getHoldReclaimedTime()); + EXPECT_EQ(50U, cfg->getMaxReclaimLeases()); + EXPECT_EQ(100U, cfg->getMaxReclaimTime()); + EXPECT_EQ(10U, cfg->getUnwarnedReclaimCycles()); } // Check that invalid configuration for the expired leases processing is @@ -5908,7 +5908,7 @@ TEST_F(Dhcp4ParserTest, 4o6subnet) { const Cfg4o6& dhcp4o6 = subnet->get4o6(); EXPECT_TRUE(dhcp4o6.enabled()); EXPECT_EQ(IOAddress("2001:db8::123"), dhcp4o6.getSubnet4o6().get().first); - EXPECT_EQ(45, dhcp4o6.getSubnet4o6().get().second); + EXPECT_EQ(45U, dhcp4o6.getSubnet4o6().get().second); } // Checks if the DHCPv4 is able to parse the configuration with 4o6 subnet @@ -6047,7 +6047,7 @@ TEST_F(Dhcp4ParserTest, 4o6subnetIface) { const Cfg4o6& dhcp4o6 = subnet->get4o6(); EXPECT_TRUE(dhcp4o6.enabled()); EXPECT_EQ(IOAddress("2001:db8::543"), dhcp4o6.getSubnet4o6().get().first); - EXPECT_EQ(21, dhcp4o6.getSubnet4o6().get().second); + EXPECT_EQ(21U, dhcp4o6.getSubnet4o6().get().second); EXPECT_EQ("ethX", dhcp4o6.getIface4o6().get()); } @@ -6089,7 +6089,7 @@ TEST_F(Dhcp4ParserTest, 4o6subnetInterfaceId) { ASSERT_TRUE(ifaceid); vector data = ifaceid->getData(); - EXPECT_EQ(7, data.size()); + EXPECT_EQ(7U, data.size()); const char *exp = "vlan123"; EXPECT_EQ(0, memcmp(&data[0], exp, data.size())); } @@ -6132,7 +6132,7 @@ TEST_F(Dhcp4ParserTest, validClientClassDictionary) { ClientClassDictionaryPtr dictionary; dictionary = CfgMgr::instance().getStagingCfg()->getClientClassDictionary(); ASSERT_TRUE(dictionary); - EXPECT_EQ(3, dictionary->getClasses()->size()); + EXPECT_EQ(3U, dictionary->getClasses()->size()); // Execute the commit ASSERT_NO_THROW(CfgMgr::instance().commit()); @@ -6140,7 +6140,7 @@ TEST_F(Dhcp4ParserTest, validClientClassDictionary) { // Verify that after commit, the current config has the correct dictionary dictionary = CfgMgr::instance().getCurrentCfg()->getClientClassDictionary(); ASSERT_TRUE(dictionary); - EXPECT_EQ(3, dictionary->getClasses()->size()); + EXPECT_EQ(3U, dictionary->getClasses()->size()); } // Verifies that a class list containing an invalid @@ -6201,7 +6201,7 @@ TEST_F(Dhcp4ParserTest, clientClassValidLifetime) { ClientClassDictionaryPtr dictionary; dictionary = CfgMgr::instance().getStagingCfg()->getClientClassDictionary(); ASSERT_TRUE(dictionary); - EXPECT_EQ(2, dictionary->getClasses()->size()); + EXPECT_EQ(2U, dictionary->getClasses()->size()); // Execute the commit ASSERT_NO_THROW(CfgMgr::instance().commit()); @@ -6209,13 +6209,13 @@ TEST_F(Dhcp4ParserTest, clientClassValidLifetime) { // Verify that after commit, the current config has the correct dictionary dictionary = CfgMgr::instance().getCurrentCfg()->getClientClassDictionary(); ASSERT_TRUE(dictionary); - EXPECT_EQ(2, dictionary->getClasses()->size()); + EXPECT_EQ(2U, dictionary->getClasses()->size()); ClientClassDefPtr class_def = dictionary->findClass("one"); ASSERT_TRUE(class_def); - EXPECT_EQ(class_def->getValid().getMin(), 1000); - EXPECT_EQ(class_def->getValid().get(), 2000); - EXPECT_EQ(class_def->getValid().getMax(), 3000); + EXPECT_EQ(class_def->getValid().getMin(), 1000U); + EXPECT_EQ(class_def->getValid().get(), 2000U); + EXPECT_EQ(class_def->getValid().getMax(), 3000U); class_def = dictionary->findClass("two"); ASSERT_TRUE(class_def); @@ -6259,7 +6259,7 @@ TEST_F(Dhcp4ParserTest, templateClientClassValidLifetime) { ClientClassDictionaryPtr dictionary; dictionary = CfgMgr::instance().getStagingCfg()->getClientClassDictionary(); ASSERT_TRUE(dictionary); - EXPECT_EQ(2, dictionary->getClasses()->size()); + EXPECT_EQ(2U, dictionary->getClasses()->size()); // Execute the commit ASSERT_NO_THROW(CfgMgr::instance().commit()); @@ -6267,14 +6267,14 @@ TEST_F(Dhcp4ParserTest, templateClientClassValidLifetime) { // Verify that after commit, the current config has the correct dictionary dictionary = CfgMgr::instance().getCurrentCfg()->getClientClassDictionary(); ASSERT_TRUE(dictionary); - EXPECT_EQ(2, dictionary->getClasses()->size()); + EXPECT_EQ(2U, dictionary->getClasses()->size()); ClientClassDefPtr class_def = dictionary->findClass("one"); ASSERT_TRUE(class_def); ASSERT_TRUE(dynamic_cast(class_def.get())); - EXPECT_EQ(class_def->getValid().getMin(), 1000); - EXPECT_EQ(class_def->getValid().get(), 2000); - EXPECT_EQ(class_def->getValid().getMax(), 3000); + EXPECT_EQ(class_def->getValid().getMin(), 1000U); + EXPECT_EQ(class_def->getValid().get(), 2000U); + EXPECT_EQ(class_def->getValid().getMax(), 3000U); class_def = dictionary->findClass("two"); ASSERT_TRUE(class_def); @@ -6304,7 +6304,7 @@ TEST_F(Dhcp4ParserTest, poolUserContextEmpty) { // The context should be of type map and not contain any parameters. EXPECT_EQ(Element::map, ctx->getType()); - EXPECT_EQ(0, ctx->size()); + EXPECT_EQ(0U, ctx->size()); } // Test verifies that it's possible to specify parameters in the user context @@ -6319,7 +6319,7 @@ TEST_F(Dhcp4ParserTest, poolUserContextData) { // The context should be of type map and contain 4 parameters. EXPECT_EQ(Element::map, ctx->getType()); - EXPECT_EQ(3, ctx->size()); + EXPECT_EQ(3U, ctx->size()); ConstElementPtr int_param = ctx->get("integer-param"); ConstElementPtr str_param = ctx->get("string-param"); ConstElementPtr bool_param = ctx->get("bool-param"); @@ -6353,7 +6353,7 @@ TEST_F(Dhcp4ParserTest, poolMinMaxUserContext) { // The context should be of type map and contain 4 parameters. EXPECT_EQ(Element::map, ctx->getType()); - EXPECT_EQ(3, ctx->size()); + EXPECT_EQ(3U, ctx->size()); ConstElementPtr int_param = ctx->get("integer-param"); ConstElementPtr str_param = ctx->get("string-param"); ConstElementPtr bool_param = ctx->get("bool-param"); @@ -6490,7 +6490,7 @@ TEST_F(Dhcp4ParserTest, sharedNetworksName) { ASSERT_TRUE(cfg_net); const SharedNetwork4Collection* nets = cfg_net->getAll(); ASSERT_TRUE(nets); - ASSERT_EQ(1, nets->size()); + ASSERT_EQ(1U, nets->size()); SharedNetwork4Ptr net = *(nets->begin()); ASSERT_TRUE(net); EXPECT_EQ("foo", net->getName()); @@ -6498,7 +6498,7 @@ TEST_F(Dhcp4ParserTest, sharedNetworksName) { // Verify that there are no subnets in this shared-network const Subnet4SimpleCollection* subs = net->getAllSubnets(); ASSERT_TRUE(subs); - EXPECT_EQ(0, subs->size()); + EXPECT_EQ(0U, subs->size()); } // Test verifies that a degenerated shared-network (just one subnet) is @@ -6526,7 +6526,7 @@ TEST_F(Dhcp4ParserTest, sharedNetworks1subnet) { // There should be exactly one shared subnet. const SharedNetwork4Collection* nets = cfg_net->getAll(); ASSERT_TRUE(nets); - ASSERT_EQ(1, nets->size()); + ASSERT_EQ(1U, nets->size()); SharedNetwork4Ptr net = *(nets->begin()); ASSERT_TRUE(net); @@ -6535,7 +6535,7 @@ TEST_F(Dhcp4ParserTest, sharedNetworks1subnet) { // It should have one subnet. The subnet should have default values. const Subnet4SimpleCollection* subs = net->getAllSubnets(); ASSERT_TRUE(subs); - EXPECT_EQ(1, subs->size()); + EXPECT_EQ(1U, subs->size()); checkSubnet(*subs, "192.0.2.0/24", 0, 0, 7200); // Now make sure the subnet was added to global list of subnets. @@ -6599,7 +6599,7 @@ TEST_F(Dhcp4ParserTest, sharedNetworks3subnets) { ASSERT_TRUE(cfg_net); const SharedNetwork4Collection* nets = cfg_net->getAll(); ASSERT_TRUE(nets); - ASSERT_EQ(1, nets->size()); + ASSERT_EQ(1U, nets->size()); SharedNetwork4Ptr net = *(nets->begin()); ASSERT_TRUE(net); @@ -6608,7 +6608,7 @@ TEST_F(Dhcp4ParserTest, sharedNetworks3subnets) { const Subnet4SimpleCollection* subs = net->getAllSubnets(); ASSERT_TRUE(subs); - EXPECT_EQ(3, subs->size()); + EXPECT_EQ(3U, subs->size()); checkSubnet(*subs, "192.0.1.0/24", 1000, 2000, 4000, 3000, 5000); checkSubnet(*subs, "192.0.2.0/24", 2, 22, 222, 111, 333); checkSubnet(*subs, "192.0.3.0/24", 1000, 2000, 4000, 3000, 5000); @@ -6716,7 +6716,7 @@ TEST_F(Dhcp4ParserTest, sharedNetworksDerive) { ASSERT_TRUE(cfg_net); const SharedNetwork4Collection* nets = cfg_net->getAll(); ASSERT_TRUE(nets); - ASSERT_EQ(2, nets->size()); + ASSERT_EQ(2U, nets->size()); // Let's check the first one. SharedNetwork4Ptr net = nets->at(0); @@ -6725,7 +6725,7 @@ TEST_F(Dhcp4ParserTest, sharedNetworksDerive) { // The first shared network has two subnets. const Subnet4SimpleCollection* subs = net->getAllSubnets(); ASSERT_TRUE(subs); - EXPECT_EQ(2, subs->size()); + EXPECT_EQ(2U, subs->size()); // For the first subnet, the renew-timer should be 10, because it was // derived from shared-network level. Other parameters a derived @@ -6772,7 +6772,7 @@ TEST_F(Dhcp4ParserTest, sharedNetworksDerive) { subs = net->getAllSubnets(); ASSERT_TRUE(subs); - EXPECT_EQ(1, subs->size()); + EXPECT_EQ(1U, subs->size()); // This subnet should derive its renew-timer from global scope. // All other parameters should have default values. @@ -6843,7 +6843,7 @@ TEST_F(Dhcp4ParserTest, sharedNetworksDeriveInterfaces) { ASSERT_TRUE(cfg_net); const SharedNetwork4Collection* nets = cfg_net->getAll(); ASSERT_TRUE(nets); - ASSERT_EQ(2, nets->size()); + ASSERT_EQ(2U, nets->size()); // Let's check the first one. SharedNetwork4Ptr net = nets->at(0); @@ -6851,7 +6851,7 @@ TEST_F(Dhcp4ParserTest, sharedNetworksDeriveInterfaces) { const Subnet4SimpleCollection* subs = net->getAllSubnets(); ASSERT_TRUE(subs); - EXPECT_EQ(2, subs->size()); + EXPECT_EQ(2U, subs->size()); // For the first subnet, the rebind-timer should be 10, because it was // derived from shared-network level. Other parameters a derived @@ -6874,7 +6874,7 @@ TEST_F(Dhcp4ParserTest, sharedNetworksDeriveInterfaces) { subs = net->getAllSubnets(); ASSERT_TRUE(subs); - EXPECT_EQ(1, subs->size()); + EXPECT_EQ(1U, subs->size()); // This subnet should derive its rebind-timer from global scope. s = checkSubnet(*subs, "192.0.3.0/24", 0, 0, 7200); @@ -6926,7 +6926,7 @@ TEST_F(Dhcp4ParserTest, hostsDatabases) { CfgMgr::instance().getStagingCfg()->getCfgDbAccess(); ASSERT_TRUE(cfgdb); const std::list& hal = cfgdb->getHostDbAccessStringList(); - ASSERT_EQ(2, hal.size()); + ASSERT_EQ(2U, hal.size()); // Keywords are in alphabetical order EXPECT_EQ("name=keatest1 password=keatest type=mysql user=keatest", hal.front()); EXPECT_EQ("name=keatest2 password=keatest retry-on-startup=true type=mysql user=keatest", hal.back()); @@ -6944,7 +6944,7 @@ TEST_F(Dhcp4ParserTest, comments) { // Check global user context. ConstElementPtr ctx = CfgMgr::instance().getStagingCfg()->getContext(); ASSERT_TRUE(ctx); - ASSERT_EQ(1, ctx->size()); + ASSERT_EQ(1U, ctx->size()); ASSERT_TRUE(ctx->get("comment")); EXPECT_EQ("\"A DHCPv4 server\"", ctx->get("comment")->str()); @@ -6955,7 +6955,7 @@ TEST_F(Dhcp4ParserTest, comments) { // Check network interface configuration user context. ConstElementPtr ctx_iface = iface->getContext(); ASSERT_TRUE(ctx_iface); - ASSERT_EQ(1, ctx_iface->size()); + ASSERT_EQ(1U, ctx_iface->size()); ASSERT_TRUE(ctx_iface->get("comment")); EXPECT_EQ("\"Use wildcard\"", ctx_iface->get("comment")->str()); @@ -6971,7 +6971,7 @@ TEST_F(Dhcp4ParserTest, comments) { LibDHCP::getRuntimeOptionDef("isc", 100); ASSERT_TRUE(opt_def); EXPECT_EQ("foo", opt_def->getName()); - EXPECT_EQ(100, opt_def->getCode()); + EXPECT_EQ(100U, opt_def->getCode()); EXPECT_FALSE(opt_def->getArrayType()); EXPECT_EQ(OPT_IPV4_ADDRESS_TYPE, opt_def->getType()); EXPECT_TRUE(opt_def->getEncapsulatedSpace().empty()); @@ -6979,7 +6979,7 @@ TEST_F(Dhcp4ParserTest, comments) { // Check option definition user context. ConstElementPtr ctx_opt_def = opt_def->getContext(); ASSERT_TRUE(ctx_opt_def); - ASSERT_EQ(1, ctx_opt_def->size()); + ASSERT_EQ(1U, ctx_opt_def->size()); ASSERT_TRUE(ctx_opt_def->get("comment")); EXPECT_EQ("\"An option definition\"", ctx_opt_def->get("comment")->str()); @@ -6993,7 +6993,7 @@ TEST_F(Dhcp4ParserTest, comments) { // Check option descriptor user context. ConstElementPtr ctx_opt_desc = opt_desc.getContext(); ASSERT_TRUE(ctx_opt_desc); - ASSERT_EQ(1, ctx_opt_desc->size()); + ASSERT_EQ(1U, ctx_opt_desc->size()); ASSERT_TRUE(ctx_opt_desc->get("comment")); EXPECT_EQ("\"Set option value\"", ctx_opt_desc->get("comment")->str()); @@ -7001,7 +7001,7 @@ TEST_F(Dhcp4ParserTest, comments) { const ClientClassDictionaryPtr& dict = CfgMgr::instance().getStagingCfg()->getClientClassDictionary(); ASSERT_TRUE(dict); - EXPECT_EQ(3, dict->getClasses()->size()); + EXPECT_EQ(3U, dict->getClasses()->size()); ClientClassDefPtr cclass = dict->findClass("all"); ASSERT_TRUE(cclass); EXPECT_EQ("all", cclass->getName()); @@ -7010,7 +7010,7 @@ TEST_F(Dhcp4ParserTest, comments) { // Check client class user context. ConstElementPtr ctx_class = cclass->getContext(); ASSERT_TRUE(ctx_class); - ASSERT_EQ(1, ctx_class->size()); + ASSERT_EQ(1U, ctx_class->size()); ASSERT_TRUE(ctx_class->get("comment")); EXPECT_EQ("\"match all\"", ctx_class->get("comment")->str()); @@ -7027,7 +7027,7 @@ TEST_F(Dhcp4ParserTest, comments) { EXPECT_EQ("", cclass->getTest()); ctx_class = cclass->getContext(); ASSERT_TRUE(ctx_class); - ASSERT_EQ(2, ctx_class->size()); + ASSERT_EQ(2U, ctx_class->size()); ASSERT_TRUE(ctx_class->get("comment")); EXPECT_EQ("\"a comment\"", ctx_class->get("comment")->str()); ASSERT_TRUE(ctx_class->get("version")); @@ -7038,7 +7038,7 @@ TEST_F(Dhcp4ParserTest, comments) { CfgMgr::instance().getStagingCfg()->getUnixControlSocketInfo(); ASSERT_TRUE(socket); ASSERT_EQ(Element::list, socket->getType()); - ASSERT_EQ(socket->size(), 1); + ASSERT_EQ(socket->size(), 1U); socket = socket->get(0); ASSERT_TRUE(socket); ASSERT_TRUE(socket->get("socket-type")); @@ -7049,7 +7049,7 @@ TEST_F(Dhcp4ParserTest, comments) { // Check UNIX control socket comment and user context. ConstElementPtr ctx_socket = socket->get("user-context"); ASSERT_TRUE(ctx_socket); - ASSERT_EQ(1, ctx_socket->size()); + ASSERT_EQ(1U, ctx_socket->size()); ASSERT_TRUE(ctx_socket->get("comment")); EXPECT_EQ("\"Indirect comment\"", ctx_socket->get("comment")->str()); @@ -7057,7 +7057,7 @@ TEST_F(Dhcp4ParserTest, comments) { socket = CfgMgr::instance().getStagingCfg()->getHttpControlSocketInfo(); ASSERT_TRUE(socket); ASSERT_EQ(Element::list, socket->getType()); - ASSERT_EQ(socket->size(), 1); + ASSERT_EQ(socket->size(), 1U); socket = socket->get(0); ASSERT_TRUE(socket); /// @todo use the configuration object. @@ -7071,14 +7071,14 @@ TEST_F(Dhcp4ParserTest, comments) { // Check HTTP control socket comment. ctx_socket = socket->get("user-context"); ASSERT_TRUE(ctx_socket); - ASSERT_EQ(1, ctx_socket->size()); + ASSERT_EQ(1U, ctx_socket->size()); ASSERT_TRUE(ctx_socket->get("comment")); EXPECT_EQ("\"HTTP control socket\"", ctx_socket->get("comment")->str()); // HTTP headers. ConstElementPtr headers = socket->get("http-headers"); ASSERT_TRUE(headers); - ASSERT_EQ(1, headers->size()); + ASSERT_EQ(1U, headers->size()); ConstElementPtr header = headers->get(0); ASSERT_TRUE(header); ASSERT_TRUE(header->get("name")); @@ -7089,7 +7089,7 @@ TEST_F(Dhcp4ParserTest, comments) { // Check HTTP header user context. ConstElementPtr ctx_header = header->get("user-context"); ASSERT_TRUE(ctx_header); - ASSERT_EQ(1, ctx_header->size()); + ASSERT_EQ(1U, ctx_header->size()); ASSERT_TRUE(ctx_header->get("comment")); EXPECT_EQ("\"HSTS header\"", ctx_header->get("comment")->str()); @@ -7100,14 +7100,14 @@ TEST_F(Dhcp4ParserTest, comments) { EXPECT_EQ("\"basic\"", auth->get("type")->str()); ConstElementPtr ctx_auth = auth->get("user-context"); ASSERT_TRUE(ctx_auth); - ASSERT_EQ(1, ctx_auth->size()); + ASSERT_EQ(1U, ctx_auth->size()); ASSERT_TRUE(ctx_auth->get("comment")); EXPECT_EQ("\"basic HTTP authentication\"", ctx_auth->get("comment")->str()); // Authentication client. ConstElementPtr clients = auth->get("clients"); ASSERT_TRUE(clients); - ASSERT_EQ(1, clients->size()); + ASSERT_EQ(1U, clients->size()); ConstElementPtr client; ASSERT_NO_THROW(client = clients->get(0)); ASSERT_TRUE(client); @@ -7117,7 +7117,7 @@ TEST_F(Dhcp4ParserTest, comments) { ASSERT_EQ("\"foobar\"", client->get("password")->str()); ConstElementPtr ctx_client = client->get("user-context"); ASSERT_TRUE(ctx_client); - ASSERT_EQ(1, ctx_client->size()); + ASSERT_EQ(1U, ctx_client->size()); ASSERT_TRUE(ctx_client->get("comment")); EXPECT_EQ("\"admin is authorized\"", ctx_client->get("comment")->str()); @@ -7127,7 +7127,7 @@ TEST_F(Dhcp4ParserTest, comments) { ASSERT_TRUE(cfg_net); const SharedNetwork4Collection* nets = cfg_net->getAll(); ASSERT_TRUE(nets); - ASSERT_EQ(1, nets->size()); + ASSERT_EQ(1U, nets->size()); SharedNetwork4Ptr net = nets->at(0); ASSERT_TRUE(net); EXPECT_EQ("foo", net->getName()); @@ -7135,36 +7135,36 @@ TEST_F(Dhcp4ParserTest, comments) { // Check shared network user context. ConstElementPtr ctx_net = net->getContext(); ASSERT_TRUE(ctx_net); - ASSERT_EQ(1, ctx_net->size()); + ASSERT_EQ(1U, ctx_net->size()); ASSERT_TRUE(ctx_net->get("comment")); EXPECT_EQ("\"A shared network\"", ctx_net->get("comment")->str()); // The shared network has a subnet. const Subnet4SimpleCollection* subs = net->getAllSubnets(); ASSERT_TRUE(subs); - ASSERT_EQ(1, subs->size()); + ASSERT_EQ(1U, subs->size()); Subnet4Ptr sub = *subs->begin(); ASSERT_TRUE(sub); - EXPECT_EQ(100, sub->getID()); + EXPECT_EQ(100U, sub->getID()); EXPECT_EQ("192.0.1.0/24", sub->toText()); // Check subnet user context. ConstElementPtr ctx_sub = sub->getContext(); ASSERT_TRUE(ctx_sub); - ASSERT_EQ(1, ctx_sub->size()); + ASSERT_EQ(1U, ctx_sub->size()); ASSERT_TRUE(ctx_sub->get("comment")); EXPECT_EQ("\"A subnet\"", ctx_sub->get("comment")->str()); // The subnet has a pool. const PoolCollection& pools = sub->getPools(Lease::TYPE_V4); - ASSERT_EQ(1, pools.size()); + ASSERT_EQ(1U, pools.size()); PoolPtr pool = pools.at(0); ASSERT_TRUE(pool); // Check pool user context. ConstElementPtr ctx_pool = pool->getContext(); ASSERT_TRUE(ctx_pool); - ASSERT_EQ(1, ctx_pool->size()); + ASSERT_EQ(1U, ctx_pool->size()); ASSERT_TRUE(ctx_pool->get("comment")); EXPECT_EQ("\"A pool\"", ctx_pool->get("comment")->str()); @@ -7177,14 +7177,14 @@ TEST_F(Dhcp4ParserTest, comments) { EXPECT_EQ(Host::IDENT_HWADDR, host->getIdentifierType()); EXPECT_EQ("aa:bb:cc:dd:ee:ff", host->getHWAddress()->toText(false)); EXPECT_FALSE(host->getDuid()); - EXPECT_EQ(100, host->getIPv4SubnetID()); + EXPECT_EQ(100U, host->getIPv4SubnetID()); EXPECT_EQ(SUBNET_ID_UNUSED, host->getIPv6SubnetID()); EXPECT_EQ("foo.example.com", host->getHostname()); // Check host user context. ConstElementPtr ctx_host = host->getContext(); ASSERT_TRUE(ctx_host); - ASSERT_EQ(1, ctx_host->size()); + ASSERT_EQ(1U, ctx_host->size()); ASSERT_TRUE(ctx_host->get("comment")); EXPECT_EQ("\"A host reservation\"", ctx_host->get("comment")->str()); @@ -7200,7 +7200,7 @@ TEST_F(Dhcp4ParserTest, comments) { // Check embedded option data user context. ConstElementPtr ctx_host_desc = host_desc.getContext(); ASSERT_TRUE(ctx_host_desc); - ASSERT_EQ(1, ctx_host_desc->size()); + ASSERT_EQ(1U, ctx_host_desc->size()); ASSERT_TRUE(ctx_host_desc->get("comment")); EXPECT_EQ("\"An option in a reservation\"", ctx_host_desc->get("comment")->str()); @@ -7214,7 +7214,7 @@ TEST_F(Dhcp4ParserTest, comments) { // Check dynamic DNS update configuration user context. ConstElementPtr ctx_d2 = d2->getContext(); ASSERT_TRUE(ctx_d2); - ASSERT_EQ(1, ctx_d2->size()); + ASSERT_EQ(1U, ctx_d2->size()); ASSERT_TRUE(ctx_d2->get("comment")); EXPECT_EQ("\"No dynamic DNS\"", ctx_d2->get("comment")->str()); } @@ -7284,7 +7284,7 @@ TEST_F(Dhcp4ParserTest, globalReservations) { const Subnet4Collection* subnets = CfgMgr::instance().getStagingCfg()->getCfgSubnets4()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(2, subnets->size()); + ASSERT_EQ(2U, subnets->size()); // Hosts configuration must be available. CfgHostsPtr hosts_cfg = CfgMgr::instance().getStagingCfg()->getCfgHosts(); @@ -7314,7 +7314,7 @@ TEST_F(Dhcp4ParserTest, globalReservations) { retrieveOption(*host, DHO_NAME_SERVERS); ASSERT_TRUE(opt_dns); Option4AddrLst::AddressContainer dns_addrs = opt_dns->getAddresses(); - ASSERT_EQ(1, dns_addrs.size()); + ASSERT_EQ(1U, dns_addrs.size()); EXPECT_EQ("192.0.3.95", dns_addrs[0].toText()); OptionUint8Ptr opt_ttl = retrieveOption(*host, DHO_DEFAULT_IP_TTL); @@ -7336,7 +7336,7 @@ TEST_F(Dhcp4ParserTest, globalReservations) { opt_dns = retrieveOption(*host, DHO_NAME_SERVERS); ASSERT_TRUE(opt_dns); dns_addrs = opt_dns->getAddresses(); - ASSERT_EQ(1, dns_addrs.size()); + ASSERT_EQ(1U, dns_addrs.size()); EXPECT_EQ("192.0.3.15", dns_addrs[0].toText()); opt_ttl = retrieveOption(*host, DHO_DEFAULT_IP_TTL); ASSERT_TRUE(opt_ttl); @@ -7386,7 +7386,7 @@ TEST_F(Dhcp4ParserTest, configControlInfo) { // Fetch the list of config dbs. It should have two entries. const process::ConfigDbInfoList& dblist = info->getConfigDatabases(); - ASSERT_EQ(2, dblist.size()); + ASSERT_EQ(2U, dblist.size()); // Make sure the entries are what we expect and in the right order. // (DbAccessParser creates access strings with the keywords in @@ -7398,7 +7398,7 @@ TEST_F(Dhcp4ParserTest, configControlInfo) { // Verify that the config-fetch-wait-time is correct. EXPECT_FALSE(info->getConfigFetchWaitTime().unspecified()); - EXPECT_EQ(10, info->getConfigFetchWaitTime().get()); + EXPECT_EQ(10U, info->getConfigFetchWaitTime().get()); } // Check whether it is possible to configure server-tag @@ -7818,7 +7818,7 @@ TEST_F(Dhcp4ParserTest, statsDefaultLimits) { CfgMgr::instance().commit(); stats::StatsMgr& stats_mgr = stats::StatsMgr::instance(); - EXPECT_EQ(10, stats_mgr.getMaxSampleCountDefault()); + EXPECT_EQ(10U, stats_mgr.getMaxSampleCountDefault()); EXPECT_EQ("00:00:05", util::durationToText(stats_mgr.getMaxSampleAgeDefault(), 0)); } @@ -7912,7 +7912,7 @@ TEST_F(Dhcp4ParserTest, parkedPacketLimit) { configure(config_no_limit, CONTROL_RESULT_SUCCESS, ""); ConstElementPtr ppl; ASSERT_TRUE(ppl = CfgMgr::instance().getStagingCfg()->getConfiguredGlobal("parked-packet-limit")); - EXPECT_EQ(256, ppl->intValue()); + EXPECT_EQ(256U, ppl->intValue()); // Clear the config CfgMgr::instance().clear(); @@ -7921,7 +7921,7 @@ TEST_F(Dhcp4ParserTest, parkedPacketLimit) { configure(config_limit, CONTROL_RESULT_SUCCESS, ""); ASSERT_TRUE(ppl = CfgMgr::instance().getStagingCfg()->getConfiguredGlobal("parked-packet-limit")); - EXPECT_EQ(777, ppl->intValue()); + EXPECT_EQ(777U, ppl->intValue()); // Make sure an invalid limit fails to parse. ASSERT_THROW(parseDHCP4(bad_limit), std::exception); @@ -8092,7 +8092,7 @@ TEST_F(Dhcp4ParserTest, optionClientClassesDuplicateCheck) { CfgOptionPtr cfg = CfgMgr::instance().getStagingCfg()->getCfgOption(); const auto desc = cfg->get(DHCP4_OPTION_SPACE, DHO_DOMAIN_NAME); ASSERT_TRUE(desc.option_); - ASSERT_EQ(desc.client_classes_.size(), 2); + ASSERT_EQ(desc.client_classes_.size(), 2U); auto cclasses = desc.client_classes_.begin(); EXPECT_EQ(*cclasses, "foo"); ++cclasses; @@ -8137,7 +8137,7 @@ TEST_F(Dhcp4ParserTest, deprecatedRequireClientClassesCheck) { ASSERT_TRUE(network); auto& net_class_list = network->getAdditionalClasses(); - EXPECT_EQ(1, net_class_list.size()); + EXPECT_EQ(1U, net_class_list.size()); auto cclasses = net_class_list.begin(); EXPECT_EQ(*cclasses, "one"); @@ -8146,7 +8146,7 @@ TEST_F(Dhcp4ParserTest, deprecatedRequireClientClassesCheck) { ASSERT_TRUE(subnet); auto& sub_class_list = subnet->getAdditionalClasses(); - EXPECT_EQ(1, sub_class_list.size()); + EXPECT_EQ(1U, sub_class_list.size()); cclasses = sub_class_list.begin(); EXPECT_EQ(*cclasses, "two"); @@ -8154,7 +8154,7 @@ TEST_F(Dhcp4ParserTest, deprecatedRequireClientClassesCheck) { ASSERT_TRUE(pool); auto& pool_class_list = pool->getAdditionalClasses(); - EXPECT_EQ(1, pool_class_list.size()); + EXPECT_EQ(1U, pool_class_list.size()); cclasses = pool_class_list.begin(); EXPECT_EQ(*cclasses, "three"); @@ -8208,7 +8208,7 @@ TEST_F(Dhcp4ParserTest, deprecatedOnlyIfRequiredCheck) { auto dictionary = CfgMgr::instance().getStagingCfg()->getClientClassDictionary(); ASSERT_TRUE(dictionary); - EXPECT_EQ(1, dictionary->getClasses()->size()); + EXPECT_EQ(1U, dictionary->getClasses()->size()); ClientClassDefPtr class_def = dictionary->findClass("foo"); ASSERT_TRUE(class_def); @@ -8274,7 +8274,7 @@ TEST_F(Dhcp4ParserTest, deprecatedClientClassesCheck) { ASSERT_TRUE(network); auto& net_class_list = network->getClientClasses(); - ASSERT_EQ(1, net_class_list.size()); + ASSERT_EQ(1U, net_class_list.size()); auto cclasses = net_class_list.begin(); EXPECT_EQ(*cclasses, "one"); @@ -8283,7 +8283,7 @@ TEST_F(Dhcp4ParserTest, deprecatedClientClassesCheck) { ASSERT_TRUE(subnet); auto& sub_class_list = subnet->getClientClasses(); - ASSERT_EQ(1, sub_class_list.size()); + ASSERT_EQ(1U, sub_class_list.size()); cclasses = sub_class_list.begin(); EXPECT_EQ(*cclasses, "two"); @@ -8291,7 +8291,7 @@ TEST_F(Dhcp4ParserTest, deprecatedClientClassesCheck) { ASSERT_TRUE(pool); auto& pool_class_list = pool->getClientClasses(); - ASSERT_EQ(1, pool_class_list.size()); + ASSERT_EQ(1U, pool_class_list.size()); cclasses = pool_class_list.begin(); EXPECT_EQ(*cclasses, "three"); @@ -8402,13 +8402,13 @@ TEST_F(Dhcp4ParserTest, ddnsTtl) { ASSERT_TRUE(subnet); EXPECT_FALSE(subnet->getDdnsTtl(Network::Inheritance::NONE).unspecified()); - EXPECT_EQ(250, subnet->getDdnsTtl(Network::Inheritance::NONE).get()); + EXPECT_EQ(250U, subnet->getDdnsTtl(Network::Inheritance::NONE).get()); EXPECT_FALSE(subnet->getDdnsTtl(Network::Inheritance::PARENT_NETWORK).unspecified()); - EXPECT_EQ(500, subnet->getDdnsTtl(Network::Inheritance::PARENT_NETWORK).get()); + EXPECT_EQ(500U, subnet->getDdnsTtl(Network::Inheritance::PARENT_NETWORK).get()); EXPECT_FALSE(subnet->getDdnsTtl(Network::Inheritance::GLOBAL).unspecified()); - EXPECT_EQ(750, subnet->getDdnsTtl(Network::Inheritance::GLOBAL).get()); + EXPECT_EQ(750U, subnet->getDdnsTtl(Network::Inheritance::GLOBAL).get()); } // Verifies ddns-ttl-min is supported at global, @@ -8448,13 +8448,13 @@ TEST_F(Dhcp4ParserTest, ddnsTtlMin) { ASSERT_TRUE(subnet); EXPECT_FALSE(subnet->getDdnsTtlMin(Network::Inheritance::NONE).unspecified()); - EXPECT_EQ(250, subnet->getDdnsTtlMin(Network::Inheritance::NONE).get()); + EXPECT_EQ(250U, subnet->getDdnsTtlMin(Network::Inheritance::NONE).get()); EXPECT_FALSE(subnet->getDdnsTtlMin(Network::Inheritance::PARENT_NETWORK).unspecified()); - EXPECT_EQ(500, subnet->getDdnsTtlMin(Network::Inheritance::PARENT_NETWORK).get()); + EXPECT_EQ(500U, subnet->getDdnsTtlMin(Network::Inheritance::PARENT_NETWORK).get()); EXPECT_FALSE(subnet->getDdnsTtlMin(Network::Inheritance::GLOBAL).unspecified()); - EXPECT_EQ(750, subnet->getDdnsTtlMin(Network::Inheritance::GLOBAL).get()); + EXPECT_EQ(750U, subnet->getDdnsTtlMin(Network::Inheritance::GLOBAL).get()); } // Verifies ddns-ttl-max is supported at global, @@ -8494,13 +8494,13 @@ TEST_F(Dhcp4ParserTest, ddnsTtlMax) { ASSERT_TRUE(subnet); EXPECT_FALSE(subnet->getDdnsTtlMax(Network::Inheritance::NONE).unspecified()); - EXPECT_EQ(250, subnet->getDdnsTtlMax(Network::Inheritance::NONE).get()); + EXPECT_EQ(250U, subnet->getDdnsTtlMax(Network::Inheritance::NONE).get()); EXPECT_FALSE(subnet->getDdnsTtlMax(Network::Inheritance::PARENT_NETWORK).unspecified()); - EXPECT_EQ(500, subnet->getDdnsTtlMax(Network::Inheritance::PARENT_NETWORK).get()); + EXPECT_EQ(500U, subnet->getDdnsTtlMax(Network::Inheritance::PARENT_NETWORK).get()); EXPECT_FALSE(subnet->getDdnsTtlMax(Network::Inheritance::GLOBAL).unspecified()); - EXPECT_EQ(750, subnet->getDdnsTtlMax(Network::Inheritance::GLOBAL).get()); + EXPECT_EQ(750U, subnet->getDdnsTtlMax(Network::Inheritance::GLOBAL).get()); } // Verifies that DDNS parameters are supported in pools. @@ -8553,7 +8553,7 @@ TEST_F(Dhcp4ParserTest, poolDdnsParameters) { ASSERT_TRUE(subnet); const PoolCollection pools = subnet->getPools(Lease::TYPE_V4); - ASSERT_GE(pools.size(), 2); + ASSERT_GE(pools.size(), 2U); // First pool specifies all but ddns-ttl. PoolPtr pool = pools.at(0); @@ -8596,10 +8596,10 @@ TEST_F(Dhcp4ParserTest, poolDdnsParameters) { ASSERT_TRUE(pool->getDdnsTtl().unspecified()); ASSERT_FALSE(pool->getDdnsTtlMin().unspecified()); - EXPECT_EQ(pool->getDdnsTtlMin().get(), 200); + EXPECT_EQ(pool->getDdnsTtlMin().get(), 200U); ASSERT_FALSE(pool->getDdnsTtlMax().unspecified()); - EXPECT_EQ(pool->getDdnsTtlMax().get(), 500); + EXPECT_EQ(pool->getDdnsTtlMax().get(), 500U); // Second pool only specifies ddns-ttl. pool = pools.at(1); @@ -8619,7 +8619,7 @@ TEST_F(Dhcp4ParserTest, poolDdnsParameters) { ASSERT_TRUE(pool->getDdnsTtlMin().unspecified()); ASSERT_FALSE(pool->getDdnsTtl().unspecified()); - EXPECT_EQ(pool->getDdnsTtl().get(), 300); + EXPECT_EQ(pool->getDdnsTtl().get(), 300U); ASSERT_TRUE(pool->getDdnsTtlMax().unspecified()); } diff --git a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc index 92fd5ae5f5..356eb92a7b 100644 --- a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc @@ -871,7 +871,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, configSet) { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); @@ -901,7 +901,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, configSet) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); ASSERT_TRUE(def); @@ -939,7 +939,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, configSet) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(2, subnets->size()); + EXPECT_EQ(2U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); @@ -1055,7 +1055,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, configSetLFCRunning) { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); @@ -1089,7 +1089,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, configSetLFCRunning) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); ASSERT_TRUE(def); @@ -1211,7 +1211,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, configSetLFCRunning2) { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); @@ -1245,7 +1245,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, configSetLFCRunning2) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); ASSERT_TRUE(def); @@ -1312,7 +1312,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, configHashGet) { ASSERT_TRUE(hash); ASSERT_EQ(Element::string, hash->getType()); // SHA-256 -> 64 hex digits. - EXPECT_EQ(64, hash->stringValue().size()); + EXPECT_EQ(64U, hash->stringValue().size()); } // Verify that the "config-test" command will do what we expect. @@ -1402,7 +1402,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, configTest) { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Create a config with malformed subnet that should fail to parse. os.str(""); @@ -1428,7 +1428,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, configTest) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Create a valid config with two subnets and no command channel. os.str(""); @@ -1459,7 +1459,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, configTest) { // Check that the config was not applied. subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); @@ -1552,7 +1552,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, statusGet) { ASSERT_NO_THROW(response = Element::fromJSON(response_txt)); ASSERT_TRUE(response); ASSERT_EQ(Element::map, response->getType()); - EXPECT_EQ(2, response->size()); + EXPECT_EQ(2U, response->size()); ConstElementPtr result = response->get("result"); ASSERT_TRUE(result); ASSERT_EQ(Element::integer, result->getType()); @@ -1603,7 +1603,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, statusGet) { ASSERT_NO_THROW(response = Element::fromJSON(response_txt)); ASSERT_TRUE(response); ASSERT_EQ(Element::map, response->getType()); - EXPECT_EQ(2, response->size()); + EXPECT_EQ(2U, response->size()); result = response->get("result"); ASSERT_TRUE(result); ASSERT_EQ(Element::integer, result->getType()); @@ -1644,7 +1644,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, statusGet) { found_queue_stats = arguments->get("packet-queue-statistics"); ASSERT_TRUE(found_queue_stats); ASSERT_EQ(Element::list, found_queue_stats->getType()); - EXPECT_EQ(3, found_queue_stats->size()); + EXPECT_EQ(3U, found_queue_stats->size()); } // Check that status is returned even if LeaseMgr and HostMgr are not created. @@ -1743,7 +1743,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, statusGetSocketsErrors) { ConstElementPtr errors(sockets->get("errors")); ASSERT_TRUE(errors); ASSERT_EQ(Element::list, errors->getType()); - ASSERT_EQ(2, errors->size()); + ASSERT_EQ(2U, errors->size()); ConstElementPtr error(errors->get(0)); ASSERT_TRUE(error); @@ -2208,7 +2208,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, configReloadValid) { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(2, subnets->size()); + EXPECT_EQ(2U, subnets->size()); ::remove("test8.json"); } @@ -2285,7 +2285,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, configReloadDetectInterfaces) { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(2, subnets->size()); + EXPECT_EQ(2U, subnets->size()); ::remove("test8.json"); } diff --git a/src/bin/dhcp4/tests/d2_unittest.cc b/src/bin/dhcp4/tests/d2_unittest.cc index e8ca6cb70a..ca01638532 100644 --- a/src/bin/dhcp4/tests/d2_unittest.cc +++ b/src/bin/dhcp4/tests/d2_unittest.cc @@ -278,21 +278,21 @@ TEST_F(Dhcp4SrvD2Test, simpleUDPSend) { ASSERT_NO_FATAL_FAILURE(configureD2(true)); ASSERT_TRUE(mgr.ddnsEnabled()); ASSERT_NO_THROW(mgr.clearQueue()); - EXPECT_EQ(0, mgr.getQueueSize()); + EXPECT_EQ(0U, mgr.getQueueSize()); ASSERT_NO_THROW(srv_.startD2()); ASSERT_TRUE(mgr.amSending()); // Verify that we can queue up a message. dhcp_ddns::NameChangeRequestPtr ncr = buildTestNcr(); ASSERT_NO_THROW(mgr.sendRequest(ncr)); - EXPECT_EQ(1, mgr.getQueueSize()); + EXPECT_EQ(1U, mgr.getQueueSize()); // Calling receive should detect the ready IO on the sender's select-fd, // and invoke callback, which should complete the send. ASSERT_NO_THROW(IfaceMgr::instance().receive4(0,0)); // Verify the queue is now empty. - EXPECT_EQ(0, mgr.getQueueSize()); + EXPECT_EQ(0U, mgr.getQueueSize()); } // Checks that an IO error in sending a request to D2, results in ddns updates @@ -318,7 +318,7 @@ TEST_F(Dhcp4SrvD2Test, forceUDPSendFailure) { "0.0.0.0", 53001)); ASSERT_TRUE(mgr.ddnsEnabled()); ASSERT_NO_THROW(mgr.clearQueue()); - EXPECT_EQ(0, mgr.getQueueSize()); + EXPECT_EQ(0U, mgr.getQueueSize()); try { srv_.startD2(); } catch (const std::exception& ex) { @@ -333,7 +333,7 @@ TEST_F(Dhcp4SrvD2Test, forceUDPSendFailure) { dhcp_ddns::NameChangeRequestPtr ncr = buildTestNcr(i + 1); ASSERT_NO_THROW(mgr.sendRequest(ncr)); } - EXPECT_EQ(3, mgr.getQueueSize()); + EXPECT_EQ(3U, mgr.getQueueSize()); // Calling receive should detect the ready IO on the sender's select-fd, // and invoke callback, which should complete the send, which should @@ -348,7 +348,7 @@ TEST_F(Dhcp4SrvD2Test, forceUDPSendFailure) { ASSERT_FALSE(mgr.amSending()); // Verify message is still in the queue. - EXPECT_EQ(3, mgr.getQueueSize()); + EXPECT_EQ(3U, mgr.getQueueSize()); // Verify that we can't just restart it. /// @todo This may change if we add ability to resume. @@ -362,7 +362,7 @@ TEST_F(Dhcp4SrvD2Test, forceUDPSendFailure) { ASSERT_TRUE(mgr.amSending()); // Verify message is still in the queue. - EXPECT_EQ(3, mgr.getQueueSize()); + EXPECT_EQ(3U, mgr.getQueueSize()); // This will finish sending the 1st message in queue // and initiate send of 2nd message. @@ -370,7 +370,7 @@ TEST_F(Dhcp4SrvD2Test, forceUDPSendFailure) { EXPECT_EQ(1, srv_.error_count_); // First message is off the queue. - EXPECT_EQ(2, mgr.getQueueSize()); + EXPECT_EQ(2U, mgr.getQueueSize()); mgr.stop(); } @@ -382,13 +382,13 @@ TEST_F(Dhcp4SrvD2Test, queueMaxError) { ASSERT_NO_FATAL_FAILURE(configureD2(true)); ASSERT_TRUE(mgr.ddnsEnabled()); ASSERT_NO_THROW(mgr.clearQueue()); - EXPECT_EQ(0, mgr.getQueueSize()); + EXPECT_EQ(0U, mgr.getQueueSize()); ASSERT_NO_THROW(srv_.startD2()); ASSERT_TRUE(mgr.amSending()); // Attempt to queue more then the maximum allowed. - int max_msgs = mgr.getQueueMaxSize(); - for (int i = 0; i < max_msgs + 1; i++) { + size_t max_msgs = mgr.getQueueMaxSize(); + for (size_t i = 0; i < max_msgs + 1; i++) { dhcp_ddns::NameChangeRequestPtr ncr = buildTestNcr(i + 1); ASSERT_NO_THROW(mgr.sendRequest(ncr)); } diff --git a/src/bin/dhcp4/tests/decline_unittest.cc b/src/bin/dhcp4/tests/decline_unittest.cc index db13b978ce..7a946011b8 100644 --- a/src/bin/dhcp4/tests/decline_unittest.cc +++ b/src/bin/dhcp4/tests/decline_unittest.cc @@ -159,7 +159,7 @@ Dhcpv4SrvTest::acquireAndDecline(Dhcp4Client& client, // Let's get the subnet-id and generate statistics name out of it. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); std::stringstream name; name << "subnet[" << (*subnets->begin())->getID() << "].declined-addresses"; diff --git a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc index 74dc767b1d..f143131381 100644 --- a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc @@ -253,7 +253,7 @@ TEST_F(Dhcpv4SrvTest, adjustIfaceDataRelay) { // We will send response over the same interface which was used to receive // query. EXPECT_EQ("eth1", resp->getIface()); - EXPECT_EQ(ETH1_INDEX, resp->getIndex()); + EXPECT_EQ(static_cast(ETH1_INDEX), resp->getIndex()); // Let's do another test and set other fields: ciaddr and // flags. By doing it, we want to make sure that the relay @@ -346,7 +346,7 @@ TEST_F(Dhcpv4SrvTest, adjustIfaceDataRelayPort) { // We will send response over the same interface which was used to receive // query. EXPECT_EQ("eth1", resp->getIface()); - EXPECT_EQ(ETH1_INDEX, resp->getIndex()); + EXPECT_EQ(static_cast(ETH1_INDEX), resp->getIndex()); } // This test verifies that it is possible to configure the server to use @@ -429,7 +429,7 @@ TEST_F(Dhcpv4SrvTest, adjustIfaceDataUseRouting) { EXPECT_EQ("192.0.2.5", resp->getLocalAddr().toText()); EXPECT_EQ("eth1", resp->getIface()); - EXPECT_EQ(ETH1_INDEX, resp->getIndex()); + EXPECT_EQ(static_cast(ETH1_INDEX), resp->getIndex()); } // This test verifies that the destination address of the response @@ -543,7 +543,7 @@ TEST_F(Dhcpv4SrvTest, adjustIfaceDataRenew) { EXPECT_EQ(DHCP4_SERVER_PORT, resp->getLocalPort()); // The interface data should match the data in the query. EXPECT_EQ("eth1", resp->getIface()); - EXPECT_EQ(ETH1_INDEX, resp->getIndex()); + EXPECT_EQ(static_cast(ETH1_INDEX), resp->getIndex()); } // This test verifies that the destination address of the response message @@ -676,7 +676,7 @@ TEST_F(Dhcpv4SrvTest, adjustIfaceDataSelect) { // The response should be sent via the same interface through which // query has been received. EXPECT_EQ("eth1", resp->getIface()); - EXPECT_EQ(ETH1_INDEX, resp->getIndex()); + EXPECT_EQ(static_cast(ETH1_INDEX), resp->getIndex()); // We also want to test the case when the server has capability to // respond directly to the client which is not configured. Server @@ -810,7 +810,7 @@ TEST_F(Dhcpv4SrvTest, adjustIfaceDataBroadcast) { // The response should be sent via the same interface through which // query has been received. EXPECT_EQ("eth1", resp->getIface()); - EXPECT_EQ(ETH1_INDEX, resp->getIndex()); + EXPECT_EQ(static_cast(ETH1_INDEX), resp->getIndex()); } // This test verifies that the destination address of the response message @@ -900,7 +900,7 @@ TEST_F(Dhcpv4SrvTest, initResponse) { EXPECT_EQ(111, response->getIndex()); EXPECT_TRUE(response->getSiaddr().isV4Zero()); EXPECT_TRUE(response->getCiaddr().isV4Zero()); - EXPECT_EQ(5, response->getHops()); + EXPECT_EQ(5U, response->getHops()); EXPECT_TRUE(hw == *response->getHWAddr()); EXPECT_EQ(IOAddress("10.10.10.10"), response->getGiaddr()); EXPECT_TRUE(src_hw == *response->getLocalHWAddr()); @@ -1835,7 +1835,7 @@ TEST_F(Dhcpv4SrvTest, discoverEchoClientId) { ConstSrvConfigPtr cfg = CfgMgr::instance().getCurrentCfg(); const Subnet4Collection* subnets = cfg->getCfgSubnets4()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); CfgMgr::instance().clear(); CfgMgr::instance().getStagingCfg()->getCfgSubnets4()->add(*subnets->begin()); CfgMgr::instance().getStagingCfg()->setEchoClientId(false); @@ -1984,7 +1984,7 @@ TEST_F(Dhcpv4SrvTest, requestEchoClientId) { ConstSrvConfigPtr cfg = CfgMgr::instance().getCurrentCfg(); const Subnet4Collection* subnets = cfg->getCfgSubnets4()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); CfgMgr::instance().clear(); CfgMgr::instance().getStagingCfg()->getCfgSubnets4()->add(*subnets->begin()); CfgMgr::instance().getStagingCfg()->setEchoClientId(false); @@ -2742,7 +2742,7 @@ Dhcpv4SrvTest::relayAgentInfoEcho() { srv_->run(); // Check that the server did send a response - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Make sure that we received a response Pkt4Ptr offer = srv_->fake_sent_.front(); @@ -2785,7 +2785,7 @@ Dhcpv4SrvTest::badRelayAgentInfoEcho() { srv_->run(); // Check that the server did send a response - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Make sure that we received a response Pkt4Ptr offer = srv_->fake_sent_.front(); @@ -2794,7 +2794,7 @@ Dhcpv4SrvTest::badRelayAgentInfoEcho() { // Get Relay Agent Info from query... OptionPtr rai_query = dis->getOption(DHO_DHCP_AGENT_OPTIONS); ASSERT_TRUE(rai_query); - ASSERT_EQ(2, rai_query->len()); + ASSERT_EQ(2U, rai_query->len()); // Get Relay Agent Info from response... OptionPtr rai_response = offer->getOption(DHO_DHCP_AGENT_OPTIONS); @@ -2806,7 +2806,7 @@ Dhcpv4SrvTest::portsClientPort() { IfaceMgrTestConfig test_config(true); // By default te client port is supposed to be zero. - EXPECT_EQ(0, srv_->client_port_); + EXPECT_EQ(0U, srv_->client_port_); // Use of the captured DHCPDISCOVER packet requires that // subnet 10.254.226.0/24 is in use, because this packet @@ -2831,7 +2831,7 @@ Dhcpv4SrvTest::portsClientPort() { srv_->run(); // Check that the server did send a response - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Make sure that we received a response Pkt4Ptr offer = srv_->fake_sent_.front(); @@ -2846,7 +2846,7 @@ Dhcpv4SrvTest::portsServerPort() { IfaceMgrTestConfig test_config(true); // Do not use DHCP4_SERVER_PORT here as 0 means don't open sockets. - EXPECT_EQ(0, srv_->server_port_); + EXPECT_EQ(0U, srv_->server_port_); // Use of the captured DHCPDISCOVER packet requires that // subnet 10.254.226.0/24 is in use, because this packet @@ -2871,7 +2871,7 @@ Dhcpv4SrvTest::portsServerPort() { srv_->run(); // Check that the server did send a response - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Make sure that we received a response Pkt4Ptr offer = srv_->fake_sent_.front(); @@ -2938,7 +2938,7 @@ Dhcpv4SrvTest::loadConfigFile(const string& path) { IfaceMgrTestConfig test_config(true); // Do not use DHCP4_SERVER_PORT here as 0 means don't open sockets. - EXPECT_EQ(0, srv_->server_port_); + EXPECT_EQ(0U, srv_->server_port_); ConfigBackendDHCPv4Mgr::instance().registerBackendFactory("mysql", [](const db::DatabaseConnection::ParameterMap&) -> ConfigBackendDHCPv4Ptr { @@ -3415,9 +3415,9 @@ TEST_F(Dhcpv4SrvTest, matchClassification) { srv_->classifyPacket(query2); srv_->classifyPacket(query3); - EXPECT_EQ(query1->classes_.size(), 6); - EXPECT_EQ(query2->classes_.size(), 3); - EXPECT_EQ(query3->classes_.size(), 6); + EXPECT_EQ(query1->classes_.size(), 6U); + EXPECT_EQ(query2->classes_.size(), 3U); + EXPECT_EQ(query3->classes_.size(), 6U); EXPECT_TRUE(query1->inClass("ALL")); EXPECT_TRUE(query2->inClass("ALL")); @@ -3640,7 +3640,7 @@ TEST_F(Dhcpv4SrvTest, subnetClassPriority) { ASSERT_GT(opt->len(), opt->getHeaderLen()); // Classification sets the value to true/1, subnet to false/0 // Here subnet has the priority - EXPECT_EQ(0, opt->getUint8()); + EXPECT_EQ(0U, opt->getUint8()); } // Checks subnet options have the priority over global options @@ -3709,7 +3709,7 @@ TEST_F(Dhcpv4SrvTest, subnetGlobalPriority) { ASSERT_GT(opt->len(), opt->getHeaderLen()); // Global sets the value to true/1, subnet to false/0 // Here subnet has the priority - EXPECT_EQ(0, opt->getUint8()); + EXPECT_EQ(0U, opt->getUint8()); } // Checks class options have the priority over global options @@ -4217,7 +4217,7 @@ TEST_F(Dhcpv4SrvTest, privateOption) { // Verifies the content opt32 = boost::dynamic_pointer_cast(opt); ASSERT_TRUE(opt32); - EXPECT_EQ(12345678, opt32->getValue()); + EXPECT_EQ(12345678U, opt32->getValue()); } // Checks that parser errors are non fatal. @@ -4420,7 +4420,7 @@ TEST_F(Dhcpv4SrvTest, relayOverride) { // Let's get the subnet configuration objects const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - ASSERT_EQ(2, subnets->size()); + ASSERT_EQ(2U, subnets->size()); // Let's get them for easy reference Subnet4Ptr subnet1 = *subnets->begin(); @@ -4508,7 +4508,7 @@ TEST_F(Dhcpv4SrvTest, relayOverrideAndClientClass) { const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - ASSERT_EQ(2, subnets->size()); + ASSERT_EQ(2U, subnets->size()); // Let's get them for easy reference Subnet4Ptr subnet1 = *subnets->begin(); @@ -4573,7 +4573,7 @@ TEST_F(Dhcpv4SrvTest, relayLinkSelect) { // Let's get the subnet configuration objects const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - ASSERT_EQ(3, subnets->size()); + ASSERT_EQ(3U, subnets->size()); // Let's get them for easy reference auto subnet_it = subnets->begin(); @@ -4704,7 +4704,7 @@ TEST_F(Dhcpv4SrvTest, relayIgnoreLinkSelect) { // Let's get the subnet configuration objects const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - ASSERT_EQ(3, subnets->size()); + ASSERT_EQ(3U, subnets->size()); // Let's get them for easy reference auto subnet_it = subnets->begin(); @@ -4836,7 +4836,7 @@ TEST_F(Dhcpv4SrvTest, subnetSelect) { // Let's get the subnet configuration objects const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - ASSERT_EQ(3, subnets->size()); + ASSERT_EQ(3U, subnets->size()); // Let's get them for easy reference auto subnet_it = subnets->begin(); @@ -5048,7 +5048,7 @@ TEST_F(Dhcpv4SrvTest, acceptMessageType) { isc::util::encode::decodeHex(invalid_msg_type, bin); pkt.reset(new Pkt4(&bin[0], bin.size())); pkt->unpack(); - ASSERT_EQ(0xff, pkt->getType()); + ASSERT_EQ(0xffU, pkt->getType()); EXPECT_FALSE(srv_->acceptMessageType(pkt)); } @@ -5226,7 +5226,7 @@ TEST_F(Dhcpv4SrvTest, userContext) { ConstSrvConfigPtr cfg = CfgMgr::instance().getCurrentCfg(); const Subnet4Collection* subnets = cfg->getCfgSubnets4()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Let's get the subnet and check its context. Subnet4Ptr subnet1 = *subnets->begin(); @@ -5236,7 +5236,7 @@ TEST_F(Dhcpv4SrvTest, userContext) { // Ok, not get the sole pool in it and check its context, too. PoolCollection pools = subnet1->getPools(Lease::TYPE_V4); - ASSERT_EQ(1, pools.size()); + ASSERT_EQ(1U, pools.size()); ASSERT_TRUE(pools[0]); ASSERT_TRUE(pools[0]->getContext()); EXPECT_EQ("{ \"value\": 42 }", pools[0]->getContext()->str()); @@ -6514,9 +6514,9 @@ TEST_F(Dhcpv4SrvTest, v6OnlyPreferredNoSelectedSubnet) { ASSERT_FALSE(resp); // Should have logged a NAK_0001. - EXPECT_EQ(1, countFile("DHCP4_PACKET_NAK_0001 [hwtype=1 ], cid=[64:65:66:67]," - " tid=0x4d2: failed to select a subnet for incoming packet," - " src 192.0.99.1, type DHCPDISCOVER")); + EXPECT_EQ(1U, countFile("DHCP4_PACKET_NAK_0001 [hwtype=1 ], cid=[64:65:66:67]," + " tid=0x4d2: failed to select a subnet for incoming packet," + " src 192.0.99.1, type DHCPDISCOVER")); } @@ -6920,7 +6920,7 @@ TEST_F(StashAgentOptionTest, hexString) { TEST_F(StashAgentOptionTest, badRelayAgentInfo) { // Set the sub-options entry to truncated RAI content. string content = sub_options_->stringValue(); - ASSERT_LT(2, content.size()); + ASSERT_LT(2U, content.size()); content.resize(content.size() - 2); sub_options_ = Element::create(content); relay_agent_info_->set("sub-options", sub_options_); @@ -6936,7 +6936,7 @@ TEST_F(StashAgentOptionTest, badRelayAgentInfo) { // Set the sub-options entry to invalid RAI content. content = rai_->toHexString(); // length is in the second octet so patch the third hexdigit. - ASSERT_LE(5, content.size()); + ASSERT_LE(5U, content.size()); ASSERT_EQ('4', content[5]); content[5] = '3'; sub_options_ = Element::create(content); diff --git a/src/bin/dhcp4/tests/dhcp4to6_ipc_unittest.cc b/src/bin/dhcp4/tests/dhcp4to6_ipc_unittest.cc index 62a09418b8..56b2b16448 100644 --- a/src/bin/dhcp4/tests/dhcp4to6_ipc_unittest.cc +++ b/src/bin/dhcp4/tests/dhcp4to6_ipc_unittest.cc @@ -228,7 +228,7 @@ TEST_F(Dhcp4to6IpcTest, receive) { Pkt6Ptr pkt6_received = pkt_received->getPkt6(); ASSERT_TRUE(pkt6_received); EXPECT_EQ("eth0", pkt6_received->getIface()); - EXPECT_EQ(ETH0_INDEX, pkt6_received->getIndex()); + EXPECT_EQ(static_cast(ETH0_INDEX), pkt6_received->getIndex()); EXPECT_EQ("2001:db8:1::123", pkt6_received->getRemoteAddr().toText()); // Both DHCP4o6 and encapsulated DHCPv6 packet should have the @@ -355,7 +355,7 @@ TEST_F(Dhcp4to6IpcTest, process) { Pkt6Ptr pkt6_received = pkt_received->getPkt6(); ASSERT_TRUE(pkt6_received); EXPECT_EQ("eth0", pkt6_received->getIface()); - EXPECT_EQ(ETH0_INDEX, pkt6_received->getIndex()); + EXPECT_EQ(static_cast(ETH0_INDEX), pkt6_received->getIndex()); EXPECT_EQ("2001:db8:1::123", pkt6_received->getRemoteAddr().toText()); // Make sure that the message has been processed. @@ -369,7 +369,7 @@ TEST_F(Dhcp4to6IpcTest, process) { ASSERT_TRUE(pkt6_sent); EXPECT_EQ(DHCPV6_DHCPV4_RESPONSE, pkt6_sent->getType()); EXPECT_EQ("eth0", pkt6_sent->getIface()); - EXPECT_EQ(ETH0_INDEX, pkt6_sent->getIndex()); + EXPECT_EQ(static_cast(ETH0_INDEX), pkt6_sent->getIndex()); EXPECT_EQ("2001:db8:1::123", pkt6_sent->getRemoteAddr().toText()); // Both DHCP4o6 and encapsulated DHCPv6 packet should have the @@ -379,7 +379,7 @@ TEST_F(Dhcp4to6IpcTest, process) { // Verify the 4o6 part OptionCollection sent_msgs = pkt6_sent->getOptions(D6O_DHCPV4_MSG); - ASSERT_EQ(1, sent_msgs.size()); + ASSERT_EQ(1U, sent_msgs.size()); OptionPtr sent_msg = sent_msgs.begin()->second; ASSERT_TRUE(sent_msg); const OptionBuffer sent_buf = sent_msg->getData(); diff --git a/src/bin/dhcp4/tests/direct_client_unittest.cc b/src/bin/dhcp4/tests/direct_client_unittest.cc index ff8ecf5d57..e388800ded 100644 --- a/src/bin/dhcp4/tests/direct_client_unittest.cc +++ b/src/bin/dhcp4/tests/direct_client_unittest.cc @@ -256,7 +256,7 @@ DirectClientTest::twoSubnets() { srv_->run(); // Check that the server did send responses. - ASSERT_EQ(2, srv_->fake_sent_.size()); + ASSERT_EQ(2U, srv_->fake_sent_.size()); // In multi-threading responses can be received out of order. Pkt4Ptr offer; @@ -327,7 +327,7 @@ DirectClientTest::oneSubnet() { // Check that the server sent one response for the message received // through eth0. The other client's message should be discarded. - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Check the response. The first Discover was sent via eth0 for which // the subnet has been configured. diff --git a/src/bin/dhcp4/tests/dora_unittest.cc b/src/bin/dhcp4/tests/dora_unittest.cc index 31181492c5..31fa5ad22c 100644 --- a/src/bin/dhcp4/tests/dora_unittest.cc +++ b/src/bin/dhcp4/tests/dora_unittest.cc @@ -3039,8 +3039,8 @@ DORATest::randomAllocation() { allocated_list.push_back(next_client.config_.lease_.addr_); } // Make sure that we have 30 distinct allocations. - ASSERT_EQ(30, allocated_set.size()); - ASSERT_EQ(30, allocated_list.size()); + ASSERT_EQ(30U, allocated_set.size()); + ASSERT_EQ(30U, allocated_list.size()); // Make sure that the addresses are not allocated iteratively. size_t consecutives = 0; @@ -3055,7 +3055,7 @@ DORATest::randomAllocation() { } // Make sure we don't have too many allocations when previously // allocated address is the current address minus one. - EXPECT_LT(consecutives, 10); + EXPECT_LT(consecutives, 10U); } TEST_F(DORATest, randomAllocation) { @@ -3084,7 +3084,7 @@ DORATest::leaseCaching() { ASSERT_NO_THROW(client.getServer()->startD2()); auto& d2_mgr = CfgMgr::instance().getD2ClientMgr(); - ASSERT_EQ(0, d2_mgr.getQueueSize()); + ASSERT_EQ(0U, d2_mgr.getQueueSize()); // Obtain a lease from the server using the 4-way exchange. ASSERT_NO_THROW(client.doDORA()); @@ -3112,10 +3112,10 @@ DORATest::leaseCaching() { checkStat("subnet[2].v4-lease-reuses", 1, 0); // There should be a single NCR. - ASSERT_EQ(1, d2_mgr.getQueueSize()); + ASSERT_EQ(1U, d2_mgr.getQueueSize()); // Clear the NCR queue. ASSERT_NO_THROW(d2_mgr.runReadyIO()); - ASSERT_EQ(0, d2_mgr.getQueueSize()); + ASSERT_EQ(0U, d2_mgr.getQueueSize()); // Assume the client enters init-reboot and does a request. client.setState(Dhcp4Client::INIT_REBOOT); @@ -3144,7 +3144,7 @@ DORATest::leaseCaching() { checkStat("subnet[2].v4-lease-reuses", 1, 0); // There should be no NCRs queued. - ASSERT_EQ(0, d2_mgr.getQueueSize()); + ASSERT_EQ(0U, d2_mgr.getQueueSize()); // Let's say the client suddenly decides to do a full DORA. ASSERT_NO_THROW(client.doDORA()); @@ -3172,7 +3172,7 @@ DORATest::leaseCaching() { checkStat("subnet[2].v4-lease-reuses", 1, 0); // There should be no NCRs queued. - ASSERT_EQ(0, d2_mgr.getQueueSize()); + ASSERT_EQ(0U, d2_mgr.getQueueSize()); // Try to request a different address than the client has. The server // should respond with DHCPNAK. @@ -3200,7 +3200,7 @@ DORATest::leaseCaching() { checkStat("subnet[2].v4-lease-reuses", 1, 0); // There should be no NCRs queued. - ASSERT_EQ(0, d2_mgr.getQueueSize()); + ASSERT_EQ(0U, d2_mgr.getQueueSize()); } TEST_F(DORATest, leaseCaching) { diff --git a/src/bin/dhcp4/tests/fqdn_unittest.cc b/src/bin/dhcp4/tests/fqdn_unittest.cc index 04786e723a..edec01e036 100644 --- a/src/bin/dhcp4/tests/fqdn_unittest.cc +++ b/src/bin/dhcp4/tests/fqdn_unittest.cc @@ -850,7 +850,7 @@ public: EXPECT_EQ("client1.example.com", lease->hostname_); // Verify that an NCR was generated correctly. - ASSERT_EQ(1, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(1U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, resp->getYiaddr().toText(), "client1.example.com.", "", @@ -955,10 +955,10 @@ public: bool exp_fwd = (response_flags & Option4ClientFqdn::FLAG_S); bool exp_rev = (!(response_flags & Option4ClientFqdn::FLAG_N)); if (!exp_fwd && !exp_rev) { - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); } else { // Verify that there is one NameChangeRequest as expected. - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, exp_rev, exp_fwd, reply->getYiaddr().toText(), @@ -1208,7 +1208,7 @@ TEST_F(NameDhcpv4SrvTest, createNameChangeRequestsNewLease) { ASSERT_TRUE(getDdnsParams()->getEnableUpdates()); ASSERT_NO_THROW(srv_->createNameChangeRequests(lease, old_lease, *getDdnsParams())); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "192.0.2.3", "myhost.example.com.", @@ -1228,7 +1228,7 @@ TEST_F(NameDhcpv4SrvTest, noConflictResolution) { subnet_->setDdnsConflictResolutionMode("no-check-with-dhcid"); ASSERT_NO_THROW(srv_->createNameChangeRequests(lease, old_lease, *getDdnsParams())); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "192.0.2.3", "myhost.example.com.", @@ -1355,7 +1355,7 @@ TEST_F(NameDhcpv4SrvTest, processDiscover) { ASSERT_NO_THROW(reply = srv_->processDiscover(req)); checkResponse(reply, DHCPOFFER, 1234); - EXPECT_EQ(0, d2_mgr_.getQueueSize()); + EXPECT_EQ(0U, d2_mgr_.getQueueSize()); } // Test that server generates client's hostname from the IP address assigned @@ -1374,7 +1374,7 @@ TEST_F(NameDhcpv4SrvTest, processRequestFqdnEmptyDomainName) { checkResponse(reply, DHCPACK, 1234); // Verify that there is one NameChangeRequest generated. - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); // The hostname is generated from the IP address acquired (yiaddr). std::string hostname = generatedNameFromAddress(reply->getYiaddr()); @@ -1393,7 +1393,7 @@ TEST_F(NameDhcpv4SrvTest, processRequestFqdnEmptyDomainName) { checkResponse(reply, DHCPACK, 1234); // Verify that there are no NameChangeRequests generated. - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); } // Test that server generates client's hostname from the IP address assigned @@ -1441,7 +1441,7 @@ TEST_F(NameDhcpv4SrvTest, processRequestTopLevelHostname) { checkResponse(reply, DHCPACK, 1234); // Verify that there is one NameChangeRequest generated. - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); // The hostname is generated from the IP address acquired (yiaddr). std::string hostname = generatedNameFromAddress(reply->getYiaddr()); @@ -1471,7 +1471,7 @@ TEST_F(NameDhcpv4SrvTest, processTwoRequestsFqdn) { checkResponse(reply, DHCPACK, 1234); // Verify that there is one NameChangeRequest generated. - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, reply->getYiaddr().toText(), "myhost.example.com.", "00010132E91AA355CFBB753C0F0497A5A940436" @@ -1491,7 +1491,7 @@ TEST_F(NameDhcpv4SrvTest, processTwoRequestsFqdn) { checkResponse(reply, DHCPACK, 1234); // There should be two NameChangeRequests. Verify that they are valid. - ASSERT_EQ(2, d2_mgr_.getQueueSize()); + ASSERT_EQ(2U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_REMOVE, true, true, reply->getYiaddr().toText(), "myhost.example.com.", @@ -1529,7 +1529,7 @@ TEST_F(NameDhcpv4SrvTest, processTwoRequestsHostname) { checkResponse(reply, DHCPACK, 1234); // Verify that there is one NameChangeRequest generated. - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, reply->getYiaddr().toText(), "myhost.example.com.", "00010132E91AA355CFBB753C0F0497A5A940436" @@ -1551,7 +1551,7 @@ TEST_F(NameDhcpv4SrvTest, processTwoRequestsHostname) { checkResponse(reply, DHCPACK, 1234); // There should be two NameChangeRequests. Verify that they are valid. - ASSERT_EQ(2, d2_mgr_.getQueueSize()); + ASSERT_EQ(2U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_REMOVE, true, true, reply->getYiaddr().toText(), "myhost.example.com.", @@ -1585,7 +1585,7 @@ TEST_F(NameDhcpv4SrvTest, processRequestRenewFqdn) { checkResponse(reply, DHCPACK, 1234); // Verify that there is one NameChangeRequest generated. - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, reply->getYiaddr().toText(), "myhost.example.com.", "00010132E91AA355CFBB753C0F0497A5A940436" @@ -1604,7 +1604,7 @@ TEST_F(NameDhcpv4SrvTest, processRequestRenewFqdn) { checkResponse(reply, DHCPACK, 1234); // There should be no NameChangeRequests. - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); } // Test that client may send two requests, each carrying the same hostname @@ -1627,7 +1627,7 @@ TEST_F(NameDhcpv4SrvTest, processRequestRenewHostname) { checkResponse(reply, DHCPACK, 1234); // Verify that there is one NameChangeRequest generated. - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, reply->getYiaddr().toText(), "myhost.example.com.", "00010132E91AA355CFBB753C0F0497A5A940436" @@ -1648,7 +1648,7 @@ TEST_F(NameDhcpv4SrvTest, processRequestRenewHostname) { checkResponse(reply, DHCPACK, 1234); // There should be no NameChangeRequests. - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); } // Test that when a release message is sent for a previously acquired lease, @@ -1674,7 +1674,7 @@ TEST_F(NameDhcpv4SrvTest, processRequestRelease) { checkResponse(reply, DHCPACK, 1234); // Verify that there is one NameChangeRequest generated for lease. - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, reply->getYiaddr().toText(), "myhost.example.com.", "00010132E91AA355CFBB753C0F0497A5A940436" @@ -1691,7 +1691,7 @@ TEST_F(NameDhcpv4SrvTest, processRequestRelease) { // The lease has been removed, so there should be a NameChangeRequest to // remove corresponding DNS entries. - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_REMOVE, true, true, reply->getYiaddr().toText(), "myhost.example.com.", "00010132E91AA355CFBB753C0F0497A5A940436" @@ -1719,7 +1719,7 @@ TEST_F(NameDhcpv4SrvTest, processRequestReleaseNoDelete) { checkResponse(reply, DHCPACK, 1234); // Verify that there is one NameChangeRequest generated for lease. - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, reply->getYiaddr().toText(), "myhost.example.com.", "00010132E91AA355CFBB753C0F0497A5A940436" @@ -1736,7 +1736,7 @@ TEST_F(NameDhcpv4SrvTest, processRequestReleaseNoDelete) { // The lease has been expired, so there should not be a NameChangeRequest to // remove corresponding DNS entries. - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); } // Test that when the Release message is sent for a previously acquired lease @@ -1802,7 +1802,7 @@ TEST_F(NameDhcpv4SrvTest, fqdnReservation) { EXPECT_EQ("unique-host.example.com.", fqdn->getDomainName()); // When receiving DHCPDISCOVER, no NCRs should be generated. - EXPECT_EQ(0, d2_mgr_.getQueueSize()); + EXPECT_EQ(0U, d2_mgr_.getQueueSize()); // Now send the DHCPREQUEST with including the FQDN option. ASSERT_NO_THROW(client.doRequest()); @@ -1821,7 +1821,7 @@ TEST_F(NameDhcpv4SrvTest, fqdnReservation) { // Because this is a new lease, there should be one NCR which adds the // new DNS entry. - ASSERT_EQ(1, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(1U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, resp->getYiaddr().toText(), "unique-host.example.com.", @@ -1860,7 +1860,7 @@ TEST_F(NameDhcpv4SrvTest, fqdnReservation) { // Now there should be two name NCRs. One that removes the previous entry // and the one that adds a new entry for the new hostname. - ASSERT_EQ(2, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(2U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); { SCOPED_TRACE("Verify the correctness of the CHG_REMOVE NCR for the " @@ -1934,7 +1934,7 @@ TEST_F(NameDhcpv4SrvTest, hostnameReservation) { // Because this is a new lease, there should be one NCR which adds the // new DNS entry. - ASSERT_EQ(1, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(1U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); { SCOPED_TRACE("Verify the correctness of the NCR for the" "unique-host.example.com"); @@ -1972,7 +1972,7 @@ TEST_F(NameDhcpv4SrvTest, hostnameReservation) { // Now there should be two name NCRs. One that removes the previous entry // and the one that adds a new entry for the new hostname. - ASSERT_EQ(2, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(2U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); { SCOPED_TRACE("Verify the correctness of the CHG_REMOVE NCR for the " "unique-host.example.com"); @@ -2562,7 +2562,7 @@ TEST_F(NameDhcpv4SrvTest, ddnsScopeTest) { EXPECT_EQ("client1.example.com.", fqdn->getDomainName()); // ddns-send-updates for subnet 1 should be off, so we should NOT have an NRC. - ASSERT_EQ(0, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(0U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); // Now let's try with a client on subnet 2. Dhcp4Client client2(srv_, Dhcp4Client::SELECTING); @@ -2586,7 +2586,7 @@ TEST_F(NameDhcpv4SrvTest, ddnsScopeTest) { EXPECT_EQ("two.example.com.", fqdn->getDomainName()); // ddns-send-updates for subnet 2 are enabled, verify the NCR is correct. - ASSERT_EQ(1, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(1U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, resp->getYiaddr().toText(), "two.example.com.", "", @@ -2680,9 +2680,9 @@ TEST_F(NameDhcpv4SrvTest, processReuseExpired) { // Verify that there is one NameChangeRequest generated. if (scenario.hostname1_.empty()) { - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); } else { - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, resp->getYiaddr().toText(), scenario.hostname1_, @@ -2778,7 +2778,7 @@ TEST_F(NameDhcpv4SrvTest, ddnsSharedNetworkTest) { EXPECT_EQ("client1.one.example.com", lease->hostname_); // Verify that an NCR was generated correctly. - ASSERT_EQ(1, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(1U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, resp->getYiaddr().toText(), "client1.one.example.com.", "", @@ -2803,7 +2803,7 @@ TEST_F(NameDhcpv4SrvTest, ddnsSharedNetworkTest) { EXPECT_EQ("client2.two.example.com", hostname->getValue()); // Verify the NCR is there and correct. - ASSERT_EQ(1, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(1U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, resp->getYiaddr().toText(), "client2.two.example.com.", "", @@ -2862,7 +2862,7 @@ TEST_F(NameDhcpv4SrvTest, withOfferLifetime) { EXPECT_EQ("client-name.example.com.", fqdn->getDomainName()); // When receiving DHCPDISCOVER, no NCRs should be generated. - EXPECT_EQ(0, d2_mgr_.getQueueSize()); + EXPECT_EQ(0U, d2_mgr_.getQueueSize()); // Make sure the lease was created with offer-lifetime, fqdn flags = false, // and the FQDN. @@ -2895,7 +2895,7 @@ TEST_F(NameDhcpv4SrvTest, withOfferLifetime) { EXPECT_EQ("client-name.example.com.", fqdn->getDomainName()); // There should be one NCR which adds the new DNS entry. - ASSERT_EQ(1, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(1U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, resp->getYiaddr().toText(), "client-name.example.com.", @@ -2949,7 +2949,7 @@ TEST_F(NameDhcpv4SrvTest, withDdnsTtlPercent) { EXPECT_EQ("client1.example.com", lease->hostname_); // Verify that an NCR was generated correctly. - ASSERT_EQ(1, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(1U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, resp->getYiaddr().toText(), "client1.example.com.", "", @@ -2967,7 +2967,7 @@ TEST_F(NameDhcpv4SrvTest, checkWithDHCIDConflictResolutionMode) { subnet_->setDdnsConflictResolutionMode("check-with-dhcid"); ASSERT_NO_THROW(srv_->createNameChangeRequests(lease, old_lease, *getDdnsParams())); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "192.0.2.3", "myhost.example.com.", @@ -2987,7 +2987,7 @@ TEST_F(NameDhcpv4SrvTest, noCheckWithDHCIDConflictResolutionMode) { subnet_->setDdnsConflictResolutionMode("no-check-with-dhcid"); ASSERT_NO_THROW(srv_->createNameChangeRequests(lease, old_lease, *getDdnsParams())); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "192.0.2.3", "myhost.example.com.", @@ -3007,7 +3007,7 @@ TEST_F(NameDhcpv4SrvTest, noCheckWithoutDHCIDConflictResolutionMode) { subnet_->setDdnsConflictResolutionMode("no-check-without-dhcid"); ASSERT_NO_THROW(srv_->createNameChangeRequests(lease, old_lease, *getDdnsParams())); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "192.0.2.3", "myhost.example.com.", @@ -3027,7 +3027,7 @@ TEST_F(NameDhcpv4SrvTest, checkExistsDHCIDConflictResolutionMode) { subnet_->setDdnsConflictResolutionMode("check-exists-with-dhcid"); ASSERT_NO_THROW(srv_->createNameChangeRequests(lease, old_lease, *getDdnsParams())); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "192.0.2.3", "myhost.example.com.", @@ -3169,9 +3169,9 @@ TEST_F(NameDhcpv4SrvTest, poolDdnsParametersTest) { // Verify the NCR if we expect one. if (!scenario.expect_ncr_) { - ASSERT_EQ(0, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(0U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); } else { - ASSERT_EQ(1, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(1U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, resp->getYiaddr().toText(), (scenario.expected_hostname_ + "."), "", @@ -3200,7 +3200,7 @@ TEST_F(NameDhcpv4SrvTest, hostnameScrubbedEmpty) { // Should have logged that it was scrubbed empty. std::string log = "DHCP4_CLIENT_HOSTNAME_SCRUBBED_EMPTY"; - EXPECT_EQ(1, countFile(log)); + EXPECT_EQ(1U, countFile(log)); // Hostname should not be in the response. ASSERT_FALSE(resp->getOption(DHO_HOST_NAME)); @@ -3226,7 +3226,7 @@ TEST_F(NameDhcpv4SrvTest, fqdnScrubbedEmpty) { // Should have logged that it was scrubbed empty. std::string log = "DHCP4_CLIENT_FQDN_SCRUBBED_EMPTY"; - EXPECT_EQ(1, countFile(log)); + EXPECT_EQ(1U, countFile(log)); // Hostname should not be in the response. ASSERT_FALSE(resp->getOption(DHO_FQDN)); diff --git a/src/bin/dhcp4/tests/hooks_unittest.cc b/src/bin/dhcp4/tests/hooks_unittest.cc index 6780eefdc2..b96e760b6f 100644 --- a/src/bin/dhcp4/tests/hooks_unittest.cc +++ b/src/bin/dhcp4/tests/hooks_unittest.cc @@ -1311,7 +1311,7 @@ TEST_F(HooksDhcpv4SrvTest, buffer4ReceiveValueChange) { srv_->run(); // Check that the server did send a response - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Make sure that we received a response Pkt4Ptr offer = srv_->fake_sent_.front(); @@ -1324,7 +1324,7 @@ TEST_F(HooksDhcpv4SrvTest, buffer4ReceiveValueChange) { // ... and check if it is the modified value ASSERT_FALSE(hwaddr->hwaddr_.empty()); // there must be a MAC address - EXPECT_EQ(0xff, hwaddr->hwaddr_[0]); // check that its first byte was modified + EXPECT_EQ(0xffU, hwaddr->hwaddr_[0]); // check that its first byte was modified // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(discover); @@ -1353,7 +1353,7 @@ TEST_F(HooksDhcpv4SrvTest, buffer4ReceiveSkip) { srv_->run(); // Check that the server dropped the packet and did not produce any response - ASSERT_EQ(0, srv_->fake_sent_.size()); + ASSERT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(discover); @@ -1382,13 +1382,13 @@ TEST_F(HooksDhcpv4SrvTest, buffer4ReceiveDrop) { srv_->run(); // Check that the server dropped the packet and did not produce any response - ASSERT_EQ(0, srv_->fake_sent_.size()); + ASSERT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(discover); // Drop statistics should be maintained by the callouts, not by the server. - EXPECT_EQ(0, getStatistic("pkt4-receive-drop")); + EXPECT_EQ(0U, getStatistic("pkt4-receive-drop")); } // Checks if callouts installed on pkt4_receive are indeed called and the @@ -1458,7 +1458,7 @@ TEST_F(HooksDhcpv4SrvTest, pkt4ReceiveValueChange) { srv_->run(); // Check that the server did send a response - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Make sure that we received a response Pkt4Ptr adv = srv_->fake_sent_.front(); @@ -1499,7 +1499,7 @@ TEST_F(HooksDhcpv4SrvTest, pkt4ReceiveDeleteClientId) { srv_->run(); // Check that the server dropped the packet and did not send a response - ASSERT_EQ(0, srv_->fake_sent_.size()); + ASSERT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(discover); @@ -1528,7 +1528,7 @@ TEST_F(HooksDhcpv4SrvTest, pkt4ReceiveSkip) { srv_->run(); // Check that the server dropped the packet and did not produce any response - ASSERT_EQ(0, srv_->fake_sent_.size()); + ASSERT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(discover); @@ -1557,13 +1557,13 @@ TEST_F(HooksDhcpv4SrvTest, pkt4ReceiveDrop) { srv_->run(); // Check that the server dropped the packet and did not produce any response - ASSERT_EQ(0, srv_->fake_sent_.size()); + ASSERT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(discover); // Drop statistics should be maintained by the callouts, not by the server. - EXPECT_EQ(0, getStatistic("pkt4-receive-drop")); + EXPECT_EQ(0U, getStatistic("pkt4-receive-drop")); } // Checks if callouts installed on pkt4_send are indeed called and the @@ -1592,7 +1592,7 @@ TEST_F(HooksDhcpv4SrvTest, pkt4SendSimple) { EXPECT_EQ("pkt4_send", callback_name_); // Check that there is one packet sent - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); Pkt4Ptr adv = srv_->fake_sent_.front(); // Check that pkt4 argument passing was successful and returned proper @@ -1650,7 +1650,7 @@ TEST_F(HooksDhcpv4SrvTest, pkt4SendValueChange) { srv_->run(); // Check that the server did send a response - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Make sure that we received a response Pkt4Ptr adv = srv_->fake_sent_.front(); @@ -1692,7 +1692,7 @@ TEST_F(HooksDhcpv4SrvTest, pkt4SendDeleteServerId) { srv_->run(); // Check that the server indeed sent a malformed ADVERTISE - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Get that ADVERTISE Pkt4Ptr adv = srv_->fake_sent_.front(); @@ -1728,14 +1728,14 @@ TEST_F(HooksDhcpv4SrvTest, pkt4SendSkip) { srv_->run(); // Check that the server sent the packet - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Get the first packet and check that it has zero length (i.e. the server // did not do packing on its own) Pkt4Ptr sent = srv_->fake_sent_.front(); // The actual size of sent packet should be 0 - EXPECT_EQ(0, sent->getBuffer().getLength()); + EXPECT_EQ(0U, sent->getBuffer().getLength()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(discover); @@ -1764,7 +1764,7 @@ TEST_F(HooksDhcpv4SrvTest, pkt4SendDrop) { srv_->run(); // Check that the server does not send the packet - EXPECT_EQ(0, srv_->fake_sent_.size()); + EXPECT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(discover); @@ -1796,7 +1796,7 @@ TEST_F(HooksDhcpv4SrvTest, buffer4SendSimple) { EXPECT_EQ("buffer4_send", callback_name_); // Check that there is one packet sent - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); Pkt4Ptr adv = srv_->fake_sent_.front(); // Check that pkt4 argument passing was successful and returned proper value @@ -1837,7 +1837,7 @@ TEST_F(HooksDhcpv4SrvTest, buffer4SendChange) { srv_->run(); // Check that there is one packet sent - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); Pkt4Ptr adv = srv_->fake_sent_.front(); // The callout is supposed to fill the output buffer with dummyFile content @@ -1874,7 +1874,7 @@ TEST_F(HooksDhcpv4SrvTest, buffer4SendSkip) { EXPECT_EQ("buffer4_send", callback_name_); // Check that there is no packet sent. - ASSERT_EQ(0, srv_->fake_sent_.size()); + ASSERT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(discover); @@ -1906,7 +1906,7 @@ TEST_F(HooksDhcpv4SrvTest, buffer4SendDrop) { EXPECT_EQ("buffer4_send", callback_name_); // Check that there is no packet sent - EXPECT_EQ(0, srv_->fake_sent_.size()); + EXPECT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(discover); @@ -1984,7 +1984,7 @@ TEST_F(HooksDhcpv4SrvTest, subnet4SelectSimple) { // Server is supposed to report two subnets ASSERT_EQ(exp_subnets->size(), callback_subnet4collection_->size()); - ASSERT_GE(exp_subnets->size(), 2); + ASSERT_GE(exp_subnets->size(), 2U); // Compare that the available subnets are reported as expected EXPECT_TRUE((*exp_subnets->begin())->get() == (*callback_subnet4collection_->begin())->get()); @@ -2059,7 +2059,7 @@ TEST_F(HooksDhcpv4SrvTest, subnet4SelectChange) { // Get all subnets and use second subnet for verification const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - ASSERT_EQ(2, subnets->size()); + ASSERT_EQ(2U, subnets->size()); // Advertised address must belong to the second pool (in subnet's range, // in dynamic pool) @@ -2094,13 +2094,13 @@ TEST_F(HooksDhcpv4SrvTest, subnet4SelectDrop) { srv_->run(); // Check that the server dropped the packet and did not produce any response - ASSERT_EQ(0, srv_->fake_sent_.size()); + ASSERT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(discover); // Drop statistics should be maintained by the callouts, not by the server. - EXPECT_EQ(0, getStatistic("pkt4-receive-drop")); + EXPECT_EQ(0U, getStatistic("pkt4-receive-drop")); } // This test verifies that the leases4_committed hook point is not triggered @@ -2738,7 +2738,7 @@ TEST_F(HooksDhcpv4SrvTest, lease4ReleaseSimple) { // Try to get the lease by hardware address Lease4Collection leases = LeaseMgrFactory::instance().getLease4(*hw); - EXPECT_EQ(leases.size(), 0); + EXPECT_EQ(leases.size(), 0U); // Try to get it by hw/subnet_id combination l = LeaseMgrFactory::instance().getLease4(*hw, subnet_->getID()); @@ -2746,7 +2746,7 @@ TEST_F(HooksDhcpv4SrvTest, lease4ReleaseSimple) { // Try by client-id leases = LeaseMgrFactory::instance().getLease4(*client_id_); - EXPECT_EQ(leases.size(), 0); + EXPECT_EQ(leases.size(), 0U); // Try by client-id/subnet-id l = LeaseMgrFactory::instance().getLease4(*client_id_, subnet_->getID()); @@ -2825,7 +2825,7 @@ TEST_F(HooksDhcpv4SrvTest, lease4ReleaseSimpleInfiniteLease) { // Try to get the lease by hardware address Lease4Collection leases = LeaseMgrFactory::instance().getLease4(*hw); - EXPECT_EQ(leases.size(), 0); + EXPECT_EQ(leases.size(), 0U); // Try to get it by hw/subnet_id combination l = LeaseMgrFactory::instance().getLease4(*hw, subnet_->getID()); @@ -2833,7 +2833,7 @@ TEST_F(HooksDhcpv4SrvTest, lease4ReleaseSimpleInfiniteLease) { // Try by client-id leases = LeaseMgrFactory::instance().getLease4(*client_id_); - EXPECT_EQ(leases.size(), 0); + EXPECT_EQ(leases.size(), 0U); // Try by client-id/subnet-id l = LeaseMgrFactory::instance().getLease4(*client_id_, subnet_->getID()); @@ -2911,7 +2911,7 @@ TEST_F(HooksDhcpv4SrvTest, lease4ReleaseSimpleNoDelete) { // Try to get the lease by hardware address Lease4Collection leases = LeaseMgrFactory::instance().getLease4(*hw); - EXPECT_EQ(leases.size(), 1); + EXPECT_EQ(leases.size(), 1U); // Try to get it by hw/subnet_id combination l = LeaseMgrFactory::instance().getLease4(*hw, subnet_->getID()); @@ -2919,7 +2919,7 @@ TEST_F(HooksDhcpv4SrvTest, lease4ReleaseSimpleNoDelete) { // Try by client-id leases = LeaseMgrFactory::instance().getLease4(*client_id_); - EXPECT_EQ(leases.size(), 1); + EXPECT_EQ(leases.size(), 1U); // Try by client-id/subnet-id l = LeaseMgrFactory::instance().getLease4(*client_id_, subnet_->getID()); @@ -3002,11 +3002,11 @@ TEST_F(HooksDhcpv4SrvTest, lease4ReleaseSkip) { // Try to get the lease by hardware address, should succeed Lease4Collection leases = LeaseMgrFactory::instance().getLease4(*hw); - EXPECT_EQ(leases.size(), 1); + EXPECT_EQ(leases.size(), 1U); // Try by client-id, should be successful as well. leases = LeaseMgrFactory::instance().getLease4(*client_id_); - EXPECT_EQ(leases.size(), 1); + EXPECT_EQ(leases.size(), 1U); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(rel); @@ -3066,11 +3066,11 @@ TEST_F(HooksDhcpv4SrvTest, lease4ReleaseDrop) { // Try to get the lease by hardware address, should succeed Lease4Collection leases = LeaseMgrFactory::instance().getLease4(*hw); - EXPECT_EQ(leases.size(), 1); + EXPECT_EQ(leases.size(), 1U); // Try by client-id, should be successful as well. leases = LeaseMgrFactory::instance().getLease4(*client_id_); - EXPECT_EQ(leases.size(), 1); + EXPECT_EQ(leases.size(), 1U); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(rel); @@ -3287,7 +3287,7 @@ TEST_F(HooksDhcpv4SrvTest, host4Identifier) { srv_->run(); // check that the server did send a response - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Make sure that we received a response Pkt4Ptr adv = srv_->fake_sent_.front(); @@ -3359,7 +3359,7 @@ TEST_F(HooksDhcpv4SrvTest, host4IdentifierHWAddr) { srv_->run(); // check that the server did send a response - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Make sure that we received a response Pkt4Ptr adv = srv_->fake_sent_.front(); @@ -3588,8 +3588,8 @@ TEST_F(HooksDhcpv4SrvTest, leases4ParkedPacketLimit) { "leases4_committed", leases4_committed_park_callout)); // Statistic should not show any drops. - EXPECT_EQ(0, getStatistic("pkt4-queue-full")); - EXPECT_EQ(0, getStatistic("pkt4-receive-drop")); + EXPECT_EQ(0U, getStatistic("pkt4-queue-full")); + EXPECT_EQ(0U, getStatistic("pkt4-receive-drop")); // Create a client and initiate a DORA cycle for it. Dhcp4Client client(srv_, Dhcp4Client::SELECTING); @@ -3606,7 +3606,7 @@ TEST_F(HooksDhcpv4SrvTest, leases4ParkedPacketLimit) { // Verify we have a packet parked. auto const& parking_lot = ServerHooks::getServerHooks().getParkingLotPtr("leases4_committed"); ASSERT_TRUE(parking_lot); - ASSERT_EQ(1, parking_lot->size()); + ASSERT_EQ(1U, parking_lot->size()); // Clear callout buffers. resetCalloutBuffers(); @@ -3626,11 +3626,11 @@ TEST_F(HooksDhcpv4SrvTest, leases4ParkedPacketLimit) { ASSERT_FALSE(client2.getContext().response_); // Verify we have not parked another packet. - ASSERT_EQ(1, parking_lot->size()); + ASSERT_EQ(1U, parking_lot->size()); // Statistic should show one drop. - EXPECT_EQ(1, getStatistic("pkt4-queue-full")); - EXPECT_EQ(1, getStatistic("pkt4-receive-drop")); + EXPECT_EQ(1U, getStatistic("pkt4-queue-full")); + EXPECT_EQ(1U, getStatistic("pkt4-receive-drop")); // Invoking poll should run the scheduled action only for // the first client. @@ -3644,7 +3644,7 @@ TEST_F(HooksDhcpv4SrvTest, leases4ParkedPacketLimit) { EXPECT_EQ("192.0.2.100", rsp->getYiaddr().toText()); // Verify we have no parked packets. - ASSERT_EQ(0, parking_lot->size()); + ASSERT_EQ(0U, parking_lot->size()); resetCalloutBuffers(); @@ -3658,7 +3658,7 @@ TEST_F(HooksDhcpv4SrvTest, leases4ParkedPacketLimit) { ASSERT_FALSE(client2.getContext().response_); // Verify we parked the packet. - ASSERT_EQ(1, parking_lot->size()); + ASSERT_EQ(1U, parking_lot->size()); // Invoking poll should run the scheduled action. ASSERT_NO_THROW(io_service_->poll()); @@ -3671,11 +3671,11 @@ TEST_F(HooksDhcpv4SrvTest, leases4ParkedPacketLimit) { EXPECT_EQ("192.0.2.101", rsp->getYiaddr().toText()); // Verify we have no parked packets. - ASSERT_EQ(0, parking_lot->size()); + ASSERT_EQ(0U, parking_lot->size()); // Statistic should still show one drop. - EXPECT_EQ(1, getStatistic("pkt4-queue-full")); - EXPECT_EQ(1, getStatistic("pkt4-receive-drop")); + EXPECT_EQ(1U, getStatistic("pkt4-queue-full")); + EXPECT_EQ(1U, getStatistic("pkt4-receive-drop")); } // This test verifies that the lease4_offer hook point is triggered @@ -3955,8 +3955,8 @@ TEST_F(HooksDhcpv4SrvTest, lease4OfferParkedPacketLimit) { "lease4_offer", lease4_offer_park_callout)); // Statistic should not show any drops. - EXPECT_EQ(0, getStatistic("pkt4-queue-full")); - EXPECT_EQ(0, getStatistic("pkt4-receive-drop")); + EXPECT_EQ(0U, getStatistic("pkt4-queue-full")); + EXPECT_EQ(0U, getStatistic("pkt4-receive-drop")); // Create a client and initiate a DORA cycle for it. Dhcp4Client client(srv_, Dhcp4Client::SELECTING); @@ -3973,7 +3973,7 @@ TEST_F(HooksDhcpv4SrvTest, lease4OfferParkedPacketLimit) { // Verify we have a packet parked. auto const& parking_lot = ServerHooks::getServerHooks().getParkingLotPtr("lease4_offer"); ASSERT_TRUE(parking_lot); - ASSERT_EQ(1, parking_lot->size()); + ASSERT_EQ(1U, parking_lot->size()); // Clear callout buffers. resetCalloutBuffers(); @@ -3993,11 +3993,11 @@ TEST_F(HooksDhcpv4SrvTest, lease4OfferParkedPacketLimit) { ASSERT_FALSE(client2.getContext().response_); // Verify we have not parked another packet. - ASSERT_EQ(1, parking_lot->size()); + ASSERT_EQ(1U, parking_lot->size()); // Statistic should show one drop. - EXPECT_EQ(1, getStatistic("pkt4-queue-full")); - EXPECT_EQ(1, getStatistic("pkt4-receive-drop")); + EXPECT_EQ(1U, getStatistic("pkt4-queue-full")); + EXPECT_EQ(1U, getStatistic("pkt4-receive-drop")); // Invoking poll should run the scheduled action only for // the first client. @@ -4011,7 +4011,7 @@ TEST_F(HooksDhcpv4SrvTest, lease4OfferParkedPacketLimit) { EXPECT_EQ("192.0.2.100", rsp->getYiaddr().toText()); // Verify we have no parked packets. - ASSERT_EQ(0, parking_lot->size()); + ASSERT_EQ(0U, parking_lot->size()); resetCalloutBuffers(); @@ -4025,7 +4025,7 @@ TEST_F(HooksDhcpv4SrvTest, lease4OfferParkedPacketLimit) { ASSERT_FALSE(client2.getContext().response_); // Verify we parked the packet. - ASSERT_EQ(1, parking_lot->size()); + ASSERT_EQ(1U, parking_lot->size()); // Invoking poll should run the scheduled action. ASSERT_NO_THROW(io_service_->poll()); @@ -4038,11 +4038,11 @@ TEST_F(HooksDhcpv4SrvTest, lease4OfferParkedPacketLimit) { EXPECT_EQ("192.0.2.101", rsp->getYiaddr().toText()); // Verify we have no parked packets. - ASSERT_EQ(0, parking_lot->size()); + ASSERT_EQ(0U, parking_lot->size()); // Statistic should still show one drop. - EXPECT_EQ(1, getStatistic("pkt4-queue-full")); - EXPECT_EQ(1, getStatistic("pkt4-receive-drop")); + EXPECT_EQ(1U, getStatistic("pkt4-queue-full")); + EXPECT_EQ(1U, getStatistic("pkt4-receive-drop")); } // This test verifies that a lease4_offer callout that marks a @@ -4277,7 +4277,7 @@ TEST_F(HooksDhcpv4SrvTest, ddns4Update) { // Verify the subnet. ASSERT_TRUE(callback_subnet4_); - EXPECT_EQ(1, callback_subnet4_->getID()); + EXPECT_EQ(1U, callback_subnet4_->getID()); // Verify the hostname. EXPECT_EQ("client-name.example.com.", callback_hostname_); diff --git a/src/bin/dhcp4/tests/host_options_unittest.cc b/src/bin/dhcp4/tests/host_options_unittest.cc index 42a6e35826..35ea2543e8 100644 --- a/src/bin/dhcp4/tests/host_options_unittest.cc +++ b/src/bin/dhcp4/tests/host_options_unittest.cc @@ -318,19 +318,19 @@ HostOptionsTest::testOverrideRequestedOptions(const bool stateless) { ASSERT_EQ("10.0.0.7", client.config_.lease_.addr_.toText()); } - ASSERT_EQ(2, client.config_.routers_.size()); + ASSERT_EQ(2U, client.config_.routers_.size()); EXPECT_EQ("10.0.0.200", client.config_.routers_[0].toText()); EXPECT_EQ("10.0.0.201", client.config_.routers_[1].toText()); // Make sure that the DNS Servers option has been received. - ASSERT_EQ(2, client.config_.dns_servers_.size()); + ASSERT_EQ(2U, client.config_.dns_servers_.size()); EXPECT_EQ("10.0.0.202", client.config_.dns_servers_[0].toText()); EXPECT_EQ("10.0.0.203", client.config_.dns_servers_[1].toText()); // Make sure that the Quotes Servers option has been received. - ASSERT_EQ(2, client.config_.quotes_servers_.size()); + ASSERT_EQ(2U, client.config_.quotes_servers_.size()); EXPECT_EQ("10.1.1.202", client.config_.quotes_servers_[0].toText()); EXPECT_EQ("10.1.1.203", client.config_.quotes_servers_[1].toText()); // Make sure that the Log Servers option has been received. - ASSERT_EQ(2, client.config_.log_servers_.size()); + ASSERT_EQ(2U, client.config_.log_servers_.size()); EXPECT_EQ("10.1.1.200", client.config_.log_servers_[0].toText()); EXPECT_EQ("10.1.1.201", client.config_.log_servers_[1].toText()); } @@ -373,19 +373,19 @@ HostOptionsTest::testOverrideDefaultOptions(const bool stateless) { ASSERT_EQ("10.0.0.7", client.config_.lease_.addr_.toText()); } - ASSERT_EQ(2, client.config_.routers_.size()); + ASSERT_EQ(2U, client.config_.routers_.size()); EXPECT_EQ("10.1.1.200", client.config_.routers_[0].toText()); EXPECT_EQ("10.1.1.201", client.config_.routers_[1].toText()); // Make sure that the DNS Servers option has been received. - ASSERT_EQ(2, client.config_.dns_servers_.size()); + ASSERT_EQ(2U, client.config_.dns_servers_.size()); EXPECT_EQ("10.1.1.202", client.config_.dns_servers_[0].toText()); EXPECT_EQ("10.1.1.203", client.config_.dns_servers_[1].toText()); // Make sure that the Quotes Servers option has been received. - ASSERT_EQ(2, client.config_.quotes_servers_.size()); + ASSERT_EQ(2U, client.config_.quotes_servers_.size()); EXPECT_EQ("10.0.0.206", client.config_.quotes_servers_[0].toText()); EXPECT_EQ("10.0.0.207", client.config_.quotes_servers_[1].toText()); // Make sure that the Log Servers option has been received. - ASSERT_EQ(2, client.config_.log_servers_.size()); + ASSERT_EQ(2U, client.config_.log_servers_.size()); EXPECT_EQ("10.0.0.204", client.config_.log_servers_[0].toText()); EXPECT_EQ("10.0.0.205", client.config_.log_servers_[1].toText()); } @@ -424,17 +424,17 @@ HostOptionsTest::testHostOnlyOptions(const bool stateless) { } // Make sure that the Routers options has been received. - ASSERT_EQ(2, client.config_.routers_.size()); + ASSERT_EQ(2U, client.config_.routers_.size()); EXPECT_EQ("10.1.1.200", client.config_.routers_[0].toText()); EXPECT_EQ("10.1.1.201", client.config_.routers_[1].toText()); // Make sure that the Quotes Servers option has been received. - ASSERT_EQ(2, client.config_.quotes_servers_.size()); + ASSERT_EQ(2U, client.config_.quotes_servers_.size()); EXPECT_EQ("10.1.1.206", client.config_.quotes_servers_[0].toText()); EXPECT_EQ("10.1.1.207", client.config_.quotes_servers_[1].toText()); // Other options are not configured and should not be delivered. - EXPECT_EQ(0, client.config_.dns_servers_.size()); - EXPECT_EQ(0, client.config_.log_servers_.size()); + EXPECT_EQ(0U, client.config_.dns_servers_.size()); + EXPECT_EQ(0U, client.config_.log_servers_.size()); } void @@ -480,7 +480,7 @@ HostOptionsTest::testOverrideVendorOptions(const bool stateless) { // Make sure the server has responded with a V-I Vendor Specific // Information option with exactly one suboption. - ASSERT_EQ(1, client.config_.vendor_suboptions_.size()); + ASSERT_EQ(1U, client.config_.vendor_suboptions_.size()); // Assume this suboption is a TFTP servers suboption. std::multimap::const_iterator opt = client.config_.vendor_suboptions_.find(DOCSIS3_V4_TFTP_SERVERS); @@ -490,7 +490,7 @@ HostOptionsTest::testOverrideVendorOptions(const bool stateless) { ASSERT_TRUE(opt_tftp); // TFTP servers suboption should contain addresses specified on host level. const Option4AddrLst::AddressContainer& tftps = opt_tftp->getAddresses(); - ASSERT_EQ(2, tftps.size()); + ASSERT_EQ(2U, tftps.size()); EXPECT_EQ("10.1.1.202", tftps[0].toText()); EXPECT_EQ("10.1.1.203", tftps[1].toText()); } diff --git a/src/bin/dhcp4/tests/http_control_socket_unittest.cc b/src/bin/dhcp4/tests/http_control_socket_unittest.cc index a5357fe36a..13ecc204ee 100644 --- a/src/bin/dhcp4/tests/http_control_socket_unittest.cc +++ b/src/bin/dhcp4/tests/http_control_socket_unittest.cc @@ -417,7 +417,7 @@ public: // Errors can be in a list. if (rsp->getType() == Element::list) { - ASSERT_EQ(1, rsp->size()); + ASSERT_EQ(1U, rsp->size()); rsp = rsp->get(0); } @@ -1191,7 +1191,7 @@ TEST_F(HttpCtrlChannelDhcpv4Test, configSet) { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); @@ -1220,7 +1220,7 @@ TEST_F(HttpCtrlChannelDhcpv4Test, configSet) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); ASSERT_TRUE(def); @@ -1254,7 +1254,7 @@ TEST_F(HttpCtrlChannelDhcpv4Test, configSet) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(2, subnets->size()); + EXPECT_EQ(2U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); @@ -1360,7 +1360,7 @@ TEST_F(HttpCtrlChannelDhcpv4Test, configSetLFCRunning) { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); @@ -1397,7 +1397,7 @@ TEST_F(HttpCtrlChannelDhcpv4Test, configSetLFCRunning) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); ASSERT_TRUE(def); @@ -1509,7 +1509,7 @@ TEST_F(HttpCtrlChannelDhcpv4Test, configSetLFCRunning2) { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); @@ -1546,7 +1546,7 @@ TEST_F(HttpCtrlChannelDhcpv4Test, configSetLFCRunning2) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); ASSERT_TRUE(def); @@ -1670,7 +1670,7 @@ TEST_F(HttpsCtrlChannelDhcpv4Test, configSet) { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); @@ -1703,7 +1703,7 @@ TEST_F(HttpsCtrlChannelDhcpv4Test, configSet) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); ASSERT_TRUE(def); @@ -1737,7 +1737,7 @@ TEST_F(HttpsCtrlChannelDhcpv4Test, configSet) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(2, subnets->size()); + EXPECT_EQ(2U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); @@ -1855,7 +1855,7 @@ TEST_F(HttpsCtrlChannelDhcpv4Test, configSetLFCRunning) { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); @@ -1889,7 +1889,7 @@ TEST_F(HttpsCtrlChannelDhcpv4Test, configSetLFCRunning) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); ASSERT_TRUE(def); @@ -2013,7 +2013,7 @@ TEST_F(HttpsCtrlChannelDhcpv4Test, configSetLFCRunning2) { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); @@ -2047,7 +2047,7 @@ TEST_F(HttpsCtrlChannelDhcpv4Test, configSetLFCRunning2) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); ASSERT_TRUE(def); @@ -2122,7 +2122,7 @@ BaseCtrlChannelDhcpv4Test::testConfigHashGet() { ASSERT_TRUE(hash); ASSERT_EQ(Element::string, hash->getType()); // SHA-256 -> 64 hex digits. - EXPECT_EQ(64, hash->stringValue().size()); + EXPECT_EQ(64U, hash->stringValue().size()); } TEST_F(HttpCtrlChannelDhcpv4Test, configHashGet) { @@ -2211,7 +2211,7 @@ TEST_F(HttpCtrlChannelDhcpv4Test, configTest) { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Create a config with malformed subnet that should fail to parse. os.str(""); @@ -2236,7 +2236,7 @@ TEST_F(HttpCtrlChannelDhcpv4Test, configTest) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Create a valid config with two subnets and no command channel. os.str(""); @@ -2267,7 +2267,7 @@ TEST_F(HttpCtrlChannelDhcpv4Test, configTest) { // Check that the config was not applied. subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); @@ -2363,7 +2363,7 @@ TEST_F(HttpsCtrlChannelDhcpv4Test, configTest) { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Create a config with malformed subnet that should fail to parse. os.str(""); @@ -2392,7 +2392,7 @@ TEST_F(HttpsCtrlChannelDhcpv4Test, configTest) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Create a valid config with two subnets and no command channel. os.str(""); @@ -2423,7 +2423,7 @@ TEST_F(HttpsCtrlChannelDhcpv4Test, configTest) { // Check that the config was not applied. subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); @@ -2560,11 +2560,11 @@ BaseCtrlChannelDhcpv4Test::testStatusGet() { ASSERT_NO_THROW(response_list = Element::fromJSON(response_txt)); ASSERT_TRUE(response_list); ASSERT_EQ(Element::list, response_list->getType()); - EXPECT_EQ(1, response_list->size()); + EXPECT_EQ(1U, response_list->size()); ConstElementPtr response = response_list->get(0); ASSERT_TRUE(response); ASSERT_EQ(Element::map, response->getType()); - EXPECT_EQ(2, response->size()); + EXPECT_EQ(2U, response->size()); ConstElementPtr result = response->get("result"); ASSERT_TRUE(result); ASSERT_EQ(Element::integer, result->getType()); @@ -2615,11 +2615,11 @@ BaseCtrlChannelDhcpv4Test::testStatusGet() { ASSERT_NO_THROW(response_list = Element::fromJSON(response_txt)); ASSERT_TRUE(response_list); ASSERT_EQ(Element::list, response_list->getType()); - EXPECT_EQ(1, response_list->size()); + EXPECT_EQ(1U, response_list->size()); response = response_list->get(0); ASSERT_TRUE(response); ASSERT_EQ(Element::map, response->getType()); - EXPECT_EQ(2, response->size()); + EXPECT_EQ(2U, response->size()); result = response->get("result"); ASSERT_TRUE(result); ASSERT_EQ(Element::integer, result->getType()); @@ -2660,7 +2660,7 @@ BaseCtrlChannelDhcpv4Test::testStatusGet() { found_queue_stats = arguments->get("packet-queue-statistics"); ASSERT_TRUE(found_queue_stats); ASSERT_EQ(Element::list, found_queue_stats->getType()); - EXPECT_EQ(3, found_queue_stats->size()); + EXPECT_EQ(3U, found_queue_stats->size()); } TEST_F(HttpCtrlChannelDhcpv4Test, statusGet) { @@ -2684,7 +2684,7 @@ BaseCtrlChannelDhcpv4Test::testNoManagers() { ASSERT_NO_THROW(response_list = Element::fromJSON(response_text)); ASSERT_TRUE(response_list); ASSERT_EQ(Element::list, response_list->getType()); - EXPECT_EQ(1, response_list->size()); + EXPECT_EQ(1U, response_list->size()); ConstElementPtr response = response_list->get(0); ASSERT_TRUE(response); ASSERT_EQ(Element::map, response->getType()); @@ -2719,7 +2719,7 @@ BaseCtrlChannelDhcpv4Test::testStatusGetSockets() { ASSERT_NO_THROW(response_list = Element::fromJSON(response_text)); ASSERT_TRUE(response_list); ASSERT_EQ(Element::list, response_list->getType()); - EXPECT_EQ(1, response_list->size()); + EXPECT_EQ(1U, response_list->size()); ConstElementPtr response = response_list->get(0); ASSERT_TRUE(response); ASSERT_EQ(Element::map, response->getType()); @@ -2771,7 +2771,7 @@ BaseCtrlChannelDhcpv4Test::testStatusGetSocketsErrors() { ASSERT_NO_THROW(response_list = Element::fromJSON(response_text)); ASSERT_TRUE(response_list); ASSERT_EQ(Element::list, response_list->getType()); - EXPECT_EQ(1, response_list->size()); + EXPECT_EQ(1U, response_list->size()); ConstElementPtr response = response_list->get(0); ASSERT_TRUE(response); ASSERT_EQ(Element::map, response->getType()); @@ -2795,7 +2795,7 @@ BaseCtrlChannelDhcpv4Test::testStatusGetSocketsErrors() { ConstElementPtr errors(sockets->get("errors")); ASSERT_TRUE(errors); ASSERT_EQ(Element::list, errors->getType()); - ASSERT_EQ(2, errors->size()); + ASSERT_EQ(2U, errors->size()); ConstElementPtr error(errors->get(0)); ASSERT_TRUE(error); @@ -3374,7 +3374,7 @@ BaseCtrlChannelDhcpv4Test::testConfigReloadValid() { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(2, subnets->size()); + EXPECT_EQ(2U, subnets->size()); ::remove("test8.json"); } @@ -3454,7 +3454,7 @@ BaseCtrlChannelDhcpv4Test::testConfigReloadDetectInterfaces() { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(2, subnets->size()); + EXPECT_EQ(2U, subnets->size()); ::remove("test8.json"); } @@ -4820,7 +4820,7 @@ TEST_F(HttpCtrlChannelDhcpv4Test, noListenerChange) { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); @@ -4843,7 +4843,7 @@ TEST_F(HttpCtrlChannelDhcpv4Test, noListenerChange) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); @@ -4955,7 +4955,7 @@ TEST_F(HttpsCtrlChannelDhcpv4Test, noListenerChange) { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); @@ -4982,7 +4982,7 @@ TEST_F(HttpsCtrlChannelDhcpv4Test, noListenerChange) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); @@ -5085,7 +5085,7 @@ TEST_F(HttpCtrlChannelDhcpv4Test, handleHttpToHttpsSwitch) { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); @@ -5128,7 +5128,7 @@ TEST_F(HttpCtrlChannelDhcpv4Test, handleHttpToHttpsSwitch) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); @@ -5240,7 +5240,7 @@ TEST_F(HttpsCtrlChannelDhcpv4Test, handleHttpsToHttpSwitch) { // Check that the config was indeed applied. const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP4_OPTION_SPACE, 163); @@ -5283,7 +5283,7 @@ TEST_F(HttpsCtrlChannelDhcpv4Test, handleHttpsToHttpSwitch) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); diff --git a/src/bin/dhcp4/tests/inform_unittest.cc b/src/bin/dhcp4/tests/inform_unittest.cc index 26d6a46249..ddf9393d55 100644 --- a/src/bin/dhcp4/tests/inform_unittest.cc +++ b/src/bin/dhcp4/tests/inform_unittest.cc @@ -240,19 +240,19 @@ TEST_F(InformTest, directClientBroadcast) { EXPECT_EQ("10.0.0.1", client.config_.serverid_.toText()); // Make sure that the Routers option has been received. - ASSERT_EQ(2, client.config_.routers_.size()); + ASSERT_EQ(2U, client.config_.routers_.size()); EXPECT_EQ("10.0.0.200", client.config_.routers_[0].toText()); EXPECT_EQ("10.0.0.201", client.config_.routers_[1].toText()); // Make sure that the DNS Servers option has been received. - ASSERT_EQ(2, client.config_.dns_servers_.size()); + ASSERT_EQ(2U, client.config_.dns_servers_.size()); EXPECT_EQ("10.0.0.202", client.config_.dns_servers_[0].toText()); EXPECT_EQ("10.0.0.203", client.config_.dns_servers_[1].toText()); // Make sure that the Log Servers option has been received. - ASSERT_EQ(2, client.config_.quotes_servers_.size()); + ASSERT_EQ(2U, client.config_.quotes_servers_.size()); EXPECT_EQ("10.0.0.200", client.config_.quotes_servers_[0].toText()); EXPECT_EQ("10.0.0.201", client.config_.quotes_servers_[1].toText()); // Make sure that the Quotes Servers option has been received. - ASSERT_EQ(2, client.config_.log_servers_.size()); + ASSERT_EQ(2U, client.config_.log_servers_.size()); EXPECT_EQ("10.0.0.202", client.config_.log_servers_[0].toText()); EXPECT_EQ("10.0.0.203", client.config_.log_servers_[1].toText()); @@ -281,11 +281,11 @@ TEST_F(InformTest, directClientBroadcast) { // Make sure that the server id is present. EXPECT_EQ("10.0.0.1", client.config_.serverid_.toText()); // Make sure that the Routers option has been received. - ASSERT_EQ(2, client.config_.routers_.size()); + ASSERT_EQ(2U, client.config_.routers_.size()); EXPECT_EQ("10.0.0.200", client.config_.routers_[0].toText()); EXPECT_EQ("10.0.0.201", client.config_.routers_[1].toText()); // Make sure that the DNS Servers option has been received. - ASSERT_EQ(2, client.config_.dns_servers_.size()); + ASSERT_EQ(2U, client.config_.dns_servers_.size()); EXPECT_EQ("10.0.0.202", client.config_.dns_servers_[0].toText()); EXPECT_EQ("10.0.0.203", client.config_.dns_servers_[1].toText()); // Make sure that the Quotes Servers option hasn't been received. @@ -333,11 +333,11 @@ TEST_F(InformTest, directClientUnicast) { // Make sure that the server id is present. EXPECT_EQ("10.0.0.1", client.config_.serverid_.toText()); // Make sure that the Routers option has been received. - ASSERT_EQ(2, client.config_.routers_.size()); + ASSERT_EQ(2U, client.config_.routers_.size()); EXPECT_EQ("10.0.0.200", client.config_.routers_[0].toText()); EXPECT_EQ("10.0.0.201", client.config_.routers_[1].toText()); // Make sure that the DNS Servers option has been received. - ASSERT_EQ(2, client.config_.dns_servers_.size()); + ASSERT_EQ(2U, client.config_.dns_servers_.size()); EXPECT_EQ("10.0.0.202", client.config_.dns_servers_[0].toText()); EXPECT_EQ("10.0.0.203", client.config_.dns_servers_[1].toText()); } @@ -369,11 +369,11 @@ TEST_F(InformTest, directClientNoCiaddr) { // Make sure that the server id is present. EXPECT_EQ("10.0.0.1", client.config_.serverid_.toText()); // Make sure that the Routers option has been received. - ASSERT_EQ(2, client.config_.routers_.size()); + ASSERT_EQ(2U, client.config_.routers_.size()); EXPECT_EQ("10.0.0.200", client.config_.routers_[0].toText()); EXPECT_EQ("10.0.0.201", client.config_.routers_[1].toText()); // Make sure that the DNS Servers option has been received. - ASSERT_EQ(2, client.config_.dns_servers_.size()); + ASSERT_EQ(2U, client.config_.dns_servers_.size()); EXPECT_EQ("10.0.0.202", client.config_.dns_servers_[0].toText()); EXPECT_EQ("10.0.0.203", client.config_.dns_servers_[1].toText()); } @@ -408,19 +408,19 @@ TEST_F(InformTest, relayedClient) { // Make sure that the server id is present. EXPECT_EQ("10.0.0.1", client.config_.serverid_.toText()); // Make sure that the Routers option has been received. - ASSERT_EQ(2, client.config_.routers_.size()); + ASSERT_EQ(2U, client.config_.routers_.size()); EXPECT_EQ("192.0.2.200", client.config_.routers_[0].toText()); EXPECT_EQ("192.0.2.201", client.config_.routers_[1].toText()); // Make sure that the DNS Servers option has been received. - ASSERT_EQ(2, client.config_.dns_servers_.size()); + ASSERT_EQ(2U, client.config_.dns_servers_.size()); EXPECT_EQ("192.0.2.202", client.config_.dns_servers_[0].toText()); EXPECT_EQ("192.0.2.203", client.config_.dns_servers_[1].toText()); // Make sure that the Quotes Servers option has been received. - ASSERT_EQ(2, client.config_.quotes_servers_.size()); + ASSERT_EQ(2U, client.config_.quotes_servers_.size()); EXPECT_EQ("10.0.0.202", client.config_.quotes_servers_[0].toText()); EXPECT_EQ("10.0.0.203", client.config_.quotes_servers_[1].toText()); // Make sure that the Log Servers option has been received. - ASSERT_EQ(2, client.config_.log_servers_.size()); + ASSERT_EQ(2U, client.config_.log_servers_.size()); EXPECT_EQ("10.0.0.200", client.config_.log_servers_[0].toText()); EXPECT_EQ("10.0.0.201", client.config_.log_servers_[1].toText()); } @@ -443,7 +443,7 @@ TEST_F(InformTest, relayedClientNoCiaddr) { // Response should go through a relay as there is no ciaddr. EXPECT_EQ(IOAddress("192.0.2.2"), resp->getLocalAddr()); EXPECT_EQ(IOAddress("192.0.2.2"), resp->getGiaddr()); - EXPECT_EQ(1, resp->getHops()); + EXPECT_EQ(1U, resp->getHops()); EXPECT_EQ(DHCP4_SERVER_PORT, resp->getLocalPort()); EXPECT_EQ(DHCP4_SERVER_PORT, resp->getRemotePort()); // In the case when the client didn't set the ciaddr and the message @@ -453,11 +453,11 @@ TEST_F(InformTest, relayedClientNoCiaddr) { // Make sure that the server id is present. EXPECT_EQ("10.0.0.1", client.config_.serverid_.toText()); // Make sure that the Routers option has been received. - ASSERT_EQ(2, client.config_.routers_.size()); + ASSERT_EQ(2U, client.config_.routers_.size()); EXPECT_EQ("192.0.2.200", client.config_.routers_[0].toText()); EXPECT_EQ("192.0.2.201", client.config_.routers_[1].toText()); // Make sure that the DNS Servers option has been received. - ASSERT_EQ(2, client.config_.dns_servers_.size()); + ASSERT_EQ(2U, client.config_.dns_servers_.size()); EXPECT_EQ("192.0.2.202", client.config_.dns_servers_[0].toText()); EXPECT_EQ("192.0.2.203", client.config_.dns_servers_[1].toText()); } @@ -550,7 +550,7 @@ TEST_F(InformTest, messageFieldsLongOptions) { uint32_t count = 0; uint8_t index = 0; for (auto const& opt : client.getContext().query_->options_) { - if (opt.first == 231) { + if (opt.first == 231U) { for (auto const& value : opt.second->getData()) { ASSERT_EQ(value, index); index++; @@ -558,7 +558,7 @@ TEST_F(InformTest, messageFieldsLongOptions) { count++; } } - ASSERT_EQ(1, count); + ASSERT_EQ(1U, count); count = 0; for (auto const& opt : resp->options_) { @@ -576,7 +576,7 @@ TEST_F(InformTest, messageFieldsLongOptions) { } } // Multiple options should have been fused by the server on unpack. - ASSERT_EQ(count, 1); + ASSERT_EQ(count, 1U); // Check that the reserved and requested values have been assigned. string expected = @@ -594,7 +594,7 @@ TEST_F(InformTest, messageFieldsLongOptions) { } } // Multiple options should have been fused by the server on unpack. - ASSERT_EQ(count, 1); + ASSERT_EQ(count, 1U); ASSERT_EQ(value, string("data") + expected + string("-data")); } diff --git a/src/bin/dhcp4/tests/kea_controller_unittest.cc b/src/bin/dhcp4/tests/kea_controller_unittest.cc index fb4774d801..6febea8caf 100644 --- a/src/bin/dhcp4/tests/kea_controller_unittest.cc +++ b/src/bin/dhcp4/tests/kea_controller_unittest.cc @@ -311,9 +311,9 @@ public: // committed so becomes the current one. // - the command is called outside configuration so it must // be the current configuration. The test explicitly checks this. - EXPECT_EQ(1, cb_control->getDatabaseTotalConfigFetchCalls()); - EXPECT_EQ(0, cb_control->getDatabaseCurrentConfigFetchCalls()); - EXPECT_EQ(1, cb_control->getDatabaseStagingConfigFetchCalls()); + EXPECT_EQ(1U, cb_control->getDatabaseTotalConfigFetchCalls()); + EXPECT_EQ(0U, cb_control->getDatabaseCurrentConfigFetchCalls()); + EXPECT_EQ(1U, cb_control->getDatabaseStagingConfigFetchCalls()); if (call_command) { // The case where there is no backend is tested in the @@ -321,13 +321,13 @@ public: // that the command calls the database config fetch. // Count the startup. - EXPECT_EQ(cb_control->getDatabaseTotalConfigFetchCalls(), 1); - EXPECT_EQ(cb_control->getDatabaseCurrentConfigFetchCalls(), 0); - EXPECT_EQ(cb_control->getDatabaseStagingConfigFetchCalls(), 1); + EXPECT_EQ(cb_control->getDatabaseTotalConfigFetchCalls(), 1U); + EXPECT_EQ(cb_control->getDatabaseCurrentConfigFetchCalls(), 0U); + EXPECT_EQ(cb_control->getDatabaseStagingConfigFetchCalls(), 1U); ConstElementPtr list_cmds = createCommand("config-backend-pull"); ConstElementPtr result = CommandMgr::instance().processCommand(list_cmds); - EXPECT_EQ(cb_control->getDatabaseTotalConfigFetchCalls(), 2); + EXPECT_EQ(cb_control->getDatabaseTotalConfigFetchCalls(), 2U); std::string expected; if (throw_during_fetch) { @@ -344,13 +344,13 @@ public: ASSERT_NO_THROW(runTimersWithTimeout(srv->getIOService(), 20)); if (config_wait_fetch_time > 0) { - EXPECT_GE(cb_control->getDatabaseTotalConfigFetchCalls(), 5); - EXPECT_GE(cb_control->getDatabaseCurrentConfigFetchCalls(), 4); - EXPECT_EQ(cb_control->getDatabaseStagingConfigFetchCalls(), 1); + EXPECT_GE(cb_control->getDatabaseTotalConfigFetchCalls(), 5U); + EXPECT_GE(cb_control->getDatabaseCurrentConfigFetchCalls(), 4U); + EXPECT_EQ(cb_control->getDatabaseStagingConfigFetchCalls(), 1U); } else { - EXPECT_EQ(cb_control->getDatabaseTotalConfigFetchCalls(), 2); - EXPECT_EQ(cb_control->getDatabaseCurrentConfigFetchCalls(), 1); - EXPECT_EQ(cb_control->getDatabaseStagingConfigFetchCalls(), 1); + EXPECT_EQ(cb_control->getDatabaseTotalConfigFetchCalls(), 2U); + EXPECT_EQ(cb_control->getDatabaseCurrentConfigFetchCalls(), 1U); + EXPECT_EQ(cb_control->getDatabaseStagingConfigFetchCalls(), 1U); } } else if ((config_wait_fetch_time > 0) && (!throw_during_fetch)) { @@ -365,9 +365,9 @@ public: // least 3 attempts to fetch the updates. return (cb_control->getDatabaseTotalConfigFetchCalls() >= 3); })); - EXPECT_GE(cb_control->getDatabaseTotalConfigFetchCalls(), 3); - EXPECT_GE(cb_control->getDatabaseCurrentConfigFetchCalls(), 2); - EXPECT_EQ(cb_control->getDatabaseStagingConfigFetchCalls(), 1); + EXPECT_GE(cb_control->getDatabaseTotalConfigFetchCalls(), 3U); + EXPECT_GE(cb_control->getDatabaseCurrentConfigFetchCalls(), 2U); + EXPECT_EQ(cb_control->getDatabaseStagingConfigFetchCalls(), 1U); } else { ASSERT_NO_THROW(runTimersWithTimeout(srv->getIOService(), 500)); @@ -378,16 +378,16 @@ public: // the number of recorded fetches should be 12. One at // startup, 10 failures and one that causes the timer // to stop. - EXPECT_EQ(12, cb_control->getDatabaseTotalConfigFetchCalls()); - EXPECT_EQ(11, cb_control->getDatabaseCurrentConfigFetchCalls()); - EXPECT_EQ(1, cb_control->getDatabaseStagingConfigFetchCalls()); + EXPECT_EQ(12U, cb_control->getDatabaseTotalConfigFetchCalls()); + EXPECT_EQ(11U, cb_control->getDatabaseCurrentConfigFetchCalls()); + EXPECT_EQ(1U, cb_control->getDatabaseStagingConfigFetchCalls()); } else { // If the server is not configured to schedule the timer, // we should still have one fetch attempt recorded. - EXPECT_EQ(1, cb_control->getDatabaseTotalConfigFetchCalls()); - EXPECT_EQ(0, cb_control->getDatabaseCurrentConfigFetchCalls()); - EXPECT_EQ(1, cb_control->getDatabaseStagingConfigFetchCalls()); + EXPECT_EQ(1U, cb_control->getDatabaseTotalConfigFetchCalls()); + EXPECT_EQ(0U, cb_control->getDatabaseCurrentConfigFetchCalls()); + EXPECT_EQ(1U, cb_control->getDatabaseStagingConfigFetchCalls()); } } } @@ -443,17 +443,17 @@ TEST_F(JSONFileBackendTest, jsonFile) { const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(3, subnets->size()); // We expect 3 subnets. + ASSERT_EQ(3U, subnets->size()); // We expect 3 subnets. // Check subnet 1. auto subnet = subnets->begin(); ASSERT_TRUE(subnet != subnets->end()); EXPECT_EQ("192.0.2.0", (*subnet)->get().first.toText()); - EXPECT_EQ(24, (*subnet)->get().second); + EXPECT_EQ(24U, (*subnet)->get().second); // Check pools in the first subnet. const PoolCollection& pools1 = (*subnet)->getPools(Lease::TYPE_V4); - ASSERT_EQ(1, pools1.size()); + ASSERT_EQ(1U, pools1.size()); EXPECT_EQ("192.0.2.1", pools1.at(0)->getFirstAddress().toText()); EXPECT_EQ("192.0.2.100", pools1.at(0)->getLastAddress().toText()); EXPECT_EQ(Lease::TYPE_V4, pools1.at(0)->getType()); @@ -462,11 +462,11 @@ TEST_F(JSONFileBackendTest, jsonFile) { ++subnet; ASSERT_TRUE(subnet != subnets->end()); EXPECT_EQ("192.0.3.0", (*subnet)->get().first.toText()); - EXPECT_EQ(24, (*subnet)->get().second); + EXPECT_EQ(24U, (*subnet)->get().second); // Check pools in the second subnet. const PoolCollection& pools2 = (*subnet)->getPools(Lease::TYPE_V4); - ASSERT_EQ(1, pools2.size()); + ASSERT_EQ(1U, pools2.size()); EXPECT_EQ("192.0.3.101", pools2.at(0)->getFirstAddress().toText()); EXPECT_EQ("192.0.3.150", pools2.at(0)->getLastAddress().toText()); EXPECT_EQ(Lease::TYPE_V4, pools2.at(0)->getType()); @@ -475,7 +475,7 @@ TEST_F(JSONFileBackendTest, jsonFile) { ++subnet; ASSERT_TRUE(subnet != subnets->end()); EXPECT_EQ("192.0.4.0", (*subnet)->get().first.toText()); - EXPECT_EQ(24, (*subnet)->get().second); + EXPECT_EQ(24U, (*subnet)->get().second); // ... and its only pool. const PoolCollection& pools3 = (*subnet)->getPools(Lease::TYPE_V4); @@ -520,17 +520,17 @@ TEST_F(JSONFileBackendTest, hashComments) { const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Check subnet 1. auto subnet = subnets->begin(); ASSERT_TRUE(subnet != subnets->end()); EXPECT_EQ("192.0.2.0", (*subnet)->get().first.toText()); - EXPECT_EQ(22, (*subnet)->get().second); + EXPECT_EQ(22U, (*subnet)->get().second); // Check pools in the first subnet. const PoolCollection& pools1 = (*subnet)->getPools(Lease::TYPE_V4); - ASSERT_EQ(1, pools1.size()); + ASSERT_EQ(1U, pools1.size()); EXPECT_EQ("192.0.2.0", pools1.at(0)->getFirstAddress().toText()); EXPECT_EQ("192.0.2.255", pools1.at(0)->getLastAddress().toText()); EXPECT_EQ(Lease::TYPE_V4, pools1.at(0)->getType()); @@ -572,17 +572,17 @@ TEST_F(JSONFileBackendTest, cppLineComments) { const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Check subnet 1. auto subnet = subnets->begin(); ASSERT_TRUE(subnet != subnets->end()); EXPECT_EQ("192.0.2.0", (*subnet)->get().first.toText()); - EXPECT_EQ(22, (*subnet)->get().second); + EXPECT_EQ(22U, (*subnet)->get().second); // Check pools in the first subnet. const PoolCollection& pools1 = (*subnet)->getPools(Lease::TYPE_V4); - ASSERT_EQ(1, pools1.size()); + ASSERT_EQ(1U, pools1.size()); EXPECT_EQ("192.0.2.0", pools1.at(0)->getFirstAddress().toText()); EXPECT_EQ("192.0.2.255", pools1.at(0)->getLastAddress().toText()); EXPECT_EQ(Lease::TYPE_V4, pools1.at(0)->getType()); @@ -624,17 +624,17 @@ TEST_F(JSONFileBackendTest, cBlockComments) { const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Check subnet 1. auto subnet = subnets->begin(); ASSERT_TRUE(subnet != subnets->end()); EXPECT_EQ("192.0.2.0", (*subnet)->get().first.toText()); - EXPECT_EQ(22, (*subnet)->get().second); + EXPECT_EQ(22U, (*subnet)->get().second); // Check pools in the first subnet. const PoolCollection& pools1 = (*subnet)->getPools(Lease::TYPE_V4); - ASSERT_EQ(1, pools1.size()); + ASSERT_EQ(1U, pools1.size()); EXPECT_EQ("192.0.2.0", pools1.at(0)->getFirstAddress().toText()); EXPECT_EQ("192.0.2.255", pools1.at(0)->getLastAddress().toText()); EXPECT_EQ(Lease::TYPE_V4, pools1.at(0)->getType()); @@ -676,17 +676,17 @@ TEST_F(JSONFileBackendTest, include) { const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Check subnet 1. auto subnet = subnets->begin(); ASSERT_TRUE(subnet != subnets->end()); EXPECT_EQ("192.0.2.0", (*subnet)->get().first.toText()); - EXPECT_EQ(22, (*subnet)->get().second); + EXPECT_EQ(22U, (*subnet)->get().second); // Check pools in the first subnet. const PoolCollection& pools1 = (*subnet)->getPools(Lease::TYPE_V4); - ASSERT_EQ(1, pools1.size()); + ASSERT_EQ(1U, pools1.size()); EXPECT_EQ("192.0.2.0", pools1.at(0)->getFirstAddress().toText()); EXPECT_EQ("192.0.2.255", pools1.at(0)->getLastAddress().toText()); EXPECT_EQ(Lease::TYPE_V4, pools1.at(0)->getType()); diff --git a/src/bin/dhcp4/tests/out_of_range_unittest.cc b/src/bin/dhcp4/tests/out_of_range_unittest.cc index efd9bb477b..3b232d37d4 100644 --- a/src/bin/dhcp4/tests/out_of_range_unittest.cc +++ b/src/bin/dhcp4/tests/out_of_range_unittest.cc @@ -354,7 +354,7 @@ OutOfRangeTest::oorRenewReleaseTest(CfgIndex cfg_idx, // Verify that we received an ACK to our renewal resp = client.getContext().response_; ASSERT_EQ(DHCPACK, static_cast(resp->getType())); - EXPECT_EQ(0, d2_mgr_.getQueueSize()); + EXPECT_EQ(0U, d2_mgr_.getQueueSize()); // STAGE TWO: @@ -401,12 +401,12 @@ OutOfRangeTest::oorRenewReleaseTest(CfgIndex cfg_idx, } else { // Lease should still exist, and no NCR should be queued. ASSERT_TRUE(lease); - EXPECT_EQ(0, d2_mgr_.getQueueSize()); + EXPECT_EQ(0U, d2_mgr_.getQueueSize()); if (release_outcome == DOES_RELEASE_EXPIRE) { - EXPECT_EQ(lease->valid_lft_, 0); + EXPECT_EQ(lease->valid_lft_, 0U); } else { EXPECT_FALSE(lease->expired()); - EXPECT_TRUE(lease->valid_lft_ > 0); + EXPECT_TRUE(lease->valid_lft_ > 0U); } } } diff --git a/src/bin/dhcp4/tests/parser_unittest.cc b/src/bin/dhcp4/tests/parser_unittest.cc index a6a753aa71..87749c43a7 100644 --- a/src/bin/dhcp4/tests/parser_unittest.cc +++ b/src/bin/dhcp4/tests/parser_unittest.cc @@ -851,9 +851,9 @@ TEST(ParserTest, mapEntries) { // Remove deprecated parameters. This needs to be done because even though // they are supported, examples are loaded by yang tests also and they don't // support both old and new syntax. - ASSERT_EQ(syntax_keys.erase("client-class"), 1); - ASSERT_EQ(syntax_keys.erase("only-if-required"), 1); - ASSERT_EQ(syntax_keys.erase("require-client-classes"), 1); + ASSERT_EQ(syntax_keys.erase("client-class"), 1U); + ASSERT_EQ(syntax_keys.erase("only-if-required"), 1U); + ASSERT_EQ(syntax_keys.erase("require-client-classes"), 1U); EXPECT_EQ(syntax_keys, sample_keys) << "syntax has: " << print_keys(syntax_keys) << endl << "sample has: " << print_keys(sample_keys) << endl; diff --git a/src/bin/dhcp4/tests/release_unittest.cc b/src/bin/dhcp4/tests/release_unittest.cc index 7c164410c8..c56487876b 100644 --- a/src/bin/dhcp4/tests/release_unittest.cc +++ b/src/bin/dhcp4/tests/release_unittest.cc @@ -147,7 +147,7 @@ ReleaseTest::acquireAndRelease(const std::string& hw_address_1, // Let's get the subnet-id and generate statistics name out of it const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); name << "subnet[" << (*subnets->begin())->getID() << "].assigned-addresses"; ObservationPtr assigned_cnt = StatsMgr::instance().getObservation(name.str()); @@ -177,7 +177,7 @@ ReleaseTest::acquireAndRelease(const std::string& hw_address_1, ASSERT_TRUE(lease); // The update succeeded, so the assigned-address should be expired - EXPECT_EQ(lease->valid_lft_, 0); + EXPECT_EQ(lease->valid_lft_, 0U); EXPECT_EQ(Lease4::STATE_RELEASED, lease->state_); // The release succeeded, so the assigned-addresses statistic should @@ -417,7 +417,7 @@ TEST_F(ReleaseTest, releaseNoDeleteNoSubnet) { ASSERT_TRUE(lease); // Check That the lease has been expired - EXPECT_EQ(lease->valid_lft_, 0); + EXPECT_EQ(lease->valid_lft_, 0U); } // This test verifies that an incoming RELEASE for an address within @@ -477,7 +477,7 @@ TEST_F(ReleaseTest, releaseAndReclaim) { // Let's get the subnet-id and generate statistics name out of it const Subnet4Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); name << "subnet[" << (*subnets->begin())->getID() << "].assigned-addresses"; ObservationPtr assigned_cnt = StatsMgr::instance().getObservation(name.str()); @@ -498,7 +498,7 @@ TEST_F(ReleaseTest, releaseAndReclaim) { ASSERT_TRUE(lease); // Check That the lease has been expired - EXPECT_EQ(lease->valid_lft_, 0); + EXPECT_EQ(lease->valid_lft_, 0U); assigned_cnt = StatsMgr::instance().getObservation(name.str()); ASSERT_TRUE(assigned_cnt); diff --git a/src/bin/dhcp4/tests/shared_network_unittest.cc b/src/bin/dhcp4/tests/shared_network_unittest.cc index c43d33b1d8..e2a5340d85 100644 --- a/src/bin/dhcp4/tests/shared_network_unittest.cc +++ b/src/bin/dhcp4/tests/shared_network_unittest.cc @@ -1365,7 +1365,7 @@ public: boost::dynamic_pointer_cast(opt); ASSERT_TRUE(servers); auto addrs = servers->getAddresses(); - ASSERT_EQ(1, addrs.size()); + ASSERT_EQ(1U, addrs.size()); EXPECT_EQ(ns_address, addrs[0].toText()); } @@ -1471,7 +1471,7 @@ public: allocated_set.insert(next_client.config_.lease_.addr_.toText()); } // Make sure that we have 20 distinct allocations. - ASSERT_EQ(20, allocated_set.size()); + ASSERT_EQ(20U, allocated_set.size()); // Try one more time. This time no leases should be allocated because // the pools are exhausted. @@ -1517,7 +1517,7 @@ TEST_F(Dhcpv4SharedNetworkTest, parse) { SharedNetwork4Ptr network = cfg->getByName("frog"); ConstElementPtr context = network->getContext(); ASSERT_TRUE(context); - ASSERT_EQ(1, context->size()); + ASSERT_EQ(1U, context->size()); ASSERT_TRUE(context->get("comment")); EXPECT_EQ("\"example\"", context->get("comment")->str()); } @@ -1965,21 +1965,21 @@ TEST_F(Dhcpv4SharedNetworkTest, optionsDerivation) { doDORA(client1, "192.0.2.63", "192.0.2.63"); // This option is specified at the global level. - ASSERT_EQ(1, client1.config_.log_servers_.size()); + ASSERT_EQ(1U, client1.config_.log_servers_.size()); EXPECT_EQ("1.2.3.4", client1.config_.log_servers_[0].toText()); // This option is specified on the subnet level. - ASSERT_EQ(1, client1.config_.routers_.size()); + ASSERT_EQ(1U, client1.config_.routers_.size()); EXPECT_EQ("192.0.2.5", client1.config_.routers_[0].toText()); // This option is specified on the shared network level and the subnet level. // The instance on the subnet level should take precedence. - ASSERT_EQ(1, client1.config_.quotes_servers_.size()); + ASSERT_EQ(1U, client1.config_.quotes_servers_.size()); EXPECT_EQ("10.5.4.3", client1.config_.quotes_servers_[0].toText()); // This option is only specified on the shared network level and should be // inherited by all subnets within this network. - ASSERT_EQ(1, client1.config_.dns_servers_.size()); + ASSERT_EQ(1U, client1.config_.dns_servers_.size()); EXPECT_EQ("10.1.2.3", client1.config_.dns_servers_[0].toText()); // Client #2. @@ -1992,17 +1992,17 @@ TEST_F(Dhcpv4SharedNetworkTest, optionsDerivation) { doDORA(client2, "10.0.0.16", "10.0.0.16"); // This option is specified at the global level. - ASSERT_EQ(1, client2.config_.log_servers_.size()); + ASSERT_EQ(1U, client2.config_.log_servers_.size()); EXPECT_EQ("1.2.3.4", client2.config_.log_servers_[0].toText()); // This option is only specified on the shared network level and should be // inherited by all subnets within this network. - ASSERT_EQ(1, client2.config_.quotes_servers_.size()); + ASSERT_EQ(1U, client2.config_.quotes_servers_.size()); EXPECT_EQ("10.6.5.4", client2.config_.quotes_servers_[0].toText()); // This option is only specified on the shared network level and should be // inherited by all subnets within this network. - ASSERT_EQ(1, client2.config_.dns_servers_.size()); + ASSERT_EQ(1U, client2.config_.dns_servers_.size()); EXPECT_EQ("10.1.2.3", client2.config_.dns_servers_[0].toText()); // Client #3. @@ -2015,17 +2015,17 @@ TEST_F(Dhcpv4SharedNetworkTest, optionsDerivation) { doDORA(client3, "192.0.2.65"); // This option is specified at the global level. - ASSERT_EQ(1, client3.config_.log_servers_.size()); + ASSERT_EQ(1U, client3.config_.log_servers_.size()); EXPECT_EQ("1.2.3.4", client3.config_.log_servers_[0].toText()); // This option is specified on the subnet level. - ASSERT_EQ(1, client3.config_.quotes_servers_.size()); + ASSERT_EQ(1U, client3.config_.quotes_servers_.size()); EXPECT_EQ("10.1.1.1", client3.config_.quotes_servers_[0].toText()); // This option is only specified on the shared network level and thus it should // not be returned to this client, because the client doesn't belong to the // shared network. - ASSERT_EQ(0, client3.config_.dns_servers_.size()); + ASSERT_EQ(0U, client3.config_.dns_servers_.size()); } // Client has a lease in a subnet within shared network. diff --git a/src/bin/dhcp4/tests/simple_parser4_unittest.cc b/src/bin/dhcp4/tests/simple_parser4_unittest.cc index d84ff3d1ff..8c65bcb6ba 100644 --- a/src/bin/dhcp4/tests/simple_parser4_unittest.cc +++ b/src/bin/dhcp4/tests/simple_parser4_unittest.cc @@ -128,7 +128,7 @@ TEST_F(SimpleParser4Test, inheritGlobalToSubnet4) { // as it was already defined in the subnet scope. size_t num; EXPECT_NO_THROW(num = SimpleParser4::deriveParameters(global)); - EXPECT_EQ(4, num); + EXPECT_EQ(4U, num); // Check the values. 2 of them are inherited, while the third one // was already defined in the subnet, so should not be inherited. @@ -150,7 +150,7 @@ TEST_F(SimpleParser4Test, subnetDefaults4) { size_t num = 0; EXPECT_NO_THROW(num = SimpleParser4::setAllDefaults(global)); - EXPECT_LE(1, num); // at least 1 parameter has to be modified + EXPECT_LE(1U, num); // at least 1 parameter has to be modified ConstElementPtr subnets = global->find("subnet4"); ASSERT_TRUE(subnets); @@ -172,7 +172,7 @@ TEST_F(SimpleParser4Test, optionDataDefaults4) { size_t num = 0; EXPECT_NO_THROW(num = SimpleParser4::setAllDefaults(global)); - EXPECT_LE(1, num); // at least 1 parameter has to be modified + EXPECT_LE(1U, num); // at least 1 parameter has to be modified ConstElementPtr options = global->find("option-data"); ASSERT_TRUE(options); @@ -194,11 +194,11 @@ TEST_F(SimpleParser4Test, optionDefDefaults4) { size_t num = 0; EXPECT_NO_THROW(num = SimpleParser4::setAllDefaults(global)); - EXPECT_LE(1, num); // at least 1 parameter has to be modified + EXPECT_LE(1U, num); // at least 1 parameter has to be modified ConstElementPtr defs = global->find("option-def"); ASSERT_TRUE(defs); - ASSERT_EQ(1, defs->size()); + ASSERT_EQ(1U, defs->size()); ConstElementPtr def = defs->get(0); ASSERT_TRUE(def); diff --git a/src/bin/dhcp4/tests/vendor_opts_unittest.cc b/src/bin/dhcp4/tests/vendor_opts_unittest.cc index 1b0e078f1b..06c05febfc 100644 --- a/src/bin/dhcp4/tests/vendor_opts_unittest.cc +++ b/src/bin/dhcp4/tests/vendor_opts_unittest.cc @@ -260,12 +260,12 @@ public: // Check that the provided addresses match the ones in configuration. Option4AddrLst::AddressContainer addrs = tftp_srvs->getAddresses(); - ASSERT_EQ(2, addrs.size()); + ASSERT_EQ(2U, addrs.size()); EXPECT_EQ("192.0.2.1", addrs[0].toText()); EXPECT_EQ("192.0.2.2", addrs[1].toText()); } - if (option == 22) { + if (option == 22U) { // Option 22 should be present. OptionPtr custom = vendor_resp->getOption(22); ASSERT_TRUE(custom); @@ -531,7 +531,7 @@ public: // Check that the provided addresses match the ones in configuration. Option4AddrLst::AddressContainer addrs = tftp_srvs->getAddresses(); - ASSERT_EQ(2, addrs.size()); + ASSERT_EQ(2U, addrs.size()); if (vendor_resp->getVendorId() == VENDOR_ID_CABLE_LABS) { EXPECT_EQ("192.0.2.1", addrs[0].toText()); EXPECT_EQ("192.0.2.2", addrs[1].toText()); @@ -780,7 +780,7 @@ public: // Check that the provided addresses match the ones in configuration. Option4AddrLst::AddressContainer addrs = tftp_srvs->getAddresses(); - ASSERT_EQ(2, addrs.size()); + ASSERT_EQ(2U, addrs.size()); if (vendor_resp->getVendorId() == VENDOR_ID_CABLE_LABS) { EXPECT_EQ("192.0.2.1", addrs[0].toText()); EXPECT_EQ("192.0.2.2", addrs[1].toText()); @@ -880,7 +880,7 @@ TEST_F(VendorOptsTest, vendorOptionsDocsis) { srv_->run(); // Check that the server did send a response - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Make sure that we received a response Pkt4Ptr offer = srv_->fake_sent_.front(); @@ -906,7 +906,7 @@ TEST_F(VendorOptsTest, vendorOptionsDocsis) { ASSERT_TRUE(tftp_servers); Option4AddrLst::AddressContainer addrs = tftp_servers->getAddresses(); - ASSERT_EQ(1, addrs.size()); + ASSERT_EQ(1U, addrs.size()); EXPECT_EQ("10.253.175.16", addrs[0].toText()); } @@ -1432,7 +1432,7 @@ TEST_F(VendorOptsTest, vendorCancelledOptions) { EXPECT_FALSE(vendor_resp->getOption(DOCSIS3_V4_TFTP_SERVERS)); // But an option 100. - EXPECT_EQ(1, vendor_resp->getOptions().size()); + EXPECT_EQ(1U, vendor_resp->getOptions().size()); EXPECT_TRUE(vendor_resp->getOption(100)); } @@ -1582,7 +1582,7 @@ TEST_F(VendorOptsTest, vivsoInResponseOnly) { // Check that it includes vivso with vendor-id = 25167 OptionVendorPtr rsp_vivso = boost::dynamic_pointer_cast(rsp); ASSERT_TRUE(rsp_vivso); - EXPECT_EQ(rsp_vivso->getVendorId(), 25167); + EXPECT_EQ(rsp_vivso->getVendorId(), 25167U); // Now check that it contains suboption 2 with appropriate content. OptionPtr subopt2 = rsp_vivso->getOption(2); @@ -1709,7 +1709,7 @@ TEST_F(VendorOptsTest, vivsoInResponseOnlyComplex) { // Check that it includes vivso with vendor-id = 25167 OptionVendorPtr rsp_vivso = boost::dynamic_pointer_cast(rsp); ASSERT_TRUE(rsp_vivso); - EXPECT_EQ(rsp_vivso->getVendorId(), 25167); + EXPECT_EQ(rsp_vivso->getVendorId(), 25167U); // Now check that it contains suboption 193 with appropriate content. OptionPtr subopt193 = rsp_vivso->getOption(193); @@ -1812,10 +1812,10 @@ TEST_F(VendorOptsTest, option43LastResort) { opt = offer->getOption(DHO_VENDOR_ENCAPSULATED_OPTIONS); ASSERT_TRUE(opt); const OptionCollection& opts = opt->getOptions(); - ASSERT_EQ(1, opts.size()); + ASSERT_EQ(1U, opts.size()); OptionPtr sopt = opts.begin()->second; ASSERT_TRUE(sopt); - EXPECT_EQ(1, sopt->getType()); + EXPECT_EQ(1U, sopt->getType()); } // Checks effect of raw not compatible option 43 (no failure) @@ -2054,8 +2054,8 @@ TEST_F(VendorOptsTest, option43RawGlobal) { ASSERT_TRUE(opt); // Verifies the content ASSERT_EQ(2, opt->len() - opt->getHeaderLen()); - EXPECT_EQ(0x01, opt->getData()[0]); - EXPECT_EQ(0x02, opt->getData()[1]); + EXPECT_EQ(0x01U, opt->getData()[0]); + EXPECT_EQ(0x02U, opt->getData()[1]); } // Verifies raw option 43 can be handled (catch-all class) @@ -2144,8 +2144,8 @@ TEST_F(VendorOptsTest, option43RawClass) { ASSERT_TRUE(opt); // Verifies the content ASSERT_EQ(2, opt->len() - opt->getHeaderLen()); - EXPECT_EQ(0x01, opt->getData()[0]); - EXPECT_EQ(0x02, opt->getData()[1]); + EXPECT_EQ(0x01U, opt->getData()[0]); + EXPECT_EQ(0x02U, opt->getData()[1]); } // Verifies option 43 deferred processing (one class) @@ -2233,7 +2233,7 @@ TEST_F(VendorOptsTest, option43Class) { vopt = query->getOption(DHO_VENDOR_ENCAPSULATED_OPTIONS); OptionCustomPtr custom = boost::dynamic_pointer_cast(vopt); EXPECT_TRUE(custom); - EXPECT_EQ(1, vopt->getOptions().size()); + EXPECT_EQ(1U, vopt->getOptions().size()); // Pass it to the server and get a DHCPOFFER. Pkt4Ptr offer = srv_->processDiscover(query); @@ -2251,13 +2251,13 @@ TEST_F(VendorOptsTest, option43Class) { ASSERT_TRUE(opt); // Verifies the content const OptionCollection& opts = opt->getOptions(); - ASSERT_EQ(1, opts.size()); + ASSERT_EQ(1U, opts.size()); OptionPtr sopt = opts.begin()->second; ASSERT_TRUE(sopt); - EXPECT_EQ(1, sopt->getType()); + EXPECT_EQ(1U, sopt->getType()); OptionUint32Ptr sopt32 = boost::dynamic_pointer_cast(sopt); ASSERT_TRUE(sopt32); - EXPECT_EQ(12345678, sopt32->getValue()); + EXPECT_EQ(12345678U, sopt32->getValue()); } // Verifies option 43 priority @@ -2362,7 +2362,7 @@ TEST_F(VendorOptsTest, option43ClassPriority) { vopt = query->getOption(DHO_VENDOR_ENCAPSULATED_OPTIONS); OptionCustomPtr custom = boost::dynamic_pointer_cast(vopt); EXPECT_TRUE(custom); - EXPECT_EQ(1, vopt->getOptions().size()); + EXPECT_EQ(1U, vopt->getOptions().size()); // Pass it to the server and get a DHCPOFFER. Pkt4Ptr offer = srv_->processDiscover(query); @@ -2383,14 +2383,14 @@ TEST_F(VendorOptsTest, option43ClassPriority) { ASSERT_TRUE(opt); // Verifies the content const OptionCollection& opts = opt->getOptions(); - ASSERT_EQ(1, opts.size()); + ASSERT_EQ(1U, opts.size()); OptionPtr sopt = opts.begin()->second; ASSERT_TRUE(sopt); - EXPECT_EQ(1, sopt->getType()); - EXPECT_EQ(2 + 4, sopt->len()); + EXPECT_EQ(1U, sopt->getType()); + EXPECT_EQ(2 + 4U, sopt->len()); OptionUint32Ptr sopt32 = boost::dynamic_pointer_cast(sopt); ASSERT_TRUE(sopt32); - EXPECT_EQ(12345678, sopt32->getValue()); + EXPECT_EQ(12345678U, sopt32->getValue()); } // Verifies option 43 deferred processing (two classes) @@ -2497,7 +2497,7 @@ TEST_F(VendorOptsTest, option43Classes) { vopt = query->getOption(DHO_VENDOR_ENCAPSULATED_OPTIONS); OptionCustomPtr custom = boost::dynamic_pointer_cast(vopt); EXPECT_TRUE(custom); - EXPECT_EQ(1, vopt->getOptions().size()); + EXPECT_EQ(1U, vopt->getOptions().size()); // Pass it to the server and get a DHCPOFFER. Pkt4Ptr offer = srv_->processDiscover(query); @@ -2518,14 +2518,14 @@ TEST_F(VendorOptsTest, option43Classes) { ASSERT_TRUE(opt); // Verifies the content const OptionCollection& opts = opt->getOptions(); - ASSERT_EQ(1, opts.size()); + ASSERT_EQ(1U, opts.size()); OptionPtr sopt = opts.begin()->second; ASSERT_TRUE(sopt); - EXPECT_EQ(1, sopt->getType()); - EXPECT_EQ(2 + 4, sopt->len()); + EXPECT_EQ(1U, sopt->getType()); + EXPECT_EQ(2 + 4U, sopt->len()); OptionUint32Ptr sopt32 = boost::dynamic_pointer_cast(sopt); ASSERT_TRUE(sopt32); - EXPECT_EQ(12345678, sopt32->getValue()); + EXPECT_EQ(12345678U, sopt32->getValue()); } // Checks effect of raw not compatible option 43 sent by a client (failure) @@ -2701,7 +2701,7 @@ TEST_F(VendorOptsTest, truncatedVIVSOOption) { srv_->run(); // Check that the server did send a response - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Make sure that we received an response and it was a DHCPOFFER. Pkt4Ptr offer = srv_->fake_sent_.front(); @@ -2820,10 +2820,10 @@ TEST_F(VendorOptsTest, vendorOpsSubOption0) { OptionPtr opt = offer->getOption(DHO_VENDOR_ENCAPSULATED_OPTIONS); ASSERT_TRUE(opt); const OptionCollection& opts = opt->getOptions(); - ASSERT_EQ(1, opts.size()); + ASSERT_EQ(1U, opts.size()); OptionPtr sopt = opts.begin()->second; ASSERT_TRUE(sopt); - EXPECT_EQ(0, sopt->getType()); + EXPECT_EQ(0U, sopt->getType()); // Check suboption 0 content. OptionStringPtr sopt0 = @@ -2875,7 +2875,7 @@ TEST_F(VendorOptsTest, twoVivcos) { // Check whether there are vivco options. const OptionCollection& classes = client.getContext().response_->getOptions(DHO_VIVCO_SUBOPTIONS); - ASSERT_EQ(2, classes.size()); + ASSERT_EQ(2U, classes.size()); OptionVendorClassPtr opt_class1234; OptionVendorClassPtr opt_class5678; for (auto const& opt : classes) { @@ -2889,18 +2889,18 @@ TEST_F(VendorOptsTest, twoVivcos) { opt_class1234 = opt_class; continue; } - ASSERT_EQ(5678, vendor_id); + ASSERT_EQ(5678U, vendor_id); ASSERT_FALSE(opt_class5678); opt_class5678 = opt_class; } // Verify first vivco option. ASSERT_TRUE(opt_class1234); - ASSERT_EQ(1, opt_class1234->getTuplesNum()); + ASSERT_EQ(1U, opt_class1234->getTuplesNum()); EXPECT_EQ("foo", opt_class1234->getTuple(0).getText()); // Verify second vivco option. ASSERT_TRUE(opt_class5678); - ASSERT_EQ(1, opt_class5678->getTuplesNum()); + ASSERT_EQ(1U, opt_class5678->getTuplesNum()); EXPECT_EQ("bar", opt_class5678->getTuple(0).getText()); } diff --git a/src/bin/dhcp6/tests/addr_reg_unittest.cc b/src/bin/dhcp6/tests/addr_reg_unittest.cc index be4cf2623b..5c2b74dc74 100644 --- a/src/bin/dhcp6/tests/addr_reg_unittest.cc +++ b/src/bin/dhcp6/tests/addr_reg_unittest.cc @@ -400,7 +400,7 @@ TEST_F(AddrRegTest, unexpectedIA_NA) { string expected = "DHCP6_ADDR_REG_INFORM_FAIL "; expected += "error on ADDR-REG-INFORM from client fe80::abcd, "; expected += "unexpected IA_NA option"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test that an IA_TA option is forbidden. @@ -434,7 +434,7 @@ TEST_F(AddrRegTest, unexpectedIA_TA) { string expected = "DHCP6_ADDR_REG_INFORM_FAIL "; expected += "error on ADDR-REG-INFORM from client fe80::abcd, "; expected += "unexpected IA_TA option"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test that an IA_PD option is forbidden. @@ -467,7 +467,7 @@ TEST_F(AddrRegTest, unexpectedIA_PD) { string expected = "DHCP6_ADDR_REG_INFORM_FAIL "; expected += "error on ADDR-REG-INFORM from client fe80::abcd, "; expected += "unexpected IA_PD option"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test that an IAADDR option is required. @@ -499,7 +499,7 @@ TEST_F(AddrRegTest, noIAADDR) { string expected = "DHCP6_ADDR_REG_INFORM_FAIL "; expected += "error on ADDR-REG-INFORM from client fe80::abcd, "; expected += "Exactly 1 IAADDR option expected, but 0 received"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test that an exactly one IAADDR option is required. @@ -533,7 +533,7 @@ TEST_F(AddrRegTest, twoIAADDR) { string expected = "DHCP6_ADDR_REG_INFORM_FAIL "; expected += "error on ADDR-REG-INFORM from client fe80::abcd, "; expected += "Exactly 1 IAADDR option expected, but 2 received"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test that a well formed IAADDR option is required. @@ -571,7 +571,7 @@ TEST_F(AddrRegTest, badIAADDR) { string expected = "DHCP6_ADDR_REG_INFORM_FAIL "; expected += "error on ADDR-REG-INFORM from client fe80::abcd, "; expected += "can't convert the IAADDR option"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test that addresses must match. @@ -605,7 +605,7 @@ TEST_F(AddrRegTest, noAddrMatch) { expected += "error on ADDR-REG-INFORM from client fe80::abcd, "; expected += "Address mismatch: client at fe80::abcd "; expected += "wants to register 2001:db8:1::1"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test that addresses must match with a relay. @@ -645,7 +645,7 @@ TEST_F(AddrRegTest, noAddrMatchRelay) { expected += "error on ADDR-REG-INFORM from client fe80::1, "; expected += "Address mismatch: client at fe80::1 "; expected += "wants to register 2001:db8:1::1"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test that addresses must match with relays. @@ -691,7 +691,7 @@ TEST_F(AddrRegTest, noAddrMatch2Relays) { expected += "error on ADDR-REG-INFORM from client fe80::1, "; expected += "Address mismatch: client at fe80::1 "; expected += "wants to register 2001:db8:1::1"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test that the registering address must be in the subnet. @@ -725,7 +725,7 @@ TEST_F(AddrRegTest, noInSubnet) { expected += "error on ADDR-REG-INFORM from client 2001:db8::1, "; expected += "Address 2001:db8::1 is not in subnet "; expected += "2001:db8:1::/64 (id 1)"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test that the registering address must be not reserved. @@ -758,7 +758,7 @@ TEST_F(AddrRegTest, reserved) { string expected = "DHCP6_ADDR_REG_INFORM_FAIL "; expected += "error on ADDR-REG-INFORM from client 2001:db8:1::10, "; expected += "Address 2001:db8:1::10 is reserved"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } void @@ -799,7 +799,7 @@ AddrRegTest::testAddressInUse(const uint32_t state) { string expected = "DHCP6_ADDR_REG_INFORM_FAIL "; expected += "error on ADDR-REG-INFORM from client 2001:db8:1::1, "; expected += "Address 2001:db8:1::1 already in use Type:"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Check that a lease in the defaul state (0) makes the registering address @@ -864,8 +864,8 @@ AddrRegTest::testBasic() { Option6IAAddrPtr iaaddr = getIAAddr(response); ASSERT_TRUE(iaaddr); EXPECT_EQ(addr, iaaddr->getAddress()); - EXPECT_EQ(3000, iaaddr->getPreferred()); - EXPECT_EQ(4000, iaaddr->getValid()); + EXPECT_EQ(3000U, iaaddr->getPreferred()); + EXPECT_EQ(4000U, iaaddr->getValid()); // Verify the added lease. Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA, addr); @@ -874,14 +874,14 @@ AddrRegTest::testBasic() { EXPECT_EQ(addr, l->addr_); ASSERT_TRUE(l->duid_); EXPECT_TRUE(*l->duid_ == *duid_); - EXPECT_EQ(0, l->iaid_); - EXPECT_EQ(1, l->subnet_id_); + EXPECT_EQ(0U, l->iaid_); + EXPECT_EQ(1U, l->subnet_id_); EXPECT_FALSE(l->fqdn_fwd_); EXPECT_FALSE(l->fqdn_rev_); string expected = "DHCPSRV_MEMFILE_ADD_ADDR6 "; expected += "adding IPv6 lease with address 2001:db8:1::1"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test the basic positive scenario. @@ -939,12 +939,12 @@ TEST_F(AddrRegTest, relayed) { Option6IAAddrPtr iaaddr = getIAAddr(response); ASSERT_TRUE(iaaddr); EXPECT_EQ(addr, iaaddr->getAddress()); - EXPECT_EQ(3000, iaaddr->getPreferred()); - EXPECT_EQ(4000, iaaddr->getValid()); + EXPECT_EQ(3000U, iaaddr->getPreferred()); + EXPECT_EQ(4000U, iaaddr->getValid()); // Verify relays. auto relay_info = response->relay_info_; - ASSERT_EQ(2, relay_info.size()); + ASSERT_EQ(2U, relay_info.size()); EXPECT_EQ(relay.linkaddr_, relay_info[0].linkaddr_); EXPECT_EQ(relay.peeraddr_, relay_info[0].peeraddr_); EXPECT_EQ(relay2.linkaddr_, relay_info[1].linkaddr_); @@ -957,14 +957,14 @@ TEST_F(AddrRegTest, relayed) { EXPECT_EQ(addr, l->addr_); ASSERT_TRUE(l->duid_); EXPECT_TRUE(*l->duid_ == *duid_); - EXPECT_EQ(0, l->iaid_); - EXPECT_EQ(1, l->subnet_id_); + EXPECT_EQ(0U, l->iaid_); + EXPECT_EQ(1U, l->subnet_id_); EXPECT_FALSE(l->fqdn_fwd_); EXPECT_FALSE(l->fqdn_rev_); string expected = "DHCPSRV_MEMFILE_ADD_ADDR6 "; expected += "adding IPv6 lease with address 2001:db8:1::1"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test that the registration can be renewed. @@ -1006,16 +1006,16 @@ AddrRegTest::testRenew() { EXPECT_EQ(addr, l->addr_); ASSERT_TRUE(l->duid_); EXPECT_TRUE(*l->duid_ == *duid_); - EXPECT_EQ(0, l->iaid_); - EXPECT_EQ(1, l->subnet_id_); + EXPECT_EQ(0U, l->iaid_); + EXPECT_EQ(1U, l->subnet_id_); EXPECT_FALSE(l->fqdn_fwd_); EXPECT_FALSE(l->fqdn_rev_); string expected = "DHCPSRV_MEMFILE_UPDATE_ADDR6 "; expected += "updating IPv6 lease for address 2001:db8:1::1"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); expected = "DHCP6_ADDR_REG_INFORM_CLIENT_CHANGE"; - EXPECT_EQ(0, countFile(expected)); + EXPECT_EQ(0U, countFile(expected)); } // Test that the registration can be renewed. @@ -1067,20 +1067,20 @@ AddrRegTest::testAnotherClient() { EXPECT_EQ(addr, l->addr_); ASSERT_TRUE(l->duid_); EXPECT_TRUE(*l->duid_ == *duid_); - EXPECT_EQ(0, l->iaid_); - EXPECT_EQ(1, l->subnet_id_); + EXPECT_EQ(0U, l->iaid_); + EXPECT_EQ(1U, l->subnet_id_); EXPECT_FALSE(l->fqdn_fwd_); EXPECT_FALSE(l->fqdn_rev_); string expected = "DHCPSRV_MEMFILE_UPDATE_ADDR6 "; expected += "updating IPv6 lease for address 2001:db8:1::1"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); expected = "DHCP6_ADDR_REG_INFORM_CLIENT_CHANGE "; expected += "received an ADDR-REG-INFORM for 2001:db8:1::1 from client '"; expected += duid_->toText(); expected += "' but the address was registered by another client "; expected += "'44:44:44:44:44:44:44:44'"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test that the registered lease is updated even it belongs to another client. @@ -1132,16 +1132,16 @@ AddrRegTest::testAnotherSubnet() { EXPECT_EQ(addr, l->addr_); ASSERT_TRUE(l->duid_); EXPECT_TRUE(*l->duid_ == *duid_); - EXPECT_EQ(0, l->iaid_); - EXPECT_EQ(1, l->subnet_id_); + EXPECT_EQ(0U, l->iaid_); + EXPECT_EQ(1U, l->subnet_id_); EXPECT_FALSE(l->fqdn_fwd_); EXPECT_FALSE(l->fqdn_rev_); string expected = "DHCPSRV_MEMFILE_UPDATE_ADDR6 "; expected += "updating IPv6 lease for address 2001:db8:1::1"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); expected = "DHCP6_ADDR_REG_INFORM_CLIENT_CHANGE"; - EXPECT_EQ(0, countFile(expected)); + EXPECT_EQ(0U, countFile(expected)); } // Test that the registered lease is updated even it belongs to another subnet. @@ -1194,8 +1194,8 @@ TEST_F(AddrRegTest, fqdn) { Option6IAAddrPtr iaaddr = getIAAddr(response); ASSERT_TRUE(iaaddr); EXPECT_EQ(addr, iaaddr->getAddress()); - EXPECT_EQ(3000, iaaddr->getPreferred()); - EXPECT_EQ(4000, iaaddr->getValid()); + EXPECT_EQ(3000U, iaaddr->getPreferred()); + EXPECT_EQ(4000U, iaaddr->getValid()); EXPECT_TRUE(response->getOption(D6O_CLIENT_FQDN)); Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA, addr); @@ -1204,20 +1204,20 @@ TEST_F(AddrRegTest, fqdn) { EXPECT_EQ(addr, l->addr_); ASSERT_TRUE(l->duid_); EXPECT_TRUE(*l->duid_ == *duid_); - EXPECT_EQ(0, l->iaid_); - EXPECT_EQ(1, l->subnet_id_); + EXPECT_EQ(0U, l->iaid_); + EXPECT_EQ(1U, l->subnet_id_); EXPECT_EQ("client.example.com.", l->hostname_); EXPECT_TRUE(l->fqdn_fwd_); EXPECT_TRUE(l->fqdn_rev_); // There should be one name change request generated. - EXPECT_EQ(1, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + EXPECT_EQ(1U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); string expected = "DHCP6_DDNS_CREATE_ADD_NAME_CHANGE_REQUEST duid=["; expected += duid_->toText(); expected += "], [no hwaddr info], tid=0x4d2: "; expected += "created name change request: Type: 0 (CHG_ADD)"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test that DDNS is skipped on renew. @@ -1258,11 +1258,11 @@ TEST_F(AddrRegTest, renewDdns) { // There should be one name change request generated. auto& d2_mgr = CfgMgr::instance().getD2ClientMgr(); - EXPECT_EQ(1, d2_mgr.getQueueSize()); + EXPECT_EQ(1U, d2_mgr.getQueueSize()); // Clear the queue. ASSERT_NO_THROW(d2_mgr.runReadyIO()); - EXPECT_EQ(0, d2_mgr.getQueueSize()); + EXPECT_EQ(0U, d2_mgr.getQueueSize()); // Process it a second time. AllocEngine::ClientContext6 ctx2; @@ -1279,14 +1279,14 @@ TEST_F(AddrRegTest, renewDdns) { // DDNS is skipped when ddns-update-on-renew is false (default). EXPECT_FALSE(ctx2.getDdnsParams()->getUpdateOnRenew()); - EXPECT_EQ(0, d2_mgr.getQueueSize()); + EXPECT_EQ(0U, d2_mgr.getQueueSize()); string expected = "DHCPSRV_MEMFILE_ADD_ADDR6 "; expected += "adding IPv6 lease with address 2001:db8:1::1"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); expected = "DHCPSRV_MEMFILE_UPDATE_ADDR6 "; expected += "updating IPv6 lease for address 2001:db8:1::1"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test that DDNS is not skipped on renew when ddns-update-on-renew is true. @@ -1331,11 +1331,11 @@ TEST_F(AddrRegTest, renewDdnsUpdateOnRenew) { // There should be one name change request generated. auto& d2_mgr = CfgMgr::instance().getD2ClientMgr(); - EXPECT_EQ(1, d2_mgr.getQueueSize()); + EXPECT_EQ(1U, d2_mgr.getQueueSize()); // Clear the queue. ASSERT_NO_THROW(d2_mgr.runReadyIO()); - EXPECT_EQ(0, d2_mgr.getQueueSize()); + EXPECT_EQ(0U, d2_mgr.getQueueSize()); // Process it a second time. AllocEngine::ClientContext6 ctx2; @@ -1353,14 +1353,14 @@ TEST_F(AddrRegTest, renewDdnsUpdateOnRenew) { // DDNS is not skipped when ddns-update-on-renew is true. EXPECT_TRUE(ctx2.getDdnsParams()->getUpdateOnRenew()); // One CHG_REMOVE and one CHG_ADD (no CHG_UPDATE). - EXPECT_EQ(2, d2_mgr.getQueueSize()); + EXPECT_EQ(2U, d2_mgr.getQueueSize()); string expected = "DHCPSRV_MEMFILE_ADD_ADDR6 "; expected += "adding IPv6 lease with address 2001:db8:1::1"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); expected = "DHCPSRV_MEMFILE_UPDATE_ADDR6 "; expected += "updating IPv6 lease for address 2001:db8:1::1"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test that DDNS is not skipped when the hostname changes. @@ -1401,11 +1401,11 @@ TEST_F(AddrRegTest, renewDdnsHostname) { // There should be one name change request generated. auto& d2_mgr = CfgMgr::instance().getD2ClientMgr(); - EXPECT_EQ(1, d2_mgr.getQueueSize()); + EXPECT_EQ(1U, d2_mgr.getQueueSize()); // Clear the queue. ASSERT_NO_THROW(d2_mgr.runReadyIO()); - EXPECT_EQ(0, d2_mgr.getQueueSize()); + EXPECT_EQ(0U, d2_mgr.getQueueSize()); // Change the hostname. ASSERT_TRUE(addr_reg_inf->delOption(D6O_CLIENT_FQDN)); @@ -1430,14 +1430,14 @@ TEST_F(AddrRegTest, renewDdnsHostname) { // DDNS is not skipped when the hostname changed. EXPECT_FALSE(ctx2.getDdnsParams()->getUpdateOnRenew()); // One CHG_REMOVE and one CHG_ADD (no CHG_UPDATE). - EXPECT_EQ(2, d2_mgr.getQueueSize()); + EXPECT_EQ(2U, d2_mgr.getQueueSize()); string expected = "DHCPSRV_MEMFILE_ADD_ADDR6 "; expected += "adding IPv6 lease with address 2001:db8:1::1"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); expected = "DHCPSRV_MEMFILE_UPDATE_ADDR6 "; expected += "updating IPv6 lease for address 2001:db8:1::1"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test that the ORO option is handled. @@ -1479,15 +1479,15 @@ TEST_F(AddrRegTest, oro) { Option6IAAddrPtr iaaddr = getIAAddr(response); ASSERT_TRUE(iaaddr); EXPECT_EQ(addr, iaaddr->getAddress()); - EXPECT_EQ(3000, iaaddr->getPreferred()); - EXPECT_EQ(4000, iaaddr->getValid()); + EXPECT_EQ(3000U, iaaddr->getPreferred()); + EXPECT_EQ(4000U, iaaddr->getValid()); // Check the name-servers option. OptionPtr opt = response->getOption(D6O_NAME_SERVERS); Option6AddrLstPtr ns = boost::dynamic_pointer_cast(opt); ASSERT_TRUE(ns); Option6AddrLst::AddressContainer ns_addrs = ns->getAddresses(); - ASSERT_EQ(2, ns_addrs.size()); + ASSERT_EQ(2U, ns_addrs.size()); EXPECT_EQ("2001:db8:1::45", ns_addrs[0].toText()); EXPECT_EQ("2001:db8:1::100", ns_addrs[1].toText()); @@ -1510,7 +1510,7 @@ TEST_F(AddrRegTest, callout) { string expected = "HOOKS_CALLOUTS_BEGIN "; expected += "begin all callouts for hook addr6_register"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test the callout in the renew scenario. @@ -1529,7 +1529,7 @@ TEST_F(AddrRegTest, calloutRenew) { string expected = "HOOKS_CALLOUTS_BEGIN "; expected += "begin all callouts for hook addr6_register"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test the callout in the another client scenario. @@ -1548,7 +1548,7 @@ TEST_F(AddrRegTest, calloutAnotherClient) { string expected = "HOOKS_CALLOUTS_BEGIN "; expected += "begin all callouts for hook addr6_register"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test the callout in the another subnet scenario. @@ -1567,7 +1567,7 @@ TEST_F(AddrRegTest, calloutAnotherSubnet) { string expected = "HOOKS_CALLOUTS_BEGIN "; expected += "begin all callouts for hook addr6_register"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test that when the callout sets the status skip the lease operation @@ -1613,15 +1613,15 @@ TEST_F(AddrRegTest, calloutSkip) { Option6IAAddrPtr iaaddr = getIAAddr(response); ASSERT_TRUE(iaaddr); EXPECT_EQ(addr, iaaddr->getAddress()); - EXPECT_EQ(3000, iaaddr->getPreferred()); - EXPECT_EQ(4000, iaaddr->getValid()); + EXPECT_EQ(3000U, iaaddr->getPreferred()); + EXPECT_EQ(4000U, iaaddr->getValid()); // No lease was added. EXPECT_FALSE(LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA, addr)); string expected = "DHCPSRV_MEMFILE_ADD_ADDR6"; - EXPECT_EQ(0, countFile(expected)); - EXPECT_EQ(1, countFile("DHCP6_HOOK_ADDR6_REGISTER_SKIP")); + EXPECT_EQ(0U, countFile(expected)); + EXPECT_EQ(1U, countFile("DHCP6_HOOK_ADDR6_REGISTER_SKIP")); } // Test that when the callout sets the status drop the query is dropped. @@ -1662,8 +1662,8 @@ TEST_F(AddrRegTest, calloutDrop) { string expected = "HOOKS_CALLOUTS_BEGIN "; expected += "begin all callouts for hook addr6_register"; - EXPECT_EQ(1, countFile(expected)); - EXPECT_EQ(1, countFile("DHCP6_HOOK_ADDR6_REGISTER_DROP")); + EXPECT_EQ(1U, countFile(expected)); + EXPECT_EQ(1U, countFile("DHCP6_HOOK_ADDR6_REGISTER_DROP")); } // Check the statistics for the basic scenario. @@ -1795,17 +1795,17 @@ TEST_F(AddrRegTest, client) { EXPECT_EQ(addr, l->addr_); ASSERT_TRUE(l->duid_); EXPECT_TRUE(*l->duid_ == *duid); - EXPECT_EQ(0, l->iaid_); - EXPECT_EQ(1, l->subnet_id_); - EXPECT_EQ(3000, l->preferred_lft_); - EXPECT_EQ(4000, l->valid_lft_); + EXPECT_EQ(0U, l->iaid_); + EXPECT_EQ(1U, l->subnet_id_); + EXPECT_EQ(3000U, l->preferred_lft_); + EXPECT_EQ(4000U, l->valid_lft_); string expected = "DHCPSRV_MEMFILE_ADD_ADDR6 "; expected += "adding IPv6 lease with address 2001:db8:1::1"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); expected = "HOOKS_CALLOUTS_BEGIN "; expected += "begin all callouts for hook leases6_committed"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Check the renew scenario with the client test tool. @@ -1848,17 +1848,17 @@ TEST_F(AddrRegTest, clientRenew) { EXPECT_EQ(addr, l->addr_); ASSERT_TRUE(l->duid_); EXPECT_TRUE(*l->duid_ == *duid); - EXPECT_EQ(0, l->iaid_); - EXPECT_EQ(1, l->subnet_id_); - EXPECT_EQ(3000, l->preferred_lft_); - EXPECT_EQ(4000, l->valid_lft_); + EXPECT_EQ(0U, l->iaid_); + EXPECT_EQ(1U, l->subnet_id_); + EXPECT_EQ(3000U, l->preferred_lft_); + EXPECT_EQ(4000U, l->valid_lft_); string expected = "DHCPSRV_MEMFILE_UPDATE_ADDR6 "; expected += "updating IPv6 lease for address 2001:db8:1::1"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); expected = "HOOKS_CALLOUTS_BEGIN "; expected += "begin all callouts for hook leases6_committed"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); } // Test the global allow-address-registration = false; @@ -1924,7 +1924,7 @@ TEST_F(AddrRegTest, allowAddressRegistrationFalse) { ASSERT_TRUE(stat); EXPECT_EQ(1, stat->getInteger().first); - EXPECT_EQ(1, countFile("DHCP6_ADDR6_REGISTER_DISABLED_DROP ADDR-REG-INFORM")); + EXPECT_EQ(1U, countFile("DHCP6_ADDR6_REGISTER_DISABLED_DROP ADDR-REG-INFORM")); } // Test the global allow-address-registration = true; diff --git a/src/bin/dhcp6/tests/classify_unittest.cc b/src/bin/dhcp6/tests/classify_unittest.cc index 72649ee5eb..5183b31681 100644 --- a/src/bin/dhcp6/tests/classify_unittest.cc +++ b/src/bin/dhcp6/tests/classify_unittest.cc @@ -628,7 +628,7 @@ public: ASSERT_TRUE(ip_forwarding_opt); // The option comprises 2 bytes of option code, 2 bytes of option length, // and a single 1 byte value. This makes it 5 bytes of a total length. - ASSERT_EQ(5, ip_forwarding_opt->len()); + ASSERT_EQ(5U, ip_forwarding_opt->len()); ASSERT_EQ(static_cast(ip_forwarding), static_cast(ip_forwarding_opt->getUint8())); @@ -639,7 +639,7 @@ public: ASSERT_TRUE(dns_servers_opt); Option6AddrLst::AddressContainer addresses = dns_servers_opt->getAddresses(); // For simplicity, we expect only a single address. - ASSERT_EQ(1, addresses.size()); + ASSERT_EQ(1U, addresses.size()); EXPECT_EQ(dns_servers, addresses[0].toText()); } else { @@ -653,7 +653,7 @@ public: ASSERT_TRUE(nis_servers_opt); Option6AddrLst::AddressContainer addresses = nis_servers_opt->getAddresses(); // For simplicity, we expect only a single address. - ASSERT_EQ(1, addresses.size()); + ASSERT_EQ(1U, addresses.size()); EXPECT_EQ(nis_servers, addresses[0].toText()); } else { @@ -802,9 +802,9 @@ TEST_F(ClassifyTest, matchClassification) { srv_->classifyPacket(query2); srv_->classifyPacket(query3); - EXPECT_EQ(query1->classes_.size(), 6); - EXPECT_EQ(query2->classes_.size(), 3); - EXPECT_EQ(query3->classes_.size(), 6); + EXPECT_EQ(query1->classes_.size(), 6U); + EXPECT_EQ(query2->classes_.size(), 3U); + EXPECT_EQ(query3->classes_.size(), 6U); EXPECT_TRUE(query1->inClass("ALL")); EXPECT_TRUE(query2->inClass("ALL")); @@ -1175,7 +1175,7 @@ TEST_F(ClassifyTest, subnetClassPriority) { ASSERT_GT(opt->len(), opt->getHeaderLen()); // Classification sets the value to true/1, subnet to false/0 // Here subnet has the priority - EXPECT_EQ(0, opt->getUint8()); + EXPECT_EQ(0U, opt->getUint8()); } // Checks subnet options have the priority over global options @@ -1243,7 +1243,7 @@ TEST_F(ClassifyTest, subnetGlobalPriority) { ASSERT_GT(opt->len(), opt->getHeaderLen()); // Global sets the value to true/1, subnet to false/0 // Here subnet has the priority - EXPECT_EQ(0, opt->getUint8()); + EXPECT_EQ(0U, opt->getUint8()); } // Checks class options have the priority over global options @@ -1392,7 +1392,7 @@ TEST_F(ClassifyTest, classGlobalPersistency) { ASSERT_GT(opt->len(), opt->getHeaderLen()); // Global sets the value to true/1, subnet to false/0 // Here subnet has the priority - EXPECT_EQ(0, opt->getUint8()); + EXPECT_EQ(0U, opt->getUint8()); } // Checks class never-send options have the priority over everything else. @@ -1785,7 +1785,7 @@ TEST_F(ClassifyTest, relayOverrideAndClientClass) { // Let's get the subnet configuration objects const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - ASSERT_EQ(2, subnets->size()); + ASSERT_EQ(2U, subnets->size()); // Let's get them for easy reference Subnet6Ptr subnet1 = *subnets->begin(); @@ -2111,7 +2111,7 @@ TEST_F(ClassifyTest, precedenceNone) { ASSERT_NO_THROW(client.doSARR()); // Check response - EXPECT_EQ(1, client.getLeaseNum()); + EXPECT_EQ(1U, client.getLeaseNum()); Pkt6Ptr resp = client.getContext().response_; ASSERT_TRUE(resp); @@ -2185,7 +2185,7 @@ TEST_F(ClassifyTest, precedencePool) { ASSERT_NO_THROW(client.doSARR()); // Check response - EXPECT_EQ(1, client.getLeaseNum()); + EXPECT_EQ(1U, client.getLeaseNum()); Pkt6Ptr resp = client.getContext().response_; ASSERT_TRUE(resp); @@ -2196,7 +2196,7 @@ TEST_F(ClassifyTest, precedencePool) { boost::dynamic_pointer_cast(opt); ASSERT_TRUE(servers); auto addrs = servers->getAddresses(); - ASSERT_EQ(1, addrs.size()); + ASSERT_EQ(1U, addrs.size()); EXPECT_EQ("2001:db8:1::1", addrs[0].toText()); } @@ -2266,7 +2266,7 @@ TEST_F(ClassifyTest, precedencePdPool) { ASSERT_NO_THROW(client.doSARR()); // Check response - EXPECT_EQ(1, client.getLeaseNum()); + EXPECT_EQ(1U, client.getLeaseNum()); Pkt6Ptr resp = client.getContext().response_; ASSERT_TRUE(resp); @@ -2277,7 +2277,7 @@ TEST_F(ClassifyTest, precedencePdPool) { boost::dynamic_pointer_cast(opt); ASSERT_TRUE(servers); auto addrs = servers->getAddresses(); - ASSERT_EQ(1, addrs.size()); + ASSERT_EQ(1U, addrs.size()); EXPECT_EQ("2001:db8:1::1", addrs[0].toText()); } @@ -2345,7 +2345,7 @@ TEST_F(ClassifyTest, precedenceSubnet) { ASSERT_NO_THROW(client.doSARR()); // Check response - EXPECT_EQ(1, client.getLeaseNum()); + EXPECT_EQ(1U, client.getLeaseNum()); Pkt6Ptr resp = client.getContext().response_; ASSERT_TRUE(resp); @@ -2356,7 +2356,7 @@ TEST_F(ClassifyTest, precedenceSubnet) { boost::dynamic_pointer_cast(opt); ASSERT_TRUE(servers); auto addrs = servers->getAddresses(); - ASSERT_EQ(1, addrs.size()); + ASSERT_EQ(1U, addrs.size()); EXPECT_EQ("2001:db8:1::2", addrs[0].toText()); } @@ -2423,7 +2423,7 @@ TEST_F(ClassifyTest, precedenceNetwork) { ASSERT_NO_THROW(client.doSARR()); // Check response - EXPECT_EQ(1, client.getLeaseNum()); + EXPECT_EQ(1U, client.getLeaseNum()); Pkt6Ptr resp = client.getContext().response_; ASSERT_TRUE(resp); @@ -2434,7 +2434,7 @@ TEST_F(ClassifyTest, precedenceNetwork) { boost::dynamic_pointer_cast(opt); ASSERT_TRUE(servers); auto addrs = servers->getAddresses(); - ASSERT_EQ(1, addrs.size()); + ASSERT_EQ(1U, addrs.size()); EXPECT_EQ("2001:db8:1::3", addrs[0].toText()); } @@ -2481,7 +2481,7 @@ TEST_F(ClassifyTest, additionalNoTest) { ASSERT_NO_THROW(client.doSARR()); // Check response - EXPECT_EQ(1, client.getLeaseNum()); + EXPECT_EQ(1U, client.getLeaseNum()); Pkt6Ptr resp = client.getContext().response_; ASSERT_TRUE(resp); @@ -2492,7 +2492,7 @@ TEST_F(ClassifyTest, additionalNoTest) { boost::dynamic_pointer_cast(opt); ASSERT_TRUE(servers); auto addrs = servers->getAddresses(); - ASSERT_EQ(1, addrs.size()); + ASSERT_EQ(1U, addrs.size()); EXPECT_EQ("2001:db8:1::3", addrs[0].toText()); } @@ -2531,7 +2531,7 @@ TEST_F(ClassifyTest, additionalNotDefined) { ASSERT_NO_THROW(client.doSARR()); // Check response - EXPECT_EQ(1, client.getLeaseNum()); + EXPECT_EQ(1U, client.getLeaseNum()); Pkt6Ptr resp = client.getContext().response_; ASSERT_TRUE(resp); } @@ -2559,7 +2559,7 @@ TEST_F(ClassifyTest, server1Telephone) { ASSERT_TRUE(resp); // The address is from the first pool. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); EXPECT_EQ("2001:db8:1:1::", lease_client.addr_.toText()); } @@ -2587,7 +2587,7 @@ TEST_F(ClassifyTest, server1Computer) { ASSERT_TRUE(resp); // The address is from the second pool. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); EXPECT_EQ("2001:db8:1:2::", lease_client.addr_.toText()); } @@ -2615,7 +2615,7 @@ TEST_F(ClassifyTest, server2Telephone) { ASSERT_TRUE(resp); // The address is from the third pool. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); EXPECT_EQ("2001:db8:1:3::", lease_client.addr_.toText()); } @@ -2643,7 +2643,7 @@ TEST_F(ClassifyTest, server2Computer) { ASSERT_TRUE(resp); // The address is from the forth pool. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); EXPECT_EQ("2001:db8:1:4::", lease_client.addr_.toText()); } @@ -2672,7 +2672,7 @@ TEST_F(ClassifyTest, pDserver1Telephone) { ASSERT_TRUE(resp); // The prefix is from the first pool. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); EXPECT_EQ("2001:db8:1::", lease_client.addr_.toText()); } @@ -2701,7 +2701,7 @@ TEST_F(ClassifyTest, pDserver1Computer) { ASSERT_TRUE(resp); // The prefix is from the second pool. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); EXPECT_EQ("2001:db8:2::", lease_client.addr_.toText()); } @@ -2730,7 +2730,7 @@ TEST_F(ClassifyTest, pDserver2Telephone) { ASSERT_TRUE(resp); // The prefix is from the third pool. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); EXPECT_EQ("2001:db8:3::", lease_client.addr_.toText()); } @@ -2759,7 +2759,7 @@ TEST_F(ClassifyTest, pDserver2Computer) { ASSERT_TRUE(resp); // The prefix is from the forth pool. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); EXPECT_EQ("2001:db8:4::", lease_client.addr_.toText()); } @@ -3218,7 +3218,7 @@ TEST_F(ClassifyTest, vendorClassOptionClassTag) { processQuery(*srv_, query, response); const auto& vendor_classes = response->getOptions(D6O_VENDOR_CLASS); - ASSERT_EQ(1, vendor_classes.size()); + ASSERT_EQ(1U, vendor_classes.size()); // Create a SOLICIT that does not match class "right". query = createSolicit(); @@ -3234,7 +3234,7 @@ TEST_F(ClassifyTest, vendorClassOptionClassTag) { // Should not have any vendor class options. const auto& vendor_classes2 = response->getOptions(D6O_VENDOR_CLASS); - ASSERT_EQ(0, vendor_classes2.size()); + ASSERT_EQ(0U, vendor_classes2.size()); } // Verifies that D6O_VENDOR_OPTS option can be gated by option class @@ -3290,7 +3290,7 @@ TEST_F(ClassifyTest, persistedVendorOptsOptionClassTag) { // The response should not have the D6O_VENDOR_OPTS option. const auto& vendor_opts = response->getOptions(D6O_VENDOR_OPTS); - ASSERT_EQ(0, vendor_opts.size()); + ASSERT_EQ(0U, vendor_opts.size()); // Create a SOLICIT that matches class "melon". query = createSolicit(); @@ -3312,7 +3312,7 @@ TEST_F(ClassifyTest, persistedVendorOptsOptionClassTag) { // The response should have the D6O_VENDOR_OPTS option. const auto& vendor_opts2 = response->getOptions(D6O_VENDOR_OPTS); - ASSERT_EQ(1, vendor_opts2.size()); + ASSERT_EQ(1U, vendor_opts2.size()); } // Verifies that vendor options can be gated by option class tagging. @@ -3416,13 +3416,13 @@ TEST_F(ClassifyTest, requestedVendorOptionsClassTag) { // Should have 1 vendor response option. const auto& vendor_opts = response->getOptions(D6O_VENDOR_OPTS); - ASSERT_EQ(1, vendor_opts.size()); + ASSERT_EQ(1U, vendor_opts.size()); auto const& opt = (*vendor_opts.begin()).second; OptionVendorPtr vendor_resp = boost::dynamic_pointer_cast(opt); ASSERT_TRUE(vendor_resp); - ASSERT_EQ(4491, vendor_resp->getVendorId()); + ASSERT_EQ(4491U, vendor_resp->getVendorId()); // It should vendor otions 101 and 103, but not 102. OptionPtr custom = vendor_resp->getOption(101); EXPECT_TRUE(custom); @@ -3489,7 +3489,7 @@ TEST_F(ClassifyTest, classTaggingAndAlwaysSend) { OptionPtr opt = response->getOption(2345); ASSERT_TRUE(opt); ASSERT_GT(opt->len(), opt->getHeaderLen()); - EXPECT_EQ(1, opt->getUint8()); + EXPECT_EQ(1U, opt->getUint8()); } // Verifies that option class-tagging does not subvert never-send. diff --git a/src/bin/dhcp6/tests/config_backend_unittest.cc b/src/bin/dhcp6/tests/config_backend_unittest.cc index 61509ac229..65513f1176 100644 --- a/src/bin/dhcp6/tests/config_backend_unittest.cc +++ b/src/bin/dhcp6/tests/config_backend_unittest.cc @@ -214,7 +214,7 @@ TEST_F(Dhcp6CBTest, mergeGlobals) { // decline-probation-period is an explicit member that should come // from the backend. - EXPECT_EQ(86400, staging_cfg->getDeclinePeriod()); + EXPECT_EQ(86400U, staging_cfg->getDeclinePeriod()); // Verify that the implicit globals from JSON are there. ASSERT_NO_FATAL_FAILURE(checkConfiguredGlobal(staging_cfg, "valid-lifetime", @@ -230,7 +230,7 @@ TEST_F(Dhcp6CBTest, mergeGlobals) { ASSERT_NO_FATAL_FAILURE(checkConfiguredGlobal(staging_cfg, hr_identifiers, true)); auto const& ex_hr_i = staging_cfg->getCfgHostOperations6()->getIdentifierTypes(); - EXPECT_EQ(ex_hr_i.size(), 2); + EXPECT_EQ(ex_hr_i.size(), 2U); EXPECT_EQ(ex_hr_i.front(), Host::IDENT_HWADDR); EXPECT_EQ(ex_hr_i.back(), Host::IDENT_FLEX); } @@ -290,18 +290,18 @@ TEST_F(Dhcp6CBTest, mergeOptionDefs) { // Definition "one" from first backend should be there. OptionDefinitionPtr found_def = option_defs->get("isc", "one"); ASSERT_TRUE(found_def); - EXPECT_EQ(101, found_def->getCode()); + EXPECT_EQ(101U, found_def->getCode()); EXPECT_EQ(OptionDataType::OPT_UINT16_TYPE, found_def->getType()); // Definition "two" from JSON config should be there. found_def = option_defs->get("isc", "two"); ASSERT_TRUE(found_def); - EXPECT_EQ(2, found_def->getCode()); + EXPECT_EQ(2U, found_def->getCode()); // Definition "three" from first backend should be there. found_def = option_defs->get("isc", "three"); ASSERT_TRUE(found_def); - EXPECT_EQ(3, found_def->getCode()); + EXPECT_EQ(3U, found_def->getCode()); // Definition "four" from first backend should not be there. found_def = option_defs->get("isc", "four"); @@ -370,7 +370,7 @@ TEST_F(Dhcp6CBTest, mergeOptions) { ASSERT_TRUE(found_opt.option_); OptionUint32Ptr opint = boost::dynamic_pointer_cast(found_opt.option_); ASSERT_TRUE(opint); - EXPECT_EQ(500, opint->getValue()); + EXPECT_EQ(500U, opint->getValue()); } // This test verifies that DHCP options fetched from the config backend diff --git a/src/bin/dhcp6/tests/config_parser_unittest.cc b/src/bin/dhcp6/tests/config_parser_unittest.cc index 4dc3103f88..4ad925c076 100644 --- a/src/bin/dhcp6/tests/config_parser_unittest.cc +++ b/src/bin/dhcp6/tests/config_parser_unittest.cc @@ -1281,11 +1281,11 @@ TEST_F(Dhcp6ParserTest, unspecifiedRenewTimer) { EXPECT_TRUE(subnet->getT1().unspecified()); EXPECT_FALSE(subnet->getT2().unspecified()); - EXPECT_EQ(2000, subnet->getT2().get()); - EXPECT_EQ(4000, subnet->getValid().get()); + EXPECT_EQ(2000U, subnet->getT2().get()); + EXPECT_EQ(4000U, subnet->getValid().get()); // Check that subnet-id is 1 - EXPECT_EQ(1, subnet->getID()); + EXPECT_EQ(1U, subnet->getID()); } /// Check that the rebind-timer doesn't have to be specified, in which case @@ -1314,12 +1314,12 @@ TEST_F(Dhcp6ParserTest, unspecifiedRebindTimer) { getCfgSubnets6()->selectSubnet(IOAddress("2001:db8::1")); ASSERT_TRUE(subnet); EXPECT_FALSE(subnet->getT1().unspecified()); - EXPECT_EQ(1000, subnet->getT1().get()); + EXPECT_EQ(1000U, subnet->getT1().get()); EXPECT_TRUE(subnet->getT2().unspecified()); - EXPECT_EQ(4000, subnet->getValid().get()); + EXPECT_EQ(4000U, subnet->getValid().get()); // Check that subnet-id is 1 - EXPECT_EQ(1, subnet->getID()); + EXPECT_EQ(1U, subnet->getID()); } /// Check that preferred-lifetime must be between min-preferred-lifetime and @@ -1529,17 +1529,17 @@ TEST_F(Dhcp6ParserTest, subnetGlobalDefaults) { ConstSubnet6Ptr subnet = CfgMgr::instance().getStagingCfg()-> getCfgSubnets6()->selectSubnet(IOAddress("2001:db8:1::5"), classify_); ASSERT_TRUE(subnet); - EXPECT_EQ(1000, subnet->getT1().get()); - EXPECT_EQ(2000, subnet->getT2().get()); - EXPECT_EQ(3000, subnet->getPreferred().get()); - EXPECT_EQ(2000, subnet->getPreferred().getMin()); - EXPECT_EQ(4000, subnet->getPreferred().getMax()); - EXPECT_EQ(4000, subnet->getValid().get()); - EXPECT_EQ(3000, subnet->getValid().getMin()); - EXPECT_EQ(5000, subnet->getValid().getMax()); + EXPECT_EQ(1000U, subnet->getT1().get()); + EXPECT_EQ(2000U, subnet->getT2().get()); + EXPECT_EQ(3000U, subnet->getPreferred().get()); + EXPECT_EQ(2000U, subnet->getPreferred().getMin()); + EXPECT_EQ(4000U, subnet->getPreferred().getMax()); + EXPECT_EQ(4000U, subnet->getValid().get()); + EXPECT_EQ(3000U, subnet->getValid().getMin()); + EXPECT_EQ(5000U, subnet->getValid().getMax()); // Check that subnet-id is 1 - EXPECT_EQ(1, subnet->getID()); + EXPECT_EQ(1U, subnet->getID()); } // This test checks that it is possible to assign arbitrary ids for subnets. @@ -1587,15 +1587,15 @@ TEST_F(Dhcp6ParserTest, multipleSubnetsExplicitIDs) { const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(4, subnets->size()); // We expect 4 subnets + ASSERT_EQ(4U, subnets->size()); // We expect 4 subnets // Verify that subnet ids are as expected. // Now the subnet order is the subnet id one. auto subnet = subnets->begin(); - EXPECT_EQ(1, (*subnet)->getID()); - EXPECT_EQ(34, (*++subnet)->getID()); - EXPECT_EQ(100, (*++subnet)->getID()); - EXPECT_EQ(1024, (*++subnet)->getID()); + EXPECT_EQ(1U, (*subnet)->getID()); + EXPECT_EQ(34U, (*++subnet)->getID()); + EXPECT_EQ(100U, (*++subnet)->getID()); + EXPECT_EQ(1024U, (*++subnet)->getID()); // Repeat reconfiguration process 10 times and check that the subnet-id // is set to the same value. @@ -1730,7 +1730,7 @@ TEST_F(Dhcp6ParserTest, reconfigureRemoveSubnet) { const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(4, subnets->size()); // We expect 4 subnets + ASSERT_EQ(4U, subnets->size()); // We expect 4 subnets CfgMgr::instance().clear(); @@ -1743,13 +1743,13 @@ TEST_F(Dhcp6ParserTest, reconfigureRemoveSubnet) { subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(3, subnets->size()); // We expect 3 subnets now (4th is removed) + ASSERT_EQ(3U, subnets->size()); // We expect 3 subnets now (4th is removed) // Check subnet-ids of each subnet (it should be monotonously increasing) auto subnet = subnets->begin(); - EXPECT_EQ(1, (*subnet)->getID()); - EXPECT_EQ(2, (*++subnet)->getID()); - EXPECT_EQ(3, (*++subnet)->getID()); + EXPECT_EQ(1U, (*subnet)->getID()); + EXPECT_EQ(2U, (*++subnet)->getID()); + EXPECT_EQ(3U, (*++subnet)->getID()); CfgMgr::instance().clear(); @@ -1770,13 +1770,13 @@ TEST_F(Dhcp6ParserTest, reconfigureRemoveSubnet) { subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(3, subnets->size()); // We expect 4 subnets + ASSERT_EQ(3U, subnets->size()); // We expect 4 subnets subnet = subnets->begin(); - EXPECT_EQ(1, (*subnet)->getID()); + EXPECT_EQ(1U, (*subnet)->getID()); // The second subnet (with subnet-id = 2) is no longer there - EXPECT_EQ(3, (*++subnet)->getID()); - EXPECT_EQ(4, (*++subnet)->getID()); + EXPECT_EQ(3U, (*++subnet)->getID()); + EXPECT_EQ(4U, (*++subnet)->getID()); } // Check whether it is possible to configure compatibility flags. @@ -1904,14 +1904,14 @@ TEST_F(Dhcp6ParserTest, subnetLocal) { ConstSubnet6Ptr subnet = CfgMgr::instance().getStagingCfg()-> getCfgSubnets6()->selectSubnet(IOAddress("2001:db8:1::5"), classify_); ASSERT_TRUE(subnet); - EXPECT_EQ(1, subnet->getT1().get()); - EXPECT_EQ(2, subnet->getT2().get()); - EXPECT_EQ(3, subnet->getPreferred().get()); - EXPECT_EQ(2, subnet->getPreferred().getMin()); - EXPECT_EQ(4, subnet->getPreferred().getMax()); - EXPECT_EQ(4, subnet->getValid().get()); - EXPECT_EQ(3, subnet->getValid().getMin()); - EXPECT_EQ(5, subnet->getValid().getMax()); + EXPECT_EQ(1U, subnet->getT1().get()); + EXPECT_EQ(2U, subnet->getT2().get()); + EXPECT_EQ(3U, subnet->getPreferred().get()); + EXPECT_EQ(2U, subnet->getPreferred().getMin()); + EXPECT_EQ(4U, subnet->getPreferred().getMax()); + EXPECT_EQ(4U, subnet->getValid().get()); + EXPECT_EQ(3U, subnet->getValid().getMin()); + EXPECT_EQ(5U, subnet->getValid().getMax()); } // This test checks if it is possible to define a subnet with an @@ -2269,12 +2269,12 @@ TEST_F(Dhcp6ParserTest, multiplePools) { const Subnet6Collection* subnets = CfgMgr::instance().getStagingCfg()->getCfgSubnets6()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(2, subnets->size()); // We expect 2 subnets + ASSERT_EQ(2U, subnets->size()); // We expect 2 subnets // Check the first subnet auto subnet = subnets->begin(); const PoolCollection& pools1 = (*subnet)->getPools(Lease::TYPE_NA); - ASSERT_EQ(2, pools1.size()); + ASSERT_EQ(2U, pools1.size()); EXPECT_EQ("type=IA_NA, 2001:db8:1::-2001:db8:1::ffff:ffff, delegated_len=128", pools1[0]->toText()); EXPECT_EQ("type=IA_NA, 2001:db8:1:0:abcd::-2001:db8:1:0:abcd::ffff, delegated_len=128", @@ -2285,7 +2285,7 @@ TEST_F(Dhcp6ParserTest, multiplePools) { // Check the second subnet ++subnet; const PoolCollection& pools2 = (*subnet)->getPools(Lease::TYPE_NA); - ASSERT_EQ(2, pools2.size()); + ASSERT_EQ(2U, pools2.size()); EXPECT_EQ("type=IA_NA, 2001:db8:2::1-2001:db8:2::ff, delegated_len=128", pools2[0]->toText()); EXPECT_EQ("type=IA_NA, 2001:db8:2::300-2001:db8:2::3ff, delegated_len=128", @@ -2349,10 +2349,10 @@ TEST_F(Dhcp6ParserTest, poolPrefixLen) { ConstSubnet6Ptr subnet = CfgMgr::instance().getStagingCfg()-> getCfgSubnets6()->selectSubnet(IOAddress("2001:db8:1::5"), classify_); ASSERT_TRUE(subnet); - EXPECT_EQ(1000, subnet->getT1().get()); - EXPECT_EQ(2000, subnet->getT2().get()); - EXPECT_EQ(3000, subnet->getPreferred().get()); - EXPECT_EQ(4000, subnet->getValid().get()); + EXPECT_EQ(1000U, subnet->getT1().get()); + EXPECT_EQ(2000U, subnet->getT2().get()); + EXPECT_EQ(3000U, subnet->getPreferred().get()); + EXPECT_EQ(4000U, subnet->getValid().get()); } // Goal of this test is to verify if invalid pool definitions @@ -2555,14 +2555,14 @@ TEST_F(Dhcp6ParserTest, pdPoolBasics) { // Fetch the collection of PD pools. It should have 1 entry. PoolCollection pc; ASSERT_NO_THROW(pc = subnet->getPools(Lease::TYPE_PD)); - EXPECT_EQ(1, pc.size()); + EXPECT_EQ(1U, pc.size()); // Get a pointer to the pd pool instance, and verify its contents. Pool6Ptr p6; ASSERT_NO_THROW(p6 = boost::dynamic_pointer_cast(pc[0])); ASSERT_TRUE(p6); EXPECT_EQ("2001:db8:1::", p6->getFirstAddress().toText()); - EXPECT_EQ(128, p6->getLength()); + EXPECT_EQ(128U, p6->getLength()); // prefix-len is not directly accessible after pool construction, so // verify that it was interpreted correctly by checking the last address @@ -2615,14 +2615,14 @@ TEST_F(Dhcp6ParserTest, pdPoolPrefixExclude) { // Fetch the collection of PD pools. It should have 1 entry. PoolCollection pc; ASSERT_NO_THROW(pc = subnet->getPools(Lease::TYPE_PD)); - EXPECT_EQ(1, pc.size()); + EXPECT_EQ(1U, pc.size()); // Get a pointer to the pd pool instance, and verify its contents. Pool6Ptr p6; ASSERT_NO_THROW(p6 = boost::dynamic_pointer_cast(pc[0])); ASSERT_TRUE(p6); EXPECT_EQ("3000::", p6->getFirstAddress().toText()); - EXPECT_EQ(64, p6->getLength()); + EXPECT_EQ(64U, p6->getLength()); // This pool should have Prefix Exclude option associated. Option6PDExcludePtr pd_exclude_option = p6->getPrefixExcludeOption(); @@ -2633,7 +2633,7 @@ TEST_F(Dhcp6ParserTest, pdPoolPrefixExclude) { // verify that it is correct. EXPECT_EQ("3000:0:0:3:1000::", pd_exclude_option->getExcludedPrefix(IOAddress("3000:0:0:3::"), 64).toText()); - EXPECT_EQ(72, static_cast(pd_exclude_option->getExcludedPrefixLength())); + EXPECT_EQ(72, static_cast(pd_exclude_option->getExcludedPrefixLength())); } // Goal of this test is verify that a list of PD pools can be configured. @@ -2697,11 +2697,11 @@ TEST_F(Dhcp6ParserTest, pdPoolList) { // Fetch the collection of NA pools. It should have 1 entry. PoolCollection pc; ASSERT_NO_THROW(pc = subnet->getPools(Lease::TYPE_NA)); - EXPECT_EQ(1, pc.size()); + EXPECT_EQ(1U, pc.size()); // Fetch the collection of PD pools. It should have 3 entries. ASSERT_NO_THROW(pc = subnet->getPools(Lease::TYPE_PD)); - EXPECT_EQ(3, pc.size()); + EXPECT_EQ(3U, pc.size()); // Loop through the pools and verify their contents. for (unsigned int i = 0; i < 3; i++) { @@ -2709,7 +2709,7 @@ TEST_F(Dhcp6ParserTest, pdPoolList) { ASSERT_NO_THROW(p6 = boost::dynamic_pointer_cast(pc[i])); ASSERT_TRUE(p6); EXPECT_EQ(prefixes[i], p6->getFirstAddress().toText()); - EXPECT_EQ((80 + (i * 8)), p6->getLength()); + EXPECT_EQ((80U + (i * 8)), p6->getLength()); } } @@ -2756,14 +2756,14 @@ TEST_F(Dhcp6ParserTest, subnetAndPrefixDelegated) { // Fetch the collection of PD pools. It should have 1 entry. PoolCollection pc; ASSERT_NO_THROW(pc = subnet->getPools(Lease::TYPE_PD)); - EXPECT_EQ(1, pc.size()); + EXPECT_EQ(1U, pc.size()); // Get a pointer to the pd pool instance, and verify its contents. Pool6Ptr p6; ASSERT_NO_THROW(p6 = boost::dynamic_pointer_cast(pc[0])); ASSERT_TRUE(p6); EXPECT_EQ("2001:db8:1::", p6->getFirstAddress().toText()); - EXPECT_EQ(64, p6->getLength()); + EXPECT_EQ(64U, p6->getLength()); // prefix-len is not directly accessible after pool construction, so // verify that it was interpreted correctly by checking the last address @@ -2925,7 +2925,7 @@ TEST_F(Dhcp6ParserTest, optionDefIpv6Address) { // Verify that the option definition data is valid. EXPECT_EQ("foo", def->getName()); - EXPECT_EQ(100, def->getCode()); + EXPECT_EQ(100U, def->getCode()); EXPECT_FALSE(def->getArrayType()); EXPECT_EQ(OPT_IPV6_ADDRESS_TYPE, def->getType()); EXPECT_TRUE(def->getEncapsulatedSpace().empty()); @@ -2985,7 +2985,7 @@ TEST_F(Dhcp6ParserTest, optionDefRecord) { // Check the option data. EXPECT_EQ("foo", def->getName()); - EXPECT_EQ(100, def->getCode()); + EXPECT_EQ(100U, def->getCode()); EXPECT_EQ(OPT_RECORD_TYPE, def->getType()); EXPECT_FALSE(def->getArrayType()); EXPECT_TRUE(def->getEncapsulatedSpace().empty()); @@ -2994,7 +2994,7 @@ TEST_F(Dhcp6ParserTest, optionDefRecord) { // fields are present and they are of the expected types. const OptionDefinition::RecordFieldsCollection& record_fields = def->getRecordFields(); - ASSERT_EQ(4, record_fields.size()); + ASSERT_EQ(4U, record_fields.size()); EXPECT_EQ(OPT_UINT16_TYPE, record_fields[0]); EXPECT_EQ(OPT_IPV4_ADDRESS_TYPE, record_fields[1]); EXPECT_EQ(OPT_IPV6_ADDRESS_TYPE, record_fields[2]); @@ -3042,7 +3042,7 @@ TEST_F(Dhcp6ParserTest, optionDefMultiple) { // Check the option data. EXPECT_EQ("foo", def1->getName()); - EXPECT_EQ(100, def1->getCode()); + EXPECT_EQ(100U, def1->getCode()); EXPECT_EQ(OPT_UINT32_TYPE, def1->getType()); EXPECT_FALSE(def1->getArrayType()); EXPECT_TRUE(def1->getEncapsulatedSpace().empty()); @@ -3054,7 +3054,7 @@ TEST_F(Dhcp6ParserTest, optionDefMultiple) { // Check the option data. EXPECT_EQ("foo-2", def2->getName()); - EXPECT_EQ(101, def2->getCode()); + EXPECT_EQ(101U, def2->getCode()); EXPECT_EQ(OPT_IPV4_ADDRESS_TYPE, def2->getType()); EXPECT_FALSE(def2->getArrayType()); EXPECT_TRUE(def2->getEncapsulatedSpace().empty()); @@ -3108,7 +3108,7 @@ TEST_F(Dhcp6ParserTest, optionDefDuplicate) { string expected = "failed to create or run parser for configuration "; expected += "element option-def: option definition with code '100' "; expected += "already exists in option space 'isc'"; - EXPECT_EQ(1, countFile(expected)); + EXPECT_EQ(1U, countFile(expected)); // The new configuration should have inserted option 100, but // once configuration failed (on the duplicate option definition) @@ -3117,7 +3117,7 @@ TEST_F(Dhcp6ParserTest, optionDefDuplicate) { def = LibDHCP::getRuntimeOptionDef("isc", 233); ASSERT_TRUE(def); EXPECT_EQ("bar", def->getName()); - EXPECT_EQ(233, def->getCode()); + EXPECT_EQ(233U, def->getCode()); } // The goal of this test is to verify that the option definition @@ -3157,7 +3157,7 @@ TEST_F(Dhcp6ParserTest, optionDefArray) { // Check the option data. EXPECT_EQ("foo", def->getName()); - EXPECT_EQ(100, def->getCode()); + EXPECT_EQ(100U, def->getCode()); EXPECT_EQ(OPT_UINT32_TYPE, def->getType()); EXPECT_TRUE(def->getArrayType()); EXPECT_TRUE(def->getEncapsulatedSpace().empty()); @@ -3200,7 +3200,7 @@ TEST_F(Dhcp6ParserTest, optionDefEncapsulate) { // Check the option data. EXPECT_EQ("foo", def->getName()); - EXPECT_EQ(100, def->getCode()); + EXPECT_EQ(100U, def->getCode()); EXPECT_EQ(OPT_UINT32_TYPE, def->getType()); EXPECT_FALSE(def->getArrayType()); EXPECT_EQ("sub-opts-space", def->getEncapsulatedSpace()); @@ -3427,7 +3427,7 @@ TEST_F(Dhcp6ParserTest, optionStandardDefOverride) { // Check the option data. EXPECT_EQ("foo", def->getName()); - EXPECT_EQ(100, def->getCode()); + EXPECT_EQ(100U, def->getCode()); EXPECT_EQ(OPT_STRING_TYPE, def->getType()); EXPECT_FALSE(def->getArrayType()); @@ -3479,7 +3479,7 @@ TEST_F(Dhcp6ParserTest, optionStandardDefOverride) { // Check the option data. EXPECT_EQ("geolocation", def->getName()); - EXPECT_EQ(63, def->getCode()); + EXPECT_EQ(63U, def->getCode()); EXPECT_EQ(OPT_STRING_TYPE, def->getType()); EXPECT_FALSE(def->getArrayType()); } @@ -3519,10 +3519,10 @@ TEST_F(Dhcp6ParserTest, optionDataDefaultsGlobal) { getCfgSubnets6()->selectSubnet(IOAddress("2001:db8:1::5"), classify_); ASSERT_TRUE(subnet); OptionContainerPtr options = subnet->getCfgOption()->getAll(DHCP6_OPTION_SPACE); - ASSERT_EQ(0, options->size()); + ASSERT_EQ(0U, options->size()); options = CfgMgr::instance().getStagingCfg()->getCfgOption()->getAll(DHCP6_OPTION_SPACE); - ASSERT_EQ(2, options->size()); + ASSERT_EQ(2U, options->size()); // Get the search index. Index #1 is to search using option code. const OptionContainerTypeIndex& idx = options->get<1>(); @@ -3591,13 +3591,13 @@ TEST_F(Dhcp6ParserTest, optionDataDefaultsSubnet) { // These options are subnet options OptionContainerPtr options = CfgMgr::instance().getStagingCfg()->getCfgOption()->getAll(DHCP6_OPTION_SPACE); - ASSERT_EQ(0, options->size()); + ASSERT_EQ(0U, options->size()); ConstSubnet6Ptr subnet = CfgMgr::instance().getStagingCfg()-> getCfgSubnets6()->selectSubnet(IOAddress("2001:db8:1::5"), classify_); ASSERT_TRUE(subnet); options = subnet->getCfgOption()->getAll(DHCP6_OPTION_SPACE); - ASSERT_EQ(2, options->size()); + ASSERT_EQ(2U, options->size()); // Get the search index. Index #1 is to search using option code. const OptionContainerTypeIndex& idx = options->get<1>(); @@ -3687,12 +3687,12 @@ TEST_F(Dhcp6ParserTest, optionDataTwoSpaces) { OptionDescriptor desc1 = CfgMgr::instance().getStagingCfg()->getCfgOption()->get(DHCP6_OPTION_SPACE, 38); ASSERT_TRUE(desc1.option_); - EXPECT_EQ(38, desc1.option_->getType()); + EXPECT_EQ(38U, desc1.option_->getType()); // Try to get the option from the space isc. OptionDescriptor desc2 = CfgMgr::instance().getStagingCfg()->getCfgOption()->get("isc", 38); ASSERT_TRUE(desc2.option_); - EXPECT_EQ(38, desc1.option_->getType()); + EXPECT_EQ(38U, desc1.option_->getType()); // Try to get the non-existing option from the non-existing // option space and expect that option is not returned. OptionDescriptor desc3 = CfgMgr::instance().getStagingCfg()-> @@ -3821,24 +3821,24 @@ TEST_F(Dhcp6ParserTest, optionDataEncapsulate) { OptionContainerPtr options = CfgMgr::instance().getStagingCfg()->getCfgOption()->getAll(DHCP6_OPTION_SPACE); ASSERT_TRUE(options); - ASSERT_EQ(1, options->size()); + ASSERT_EQ(1U, options->size()); // Get the option. OptionDescriptor desc = CfgMgr::instance().getStagingCfg()->getCfgOption()->get(DHCP6_OPTION_SPACE, 100); EXPECT_TRUE(desc.option_); - EXPECT_EQ(100, desc.option_->getType()); + EXPECT_EQ(100U, desc.option_->getType()); // This option should comprise two sub-options. // One of them is 'foo' with code 110. OptionPtr option_foo = desc.option_->getOption(110); ASSERT_TRUE(option_foo); - EXPECT_EQ(110, option_foo->getType()); + EXPECT_EQ(110U, option_foo->getType()); // ...another one 'foo2' with code 111. OptionPtr option_foo2 = desc.option_->getOption(111); ASSERT_TRUE(option_foo2); - EXPECT_EQ(111, option_foo2->getType()); + EXPECT_EQ(111U, option_foo2->getType()); } // Goal of this test is to verify options configuration @@ -3884,7 +3884,7 @@ TEST_F(Dhcp6ParserTest, optionDataInSingleSubnet) { getCfgSubnets6()->selectSubnet(IOAddress("2001:db8:1::5"), classify_); ASSERT_TRUE(subnet); OptionContainerPtr options = subnet->getCfgOption()->getAll(DHCP6_OPTION_SPACE); - ASSERT_EQ(2, options->size()); + ASSERT_EQ(2U, options->size()); // Get the search index. Index #1 is to search using option code. const OptionContainerTypeIndex& idx = options->get<1>(); @@ -4035,7 +4035,7 @@ TEST_F(Dhcp6ParserTest, optionDataInMultipleSubnets) { getCfgSubnets6()->selectSubnet(IOAddress("2001:db8:1::5"), classify_); ASSERT_TRUE(subnet1); OptionContainerPtr options1 = subnet1->getCfgOption()->getAll(DHCP6_OPTION_SPACE); - ASSERT_EQ(1, options1->size()); + ASSERT_EQ(1U, options1->size()); // Get the search index. Index #1 is to search using option code. const OptionContainerTypeIndex& idx1 = options1->get<1>(); @@ -4061,7 +4061,7 @@ TEST_F(Dhcp6ParserTest, optionDataInMultipleSubnets) { getCfgSubnets6()->selectSubnet(IOAddress("2001:db8:2::4"), classify_); ASSERT_TRUE(subnet2); OptionContainerPtr options2 = subnet2->getCfgOption()->getAll(DHCP6_OPTION_SPACE); - ASSERT_EQ(1, options2->size()); + ASSERT_EQ(1U, options2->size()); const OptionContainerTypeIndex& idx2 = options2->get<1>(); std::pairgetCfgOption()->getAll(DHCP6_OPTION_SPACE); - ASSERT_EQ(2, options->size()); + ASSERT_EQ(2U, options->size()); // Get the search index. Index #1 is to search using option code. const OptionContainerTypeIndex& idx = options->get<1>(); @@ -4220,7 +4220,7 @@ TEST_F(Dhcp6ParserTest, optionDataMultiplePools) { OptionContainerPtr options1 = pool6->getCfgOption()->getAll(DHCP6_OPTION_SPACE); - ASSERT_EQ(1, options1->size()); + ASSERT_EQ(1U, options1->size()); // Get the search index. Index #1 is to search using option code. const OptionContainerTypeIndex& idx1 = options1->get<1>(); @@ -4248,7 +4248,7 @@ TEST_F(Dhcp6ParserTest, optionDataMultiplePools) { OptionContainerPtr options2 = pool6->getCfgOption()->getAll(DHCP6_OPTION_SPACE); - ASSERT_EQ(1, options2->size()); + ASSERT_EQ(1U, options2->size()); const OptionContainerTypeIndex& idx2 = options2->get<1>(); std::pairgetCfgOption()->getAll(DHCP6_OPTION_SPACE); - ASSERT_EQ(1, options3->size()); + ASSERT_EQ(1U, options3->size()); const OptionContainerTypeIndex& idx3 = options3->get<1>(); std::pairgetCfgOption()->getAll(DHCP6_OPTION_SPACE); - ASSERT_EQ(1, options4->size()); + ASSERT_EQ(1U, options4->size()); const OptionContainerTypeIndex& idx4 = options4->get<1>(); std::pairgetCfgOption()->getAll(DHCP6_OPTION_SPACE); - ASSERT_EQ(1, options->size()); + ASSERT_EQ(1U, options->size()); // Get the search index. Index #1 is to search using option code. const OptionContainerTypeIndex& idx = options->get<1>(); @@ -4431,7 +4431,7 @@ TEST_F(Dhcp6ParserTest, stdOptionData) { ASSERT_TRUE(subnet); OptionContainerPtr options = subnet->getCfgOption()->getAll(DHCP6_OPTION_SPACE); ASSERT_TRUE(options); - ASSERT_EQ(1, options->size()); + ASSERT_EQ(1U, options->size()); // Get the search index. Index #1 is to search using option code. const OptionContainerTypeIndex& idx = options->get<1>(); @@ -4459,9 +4459,9 @@ TEST_F(Dhcp6ParserTest, stdOptionData) { // If cast was successful we may use accessors exposed by // Option6IA to validate that the content of this option // has been set correctly. - EXPECT_EQ(12345, optionIA->getIAID()); - EXPECT_EQ(6789, optionIA->getT1()); - EXPECT_EQ(1516, optionIA->getT2()); + EXPECT_EQ(12345U, optionIA->getIAID()); + EXPECT_EQ(6789U, optionIA->getT1()); + EXPECT_EQ(1516U, optionIA->getT2()); } // Verify that specific option object is returned for standard @@ -4486,7 +4486,7 @@ TEST_F(Dhcp6ParserTest, rdnssOption) { getCfgSubnets6()->selectSubnet(IOAddress("2001:db8:1::5"), classify_); ASSERT_TRUE(subnet); OptionContainerPtr options = subnet->getCfgOption()->getAll(DHCP6_OPTION_SPACE); - ASSERT_EQ(1, options->size()); + ASSERT_EQ(1U, options->size()); // Get the search index. Index #1 is to search using option code. const OptionContainerTypeIndex& idx = options->get<1>(); @@ -4514,9 +4514,9 @@ TEST_F(Dhcp6ParserTest, rdnssOption) { // If cast was successful we may use accessors exposed by // optionCustom to validate that the content of this option // has been set correctly. - ASSERT_EQ(5, optionCustom->getDataFieldsNum()); + ASSERT_EQ(5U, optionCustom->getDataFieldsNum()); EXPECT_EQ("2001::1", optionCustom->readAddress(0).toText()); - EXPECT_EQ(3, optionCustom->readInteger(1)); + EXPECT_EQ(3U, optionCustom->readInteger(1)); EXPECT_EQ("isc.org.", optionCustom->readFqdn(2)); EXPECT_EQ("example.org.", optionCustom->readFqdn(3)); EXPECT_EQ("example.com.", optionCustom->readFqdn(4)); @@ -4637,7 +4637,7 @@ TEST_F(Dhcp6ParserTest, DISABLED_stdOptionDataEncapsulate) { // We should have one option available. OptionContainerPtr options = subnet->getCfgOption()->getAll(DHCP6_OPTION_SPACE); ASSERT_TRUE(options); - ASSERT_EQ(1, options->size()); + ASSERT_EQ(1U, options->size()); // Get the option. OptionDescriptor desc = subnet->getCfgOption()->get(DHCP6_OPTION_SPACE, D6O_VENDOR_OPTS); @@ -4647,7 +4647,7 @@ TEST_F(Dhcp6ParserTest, DISABLED_stdOptionDataEncapsulate) { // Option with the code 110 should be added as a sub-option. OptionPtr option_foo = desc.option_->getOption(110); ASSERT_TRUE(option_foo); - EXPECT_EQ(110, option_foo->getType()); + EXPECT_EQ(110U, option_foo->getType()); // This option comprises a single uint32_t value thus it is // represented by OptionInt class. Let's get the // object of this type. @@ -4655,12 +4655,12 @@ TEST_F(Dhcp6ParserTest, DISABLED_stdOptionDataEncapsulate) { boost::dynamic_pointer_cast >(option_foo); ASSERT_TRUE(option_foo_uint32); // Validate the value according to the configuration. - EXPECT_EQ(1234, option_foo_uint32->getValue()); + EXPECT_EQ(1234U, option_foo_uint32->getValue()); // Option with the code 111 should be added as a sub-option. OptionPtr option_foo2 = desc.option_->getOption(111); ASSERT_TRUE(option_foo2); - EXPECT_EQ(111, option_foo2->getType()); + EXPECT_EQ(111U, option_foo2->getType()); // This option comprises the IPV4 address. Such option is // represented by OptionCustom object. OptionCustomPtr option_foo2_v4 = @@ -4720,12 +4720,12 @@ TEST_F(Dhcp6ParserTest, vendorOptionsHex) { OptionDescriptor desc1 = CfgMgr::instance().getStagingCfg()-> getCfgOption()->get(VENDOR_ID_CABLE_LABS, 100); ASSERT_TRUE(desc1.option_); - EXPECT_EQ(100, desc1.option_->getType()); + EXPECT_EQ(100U, desc1.option_->getType()); // Try to get the option from the vendor space 1234 OptionDescriptor desc2 = CfgMgr::instance().getStagingCfg()->getCfgOption()->get(1234, 100); ASSERT_TRUE(desc2.option_); - EXPECT_EQ(100, desc1.option_->getType()); + EXPECT_EQ(100U, desc1.option_->getType()); // Try to get the non-existing option from the non-existing // option space and expect that option is not returned. @@ -4780,7 +4780,7 @@ TEST_F(Dhcp6ParserTest, vendorOptionsCsv) { OptionDescriptor desc1 = CfgMgr::instance().getStagingCfg()-> getCfgOption()->get(VENDOR_ID_CABLE_LABS, 100); ASSERT_TRUE(desc1.option_); - EXPECT_EQ(100, desc1.option_->getType()); + EXPECT_EQ(100U, desc1.option_->getType()); // Try to get the non-existing option from the non-existing // option space and expect that option is not returned. @@ -4909,7 +4909,7 @@ TEST_F(Dhcp6ParserTest, LibrariesSpecified) { // Expect two libraries to be loaded in the correct order (load marker file // is present, no unload marker file). std::vector libraries = HooksManager::getLibraryNames(); - ASSERT_EQ(2, libraries.size()); + ASSERT_EQ(2U, libraries.size()); EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "12")); EXPECT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE)); @@ -5235,7 +5235,7 @@ TEST_F(Dhcp6ParserTest, classifySubnets) { const Subnet6Collection* subnets = CfgMgr::instance().getStagingCfg()->getCfgSubnets6()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(4, subnets->size()); // We expect 4 subnets + ASSERT_EQ(4U, subnets->size()); // We expect 4 subnets // Let's check if client belonging to alpha class is supported in subnet[0] // and not supported in any other subnet (except subnet[3], which allows @@ -5328,9 +5328,9 @@ TEST_F(Dhcp6ParserTest, classifyPools) { const Subnet6Collection* subnets = CfgMgr::instance().getStagingCfg()->getCfgSubnets6()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); const PoolCollection& pools = (*subnets->begin())->getPools(Lease::TYPE_NA); - ASSERT_EQ(4, pools.size()); // We expect 4 pools + ASSERT_EQ(4U, pools.size()); // We expect 4 pools // Let's check if client belonging to alpha class is supported in pool[0] // and not supported in any other pool (except pool[3], which allows @@ -5427,9 +5427,9 @@ TEST_F(Dhcp6ParserTest, classifyPdPools) { const Subnet6Collection* subnets = CfgMgr::instance().getStagingCfg()->getCfgSubnets6()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); const PoolCollection& pools = (*subnets->begin())->getPools(Lease::TYPE_PD); - ASSERT_EQ(4, pools.size()); // We expect 4 pools + ASSERT_EQ(4U, pools.size()); // We expect 4 pools // Let's check if client belonging to alpha class is supported in pool[0] // and not supported in any other pool (except pool[3], which allows @@ -5529,10 +5529,10 @@ TEST_F(Dhcp6ParserTest, d2ClientConfigValid) { // Verify that the configuration values are correct. EXPECT_TRUE(d2_client_config->getEnableUpdates()); EXPECT_EQ("3001::1", d2_client_config->getServerIp().toText()); - EXPECT_EQ(777, d2_client_config->getServerPort()); + EXPECT_EQ(777U, d2_client_config->getServerPort()); EXPECT_EQ("3001::2", d2_client_config->getSenderIp().toText()); - EXPECT_EQ(778, d2_client_config->getSenderPort()); - EXPECT_EQ(2048, d2_client_config->getMaxQueueSize()); + EXPECT_EQ(778U, d2_client_config->getSenderPort()); + EXPECT_EQ(2048U, d2_client_config->getMaxQueueSize()); EXPECT_EQ(dhcp_ddns::NCR_UDP, d2_client_config->getNcrProtocol()); EXPECT_EQ(dhcp_ddns::FMT_JSON, d2_client_config->getNcrFormat()); @@ -5704,7 +5704,7 @@ TEST_F(Dhcp6ParserTest, reservations) { const Subnet6Collection* subnets = CfgMgr::instance().getStagingCfg()->getCfgSubnets6()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(3, subnets->size()); + ASSERT_EQ(3U, subnets->size()); // Hosts configuration must be available. CfgHostsPtr hosts_cfg = CfgMgr::instance().getStagingCfg()->getCfgHosts(); @@ -5737,7 +5737,7 @@ TEST_F(Dhcp6ParserTest, reservations) { retrieveOption(*host, D6O_NAME_SERVERS); ASSERT_TRUE(opt_dns); Option6AddrLst::AddressContainer dns_addrs = opt_dns->getAddresses(); - ASSERT_EQ(1, dns_addrs.size()); + ASSERT_EQ(1U, dns_addrs.size()); EXPECT_EQ("2001:db8:2::abbc", dns_addrs[0].toText()); OptionUint8Ptr opt_prf = retrieveOption(*host, D6O_PREFERENCE); @@ -5762,7 +5762,7 @@ TEST_F(Dhcp6ParserTest, reservations) { opt_dns = retrieveOption(*host, D6O_NAME_SERVERS); ASSERT_TRUE(opt_dns); dns_addrs = opt_dns->getAddresses(); - ASSERT_EQ(1, dns_addrs.size()); + ASSERT_EQ(1U, dns_addrs.size()); EXPECT_EQ("2001:db8:2::1111", dns_addrs[0].toText()); opt_prf = retrieveOption(*host, D6O_PREFERENCE); ASSERT_TRUE(opt_prf); @@ -5805,7 +5805,7 @@ TEST_F(Dhcp6ParserTest, reservations) { opt_dns = retrieveOption(*host, D6O_NAME_SERVERS); ASSERT_TRUE(opt_dns); dns_addrs = opt_dns->getAddresses(); - ASSERT_EQ(1, dns_addrs.size()); + ASSERT_EQ(1U, dns_addrs.size()); EXPECT_EQ("2001:db8:3::3333", dns_addrs[0].toText()); opt_prf = retrieveOption(*host, D6O_PREFERENCE); ASSERT_TRUE(opt_prf); @@ -5883,8 +5883,8 @@ TEST_F(Dhcp6ParserTest, reservationWithOptionDefinition) { OptionUint32Ptr opt_foo = retrieveOption(*host, "isc", 100); ASSERT_TRUE(opt_foo); - EXPECT_EQ(100, opt_foo->getType()); - EXPECT_EQ(11, opt_foo->getValue()); + EXPECT_EQ(100U, opt_foo->getType()); + EXPECT_EQ(11U, opt_foo->getValue()); } // This test verifies that the bogus host reservation would trigger a @@ -6010,7 +6010,7 @@ TEST_F(Dhcp6ParserTest, macSources1) { CfgMACSources sources = CfgMgr::instance().getStagingCfg()->getMACSources().get(); - ASSERT_EQ(3, sources.size()); + ASSERT_EQ(3U, sources.size()); // Let's check the aliases. They should be recognized to their base methods. EXPECT_EQ(HWAddr::HWADDR_SOURCE_CLIENT_ADDR_RELAY_OPTION, sources[0]); EXPECT_EQ(HWAddr::HWADDR_SOURCE_REMOTE_ID, sources[1]); @@ -6040,7 +6040,7 @@ TEST_F(Dhcp6ParserTest, macSources2) { CfgMACSources sources = CfgMgr::instance().getStagingCfg()->getMACSources().get(); - ASSERT_EQ(3, sources.size()); + ASSERT_EQ(3U, sources.size()); // Let's check the aliases. They should be recognized to their base methods. EXPECT_EQ(HWAddr::HWADDR_SOURCE_CLIENT_ADDR_RELAY_OPTION, sources[0]); EXPECT_EQ(HWAddr::HWADDR_SOURCE_REMOTE_ID, sources[1]); @@ -6172,7 +6172,7 @@ TEST_F(Dhcp6ParserTest, hostReservationPerSubnet) { ConstCfgSubnets6Ptr subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6(); ASSERT_TRUE(subnets); const Subnet6Collection* subnet_col = subnets->getAll(); - ASSERT_EQ(7, subnet_col->size()); // We expect 7 subnets + ASSERT_EQ(7U, subnet_col->size()); // We expect 7 subnets // Let's check if the parsed subnets have correct HR modes. @@ -6274,7 +6274,7 @@ TEST_F(Dhcp6ParserTest, hostReservationGlobal) { ConstCfgSubnets6Ptr subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6(); ASSERT_TRUE(subnets); const Subnet6Collection* subnet_col = subnets->getAll(); - ASSERT_EQ(2, subnet_col->size()); // We expect 2 subnets + ASSERT_EQ(2U, subnet_col->size()); // We expect 2 subnets // Let's check if the parsed subnets have correct HR modes. @@ -6326,7 +6326,7 @@ TEST_F(Dhcp6ParserTest, declineTimerDefault) { // The value of decline-probation-period must be equal to the // default value (86400). The default value is defined in GLOBAL6_DEFAULTS in // simple_parser6.cc. - EXPECT_EQ(86400, CfgMgr::instance().getStagingCfg()->getDeclinePeriod()); + EXPECT_EQ(86400U, CfgMgr::instance().getStagingCfg()->getDeclinePeriod()); } /// The goal of this test is to verify that configuration can include @@ -6516,7 +6516,7 @@ TEST_F(Dhcp6ParserTest, dhcp4o6portDefault) { // The value of decline-probation-period must be equal to the // default value (0). The default value is defined in GLOBAL6_DEFAULTS in // simple_parser6.cc. - EXPECT_EQ(0, CfgMgr::instance().getStagingCfg()->getDhcp4o6Port()); + EXPECT_EQ(0U, CfgMgr::instance().getStagingCfg()->getDhcp4o6Port()); } /// Check that the decline-probation-period value can be set properly. @@ -6538,7 +6538,7 @@ TEST_F(Dhcp6ParserTest, declineTimer) { // The value of decline-probation-period must be equal to the // value specified. - EXPECT_EQ(12345, + EXPECT_EQ(12345U, CfgMgr::instance().getStagingCfg()->getDeclinePeriod()); } @@ -6598,12 +6598,12 @@ TEST_F(Dhcp6ParserTest, expiredLeasesProcessing) { ASSERT_TRUE(cfg); // Verify that parameters are correct. - EXPECT_EQ(20, cfg->getReclaimTimerWaitTime()); - EXPECT_EQ(35, cfg->getFlushReclaimedTimerWaitTime()); - EXPECT_EQ(1800, cfg->getHoldReclaimedTime()); - EXPECT_EQ(50, cfg->getMaxReclaimLeases()); - EXPECT_EQ(100, cfg->getMaxReclaimTime()); - EXPECT_EQ(10, cfg->getUnwarnedReclaimCycles()); + EXPECT_EQ(20U, cfg->getReclaimTimerWaitTime()); + EXPECT_EQ(35U, cfg->getFlushReclaimedTimerWaitTime()); + EXPECT_EQ(1800U, cfg->getHoldReclaimedTime()); + EXPECT_EQ(50U, cfg->getMaxReclaimLeases()); + EXPECT_EQ(100U, cfg->getMaxReclaimTime()); + EXPECT_EQ(10U, cfg->getUnwarnedReclaimCycles()); } // Check that invalid configuration for the expired leases processing is @@ -6676,7 +6676,7 @@ TEST_F(Dhcp6ParserTest, validClientClassDictionary) { ClientClassDictionaryPtr dictionary; dictionary = CfgMgr::instance().getStagingCfg()->getClientClassDictionary(); ASSERT_TRUE(dictionary); - EXPECT_EQ(3, dictionary->getClasses()->size()); + EXPECT_EQ(3U, dictionary->getClasses()->size()); // Execute the commit ASSERT_NO_THROW(CfgMgr::instance().commit()); @@ -6684,7 +6684,7 @@ TEST_F(Dhcp6ParserTest, validClientClassDictionary) { // Verify that after commit, the current config has the correct dictionary dictionary = CfgMgr::instance().getCurrentCfg()->getClientClassDictionary(); ASSERT_TRUE(dictionary); - EXPECT_EQ(3, dictionary->getClasses()->size()); + EXPECT_EQ(3U, dictionary->getClasses()->size()); } // Verifies that a class list containing an invalid @@ -6745,7 +6745,7 @@ TEST_F(Dhcp6ParserTest, clientClassValidLifetime) { ClientClassDictionaryPtr dictionary; dictionary = CfgMgr::instance().getStagingCfg()->getClientClassDictionary(); ASSERT_TRUE(dictionary); - EXPECT_EQ(2, dictionary->getClasses()->size()); + EXPECT_EQ(2U, dictionary->getClasses()->size()); // Execute the commit ASSERT_NO_THROW(CfgMgr::instance().commit()); @@ -6753,13 +6753,13 @@ TEST_F(Dhcp6ParserTest, clientClassValidLifetime) { // Verify that after commit, the current config has the correct dictionary dictionary = CfgMgr::instance().getCurrentCfg()->getClientClassDictionary(); ASSERT_TRUE(dictionary); - EXPECT_EQ(2, dictionary->getClasses()->size()); + EXPECT_EQ(2U, dictionary->getClasses()->size()); ClientClassDefPtr class_def = dictionary->findClass("one"); ASSERT_TRUE(class_def); - EXPECT_EQ(class_def->getValid().getMin(), 1000); - EXPECT_EQ(class_def->getValid().get(), 2000); - EXPECT_EQ(class_def->getValid().getMax(), 3000); + EXPECT_EQ(class_def->getValid().getMin(), 1000U); + EXPECT_EQ(class_def->getValid().get(), 2000U); + EXPECT_EQ(class_def->getValid().getMax(), 3000U); class_def = dictionary->findClass("two"); ASSERT_TRUE(class_def); @@ -6803,7 +6803,7 @@ TEST_F(Dhcp6ParserTest, templateClientClassValidLifetime) { ClientClassDictionaryPtr dictionary; dictionary = CfgMgr::instance().getStagingCfg()->getClientClassDictionary(); ASSERT_TRUE(dictionary); - EXPECT_EQ(2, dictionary->getClasses()->size()); + EXPECT_EQ(2U, dictionary->getClasses()->size()); // Execute the commit ASSERT_NO_THROW(CfgMgr::instance().commit()); @@ -6811,14 +6811,14 @@ TEST_F(Dhcp6ParserTest, templateClientClassValidLifetime) { // Verify that after commit, the current config has the correct dictionary dictionary = CfgMgr::instance().getCurrentCfg()->getClientClassDictionary(); ASSERT_TRUE(dictionary); - EXPECT_EQ(2, dictionary->getClasses()->size()); + EXPECT_EQ(2U, dictionary->getClasses()->size()); ClientClassDefPtr class_def = dictionary->findClass("one"); ASSERT_TRUE(class_def); ASSERT_TRUE(dynamic_cast(class_def.get())); - EXPECT_EQ(class_def->getValid().getMin(), 1000); - EXPECT_EQ(class_def->getValid().get(), 2000); - EXPECT_EQ(class_def->getValid().getMax(), 3000); + EXPECT_EQ(class_def->getValid().getMin(), 1000U); + EXPECT_EQ(class_def->getValid().get(), 2000U); + EXPECT_EQ(class_def->getValid().getMax(), 3000U); class_def = dictionary->findClass("two"); ASSERT_TRUE(class_def); @@ -6848,7 +6848,7 @@ TEST_F(Dhcp6ParserTest, poolUserContextEmpty) { // The context should be of type map and not contain any parameters. EXPECT_EQ(Element::map, ctx->getType()); - EXPECT_EQ(0, ctx->size()); + EXPECT_EQ(0U, ctx->size()); } // Test verifies that it's possible to specify parameters in the user context @@ -6863,7 +6863,7 @@ TEST_F(Dhcp6ParserTest, poolUserContextlw4over6) { // The context should be of type map and contain 4 parameters. EXPECT_EQ(Element::map, ctx->getType()); - EXPECT_EQ(4, ctx->size()); + EXPECT_EQ(4U, ctx->size()); ConstElementPtr ratio = ctx->get("lw4over6-sharing-ratio"); ConstElementPtr v4pool = ctx->get("lw4over6-v4-pool"); ConstElementPtr exclude = ctx->get("lw4over6-sysports-exclude"); @@ -6903,7 +6903,7 @@ TEST_F(Dhcp6ParserTest, poolUserContextData) { // The context should be of type map and contain 4 parameters. EXPECT_EQ(Element::map, ctx->getType()); - EXPECT_EQ(4, ctx->size()); + EXPECT_EQ(4U, ctx->size()); ConstElementPtr ratio = ctx->get("lw4over6-sharing-ratio"); ConstElementPtr v4pool = ctx->get("lw4over6-v4-pool"); ConstElementPtr exclude = ctx->get("lw4over6-sysports-exclude"); @@ -6943,7 +6943,7 @@ TEST_F(Dhcp6ParserTest, poolMinMaxUserContext) { // The context should be of type map and contain 4 parameters. EXPECT_EQ(Element::map, ctx->getType()); - EXPECT_EQ(4, ctx->size()); + EXPECT_EQ(4U, ctx->size()); ConstElementPtr ratio = ctx->get("lw4over6-sharing-ratio"); ConstElementPtr v4pool = ctx->get("lw4over6-v4-pool"); ConstElementPtr exclude = ctx->get("lw4over6-sysports-exclude"); @@ -6993,7 +6993,7 @@ TEST_F(Dhcp6ParserTest, pdPoolUserContextEmpty) { // The context should be of type map and not contain any parameters. EXPECT_EQ(Element::map, ctx->getType()); - EXPECT_EQ(0, ctx->size()); + EXPECT_EQ(0U, ctx->size()); } // Test verifies that it's possible to specify parameters in the user context @@ -7008,7 +7008,7 @@ TEST_F(Dhcp6ParserTest, pdPoolUserContextlw4over6) { // The context should be of type map and contain 4 parameters. EXPECT_EQ(Element::map, ctx->getType()); - EXPECT_EQ(4, ctx->size()); + EXPECT_EQ(4U, ctx->size()); ConstElementPtr ratio = ctx->get("lw4over6-sharing-ratio"); ConstElementPtr v4pool = ctx->get("lw4over6-v4-pool"); ConstElementPtr exclude = ctx->get("lw4over6-sysports-exclude"); @@ -7153,7 +7153,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworksName) { ASSERT_TRUE(cfg_net); const SharedNetwork6Collection* nets = cfg_net->getAll(); ASSERT_TRUE(nets); - ASSERT_EQ(1, nets->size()); + ASSERT_EQ(1U, nets->size()); SharedNetwork6Ptr net = *(nets->begin()); ASSERT_TRUE(net); EXPECT_EQ("foo", net->getName()); @@ -7161,7 +7161,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworksName) { // Verify that there are no subnets in this shared-network const Subnet6SimpleCollection* subs = net->getAllSubnets(); ASSERT_TRUE(subs); - EXPECT_EQ(0, subs->size()); + EXPECT_EQ(0U, subs->size()); } // Test verifies that a degenerated shared-network (just one subnet) is @@ -7189,7 +7189,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworks1subnet) { // There should be exactly one shared subnet. const SharedNetwork6Collection* nets = cfg_net->getAll(); ASSERT_TRUE(nets); - ASSERT_EQ(1, nets->size()); + ASSERT_EQ(1U, nets->size()); SharedNetwork6Ptr net = *(nets->begin()); ASSERT_TRUE(net); @@ -7198,7 +7198,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworks1subnet) { // It should have one subnet. The subnet should have default values. const Subnet6SimpleCollection* subs = net->getAllSubnets(); ASSERT_TRUE(subs); - EXPECT_EQ(1, subs->size()); + EXPECT_EQ(1U, subs->size()); checkSubnet(*subs, "2001:db8::/48", 0, 0, 0, 7200); // Now make sure the subnet was added to global list of subnets. @@ -7268,7 +7268,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworks3subnets) { ASSERT_TRUE(cfg_net); const SharedNetwork6Collection* nets = cfg_net->getAll(); ASSERT_TRUE(nets); - ASSERT_EQ(1, nets->size()); + ASSERT_EQ(1U, nets->size()); SharedNetwork6Ptr net = *(nets->begin()); ASSERT_TRUE(net); @@ -7277,7 +7277,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworks3subnets) { const Subnet6SimpleCollection* subs = net->getAllSubnets(); ASSERT_TRUE(subs); - EXPECT_EQ(3, subs->size()); + EXPECT_EQ(3U, subs->size()); checkSubnet(*subs, "2001:db1::/48", 1000, 2000, 3000, 4000, 2000, 4000, 3000, 5000); @@ -7403,7 +7403,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworksDerive) { ASSERT_TRUE(cfg_net); const SharedNetwork6Collection* nets = cfg_net->getAll(); ASSERT_TRUE(nets); - ASSERT_EQ(2, nets->size()); + ASSERT_EQ(2U, nets->size()); // Let's check the first one. SharedNetwork6Ptr net = nets->at(0); @@ -7412,7 +7412,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworksDerive) { // The first shared network has two subnets. const Subnet6SimpleCollection* subs = net->getAllSubnets(); ASSERT_TRUE(subs); - EXPECT_EQ(2, subs->size()); + EXPECT_EQ(2U, subs->size()); // For the first subnet, the renew-timer should be 10, because it was // derived from shared-network level. Other parameters a derived @@ -7451,7 +7451,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworksDerive) { subs = net->getAllSubnets(); ASSERT_TRUE(subs); - EXPECT_EQ(1, subs->size()); + EXPECT_EQ(1U, subs->size()); // This subnet should derive its renew-timer from global scope. // All other parameters should have default values. @@ -7518,7 +7518,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworksDeriveInterfaces) { ASSERT_TRUE(cfg_net); const SharedNetwork6Collection* nets = cfg_net->getAll(); ASSERT_TRUE(nets); - ASSERT_EQ(2, nets->size()); + ASSERT_EQ(2U, nets->size()); // Let's check the first one. SharedNetwork6Ptr net = nets->at(0); @@ -7526,7 +7526,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworksDeriveInterfaces) { const Subnet6SimpleCollection* subs = net->getAllSubnets(); ASSERT_TRUE(subs); - EXPECT_EQ(2, subs->size()); + EXPECT_EQ(2U, subs->size()); // For the first subnet, the rebind-timer should be 10, because it was // derived from shared-network level. Other parameters a derived @@ -7549,7 +7549,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworksDeriveInterfaces) { subs = net->getAllSubnets(); ASSERT_TRUE(subs); - EXPECT_EQ(1, subs->size()); + EXPECT_EQ(1U, subs->size()); // This subnet should derive its rebind-timer from global scope. s = checkSubnet(*subs, "2001:db3::/48", 0, 0, 0, 7200); @@ -7633,7 +7633,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworksRapidCommit) { ASSERT_TRUE(cfg_net); const SharedNetwork6Collection* nets = cfg_net->getAll(); ASSERT_TRUE(nets); - ASSERT_EQ(2, nets->size()); + ASSERT_EQ(2U, nets->size()); // Let's check the first one. SharedNetwork6Ptr net = nets->at(0); @@ -7641,7 +7641,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworksRapidCommit) { const Subnet6SimpleCollection* subs = net->getAllSubnets(); ASSERT_TRUE(subs); - ASSERT_EQ(2, subs->size()); + ASSERT_EQ(2U, subs->size()); auto sub = subs->begin(); EXPECT_TRUE((*sub)->getRapidCommit()); EXPECT_TRUE((*std::next(sub))->getRapidCommit()); @@ -7654,7 +7654,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworksRapidCommit) { subs = net->getAllSubnets(); ASSERT_TRUE(subs); - EXPECT_EQ(1, subs->size()); + EXPECT_EQ(1U, subs->size()); // This subnet should derive its renew-timer from global scope. sub = subs->begin(); @@ -7704,7 +7704,7 @@ TEST_F(Dhcp6ParserTest, hostsDatabases) { CfgMgr::instance().getStagingCfg()->getCfgDbAccess(); ASSERT_TRUE(cfgdb); const std::list& hal = cfgdb->getHostDbAccessStringList(); - ASSERT_EQ(2, hal.size()); + ASSERT_EQ(2U, hal.size()); // Keywords are in alphabetical order EXPECT_EQ("name=keatest1 password=keatest type=mysql user=keatest", hal.front()); EXPECT_EQ("name=keatest2 password=keatest retry-on-startup=true type=mysql user=keatest", hal.back()); @@ -7722,7 +7722,7 @@ TEST_F(Dhcp6ParserTest, comments) { // Check global user context. ConstElementPtr ctx = CfgMgr::instance().getStagingCfg()->getContext(); ASSERT_TRUE(ctx); - ASSERT_EQ(1, ctx->size()); + ASSERT_EQ(1U, ctx->size()); ASSERT_TRUE(ctx->get("comment")); EXPECT_EQ("\"A DHCPv6 server\"", ctx->get("comment")->str()); @@ -7734,7 +7734,7 @@ TEST_F(Dhcp6ParserTest, comments) { // Check server id user context. ConstElementPtr ctx_duid = duid->getContext(); ASSERT_TRUE(ctx_duid); - ASSERT_EQ(1, ctx_duid->size()); + ASSERT_EQ(1U, ctx_duid->size()); ASSERT_TRUE(ctx_duid->get("comment")); EXPECT_EQ("\"DHCPv6 specific\"", ctx_duid->get("comment")->str()); @@ -7745,7 +7745,7 @@ TEST_F(Dhcp6ParserTest, comments) { // Check network interface configuration user context. ConstElementPtr ctx_iface = iface->getContext(); ASSERT_TRUE(ctx_iface); - ASSERT_EQ(1, ctx_iface->size()); + ASSERT_EQ(1U, ctx_iface->size()); ASSERT_TRUE(ctx_iface->get("comment")); EXPECT_EQ("\"Use wildcard\"", ctx_iface->get("comment")->str()); @@ -7761,7 +7761,7 @@ TEST_F(Dhcp6ParserTest, comments) { LibDHCP::getRuntimeOptionDef("isc", 100); ASSERT_TRUE(opt_def); EXPECT_EQ("foo", opt_def->getName()); - EXPECT_EQ(100, opt_def->getCode()); + EXPECT_EQ(100U, opt_def->getCode()); EXPECT_FALSE(opt_def->getArrayType()); EXPECT_EQ(OPT_IPV6_ADDRESS_TYPE, opt_def->getType()); EXPECT_TRUE(opt_def->getEncapsulatedSpace().empty()); @@ -7769,7 +7769,7 @@ TEST_F(Dhcp6ParserTest, comments) { // Check option definition user context. ConstElementPtr ctx_opt_def = opt_def->getContext(); ASSERT_TRUE(ctx_opt_def); - ASSERT_EQ(1, ctx_opt_def->size()); + ASSERT_EQ(1U, ctx_opt_def->size()); ASSERT_TRUE(ctx_opt_def->get("comment")); EXPECT_EQ("\"An option definition\"", ctx_opt_def->get("comment")->str()); @@ -7783,7 +7783,7 @@ TEST_F(Dhcp6ParserTest, comments) { // Check option descriptor user context. ConstElementPtr ctx_opt_desc = opt_desc.getContext(); ASSERT_TRUE(ctx_opt_desc); - ASSERT_EQ(1, ctx_opt_desc->size()); + ASSERT_EQ(1U, ctx_opt_desc->size()); ASSERT_TRUE(ctx_opt_desc->get("comment")); EXPECT_EQ("\"Set option value\"", ctx_opt_desc->get("comment")->str()); @@ -7791,7 +7791,7 @@ TEST_F(Dhcp6ParserTest, comments) { const ClientClassDictionaryPtr& dict = CfgMgr::instance().getStagingCfg()->getClientClassDictionary(); ASSERT_TRUE(dict); - EXPECT_EQ(3, dict->getClasses()->size()); + EXPECT_EQ(3U, dict->getClasses()->size()); ClientClassDefPtr cclass = dict->findClass("all"); ASSERT_TRUE(cclass); EXPECT_EQ("all", cclass->getName()); @@ -7800,7 +7800,7 @@ TEST_F(Dhcp6ParserTest, comments) { // Check client class user context. ConstElementPtr ctx_class = cclass->getContext(); ASSERT_TRUE(ctx_class); - ASSERT_EQ(1, ctx_class->size()); + ASSERT_EQ(1U, ctx_class->size()); ASSERT_TRUE(ctx_class->get("comment")); EXPECT_EQ("\"match all\"", ctx_class->get("comment")->str()); @@ -7817,7 +7817,7 @@ TEST_F(Dhcp6ParserTest, comments) { EXPECT_EQ("", cclass->getTest()); ctx_class = cclass->getContext(); ASSERT_TRUE(ctx_class); - ASSERT_EQ(2, ctx_class->size()); + ASSERT_EQ(2U, ctx_class->size()); ASSERT_TRUE(ctx_class->get("comment")); EXPECT_EQ("\"a comment\"", ctx_class->get("comment")->str()); ASSERT_TRUE(ctx_class->get("version")); @@ -7828,7 +7828,7 @@ TEST_F(Dhcp6ParserTest, comments) { CfgMgr::instance().getStagingCfg()->getUnixControlSocketInfo(); ASSERT_TRUE(socket); ASSERT_EQ(Element::list, socket->getType()); - ASSERT_EQ(socket->size(), 1); + ASSERT_EQ(socket->size(), 1U); socket = socket->get(0); ASSERT_TRUE(socket); ASSERT_TRUE(socket->get("socket-type")); @@ -7839,7 +7839,7 @@ TEST_F(Dhcp6ParserTest, comments) { // Check UNIX control socket comment and user context. ConstElementPtr ctx_socket = socket->get("user-context"); ASSERT_TRUE(ctx_socket); - ASSERT_EQ(1, ctx_socket->size()); + ASSERT_EQ(1U, ctx_socket->size()); ASSERT_TRUE(ctx_socket->get("comment")); EXPECT_EQ("\"Indirect comment\"", ctx_socket->get("comment")->str()); @@ -7847,7 +7847,7 @@ TEST_F(Dhcp6ParserTest, comments) { socket = CfgMgr::instance().getStagingCfg()->getHttpControlSocketInfo(); ASSERT_TRUE(socket); ASSERT_EQ(Element::list, socket->getType()); - ASSERT_EQ(socket->size(), 1); + ASSERT_EQ(socket->size(), 1U); socket = socket->get(0); ASSERT_TRUE(socket); /// @todo use the configuration object. @@ -7861,14 +7861,14 @@ TEST_F(Dhcp6ParserTest, comments) { // Check HTTP control socket comment. ctx_socket = socket->get("user-context"); ASSERT_TRUE(ctx_socket); - ASSERT_EQ(1, ctx_socket->size()); + ASSERT_EQ(1U, ctx_socket->size()); ASSERT_TRUE(ctx_socket->get("comment")); EXPECT_EQ("\"HTTP control socket\"", ctx_socket->get("comment")->str()); // HTTP headers. ConstElementPtr headers = socket->get("http-headers"); ASSERT_TRUE(headers); - ASSERT_EQ(1, headers->size()); + ASSERT_EQ(1U, headers->size()); ConstElementPtr header = headers->get(0); ASSERT_TRUE(header); ASSERT_TRUE(header->get("name")); @@ -7879,7 +7879,7 @@ TEST_F(Dhcp6ParserTest, comments) { // Check HTTP header user context. ConstElementPtr ctx_header = header->get("user-context"); ASSERT_TRUE(ctx_header); - ASSERT_EQ(1, ctx_header->size()); + ASSERT_EQ(1U, ctx_header->size()); ASSERT_TRUE(ctx_header->get("comment")); EXPECT_EQ("\"HSTS header\"", ctx_header->get("comment")->str()); @@ -7890,14 +7890,14 @@ TEST_F(Dhcp6ParserTest, comments) { EXPECT_EQ("\"basic\"", auth->get("type")->str()); ConstElementPtr ctx_auth = auth->get("user-context"); ASSERT_TRUE(ctx_auth); - ASSERT_EQ(1, ctx_auth->size()); + ASSERT_EQ(1U, ctx_auth->size()); ASSERT_TRUE(ctx_auth->get("comment")); EXPECT_EQ("\"basic HTTP authentication\"", ctx_auth->get("comment")->str()); // Authentication client. ConstElementPtr clients = auth->get("clients"); ASSERT_TRUE(clients); - ASSERT_EQ(1, clients->size()); + ASSERT_EQ(1U, clients->size()); ConstElementPtr client; ASSERT_NO_THROW(client = clients->get(0)); ASSERT_TRUE(client); @@ -7907,7 +7907,7 @@ TEST_F(Dhcp6ParserTest, comments) { ASSERT_EQ("\"foobar\"", client->get("password")->str()); ConstElementPtr ctx_client = client->get("user-context"); ASSERT_TRUE(ctx_client); - ASSERT_EQ(1, ctx_client->size()); + ASSERT_EQ(1U, ctx_client->size()); ASSERT_TRUE(ctx_client->get("comment")); EXPECT_EQ("\"admin is authorized\"", ctx_client->get("comment")->str()); @@ -7917,7 +7917,7 @@ TEST_F(Dhcp6ParserTest, comments) { ASSERT_TRUE(cfg_net); const SharedNetwork6Collection* nets = cfg_net->getAll(); ASSERT_TRUE(nets); - ASSERT_EQ(1, nets->size()); + ASSERT_EQ(1U, nets->size()); SharedNetwork6Ptr net = nets->at(0); ASSERT_TRUE(net); EXPECT_EQ("foo", net->getName()); @@ -7925,49 +7925,49 @@ TEST_F(Dhcp6ParserTest, comments) { // Check shared network user context. ConstElementPtr ctx_net = net->getContext(); ASSERT_TRUE(ctx_net); - ASSERT_EQ(1, ctx_net->size()); + ASSERT_EQ(1U, ctx_net->size()); ASSERT_TRUE(ctx_net->get("comment")); EXPECT_EQ("\"A shared network\"", ctx_net->get("comment")->str()); // The shared network has a subnet. const Subnet6SimpleCollection* subs = net->getAllSubnets(); ASSERT_TRUE(subs); - ASSERT_EQ(1, subs->size()); + ASSERT_EQ(1U, subs->size()); Subnet6Ptr sub = *subs->begin(); ASSERT_TRUE(sub); - EXPECT_EQ(100, sub->getID()); + EXPECT_EQ(100U, sub->getID()); EXPECT_EQ("2001:db1::/48", sub->toText()); // Check subnet user context. ConstElementPtr ctx_sub = sub->getContext(); ASSERT_TRUE(ctx_sub); - ASSERT_EQ(1, ctx_sub->size()); + ASSERT_EQ(1U, ctx_sub->size()); ASSERT_TRUE(ctx_sub->get("comment")); EXPECT_EQ("\"A subnet\"", ctx_sub->get("comment")->str()); // The subnet has a pool. const PoolCollection& pools = sub->getPools(Lease::TYPE_NA); - ASSERT_EQ(1, pools.size()); + ASSERT_EQ(1U, pools.size()); PoolPtr pool = pools.at(0); ASSERT_TRUE(pool); // Check pool user context. ConstElementPtr ctx_pool = pool->getContext(); ASSERT_TRUE(ctx_pool); - ASSERT_EQ(1, ctx_pool->size()); + ASSERT_EQ(1U, ctx_pool->size()); ASSERT_TRUE(ctx_pool->get("comment")); EXPECT_EQ("\"A pool\"", ctx_pool->get("comment")->str()); // The subnet has a prefix pool. const PoolCollection& pdpools = sub->getPools(Lease::TYPE_PD); - ASSERT_EQ(1, pdpools.size()); + ASSERT_EQ(1U, pdpools.size()); PoolPtr pdpool = pdpools.at(0); ASSERT_TRUE(pdpool); // Check prefix pool user context. ConstElementPtr ctx_pdpool = pdpool->getContext(); ASSERT_TRUE(ctx_pdpool); - ASSERT_EQ(1, ctx_pdpool->size()); + ASSERT_EQ(1U, ctx_pdpool->size()); ASSERT_TRUE(ctx_pdpool->get("comment")); EXPECT_EQ("\"A prefix pool\"", ctx_pdpool->get("comment")->str()); @@ -7981,13 +7981,13 @@ TEST_F(Dhcp6ParserTest, comments) { EXPECT_EQ("aa:bb:cc:dd:ee:ff", host->getHWAddress()->toText(false)); EXPECT_FALSE(host->getDuid()); EXPECT_EQ(SUBNET_ID_UNUSED, host->getIPv4SubnetID()); - EXPECT_EQ(100, host->getIPv6SubnetID()); + EXPECT_EQ(100U, host->getIPv6SubnetID()); EXPECT_EQ("foo.example.com", host->getHostname()); // Check host user context. ConstElementPtr ctx_host = host->getContext(); ASSERT_TRUE(ctx_host); - ASSERT_EQ(1, ctx_host->size()); + ASSERT_EQ(1U, ctx_host->size()); ASSERT_TRUE(ctx_host->get("comment")); EXPECT_EQ("\"A host reservation\"", ctx_host->get("comment")->str()); @@ -8003,7 +8003,7 @@ TEST_F(Dhcp6ParserTest, comments) { // Check embedded option data user context. ConstElementPtr ctx_host_desc = host_desc.getContext(); ASSERT_TRUE(ctx_host_desc); - ASSERT_EQ(1, ctx_host_desc->size()); + ASSERT_EQ(1U, ctx_host_desc->size()); ASSERT_TRUE(ctx_host_desc->get("comment")); EXPECT_EQ("\"An option in a reservation\"", ctx_host_desc->get("comment")->str()); @@ -8017,7 +8017,7 @@ TEST_F(Dhcp6ParserTest, comments) { // Check dynamic DNS update configuration user context. ConstElementPtr ctx_d2 = d2->getContext(); ASSERT_TRUE(ctx_d2); - ASSERT_EQ(1, ctx_d2->size()); + ASSERT_EQ(1U, ctx_d2->size()); ASSERT_TRUE(ctx_d2->get("comment")); EXPECT_EQ("\"No dynamic DNS\"", ctx_d2->get("comment")->str()); } @@ -8095,7 +8095,7 @@ TEST_F(Dhcp6ParserTest, globalReservations) { const Subnet6Collection* subnets = CfgMgr::instance().getStagingCfg()->getCfgSubnets6()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(3, subnets->size()); + ASSERT_EQ(3U, subnets->size()); // Hosts configuration must be available. CfgHostsPtr hosts_cfg = CfgMgr::instance().getStagingCfg()->getCfgHosts(); @@ -8131,7 +8131,7 @@ TEST_F(Dhcp6ParserTest, globalReservations) { retrieveOption(*host, D6O_NAME_SERVERS); ASSERT_TRUE(opt_dns); Option6AddrLst::AddressContainer dns_addrs = opt_dns->getAddresses(); - ASSERT_EQ(1, dns_addrs.size()); + ASSERT_EQ(1U, dns_addrs.size()); EXPECT_EQ("2001:db8:2::abbc", dns_addrs[0].toText()); OptionUint8Ptr opt_prf = retrieveOption(*host, D6O_PREFERENCE); @@ -8157,7 +8157,7 @@ TEST_F(Dhcp6ParserTest, globalReservations) { opt_dns = retrieveOption(*host, D6O_NAME_SERVERS); ASSERT_TRUE(opt_dns); dns_addrs = opt_dns->getAddresses(); - ASSERT_EQ(1, dns_addrs.size()); + ASSERT_EQ(1U, dns_addrs.size()); EXPECT_EQ("2001:db8:2::1111", dns_addrs[0].toText()); opt_prf = retrieveOption(*host, D6O_PREFERENCE); ASSERT_TRUE(opt_prf); @@ -8207,7 +8207,7 @@ TEST_F(Dhcp6ParserTest, configControlInfo) { // Fetch the list of config dbs. It should have two entries. const process::ConfigDbInfoList& dblist = info->getConfigDatabases(); - ASSERT_EQ(2, dblist.size()); + ASSERT_EQ(2U, dblist.size()); // Make sure the entries are what we expect and in the right order. // (DbAccessParser creates access strings with the keywords in @@ -8219,7 +8219,7 @@ TEST_F(Dhcp6ParserTest, configControlInfo) { // Verify that the config-fetch-wait-time is correct. EXPECT_FALSE(info->getConfigFetchWaitTime().unspecified()); - EXPECT_EQ(10, info->getConfigFetchWaitTime().get()); + EXPECT_EQ(10U, info->getConfigFetchWaitTime().get()); } // Check whether it is possible to configure server-tag @@ -8643,7 +8643,7 @@ TEST_F(Dhcp6ParserTest, statsDefaultLimits) { CfgMgr::instance().commit(); stats::StatsMgr& stats_mgr = stats::StatsMgr::instance(); - EXPECT_EQ(10, stats_mgr.getMaxSampleCountDefault()); + EXPECT_EQ(10U, stats_mgr.getMaxSampleCountDefault()); EXPECT_EQ("00:00:05", util::durationToText(stats_mgr.getMaxSampleAgeDefault(), 0)); } @@ -8737,7 +8737,7 @@ TEST_F(Dhcp6ParserTest, parkedPacketLimit) { configure(config_no_limit, CONTROL_RESULT_SUCCESS, ""); ConstElementPtr ppl; ASSERT_TRUE(ppl = CfgMgr::instance().getStagingCfg()->getConfiguredGlobal("parked-packet-limit")); - EXPECT_EQ(256, ppl->intValue()); + EXPECT_EQ(256U, ppl->intValue()); // Clear the config CfgMgr::instance().clear(); @@ -8746,7 +8746,7 @@ TEST_F(Dhcp6ParserTest, parkedPacketLimit) { configure(config_limit, CONTROL_RESULT_SUCCESS, ""); ASSERT_TRUE(ppl = CfgMgr::instance().getStagingCfg()->getConfiguredGlobal("parked-packet-limit")); - EXPECT_EQ(777, ppl->intValue()); + EXPECT_EQ(777U, ppl->intValue()); // Make sure an invalid limit fails to parse. ASSERT_THROW(parseDHCP6(bad_limit), std::exception); @@ -8790,7 +8790,7 @@ TEST_F(Dhcp6ParserTest, clientClassValidPreferredLifetime) { ClientClassDictionaryPtr dictionary; dictionary = CfgMgr::instance().getStagingCfg()->getClientClassDictionary(); ASSERT_TRUE(dictionary); - EXPECT_EQ(2, dictionary->getClasses()->size()); + EXPECT_EQ(2U, dictionary->getClasses()->size()); // Execute the commit ASSERT_NO_THROW(CfgMgr::instance().commit()); @@ -8798,17 +8798,17 @@ TEST_F(Dhcp6ParserTest, clientClassValidPreferredLifetime) { // Verify that after commit, the current config has the correct dictionary dictionary = CfgMgr::instance().getCurrentCfg()->getClientClassDictionary(); ASSERT_TRUE(dictionary); - EXPECT_EQ(2, dictionary->getClasses()->size()); + EXPECT_EQ(2U, dictionary->getClasses()->size()); ClientClassDefPtr class_def = dictionary->findClass("one"); ASSERT_TRUE(class_def); - EXPECT_EQ(class_def->getValid().getMin(), 1000); - EXPECT_EQ(class_def->getValid().get(), 2000); - EXPECT_EQ(class_def->getValid().getMax(), 3000); + EXPECT_EQ(class_def->getValid().getMin(), 1000U); + EXPECT_EQ(class_def->getValid().get(), 2000U); + EXPECT_EQ(class_def->getValid().getMax(), 3000U); - EXPECT_EQ(class_def->getPreferred().getMin(), 4000); - EXPECT_EQ(class_def->getPreferred().get(), 5000); - EXPECT_EQ(class_def->getPreferred().getMax(), 6000); + EXPECT_EQ(class_def->getPreferred().getMin(), 4000U); + EXPECT_EQ(class_def->getPreferred().get(), 5000U); + EXPECT_EQ(class_def->getPreferred().getMax(), 6000U); class_def = dictionary->findClass("two"); ASSERT_TRUE(class_def); @@ -8855,7 +8855,7 @@ TEST_F(Dhcp6ParserTest, templateClientClassValidPreferredLifetime) { ClientClassDictionaryPtr dictionary; dictionary = CfgMgr::instance().getStagingCfg()->getClientClassDictionary(); ASSERT_TRUE(dictionary); - EXPECT_EQ(2, dictionary->getClasses()->size()); + EXPECT_EQ(2U, dictionary->getClasses()->size()); // Execute the commit ASSERT_NO_THROW(CfgMgr::instance().commit()); @@ -8863,18 +8863,18 @@ TEST_F(Dhcp6ParserTest, templateClientClassValidPreferredLifetime) { // Verify that after commit, the current config has the correct dictionary dictionary = CfgMgr::instance().getCurrentCfg()->getClientClassDictionary(); ASSERT_TRUE(dictionary); - EXPECT_EQ(2, dictionary->getClasses()->size()); + EXPECT_EQ(2U, dictionary->getClasses()->size()); ClientClassDefPtr class_def = dictionary->findClass("one"); ASSERT_TRUE(class_def); ASSERT_TRUE(dynamic_cast(class_def.get())); - EXPECT_EQ(class_def->getValid().getMin(), 1000); - EXPECT_EQ(class_def->getValid().get(), 2000); - EXPECT_EQ(class_def->getValid().getMax(), 3000); + EXPECT_EQ(class_def->getValid().getMin(), 1000U); + EXPECT_EQ(class_def->getValid().get(), 2000U); + EXPECT_EQ(class_def->getValid().getMax(), 3000U); - EXPECT_EQ(class_def->getPreferred().getMin(), 4000); - EXPECT_EQ(class_def->getPreferred().get(), 5000); - EXPECT_EQ(class_def->getPreferred().getMax(), 6000); + EXPECT_EQ(class_def->getPreferred().getMin(), 4000U); + EXPECT_EQ(class_def->getPreferred().get(), 5000U); + EXPECT_EQ(class_def->getPreferred().getMax(), 6000U); class_def = dictionary->findClass("two"); ASSERT_TRUE(class_def); @@ -9058,7 +9058,7 @@ TEST_F(Dhcp6ParserTest, optionClientClassesDuplicateCheck) { CfgOptionPtr cfg = CfgMgr::instance().getStagingCfg()->getCfgOption(); const auto desc = cfg->get(DHCP6_OPTION_SPACE, D6O_DOMAIN_SEARCH); ASSERT_TRUE(desc.option_); - ASSERT_EQ(desc.client_classes_.size(), 2); + ASSERT_EQ(desc.client_classes_.size(), 2U); auto cclasses = desc.client_classes_.begin(); EXPECT_EQ(*cclasses, "foo"); ++cclasses; @@ -9109,7 +9109,7 @@ TEST_F(Dhcp6ParserTest, deprecatedRequireClientClassesCheck) { ASSERT_TRUE(network); auto& net_class_list = network->getAdditionalClasses(); - EXPECT_EQ(1, net_class_list.size()); + EXPECT_EQ(1U, net_class_list.size()); auto cclasses = net_class_list.begin(); EXPECT_EQ(*cclasses, "one"); @@ -9118,7 +9118,7 @@ TEST_F(Dhcp6ParserTest, deprecatedRequireClientClassesCheck) { ASSERT_TRUE(subnet); auto& sub_class_list = subnet->getAdditionalClasses(); - EXPECT_EQ(1, sub_class_list.size()); + EXPECT_EQ(1U, sub_class_list.size()); cclasses = sub_class_list.begin(); EXPECT_EQ(*cclasses, "two"); @@ -9126,7 +9126,7 @@ TEST_F(Dhcp6ParserTest, deprecatedRequireClientClassesCheck) { ASSERT_TRUE(pool); auto& pool_class_list = pool->getAdditionalClasses(); - EXPECT_EQ(1, pool_class_list.size()); + EXPECT_EQ(1U, pool_class_list.size()); cclasses = pool_class_list.begin(); EXPECT_EQ(*cclasses, "three"); @@ -9134,7 +9134,7 @@ TEST_F(Dhcp6ParserTest, deprecatedRequireClientClassesCheck) { ASSERT_TRUE(pool); auto& pd_pool_class_list = pool->getAdditionalClasses(); - EXPECT_EQ(1, pd_pool_class_list.size()); + EXPECT_EQ(1U, pd_pool_class_list.size()); cclasses = pd_pool_class_list.begin(); EXPECT_EQ(*cclasses, "four"); @@ -9188,7 +9188,7 @@ TEST_F(Dhcp6ParserTest, deprecatedOnlyIfRequiredCheck) { auto dictionary = CfgMgr::instance().getStagingCfg()->getClientClassDictionary(); ASSERT_TRUE(dictionary); - EXPECT_EQ(1, dictionary->getClasses()->size()); + EXPECT_EQ(1U, dictionary->getClasses()->size()); ClientClassDefPtr class_def = dictionary->findClass("foo"); ASSERT_TRUE(class_def); @@ -9260,7 +9260,7 @@ TEST_F(Dhcp6ParserTest, deprecatedClientClassesCheck) { ASSERT_TRUE(network); auto& net_class_list = network->getClientClasses(); - ASSERT_EQ(1, net_class_list.size()); + ASSERT_EQ(1U, net_class_list.size()); auto cclasses = net_class_list.begin(); EXPECT_EQ(*cclasses, "one"); @@ -9268,7 +9268,7 @@ TEST_F(Dhcp6ParserTest, deprecatedClientClassesCheck) { ASSERT_TRUE(subnet); auto& sub_class_list = subnet->getClientClasses(); - ASSERT_EQ(1, sub_class_list.size()); + ASSERT_EQ(1U, sub_class_list.size()); cclasses = sub_class_list.begin(); EXPECT_EQ(*cclasses, "two"); @@ -9276,7 +9276,7 @@ TEST_F(Dhcp6ParserTest, deprecatedClientClassesCheck) { ASSERT_TRUE(pool); auto& pool_class_list = pool->getClientClasses(); - ASSERT_EQ(1, pool_class_list.size()); + ASSERT_EQ(1U, pool_class_list.size()); cclasses = pool_class_list.begin(); EXPECT_EQ(*cclasses, "three"); @@ -9284,7 +9284,7 @@ TEST_F(Dhcp6ParserTest, deprecatedClientClassesCheck) { ASSERT_TRUE(pool); auto& pd_pool_class_list = pool->getClientClasses(); - ASSERT_EQ(1, pd_pool_class_list.size()); + ASSERT_EQ(1U, pd_pool_class_list.size()); cclasses = pd_pool_class_list.begin(); EXPECT_EQ(*cclasses, "four"); @@ -9393,13 +9393,13 @@ TEST_F(Dhcp6ParserTest, ddnsTtl) { ASSERT_TRUE(subnet); EXPECT_FALSE(subnet->getDdnsTtl(Network::Inheritance::NONE).unspecified()); - EXPECT_EQ(250, subnet->getDdnsTtl(Network::Inheritance::NONE).get()); + EXPECT_EQ(250U, subnet->getDdnsTtl(Network::Inheritance::NONE).get()); EXPECT_FALSE(subnet->getDdnsTtl(Network::Inheritance::PARENT_NETWORK).unspecified()); - EXPECT_EQ(500, subnet->getDdnsTtl(Network::Inheritance::PARENT_NETWORK).get()); + EXPECT_EQ(500U, subnet->getDdnsTtl(Network::Inheritance::PARENT_NETWORK).get()); EXPECT_FALSE(subnet->getDdnsTtl(Network::Inheritance::GLOBAL).unspecified()); - EXPECT_EQ(750, subnet->getDdnsTtl(Network::Inheritance::GLOBAL).get()); + EXPECT_EQ(750U, subnet->getDdnsTtl(Network::Inheritance::GLOBAL).get()); } // Verifies ddns-ttl-min is supported at global, @@ -9439,13 +9439,13 @@ TEST_F(Dhcp6ParserTest, ddnsTtlMin) { ASSERT_TRUE(subnet); EXPECT_FALSE(subnet->getDdnsTtlMin(Network::Inheritance::NONE).unspecified()); - EXPECT_EQ(250, subnet->getDdnsTtlMin(Network::Inheritance::NONE).get()); + EXPECT_EQ(250U, subnet->getDdnsTtlMin(Network::Inheritance::NONE).get()); EXPECT_FALSE(subnet->getDdnsTtlMin(Network::Inheritance::PARENT_NETWORK).unspecified()); - EXPECT_EQ(500, subnet->getDdnsTtlMin(Network::Inheritance::PARENT_NETWORK).get()); + EXPECT_EQ(500U, subnet->getDdnsTtlMin(Network::Inheritance::PARENT_NETWORK).get()); EXPECT_FALSE(subnet->getDdnsTtlMin(Network::Inheritance::GLOBAL).unspecified()); - EXPECT_EQ(750, subnet->getDdnsTtlMin(Network::Inheritance::GLOBAL).get()); + EXPECT_EQ(750U, subnet->getDdnsTtlMin(Network::Inheritance::GLOBAL).get()); } // Verifies ddns-ttl-max is supported at global, @@ -9485,13 +9485,13 @@ TEST_F(Dhcp6ParserTest, ddnsTtlMax) { ASSERT_TRUE(subnet); EXPECT_FALSE(subnet->getDdnsTtlMax(Network::Inheritance::NONE).unspecified()); - EXPECT_EQ(250, subnet->getDdnsTtlMax(Network::Inheritance::NONE).get()); + EXPECT_EQ(250U, subnet->getDdnsTtlMax(Network::Inheritance::NONE).get()); EXPECT_FALSE(subnet->getDdnsTtlMax(Network::Inheritance::PARENT_NETWORK).unspecified()); - EXPECT_EQ(500, subnet->getDdnsTtlMax(Network::Inheritance::PARENT_NETWORK).get()); + EXPECT_EQ(500U, subnet->getDdnsTtlMax(Network::Inheritance::PARENT_NETWORK).get()); EXPECT_FALSE(subnet->getDdnsTtlMax(Network::Inheritance::GLOBAL).unspecified()); - EXPECT_EQ(750, subnet->getDdnsTtlMax(Network::Inheritance::GLOBAL).get()); + EXPECT_EQ(750U, subnet->getDdnsTtlMax(Network::Inheritance::GLOBAL).get()); } TEST_F(Dhcp6ParserTest, poolDdnsParameters) { @@ -9543,7 +9543,7 @@ TEST_F(Dhcp6ParserTest, poolDdnsParameters) { ASSERT_TRUE(subnet); const PoolCollection pools = subnet->getPools(Lease::TYPE_NA); - ASSERT_GE(pools.size(), 2); + ASSERT_GE(pools.size(), 2U); // First pool specifies all but ddns-ttl. PoolPtr pool = pools.at(0); @@ -9586,10 +9586,10 @@ TEST_F(Dhcp6ParserTest, poolDdnsParameters) { ASSERT_TRUE(pool->getDdnsTtl().unspecified()); ASSERT_FALSE(pool->getDdnsTtlMin().unspecified()); - EXPECT_EQ(pool->getDdnsTtlMin().get(), 200); + EXPECT_EQ(pool->getDdnsTtlMin().get(), 200U); ASSERT_FALSE(pool->getDdnsTtlMax().unspecified()); - EXPECT_EQ(pool->getDdnsTtlMax().get(), 500); + EXPECT_EQ(pool->getDdnsTtlMax().get(), 500U); // Second pool only specifies ddns-ttl. pool = pools.at(1); @@ -9609,7 +9609,7 @@ TEST_F(Dhcp6ParserTest, poolDdnsParameters) { ASSERT_TRUE(pool->getDdnsTtlMin().unspecified()); ASSERT_FALSE(pool->getDdnsTtl().unspecified()); - EXPECT_EQ(pool->getDdnsTtl().get(), 300); + EXPECT_EQ(pool->getDdnsTtl().get(), 300U); ASSERT_TRUE(pool->getDdnsTtlMax().unspecified()); } diff --git a/src/bin/dhcp6/tests/confirm_unittest.cc b/src/bin/dhcp6/tests/confirm_unittest.cc index 9ea85d92c5..013177e9e1 100644 --- a/src/bin/dhcp6/tests/confirm_unittest.cc +++ b/src/bin/dhcp6/tests/confirm_unittest.cc @@ -130,7 +130,7 @@ TEST_F(ConfirmTest, directClientSameIAID) { Lease6 lease_client2 = lease_client1; lease_client2.addr_ = bumpAddress(lease_client2.addr_); client.createLease(lease_client2); - ASSERT_EQ(2, client.getLeaseNum()); + ASSERT_EQ(2U, client.getLeaseNum()); // Send Confirm message to the server. ASSERT_NO_THROW(client.doConfirm()); // Client should have received a status code option and this option should @@ -138,7 +138,7 @@ TEST_F(ConfirmTest, directClientSameIAID) { ASSERT_TRUE(client.receivedStatusCode()); ASSERT_EQ(STATUS_Success, client.getStatusCode()); - ASSERT_EQ(2, client.getLeaseNum()); + ASSERT_EQ(2U, client.getLeaseNum()); lease_client2 = client.getLease(1); lease_client2.addr_ = bumpSubnet(lease_client2.addr_); client.createLease(lease_client2); @@ -173,7 +173,7 @@ TEST_F(ConfirmTest, directClientDifferentIAID) { ++lease_client2.iaid_; lease_client2.addr_ = bumpAddress(lease_client2.addr_); client.createLease(lease_client2); - ASSERT_EQ(2, client.getLeaseNum()); + ASSERT_EQ(2U, client.getLeaseNum()); // Send Confirm message to the server. ASSERT_NO_THROW(client.doConfirm()); // Client should have received a status code option and this option should @@ -184,7 +184,7 @@ TEST_F(ConfirmTest, directClientDifferentIAID) { EXPECT_TRUE(client.getContext().response_->getOption(D6O_SERVERID)); EXPECT_TRUE(client.getContext().response_->getOption(D6O_CLIENTID)); - ASSERT_EQ(2, client.getLeaseNum()); + ASSERT_EQ(2U, client.getLeaseNum()); lease_client2 = client.getLease(1); lease_client2.addr_ = bumpSubnet(lease_client2.addr_); client.createLease(lease_client2); @@ -251,7 +251,7 @@ TEST_F(ConfirmTest, relayedClientNoAddress) { // Make sure we ended-up having expected number of subnets configured. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - ASSERT_EQ(2, subnets->size()); + ASSERT_EQ(2U, subnets->size()); // Client to send relayed message. client.useRelay(); // Send Confirm message to the server. This message will contain no @@ -311,7 +311,7 @@ TEST_F(ConfirmTest, relayedUnicast) { // Make 4-way exchange to get the lease. ASSERT_NO_FATAL_FAILURE(requestLease(CONFIRM_CONFIGS[1], 2, client)); // Make sure we have got the lease. - ASSERT_GT(client.getLeaseNum(), 0); + ASSERT_GT(client.getLeaseNum(), 0U); client.setDestAddress(IOAddress("2001:db8:1::1")); // Send Confirm message to the server. ASSERT_NO_THROW(client.doConfirm()); @@ -335,7 +335,7 @@ TEST_F(ConfirmTest, unicast) { // Make 4-way exchange to get the lease. ASSERT_NO_FATAL_FAILURE(requestLease(CONFIRM_CONFIGS[0], 2, client)); // Make sure the client has got the lease. - ASSERT_GT(client.getLeaseNum(), 0); + ASSERT_GT(client.getLeaseNum(), 0U); // Send Confirm message to the server to the unicast address. client.setDestAddress(IOAddress("2001:db8:1::1")); ASSERT_NO_THROW(client.doConfirm()); diff --git a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc index 0a5832d9d5..8d3f4b5837 100644 --- a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc +++ b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc @@ -878,7 +878,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, configSet) { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); @@ -908,7 +908,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, configSet) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); ASSERT_TRUE(def); @@ -946,7 +946,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, configSet) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(2, subnets->size()); + EXPECT_EQ(2U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); @@ -1063,7 +1063,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, configSetLFCRunning) { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); @@ -1097,7 +1097,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, configSetLFCRunning) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); ASSERT_TRUE(def); @@ -1220,7 +1220,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, configSetLFCRunning2) { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); @@ -1254,7 +1254,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, configSetLFCRunning2) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); ASSERT_TRUE(def); @@ -1321,7 +1321,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, configHashGet) { ASSERT_TRUE(hash); ASSERT_EQ(Element::string, hash->getType()); // SHA-256 -> 64 hex digits. - EXPECT_EQ(64, hash->stringValue().size()); + EXPECT_EQ(64U, hash->stringValue().size()); } // Verify that the "config-test" command will do what we expect. @@ -1412,7 +1412,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, configTest) { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Create a config with malformed subnet that should fail to parse. os.str(""); @@ -1438,7 +1438,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, configTest) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Create a valid config with two subnets and no command channel. os.str(""); @@ -1469,7 +1469,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, configTest) { // Check that the config was not applied. subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); @@ -1547,7 +1547,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, statusGet) { ASSERT_NO_THROW(response = Element::fromJSON(response_txt)); ASSERT_TRUE(response); ASSERT_EQ(Element::map, response->getType()); - EXPECT_EQ(2, response->size()); + EXPECT_EQ(2U, response->size()); ConstElementPtr result = response->get("result"); ASSERT_TRUE(result); ASSERT_EQ(Element::integer, result->getType()); @@ -1602,7 +1602,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, statusGet) { ASSERT_NO_THROW(response = Element::fromJSON(response_txt)); ASSERT_TRUE(response); ASSERT_EQ(Element::map, response->getType()); - EXPECT_EQ(2, response->size()); + EXPECT_EQ(2U, response->size()); result = response->get("result"); ASSERT_TRUE(result); ASSERT_EQ(Element::integer, result->getType()); @@ -1643,7 +1643,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, statusGet) { found_queue_stats = arguments->get("packet-queue-statistics"); ASSERT_TRUE(found_queue_stats); ASSERT_EQ(Element::list, found_queue_stats->getType()); - EXPECT_EQ(3, found_queue_stats->size()); + EXPECT_EQ(3U, found_queue_stats->size()); } // Check that status is returned even if LeaseMgr and HostMgr are not created. @@ -1741,7 +1741,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, statusGetSocketsErrors) { ConstElementPtr errors(sockets->get("errors")); ASSERT_TRUE(errors); ASSERT_EQ(Element::list, errors->getType()); - ASSERT_EQ(1, errors->size()); + ASSERT_EQ(1U, errors->size()); ConstElementPtr error(errors->get(0)); ASSERT_TRUE(error); @@ -2205,7 +2205,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, configReloadValid) { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(2, subnets->size()); + EXPECT_EQ(2U, subnets->size()); ::remove("test8.json"); } @@ -2281,7 +2281,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, configReloadDetectInterfaces) { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(2, subnets->size()); + EXPECT_EQ(2U, subnets->size()); ::remove("test8.json"); } diff --git a/src/bin/dhcp6/tests/d2_unittest.cc b/src/bin/dhcp6/tests/d2_unittest.cc index 57f3d4e399..0a3e141670 100644 --- a/src/bin/dhcp6/tests/d2_unittest.cc +++ b/src/bin/dhcp6/tests/d2_unittest.cc @@ -282,21 +282,21 @@ TEST_F(Dhcp6SrvD2Test, simpleUDPSend) { ASSERT_NO_FATAL_FAILURE(configureD2(true)); ASSERT_TRUE(mgr.ddnsEnabled()); ASSERT_NO_THROW(mgr.clearQueue()); - EXPECT_EQ(0, mgr.getQueueSize()); + EXPECT_EQ(0U, mgr.getQueueSize()); ASSERT_NO_THROW(srv_.startD2()); ASSERT_TRUE(mgr.amSending()); // Verify that we can queue up a message. dhcp_ddns::NameChangeRequestPtr ncr = buildTestNcr(); ASSERT_NO_THROW(mgr.sendRequest(ncr)); - EXPECT_EQ(1, mgr.getQueueSize()); + EXPECT_EQ(1U, mgr.getQueueSize()); // Calling receive should detect the ready IO on the sender's select-fd, // and invoke callback, which should complete the send. ASSERT_NO_THROW(IfaceMgr::instance().receive4(0,0)); // Verify the queue is now empty. - EXPECT_EQ(0, mgr.getQueueSize()); + EXPECT_EQ(0U, mgr.getQueueSize()); } // Checks that an IO error in sending a request to D2, results in ddns updates @@ -322,7 +322,7 @@ TEST_F(Dhcp6SrvD2Test, forceUDPSendFailure) { "::", 53001)); ASSERT_TRUE(mgr.ddnsEnabled()); ASSERT_NO_THROW(mgr.clearQueue()); - EXPECT_EQ(0, mgr.getQueueSize()); + EXPECT_EQ(0U, mgr.getQueueSize()); try { srv_.startD2(); } catch (const std::exception& ex) { @@ -337,7 +337,7 @@ TEST_F(Dhcp6SrvD2Test, forceUDPSendFailure) { dhcp_ddns::NameChangeRequestPtr ncr = buildTestNcr(i + 1); ASSERT_NO_THROW(mgr.sendRequest(ncr)); } - EXPECT_EQ(3, mgr.getQueueSize()); + EXPECT_EQ(3U, mgr.getQueueSize()); // Calling receive should detect the ready IO on the sender's select-fd, // and invoke callback, which should complete the send, which should @@ -352,7 +352,7 @@ TEST_F(Dhcp6SrvD2Test, forceUDPSendFailure) { ASSERT_FALSE(mgr.amSending()); // Verify message is still in the queue. - EXPECT_EQ(3, mgr.getQueueSize()); + EXPECT_EQ(3U, mgr.getQueueSize()); // Verify that we can't just restart it. /// @todo This may change if we add ability to resume. @@ -366,7 +366,7 @@ TEST_F(Dhcp6SrvD2Test, forceUDPSendFailure) { ASSERT_TRUE(mgr.amSending()); // Verify message is still in the queue. - EXPECT_EQ(3, mgr.getQueueSize()); + EXPECT_EQ(3U, mgr.getQueueSize()); // This will finish sending the 1st message in queue // and initiate send of 2nd message. @@ -374,7 +374,7 @@ TEST_F(Dhcp6SrvD2Test, forceUDPSendFailure) { EXPECT_EQ(1, srv_.error_count_); // First message is off the queue. - EXPECT_EQ(2, mgr.getQueueSize()); + EXPECT_EQ(2U, mgr.getQueueSize()); mgr.stop(); } @@ -386,13 +386,13 @@ TEST_F(Dhcp6SrvD2Test, queueMaxError) { ASSERT_NO_FATAL_FAILURE(configureD2(true)); ASSERT_TRUE(mgr.ddnsEnabled()); ASSERT_NO_THROW(mgr.clearQueue()); - EXPECT_EQ(0, mgr.getQueueSize()); + EXPECT_EQ(0U, mgr.getQueueSize()); ASSERT_NO_THROW(srv_.startD2()); ASSERT_TRUE(mgr.amSending()); // Attempt to queue more then the maximum allowed. - int max_msgs = mgr.getQueueMaxSize(); - for (int i = 0; i < max_msgs + 1; i++) { + size_t max_msgs = mgr.getQueueMaxSize(); + for (size_t i = 0; i < max_msgs + 1; ++i) { dhcp_ddns::NameChangeRequestPtr ncr = buildTestNcr(i + 1); ASSERT_NO_THROW(mgr.sendRequest(ncr)); } diff --git a/src/bin/dhcp6/tests/decline_unittest.cc b/src/bin/dhcp6/tests/decline_unittest.cc index 3aec6d1570..6da098b8ab 100644 --- a/src/bin/dhcp6/tests/decline_unittest.cc +++ b/src/bin/dhcp6/tests/decline_unittest.cc @@ -141,7 +141,7 @@ Dhcpv6SrvTest::acquireAndDecline(Dhcp6Client& client, // Let's get the subnet-id and generate statistics name out of it. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Let's generate the subnet specific statistic std::string name = StatsMgr::generateName("subnet", @@ -156,7 +156,7 @@ Dhcpv6SrvTest::acquireAndDecline(Dhcp6Client& client, // Make sure that the client has acquired NA lease. std::vector leases_client_na = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na.size()); + ASSERT_EQ(1U, leases_client_na.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(iaid1)); // Remember the acquired address. @@ -201,7 +201,7 @@ Dhcpv6SrvTest::acquireAndDecline(Dhcp6Client& client, // Use the second IAID (but not in NO_IA which has cleared leases) if (addr_type != NO_IA) { - ASSERT_NE(0, client.config_.leases_.size()); + ASSERT_NE(0U, client.config_.leases_.size()); client.config_.leases_[0].iaid_ = iaid2; } @@ -229,7 +229,7 @@ Dhcpv6SrvTest::acquireAndDecline(Dhcp6Client& client, ASSERT_FALSE(lease->hwaddr_); ASSERT_TRUE(lease->duid_); ASSERT_EQ(*lease->duid_, DUID::EMPTY()); - ASSERT_EQ(lease->preferred_lft_, 0); + ASSERT_EQ(lease->preferred_lft_, 0U); ASSERT_TRUE(lease->hostname_.empty()); ASSERT_FALSE(lease->fqdn_fwd_); ASSERT_FALSE(lease->fqdn_rev_); @@ -245,7 +245,7 @@ Dhcpv6SrvTest::acquireAndDecline(Dhcp6Client& client, ASSERT_TRUE(lease->hwaddr_); ASSERT_TRUE(lease->duid_); ASSERT_NE(*lease->duid_, DUID::EMPTY()); - ASSERT_NE(lease->preferred_lft_, 0); + ASSERT_NE(lease->preferred_lft_, 0U); ASSERT_FALSE(lease->fqdn_fwd_); ASSERT_FALSE(lease->fqdn_rev_); @@ -354,7 +354,7 @@ TEST_F(DeclineTest, declineAfterRelease) { // Perform 4-way exchange to obtain a new lease. client.doSARR(); auto leases = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases.size()); + ASSERT_EQ(1U, leases.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(iaid)); // Release the acquired lease. @@ -383,7 +383,7 @@ TEST_F(DeclineTest, declineAfterExpire) { // Perform 4-way exchange to obtain a new lease. client.doSARR(); auto leases = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases.size()); + ASSERT_EQ(1U, leases.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(iaid)); // Release the acquired lease. @@ -412,7 +412,7 @@ TEST_F(DeclineTest, declineAfterReclamation) { // Perform 4-way exchange to obtain a new lease. client.doSARR(); auto leases = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases.size()); + ASSERT_EQ(1U, leases.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(iaid)); // Release the acquired lease. @@ -430,5 +430,4 @@ TEST_F(DeclineTest, declineAfterReclamation) { EXPECT_EQ(Lease::STATE_EXPIRED_RECLAIMED, lease->state_); } - } // end of anonymous namespace diff --git a/src/bin/dhcp6/tests/dhcp6_message_test.cc b/src/bin/dhcp6/tests/dhcp6_message_test.cc index b47e242068..2ed43726f2 100644 --- a/src/bin/dhcp6/tests/dhcp6_message_test.cc +++ b/src/bin/dhcp6/tests/dhcp6_message_test.cc @@ -41,7 +41,7 @@ Dhcpv6MessageTest::bumpSubnet(const IOAddress& input_addr) { void Dhcpv6MessageTest::requestLease(const std::string& config, - const int subnets_num, + const size_t subnets_num, Dhcp6Client& client) { // Configure the server. configure(config, *client.getServer()); @@ -55,13 +55,13 @@ Dhcpv6MessageTest::requestLease(const std::string& config, client.fastFwdTime(1000); // Make sure that we have obtained a lease that belongs to one of the // subnets. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); // Check if the lease belongs to one of the available pools. bool pool_found = false; auto subnet = subnets->begin(); - for (int i = 0; i < subnets_num; ++i, ++subnet) { + for (size_t i = 0; i < subnets_num; ++i, ++subnet) { ASSERT_TRUE(subnet != subnets->end()); if ((*subnet)->getPool(lease_client.type_, lease_client.addr_)) { pool_found = true; diff --git a/src/bin/dhcp6/tests/dhcp6_message_test.h b/src/bin/dhcp6/tests/dhcp6_message_test.h index c64c4842d3..c9aa8a9c7e 100644 --- a/src/bin/dhcp6/tests/dhcp6_message_test.h +++ b/src/bin/dhcp6/tests/dhcp6_message_test.h @@ -67,10 +67,9 @@ public: /// @param subnets_num Number of subnets being created with the specified /// configuration. /// @param client Object representing a test DHCPv6 client to use. - void requestLease(const std::string& config, const int subnets_num, + void requestLease(const std::string& config, const size_t subnets_num, Dhcp6Client& client); - protected: /// @brief Interface Manager's fake configuration control. diff --git a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc index f03b505469..c1702dd6ed 100644 --- a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc +++ b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc @@ -284,7 +284,7 @@ Dhcpv6SrvTest::loadConfigFile(const string& path) { IfaceMgrTestConfig test_config(true); // Do not use DHCP6_SERVER_PORT here as 0 means don't open sockets. - EXPECT_EQ(0, srv_->server_port_); + EXPECT_EQ(0U, srv_->server_port_); ConfigBackendDHCPv6Mgr::instance().registerBackendFactory("mysql", [](const db::DatabaseConnection::ParameterMap&) -> ConfigBackendDHCPv6Ptr { @@ -634,32 +634,32 @@ TEST_F(Dhcpv6SrvTest, DUID) { case DUID::DUID_LLT: { // DUID must contain at least 6 bytes long MAC // + 8 bytes of fixed header - EXPECT_GE(len, 14); + EXPECT_GE(len, 14U); uint16_t hw_type = data.readUint16(); // there's no real way to find out "correct" // hardware type - EXPECT_GT(hw_type, 0); + EXPECT_GT(hw_type, 0U); // check that timer is counted since 1.1.2000, // not from 1.1.1970. uint32_t seconds = data.readUint32(); - EXPECT_LE(seconds, DUID_TIME_EPOCH); + EXPECT_LE(seconds, static_cast(DUID_TIME_EPOCH)); // this test will start failing after 2030. // Hopefully we will be at BIND12 by then. // MAC must not be zeros - vector mac(len-8); - vector zeros(len-8, 0); - data.readVector(mac, len-8); + vector mac(len - 8); + vector zeros(len - 8, 0); + data.readVector(mac, len - 8); EXPECT_TRUE(mac != zeros); break; } case DUID::DUID_EN: { // there's not much we can check. Just simple // check if it is not all zeros - vector content(len-2); - data.readVector(content, len-2); + vector content(len - 2); + data.readVector(content, len - 2); EXPECT_FALSE(isRangeZero(content.begin(), content.end())); break; } @@ -747,7 +747,7 @@ TEST_F(Dhcpv6SrvTest, advertiseOptions) { ASSERT_TRUE(reply_nameservers); Option6AddrLst::AddressContainer addrs = reply_nameservers->getAddresses(); - ASSERT_EQ(2, addrs.size()); + ASSERT_EQ(2U, addrs.size()); EXPECT_TRUE(addrs[0] == IOAddress("2001:db8:1234:FFFF::1")); EXPECT_TRUE(addrs[1] == IOAddress("2001:db8:1234:FFFF::2")); @@ -758,7 +758,7 @@ TEST_F(Dhcpv6SrvTest, advertiseOptions) { // Check that the option contains valid data (from configuration). std::vector data = tmp->getData(); - ASSERT_EQ(2, data.size()); + ASSERT_EQ(2U, data.size()); const uint8_t foo_expected[] = { 0x12, 0x34 @@ -2529,7 +2529,8 @@ TEST_F(Dhcpv6SrvTest, testUnicast) { StatsMgr& mgr = StatsMgr::instance(); ObservationPtr stat = mgr.getObservation("pkt6-rfc-violation"); ASSERT_TRUE(stat); - EXPECT_EQ(sizeof(not_allowed_unicast), stat->getInteger().first); + EXPECT_EQ(sizeof(not_allowed_unicast), + static_cast(stat->getInteger().first)); // Explicitly list client/relay message types which are allowed to // be sent to unicast. @@ -2874,7 +2875,7 @@ TEST_F(Dhcpv6SrvTest, selectSubnetRelayInterfaceId) { // Checks if server responses are sent to the proper port. TEST_F(Dhcpv6SrvTest, portsClientPort) { // Enforce a specific client port value. - EXPECT_EQ(0, srv_->client_port_); + EXPECT_EQ(0U, srv_->client_port_); srv_->client_port_ = 1234; // Let's create a simple SOLICIT @@ -2900,7 +2901,7 @@ TEST_F(Dhcpv6SrvTest, portsClientPort) { // Checks if server responses are sent to the proper port. TEST_F(Dhcpv6SrvTest, portsServerPort) { // Enforce a specific server port value. - EXPECT_EQ(0, srv_->server_port_); + EXPECT_EQ(0U, srv_->server_port_); srv_->server_port_ = 1234; // Let's create a simple SOLICIT @@ -3032,8 +3033,8 @@ TEST_F(Dhcpv6SrvTest, relaySourcePort) { srv_->run(); // Check trace of processing - EXPECT_EQ(1234, query->getRemotePort()); - ASSERT_EQ(1, query->relay_info_.size()); + EXPECT_EQ(1234U, query->getRemotePort()); + ASSERT_EQ(1U, query->relay_info_.size()); EXPECT_TRUE(query->getRelayOption(D6O_RELAY_SOURCE_PORT, 0)); // Get Response... @@ -3042,7 +3043,7 @@ TEST_F(Dhcpv6SrvTest, relaySourcePort) { ASSERT_TRUE(rsp); // Check it - EXPECT_EQ(1234, rsp->getRemotePort()); + EXPECT_EQ(1234U, rsp->getRemotePort()); EXPECT_EQ(DHCPV6_RELAY_REPL, rsp->getBuffer()[0]); // Get Advertise @@ -3052,7 +3053,7 @@ TEST_F(Dhcpv6SrvTest, relaySourcePort) { // Check it EXPECT_EQ(DHCPV6_ADVERTISE, adv->getType()); - ASSERT_EQ(1, adv->relay_info_.size()); + ASSERT_EQ(1U, adv->relay_info_.size()); EXPECT_TRUE(adv->getRelayOption(D6O_RELAY_SOURCE_PORT, 0)); } @@ -3191,7 +3192,7 @@ TEST_F(Dhcpv6SrvTest, prlPersistency) { // The subscriber-id option should be present but only once despite // it is both requested and has always-send. const OptionCollection& sifs = response->getOptions(D6O_SUBSCRIBER_ID); - ASSERT_EQ(1, sifs.size()); + ASSERT_EQ(1U, sifs.size()); // But no dns-servers ASSERT_FALSE(response->getOption(D6O_NAME_SERVERS)); // Nor a sntp-servers @@ -3344,7 +3345,7 @@ TEST_F(Dhcpv6SrvTest, relayOverride) { // Let's get the subnet configuration objects const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - ASSERT_EQ(2, subnets->size()); + ASSERT_EQ(2U, subnets->size()); // Let's get them for easy reference Subnet6Ptr subnet1 = *subnets->begin(); @@ -3634,14 +3635,14 @@ TEST_F(Dhcpv6SrvTest, rsooOverride) { ASSERT_TRUE(opt); // We check that this is the option injected by the relay by // checking option length. It should have 10 bytes long payload. - ASSERT_EQ(10, opt->getData().size()); + ASSERT_EQ(10U, opt->getData().size()); // The second option should be the one configured on the server, // rather than the one injected by the relay. opt = client.config_.findOption(120); ASSERT_TRUE(opt); // It should have the size of 1. - ASSERT_EQ(1, opt->getData().size()); + ASSERT_EQ(1U, opt->getData().size()); } // Test checks if pkt6-advertise-received is bumped up correctly. @@ -3894,7 +3895,7 @@ TEST_F(Dhcpv6SrvTest, userContext) { ConstSrvConfigPtr cfg = CfgMgr::instance().getCurrentCfg(); const Subnet6Collection* subnets = cfg->getCfgSubnets6()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Let's get the subnet and check its context. Subnet6Ptr subnet1 = (*subnets->begin()); @@ -3904,14 +3905,14 @@ TEST_F(Dhcpv6SrvTest, userContext) { // Ok, not get the address pool in it and check its context, too. PoolCollection pools = subnet1->getPools(Lease::TYPE_NA); - ASSERT_EQ(1, pools.size()); + ASSERT_EQ(1U, pools.size()); ASSERT_TRUE(pools[0]); ASSERT_TRUE(pools[0]->getContext()); EXPECT_EQ("{ \"value\": 42 }", pools[0]->getContext()->str()); // Ok, not get the prefix pool in it and check its context, too. pools = subnet1->getPools(Lease::TYPE_PD); - ASSERT_EQ(1, pools.size()); + ASSERT_EQ(1U, pools.size()); ASSERT_TRUE(pools[0]); ASSERT_TRUE(pools[0]->getContext()); EXPECT_EQ("{ \"type\": \"prefixes\" }", pools[0]->getContext()->str()); @@ -4141,8 +4142,8 @@ TEST_F(Dhcpv6SrvTest, generateFqdnUpdate) { boost::shared_ptr iaaddr = checkIA_NA(reply, 234, 1000, 2000); ASSERT_TRUE(iaaddr); EXPECT_EQ(addr, iaaddr->getAddress()); - EXPECT_EQ(3000, iaaddr->getPreferred()); - EXPECT_EQ(4000, iaaddr->getValid()); + EXPECT_EQ(3000U, iaaddr->getPreferred()); + EXPECT_EQ(4000U, iaaddr->getValid()); // Fetch the lease in the database and verify hostname has been updated // with generated FQDN. @@ -4151,8 +4152,8 @@ TEST_F(Dhcpv6SrvTest, generateFqdnUpdate) { EXPECT_EQ("myhost-2001-db8-1--1.example.com.", l->hostname_); // Should see follow log message ids in the log file. - EXPECT_EQ(1, countFile("DHCP6_DDNS_FQDN_GENERATED")); - EXPECT_EQ(0, countFile("DHCP6_DDNS_GENERATED_FQDN_UPDATE_FAIL")); + EXPECT_EQ(1U, countFile("DHCP6_DDNS_FQDN_GENERATED")); + EXPECT_EQ(0U, countFile("DHCP6_DDNS_GENERATED_FQDN_UPDATE_FAIL")); } @@ -4206,12 +4207,12 @@ TEST_F(Dhcpv6SrvTest, generateFqdnNoUpdate) { boost::shared_ptr iaaddr = checkIA_NA(reply, 234, 0, 0); ASSERT_TRUE(iaaddr); EXPECT_EQ(addr, iaaddr->getAddress()); - EXPECT_EQ(0, iaaddr->getPreferred()); - EXPECT_EQ(0, iaaddr->getValid()); + EXPECT_EQ(0U, iaaddr->getPreferred()); + EXPECT_EQ(0U, iaaddr->getValid()); // Should not see either of the follow log message ids in the log file. - EXPECT_EQ(0, countFile("DHCP6_DDNS_FQDN_GENERATED")); - EXPECT_EQ(0, countFile("DHCP6_DDNS_GENERATED_FQDN_UPDATE_FAIL")); + EXPECT_EQ(0U, countFile("DHCP6_DDNS_FQDN_GENERATED")); + EXPECT_EQ(0U, countFile("DHCP6_DDNS_GENERATED_FQDN_UPDATE_FAIL")); // Fetch the lease in the database and verify hostname has not been updated. Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA, addr); diff --git a/src/bin/dhcp6/tests/dhcp6_test_utils.cc b/src/bin/dhcp6/tests/dhcp6_test_utils.cc index 068454d65c..11fcedfa07 100644 --- a/src/bin/dhcp6/tests/dhcp6_test_utils.cc +++ b/src/bin/dhcp6/tests/dhcp6_test_utils.cc @@ -690,8 +690,8 @@ Dhcpv6SrvTest::testReleaseBasic(Lease::Type type, const IOAddress& existing, l = LeaseMgrFactory::instance().getLease6(type, release_addr); ASSERT_TRUE(l); - EXPECT_EQ(l->valid_lft_, 0); - EXPECT_EQ(l->preferred_lft_, 0); + EXPECT_EQ(l->valid_lft_, 0U); + EXPECT_EQ(l->preferred_lft_, 0U); EXPECT_EQ(Lease6::STATE_RELEASED, l->state_); @@ -700,8 +700,8 @@ Dhcpv6SrvTest::testReleaseBasic(Lease::Type type, const IOAddress& existing, subnet_->getID()); ASSERT_TRUE(l); - EXPECT_EQ(l->valid_lft_, 0); - EXPECT_EQ(l->preferred_lft_, 0); + EXPECT_EQ(l->valid_lft_, 0U); + EXPECT_EQ(l->preferred_lft_, 0U); EXPECT_EQ(Lease::STATE_RELEASED, l->state_); } @@ -792,7 +792,7 @@ Dhcpv6SrvTest::testReleaseAndReclaim(Lease::Type type) { // Let's get the subnet-id and generate statistics name out of it const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // And prepopulate the stats counter std::string name = StatsMgr::generateName("subnet", (*subnets->begin())->getID(), @@ -813,7 +813,7 @@ Dhcpv6SrvTest::testReleaseAndReclaim(Lease::Type type) { // Make sure that the client has acquired NA lease. std::vector leases = client.getLeasesByType(type); - ASSERT_EQ(1, leases.size()); + ASSERT_EQ(1U, leases.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(iaid)); // Let's create a RELEASE @@ -848,8 +848,8 @@ Dhcpv6SrvTest::testReleaseAndReclaim(Lease::Type type) { Lease6Ptr l = LeaseMgrFactory::instance().getLease6(type, leases[0].addr_); ASSERT_TRUE(l); - EXPECT_EQ(l->valid_lft_, 0); - EXPECT_EQ(l->preferred_lft_, 0); + EXPECT_EQ(l->valid_lft_, 0U); + EXPECT_EQ(l->preferred_lft_, 0U); EXPECT_EQ(Lease6::STATE_RELEASED, l->state_); @@ -858,8 +858,8 @@ Dhcpv6SrvTest::testReleaseAndReclaim(Lease::Type type) { (*subnets->begin())->getID()); ASSERT_TRUE(l); - EXPECT_EQ(l->valid_lft_, 0); - EXPECT_EQ(l->preferred_lft_, 0); + EXPECT_EQ(l->valid_lft_, 0U); + EXPECT_EQ(l->preferred_lft_, 0U); EXPECT_EQ(Lease::STATE_RELEASED, l->state_); stat = StatsMgr::instance().getObservation(type == Lease::TYPE_NA ? @@ -878,8 +878,8 @@ Dhcpv6SrvTest::testReleaseAndReclaim(Lease::Type type) { l = LeaseMgrFactory::instance().getLease6(type, leases[0].addr_); ASSERT_TRUE(l); - EXPECT_EQ(l->valid_lft_, 0); - EXPECT_EQ(l->preferred_lft_, 0); + EXPECT_EQ(l->valid_lft_, 0U); + EXPECT_EQ(l->preferred_lft_, 0U); EXPECT_EQ(Lease6::STATE_EXPIRED_RECLAIMED, l->state_); @@ -888,8 +888,8 @@ Dhcpv6SrvTest::testReleaseAndReclaim(Lease::Type type) { (*subnets->begin())->getID()); ASSERT_TRUE(l); - EXPECT_EQ(l->valid_lft_, 0); - EXPECT_EQ(l->preferred_lft_, 0); + EXPECT_EQ(l->valid_lft_, 0U); + EXPECT_EQ(l->preferred_lft_, 0U); EXPECT_EQ(Lease::STATE_EXPIRED_RECLAIMED, l->state_); stat = StatsMgr::instance().getObservation(type == Lease::TYPE_NA ? @@ -947,8 +947,8 @@ Dhcpv6SrvTest::testReleaseNoDelete(Lease::Type type, const IOAddress& addr, l = LeaseMgrFactory::instance().getLease6(type, *duid_, iaid, subnet_->getID()); ASSERT_TRUE(l); - EXPECT_EQ(l->valid_lft_, 0); - EXPECT_EQ(l->preferred_lft_, 0); + EXPECT_EQ(l->valid_lft_, 0U); + EXPECT_EQ(l->preferred_lft_, 0U); // Create query Pkt6Ptr query; @@ -1008,8 +1008,8 @@ Dhcpv6SrvTest::testReleaseNoDelete(Lease::Type type, const IOAddress& addr, subnet_->getID()); ASSERT_TRUE(l); if (qtype == DHCPV6_SOLICIT) { - EXPECT_EQ(l->valid_lft_, 0); - EXPECT_EQ(l->preferred_lft_, 0); + EXPECT_EQ(l->valid_lft_, 0U); + EXPECT_EQ(l->preferred_lft_, 0U); } else { EXPECT_EQ(l->valid_lft_, subnet_->getValid()); EXPECT_EQ(l->preferred_lft_, subnet_->getPreferred()); @@ -1419,8 +1419,8 @@ NakedDhcpv6SrvTest::checkIA_NAStatusCode( boost::dynamic_pointer_cast(opt.second); ASSERT_TRUE(addr); - EXPECT_EQ(0, addr->getPreferred()); - EXPECT_EQ(0, addr->getValid()); + EXPECT_EQ(0U, addr->getPreferred()); + EXPECT_EQ(0U, addr->getValid()); } } diff --git a/src/bin/dhcp6/tests/dhcp6to4_ipc_unittest.cc b/src/bin/dhcp6/tests/dhcp6to4_ipc_unittest.cc index 4b453a54a9..ed469c869b 100644 --- a/src/bin/dhcp6/tests/dhcp6to4_ipc_unittest.cc +++ b/src/bin/dhcp6/tests/dhcp6to4_ipc_unittest.cc @@ -192,7 +192,7 @@ TEST_F(Dhcp6to4IpcTest, receive) { EXPECT_EQ(forwarded->getType(), pkt->getType()); EXPECT_TRUE(forwarded->getOption(D6O_DHCPV4_MSG)); EXPECT_EQ("eth0", forwarded->getIface()); - EXPECT_EQ(ETH0_INDEX, forwarded->getIndex()); + EXPECT_EQ(static_cast(ETH0_INDEX), forwarded->getIndex()); EXPECT_EQ("2001:db8:1::123", forwarded->getRemoteAddr().toText()); // Verify statistics @@ -257,7 +257,7 @@ TEST_F(Dhcp6to4IpcTest, DISABLED_receiveRelayed) { EXPECT_EQ(forwarded->getType(), pkt->getType()); EXPECT_TRUE(forwarded->getOption(D6O_DHCPV4_MSG)); EXPECT_EQ("eth0", forwarded->getIface()); - EXPECT_EQ(ETH0_INDEX, forwarded->getIndex()); + EXPECT_EQ(static_cast(ETH0_INDEX), forwarded->getIndex()); EXPECT_EQ("2001:db8:1::123", forwarded->getRemoteAddr().toText()); EXPECT_EQ(DHCP6_CLIENT_PORT, forwarded->getRemotePort()); diff --git a/src/bin/dhcp6/tests/flq_unittest.cc b/src/bin/dhcp6/tests/flq_unittest.cc index bdd8e4f756..113ddb383a 100644 --- a/src/bin/dhcp6/tests/flq_unittest.cc +++ b/src/bin/dhcp6/tests/flq_unittest.cc @@ -88,7 +88,7 @@ public: // Make sure that the client has got the requested prefix. EXPECT_EQ("2001:db8:1:e000::", lease->addr_.toText()); - EXPECT_EQ(51, lease->prefixlen_); + EXPECT_EQ(51U, lease->prefixlen_); if (near_preferred) { EXPECT_NEAR(exp_preferred, lease->preferred_lft_, 2); @@ -160,7 +160,7 @@ TEST_F(FLQTest, empty) { ASSERT_NO_THROW(client.doSARR()); // Server should have assigned a prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6Ptr lease = checkLease(client.getLease(0)); // Preferred lifetime should be the config preferred-lifetime (200). @@ -183,7 +183,7 @@ TEST_F(FLQTest, last) { ASSERT_NO_THROW(client.doSARR()); // Server should have assigned a prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6Ptr lease = checkLease(client.getLease(0)); // Preferred lifetime should be the config min-preferred-lifetime (100). @@ -211,7 +211,7 @@ TEST_F(FLQTest, expired) { ASSERT_NO_THROW(client.doSARR()); // Server should have assigned a prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6Ptr lease = checkLease(client.getLease(0)); // Preferred lifetime should be the config min-preferred-lifetime (100). @@ -239,7 +239,7 @@ TEST_F(FLQTest, reclaimed) { ASSERT_NO_THROW(client.doSARR()); // Server should have assigned a prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6Ptr lease = checkLease(client.getLease(0)); // Preferred lifetime should be the config min-preferred-lifetime (100). @@ -259,7 +259,7 @@ TEST_F(FLQTest, renew) { ASSERT_NO_THROW(client.doSARR()); // Server should have assigned a prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6Ptr lease = checkLease(client.getLease(0)); // Preferred lifetime should be the config preferred-lifetime (200). @@ -273,7 +273,7 @@ TEST_F(FLQTest, renew) { ASSERT_NO_THROW(client.doRenew()); // Server should have renewed the prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6Ptr renewed = checkLease(client.getLease(0)); // Preferred lifetime should be the config preferred-lifetime (200). @@ -296,7 +296,7 @@ TEST_F(FLQTest, renewFull) { ASSERT_NO_THROW(client.doSARR()); // Server should have assigned a prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6Ptr lease = checkLease(client.getLease(0)); // Preferred lifetime should be the config preferred-lifetime (200). @@ -313,7 +313,7 @@ TEST_F(FLQTest, renewFull) { ASSERT_NO_THROW(client.doRenew()); // Server should have renewed the prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6Ptr renewed = checkLease(client.getLease(0)); ASSERT_TRUE(renewed); @@ -337,7 +337,7 @@ TEST_F(FLQTest, renewRemaining) { ASSERT_NO_THROW(client.doSARR()); // Server should have assigned a prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6Ptr lease = checkLease(client.getLease(0)); // Preferred lifetime should be the config preferred-lifetime (200). @@ -354,7 +354,7 @@ TEST_F(FLQTest, renewRemaining) { ASSERT_NO_THROW(client.doRenew()); // Server should have renewed the prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6Ptr renewed = checkLease(client.getLease(0)); // Preferred lifetime should be the remaining lifetime so ~150. @@ -378,7 +378,7 @@ TEST_F(FLQTest, renewRemainingValid) { ASSERT_NO_THROW(client.doSARR()); // Server should have assigned a prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6Ptr lease = checkLease(client.getLease(0)); // Preferred lifetime should be the config preferred-lifetime (200). @@ -395,7 +395,7 @@ TEST_F(FLQTest, renewRemainingValid) { ASSERT_NO_THROW(client.doRenew()); // Server should have renewed the prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6Ptr renewed = checkLease(client.getLease(0)); // Preferred lifetime should be the config min-preferred-lifetime (100). diff --git a/src/bin/dhcp6/tests/fqdn_unittest.cc b/src/bin/dhcp6/tests/fqdn_unittest.cc index f2a33452b7..f65ab5cc97 100644 --- a/src/bin/dhcp6/tests/fqdn_unittest.cc +++ b/src/bin/dhcp6/tests/fqdn_unittest.cc @@ -402,7 +402,7 @@ public: if (exp_fwd.value_ || exp_rev.value_) { // Should have created 1 NCR. NameChangeRequestPtr ncr; - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); ASSERT_NO_THROW(ncr = d2_mgr_.peekAt(0)); ASSERT_TRUE(ncr); EXPECT_EQ(dhcp_ddns::CHG_ADD, ncr->getChangeType()); @@ -411,7 +411,7 @@ public: ASSERT_NO_THROW(d2_mgr_.runReadyIO()); } else { // Should not have created any NCRs. - EXPECT_EQ(0, d2_mgr_.getQueueSize()); + EXPECT_EQ(0U, d2_mgr_.getQueueSize()); } } } @@ -670,14 +670,15 @@ public: /// @param pool_idx Element index of the desired pool within the desired subnet /// @param type lease type of desired pool /// - void setSubnetAndPool(int subnet_idx, int pool_idx, Lease::Type type) { + void setSubnetAndPool(unsigned subnet_idx, unsigned pool_idx, + Lease::Type type) { ConstCfgSubnets6Ptr subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6(); ASSERT_TRUE(subnets); const Subnet6Collection* subnet_col = subnets->getAll(); ASSERT_EQ(subnet_idx + 1, subnet_col->size()); auto subnet_it = subnet_col->begin(); // std::advance is not available for this iterator. - for (int i = 0; i < subnet_idx; ++i) { + for (unsigned i = 0; i < subnet_idx; ++i) { subnet_it = std::next(subnet_it); } subnet_ = *subnet_it; @@ -737,7 +738,7 @@ public: answer->addOption(fqdn); ASSERT_NO_THROW(srv_->createNameChangeRequests(answer, ctx)); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); // Verify that NameChangeRequest is correct. verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, @@ -864,7 +865,7 @@ TEST_F(FqdnDhcpv6SrvTest, createNameChangeRequestsNoFQDN) { ASSERT_NO_THROW(srv_->createNameChangeRequests(answer, ctx)); // There should be no new NameChangeRequests. - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); } // Test that NameChangeRequests are not generated if an answer message @@ -884,7 +885,7 @@ TEST_F(FqdnDhcpv6SrvTest, createNameChangeRequestsNoAddr) { // We didn't add any IAs, so there should be no NameChangeRequests in the // queue. - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); } // Test that exactly one NameChangeRequest is created as a result of processing @@ -913,7 +914,7 @@ TEST_F(FqdnDhcpv6SrvTest, createNameChangeRequests) { ASSERT_NO_THROW(srv_->createNameChangeRequests(answer, ctx)); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); // Verify that NameChangeRequest is correct. verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, @@ -947,7 +948,7 @@ TEST_F(FqdnDhcpv6SrvTest, noConflictResolution) { answer->addOption(fqdn); ASSERT_NO_THROW(srv_->createNameChangeRequests(answer, ctx)); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); // Verify that NameChangeRequest is correct. verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, @@ -997,7 +998,7 @@ TEST_F(FqdnDhcpv6SrvTest, createRemovalNameChangeRequestFwdRev) { ASSERT_NO_THROW(queueNCR(CHG_REMOVE, lease_)); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_REMOVE, true, true, "2001:db8:1::1", "000201415AA33D1187D148275136FA30300478" @@ -1034,7 +1035,7 @@ TEST_F(FqdnDhcpv6SrvTest, createRemovalNameChangeRequestRev) { ASSERT_NO_THROW(queueNCR(CHG_REMOVE, lease_)); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_REMOVE, true, false, "2001:db8:1::1", @@ -1051,7 +1052,7 @@ TEST_F(FqdnDhcpv6SrvTest, createRemovalNameChangeRequestNoUpdate) { ASSERT_NO_THROW(queueNCR(CHG_REMOVE, lease_)); - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); } // Test that NameChangeRequest is not generated if the hostname hasn't been @@ -1064,7 +1065,7 @@ TEST_F(FqdnDhcpv6SrvTest, createRemovalNameChangeRequestNoHostname) { Pkt6Ptr pkt(new Pkt6(DHCPREQUEST, 1234)); ASSERT_NO_THROW(queueNCR(CHG_REMOVE, lease_)); - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); } // Test that NameChangeRequest is not generated if the invalid hostname has @@ -1077,7 +1078,7 @@ TEST_F(FqdnDhcpv6SrvTest, createRemovalNameChangeRequestWrongHostname) { ASSERT_NO_THROW(queueNCR(CHG_REMOVE, lease_)); - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); } // Test that Advertise message generated in a response to the Solicit will @@ -1087,7 +1088,7 @@ TEST_F(FqdnDhcpv6SrvTest, processSolicit) { // response using processSolicit function. testProcessMessage(DHCPV6_SOLICIT, "myhost.example.com", "myhost.example.com."); - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); } // Test that client may send two requests, each carrying FQDN option with @@ -1107,7 +1108,7 @@ TEST_F(FqdnDhcpv6SrvTest, processTwoRequestsDiffFqdn) { IOAddress("2001:db8:1:1::dead:beef")); ASSERT_TRUE(lease_); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "2001:db8:1:1::dead:beef", "000201415AA33D1187D148275136FA30300478" @@ -1123,7 +1124,7 @@ TEST_F(FqdnDhcpv6SrvTest, processTwoRequestsDiffFqdn) { // remove the existing entries, one to add new entries. testProcessMessage(DHCPV6_REQUEST, "otherhost.example.com", "otherhost.example.com."); - ASSERT_EQ(2, d2_mgr_.getQueueSize()); + ASSERT_EQ(2U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_REMOVE, true, true, "2001:db8:1:1::dead:beef", "000201415AA33D1187D148275136FA30300478" @@ -1152,7 +1153,7 @@ TEST_F(FqdnDhcpv6SrvTest, processTwoRequestsSameFqdn) { IOAddress("2001:db8:1:1::dead:beef")); ASSERT_TRUE(lease_); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "2001:db8:1:1::dead:beef", "000201415AA33D1187D148275136FA30300478" @@ -1164,7 +1165,7 @@ TEST_F(FqdnDhcpv6SrvTest, processTwoRequestsSameFqdn) { // left alone, so we expect no NameChangeRequests queued.. testProcessMessage(DHCPV6_REQUEST, "myhost.example.com", "myhost.example.com."); - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); } // Test that NameChangeRequest is not generated when Solicit message is sent. @@ -1179,7 +1180,7 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestSolicit) { // to add both reverse and forward mapping to DNS. testProcessMessage(DHCPV6_REQUEST, "myhost.example.com", "myhost.example.com."); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "2001:db8:1:1::dead:beef", "000201415AA33D1187D148275136FA30300478" @@ -1192,7 +1193,7 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestSolicit) { // Request or Renew. testProcessMessage(DHCPV6_SOLICIT, "otherhost.example.com", "otherhost.example.com."); - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); } // Test that client may send Request followed by the Renew, both holding @@ -1213,7 +1214,7 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestRenewDiffFqdn) { IOAddress("2001:db8:1:1::dead:beef")); ASSERT_TRUE(lease_); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "2001:db8:1:1::dead:beef", "000201415AA33D1187D148275136FA30300478" @@ -1229,7 +1230,7 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestRenewDiffFqdn) { // remove the existing entries, one to add new entries. testProcessMessage(DHCPV6_RENEW, "otherhost.example.com", "otherhost.example.com."); - ASSERT_EQ(2, d2_mgr_.getQueueSize()); + ASSERT_EQ(2U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_REMOVE, true, true, "2001:db8:1:1::dead:beef", "000201415AA33D1187D148275136FA30300478" @@ -1254,21 +1255,21 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestRenewSameFqdn) { // to add both reverse and forward mapping to DNS. testProcessMessage(DHCPV6_REQUEST, "myhost.example.com", "myhost.example.com."); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "2001:db8:1:1::dead:beef", "000201415AA33D1187D148275136FA30300478" "FAAAA3EBD29826B5C907B2C9268A6F52", 4000); - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); // Client may send Renew message with a same domain-name. In this // case the same lease will be returned. No DNS updates should be // required, so the NCR queue should be empty. testProcessMessage(DHCPV6_RENEW, "myhost.example.com", "myhost.example.com."); - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); } // Tests that renewals using the same domain name but differing values for @@ -1286,14 +1287,14 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestRenewFqdnFlags) { testProcessMessage(DHCPV6_REQUEST, "myhost.example.com", "myhost.example.com.", Option6ClientFqdn::FLAG_N); // Queue should be empty. - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); // Now renew with Both N and S = 0. This means the server should only // do reverse updates and should result in a reverse-only NCR. testProcessMessage(DHCPV6_RENEW, "myhost.example.com", "myhost.example.com.", 0); // We should a only have reverse-only ADD, no remove. - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, false, "2001:db8:1:1::dead:beef", "000201415AA33D1187D148275136FA30300478" @@ -1304,7 +1305,7 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestRenewFqdnFlags) { testProcessMessage(DHCPV6_RENEW, "myhost.example.com", "myhost.example.com.", 0); // Queue should be empty. - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); // Renew with both N and S flags = 0. This tells the server to update // both directions, which should change forward flag to true. This should @@ -1319,7 +1320,7 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestRenewFqdnFlags) { ASSERT_TRUE(lease_); // We should have two NCRs, one remove and one add. - ASSERT_EQ(2, d2_mgr_.getQueueSize()); + ASSERT_EQ(2U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_REMOVE, true, false, "2001:db8:1:1::dead:beef", "000201415AA33D1187D148275136FA30300478" @@ -1337,7 +1338,7 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestRenewFqdnFlags) { testProcessMessage(DHCPV6_RENEW, "myhost.example.com", "myhost.example.com.", Option6ClientFqdn::FLAG_N); // We should only have the removal NCR. - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_REMOVE, true, true, "2001:db8:1:1::dead:beef", "000201415AA33D1187D148275136FA30300478" @@ -1361,7 +1362,7 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestRelease) { IOAddress("2001:db8:1:1::dead:beef")); ASSERT_TRUE(lease_); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "2001:db8:1:1::dead:beef", "000201415AA33D1187D148275136FA30300478" @@ -1374,7 +1375,7 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestRelease) { // remove DNS entries is generated. testProcessMessage(DHCPV6_RELEASE, "otherhost.example.com", "otherhost.example.com."); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_REMOVE, true, true, "2001:db8:1:1::dead:beef", "000201415AA33D1187D148275136FA30300478" @@ -1395,7 +1396,7 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestReleaseNoDelete) { IOAddress("2001:db8:1:1::dead:beef")); ASSERT_TRUE(lease_); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "2001:db8:1:1::dead:beef", "000201415AA33D1187D148275136FA30300478" @@ -1406,7 +1407,7 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestReleaseNoDelete) { // expired and no NameChangeRequest to remove DNS entries is generated. testProcessMessage(DHCPV6_RELEASE, "otherhost.example.com", "otherhost.example.com."); - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); } // Checks that the server include DHCPv6 Client FQDN option in its @@ -1418,7 +1419,7 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestWithoutFqdn) { testProcessMessage(DHCPV6_REQUEST, "myhost.example.com", "myhost.example.com.", Option6ClientFqdn::FLAG_S, IOAddress("2001:db8:1:1::dead:beef"), false); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "2001:db8:1:1::dead:beef", "000201415AA33D1187D148275136FA30300478" @@ -1433,7 +1434,7 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestEmptyFqdn) { "myhost-2001-db8-1-1--dead-beef.example.com.", Option6ClientFqdn::FLAG_S, IOAddress("2001:db8:1:1::dead:beef"), false); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "2001:db8:1:1::dead:beef", "000201C905E54BE12DE6AF92ADE72752B9F362" @@ -1468,7 +1469,7 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestReuseExpiredLease) { testProcessMessage(DHCPV6_REQUEST, "myhost.example.com", "myhost.example.com."); // Test that the appropriate NameChangeRequest has been generated. - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); // Get the lease acquired. Lease6Ptr lease = @@ -1502,7 +1503,7 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestReuseExpiredLease) { // reuse this lease. testProcessMessage(DHCPV6_REQUEST, "myhost.example.com.", "myhost.example.com."); - ASSERT_EQ(2, d2_mgr_.getQueueSize()); + ASSERT_EQ(2U, d2_mgr_.getQueueSize()); // The first name change request generated, should remove a DNS // mapping for an expired lease. verifyNameChangeRequest(isc::dhcp_ddns::CHG_REMOVE, true, true, @@ -1521,7 +1522,7 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestReuseExpiredLease) { TEST_F(FqdnDhcpv6SrvTest, processClientDelegation) { testProcessMessage(DHCPV6_REQUEST, "myhost.example.com", "myhost.example.com.", 0); - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, false, "2001:db8:1:1::dead:beef", "000201415AA33D1187D148275136FA30300478" @@ -1795,7 +1796,7 @@ TEST_F(FqdnDhcpv6SrvTest, ddnsScopeTest) { EXPECT_EQ("one.example.org.", fqdn->getDomainName()); // ddns-send-updates for subnet 1 should be off, so we should NOT have an NRC. - ASSERT_EQ(0, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(0U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); // Now let's try with a client on subnet 2. Dhcp6Client client2(srv_); @@ -1822,7 +1823,7 @@ TEST_F(FqdnDhcpv6SrvTest, ddnsScopeTest) { ASSERT_TRUE(p->getEnableUpdates()); // ddns-send-updates for subnet 2 are enabled, verify the NCR is correct. - ASSERT_EQ(1, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(1U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "2001:db8:2::1", "", 4000); } @@ -1897,7 +1898,7 @@ TEST_F(FqdnDhcpv6SrvTest, ddnsSharedNetworkTest) { EXPECT_EQ("client1.one.example.com.", fqdn->getDomainName()); // ddns-send-updates for subnet 1 are enabled, verify the NCR is correct. - ASSERT_EQ(1, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(1U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "2001:db8:1::1", "", 4000, "client1.one.example.com."); @@ -1931,7 +1932,7 @@ TEST_F(FqdnDhcpv6SrvTest, ddnsSharedNetworkTest) { EXPECT_EQ("client2.two.example.com.", fqdn->getDomainName()); // ddns-send-updates for subnet 2 are enabled, verify the NCR is correct. - ASSERT_EQ(1, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(1U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "2001:db8:2::1", "", 4000, "client2.two.example.com."); @@ -1956,7 +1957,7 @@ TEST_F(FqdnDhcpv6SrvTest, ddnsSharedNetworkTest) { // ddns-send-updates for subnet 2 are enabled, but currently a renew/rebind does // not update, unless the FQDN or flags change. - ASSERT_EQ(0, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(0U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); // Make sure the lease hostname is still correct. lease = LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA, IOAddress("2001:db8:2::1")); @@ -1976,7 +1977,7 @@ TEST_F(FqdnDhcpv6SrvTest, ddnsSharedNetworkTest) { // ddns-send-updates for subnet 1 are enabled, but currently a renew/rebind does // not update, unless the FQDN or flags change. - ASSERT_EQ(0, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(0U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); // Make sure the lease hostname and fqdn flags are correct. lease = LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA, IOAddress("2001:db8:1::1")); @@ -2054,7 +2055,7 @@ TEST_F(FqdnDhcpv6SrvTest, ddnsSharedNetworkTest2) { EXPECT_EQ("client1.one.example.com.", fqdn->getDomainName()); // ddns-send-updates for subnet 1 are enabled, verify the NCR is correct. - ASSERT_EQ(1, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(1U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, "2001:db8:1::1", "", 4000, "client1.one.example.com."); @@ -2088,7 +2089,7 @@ TEST_F(FqdnDhcpv6SrvTest, ddnsSharedNetworkTest2) { EXPECT_EQ("client2.two.example.com.", fqdn->getDomainName()); // ddns-send-updates for subnet 2 are disabled, verify there is no NCR. - ASSERT_EQ(0, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + ASSERT_EQ(0U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); // Make sure the lease hostname and fdqn flags are correct. lease = LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA, IOAddress("2001:db8:2::1")); @@ -2174,10 +2175,10 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestRenew) { if (!scenario.send_updates_ || scenario.old_fqdn_.empty()) { // We should not have an NCR. - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); } else { // We should have an NCR add. - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, old_lease->addr_.toText(), "", old_lease->valid_lft_, @@ -2408,9 +2409,9 @@ TEST_F(FqdnDhcpv6SrvTest, poolDdnsParametersTest) { // Verify the NCR if we expect one. if (!scenario.expect_ncr_) { - ASSERT_EQ(0, d2_mgr_.getQueueSize()); + ASSERT_EQ(0U, d2_mgr_.getQueueSize()); } else { - ASSERT_EQ(1, d2_mgr_.getQueueSize()); + ASSERT_EQ(1U, d2_mgr_.getQueueSize()); verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, scenario.expected_address_.toText(), scenario.expected_dhcid_, diff --git a/src/bin/dhcp6/tests/hooks_unittest.cc b/src/bin/dhcp6/tests/hooks_unittest.cc index f8402a5664..84dee0de39 100644 --- a/src/bin/dhcp6/tests/hooks_unittest.cc +++ b/src/bin/dhcp6/tests/hooks_unittest.cc @@ -1202,7 +1202,7 @@ TEST_F(HooksDhcpv6SrvTest, buffer6ReceiveValueChange) { srv_->run(); // Check that the server did send a response - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Make sure that we received a response Pkt6Ptr adv = srv_->fake_sent_.front(); @@ -1214,7 +1214,7 @@ TEST_F(HooksDhcpv6SrvTest, buffer6ReceiveValueChange) { ASSERT_TRUE(clientid); // ... and check if it is the modified value - EXPECT_EQ(0xff, clientid->getData()[0]); + EXPECT_EQ(0xffU, clientid->getData()[0]); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(sol); @@ -1241,7 +1241,7 @@ TEST_F(HooksDhcpv6SrvTest, buffer6ReceiveDeleteClientId) { srv_->run(); // Check that the server dropped the packet and did not send a response - ASSERT_EQ(0, srv_->fake_sent_.size()); + ASSERT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(sol); @@ -1267,7 +1267,7 @@ TEST_F(HooksDhcpv6SrvTest, buffer6ReceiveSkip) { srv_->run(); // Check that the server dropped the packet and did not produce any response - ASSERT_EQ(0, srv_->fake_sent_.size()); + ASSERT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(sol); @@ -1293,13 +1293,13 @@ TEST_F(HooksDhcpv6SrvTest, buffer6ReceiveDrop) { srv_->run(); // Check that the server dropped the packet and did not produce any response - ASSERT_EQ(0, srv_->fake_sent_.size()); + ASSERT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(sol); // Drop statistics should be maintained by the callouts, not by the server. - EXPECT_EQ(0, getStatistic("pkt6-receive-drop")); + EXPECT_EQ(0U, getStatistic("pkt6-receive-drop")); } // Checks if callouts installed on pkt6_receive are indeed called and the @@ -1363,7 +1363,7 @@ TEST_F(HooksDhcpv6SrvTest, pkt6ReceiveValueChange) { srv_->run(); // Check that the server did send a response - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Make sure that we received a response Pkt6Ptr adv = srv_->fake_sent_.front(); @@ -1401,7 +1401,7 @@ TEST_F(HooksDhcpv6SrvTest, pkt6ReceiveDeleteClientId) { srv_->run(); // Check that the server dropped the packet and did not send a response - ASSERT_EQ(0, srv_->fake_sent_.size()); + ASSERT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(sol); @@ -1427,7 +1427,7 @@ TEST_F(HooksDhcpv6SrvTest, pkt6ReceiveSkip) { srv_->run(); // Check that the server dropped the packet and did not produce any response - ASSERT_EQ(0, srv_->fake_sent_.size()); + ASSERT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(sol); @@ -1453,13 +1453,13 @@ TEST_F(HooksDhcpv6SrvTest, pkt6ReceiveDrop) { srv_->run(); // Check that the server dropped the packet and did not produce any response - ASSERT_EQ(0, srv_->fake_sent_.size()); + ASSERT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(sol); // Drop statistics should be maintained by the callouts, not by the server. - EXPECT_EQ(0, getStatistic("pkt6-receive-drop")); + EXPECT_EQ(0U, getStatistic("pkt6-receive-drop")); } // Checks if callouts installed on pkt6_send are indeed called and the @@ -1485,7 +1485,7 @@ TEST_F(HooksDhcpv6SrvTest, pkt6SendSimple) { EXPECT_EQ("pkt6_send", callback_name_); // Check that there is one packet sent - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); Pkt6Ptr adv = srv_->fake_sent_.front(); // Check that pkt6 argument passing was successful and returned proper @@ -1538,7 +1538,7 @@ TEST_F(HooksDhcpv6SrvTest, pkt6SendValueChange) { srv_->run(); // Check that the server did send a response - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Make sure that we received a response Pkt6Ptr adv = srv_->fake_sent_.front(); @@ -1577,7 +1577,7 @@ TEST_F(HooksDhcpv6SrvTest, pkt6SendDeleteServerId) { srv_->run(); // Check that the server indeed sent a malformed ADVERTISE - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Get that ADVERTISE Pkt6Ptr adv = srv_->fake_sent_.front(); @@ -1610,14 +1610,14 @@ TEST_F(HooksDhcpv6SrvTest, pkt6SendSkip) { srv_->run(); // Check that the server sent the packet - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); // Get the first packet and check that it has zero length (i.e. the server // did not do packing on its own) Pkt6Ptr sent = srv_->fake_sent_.front(); // The actual size of sent packet should be 0 - EXPECT_EQ(0, sent->getBuffer().getLength()); + EXPECT_EQ(0U, sent->getBuffer().getLength()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(sol); @@ -1643,7 +1643,7 @@ TEST_F(HooksDhcpv6SrvTest, pkt6SendDrop) { srv_->run(); // Check that the server does not send the packet - EXPECT_EQ(0, srv_->fake_sent_.size()); + EXPECT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(sol); @@ -1672,7 +1672,7 @@ TEST_F(HooksDhcpv6SrvTest, buffer6SendSimple) { EXPECT_EQ("buffer6_send", callback_name_); // Check that there is one packet sent - ASSERT_EQ(1, srv_->fake_sent_.size()); + ASSERT_EQ(1U, srv_->fake_sent_.size()); Pkt6Ptr adv = srv_->fake_sent_.front(); // Check that pkt6 argument passing was successful and returned proper value @@ -1713,7 +1713,7 @@ TEST_F(HooksDhcpv6SrvTest, buffer6SendSkip) { EXPECT_EQ("buffer6_send", callback_name_); // Check that there is no packet sent. - ASSERT_EQ(0, srv_->fake_sent_.size()); + ASSERT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(sol); @@ -1742,7 +1742,7 @@ TEST_F(HooksDhcpv6SrvTest, buffer6SendDrop) { EXPECT_EQ("buffer6_send", callback_name_); // Check that there is no packet sent - EXPECT_EQ(0, srv_->fake_sent_.size()); + EXPECT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(sol); @@ -1826,7 +1826,7 @@ TEST_F(HooksDhcpv6SrvTest, subnet6SelectSimple) { // Server is supposed to report two subnets ASSERT_EQ(exp_subnets->size(), callback_subnet6collection_->size()); - ASSERT_GE(exp_subnets->size(), 2); + ASSERT_GE(exp_subnets->size(), 2U); // Compare that the available subnets are reported as expected EXPECT_TRUE((*exp_subnets->begin())->get() == (*callback_subnet6collection_->begin())->get()); @@ -1914,7 +1914,7 @@ TEST_F(HooksDhcpv6SrvTest, subnet6SelectChange) { // Get all subnets and use second subnet for verification const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - ASSERT_EQ(2, subnets->size()); + ASSERT_EQ(2U, subnets->size()); // Advertised address must belong to the second pool (in subnet's range, // in dynamic pool) @@ -1946,13 +1946,13 @@ TEST_F(HooksDhcpv6SrvTest, subnet6SelectDrop) { srv_->run(); // Check that the server dropped the packet and did not produce any response - ASSERT_EQ(0, srv_->fake_sent_.size()); + ASSERT_EQ(0U, srv_->fake_sent_.size()); // Check if the callout handle state was reset after the callout. checkCalloutHandleReset(sol); // Drop statistics should be maintained by the callouts, not by the server. - EXPECT_EQ(0, getStatistic("pkt6-receive-drop")); + EXPECT_EQ(0U, getStatistic("pkt6-receive-drop")); } // This test verifies that the leases6_committed hook point is not triggered @@ -2129,7 +2129,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRapidCommit) { // Newly allocated lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); Lease6Ptr lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::28", lease->addr_.toText()); @@ -2204,11 +2204,11 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedParkRapidCommitPrefixes) { // Newly allocated lease should be passed to the callout. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); Lease6Ptr lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1:28::", lease->addr_.toText()); - EXPECT_EQ(64, lease->prefixlen_); + EXPECT_EQ(64U, lease->prefixlen_); // Deleted lease must not be present, because it is a new allocation. ASSERT_TRUE(callback_deleted_leases6_); @@ -2310,7 +2310,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRequest) { // Newly allocated lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); Lease6Ptr lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::28", lease->addr_.toText()); @@ -2338,7 +2338,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRequest) { // Requested lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::28", lease->addr_.toText()); @@ -2369,7 +2369,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRequest) { // New lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(2, callback_new_leases6_->size()); + ASSERT_EQ(2U, callback_new_leases6_->size()); lease = callback_new_leases6_->at(1); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::29", lease->addr_.toText()); @@ -2398,7 +2398,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRequest) { EXPECT_EQ("leases6_committed", callback_name_); ASSERT_TRUE(callback_new_leases6_); - EXPECT_EQ(3, callback_new_leases6_->size()); + EXPECT_EQ(3U, callback_new_leases6_->size()); lease = callback_new_leases6_->at(2); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::", lease->addr_.toText()); @@ -2429,7 +2429,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRequest) { EXPECT_EQ("leases6_committed", callback_name_); ASSERT_TRUE(callback_new_leases6_); - EXPECT_EQ(3, callback_new_leases6_->size()); + EXPECT_EQ(3U, callback_new_leases6_->size()); ASSERT_TRUE(callback_deleted_leases6_); EXPECT_TRUE(callback_deleted_leases6_->empty()); @@ -2490,11 +2490,11 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRequestPrefix) { // Newly allocated lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); Lease6Ptr lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1:28::", lease->addr_.toText()); - EXPECT_EQ(64, lease->prefixlen_); + EXPECT_EQ(64U, lease->prefixlen_); // Deleted lease must not be present, because it is a new allocation. ASSERT_TRUE(callback_deleted_leases6_); @@ -2519,11 +2519,11 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRequestPrefix) { // Requested lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1:28::", lease->addr_.toText()); - EXPECT_EQ(64, lease->prefixlen_); + EXPECT_EQ(64U, lease->prefixlen_); // Deleted lease must not be present, because it is a new allocation. ASSERT_TRUE(callback_deleted_leases6_); @@ -2551,11 +2551,11 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRequestPrefix) { // New lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(2, callback_new_leases6_->size()); + ASSERT_EQ(2U, callback_new_leases6_->size()); lease = callback_new_leases6_->at(1); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1:29::", lease->addr_.toText()); - EXPECT_EQ(64, lease->prefixlen_); + EXPECT_EQ(64U, lease->prefixlen_); // The old lease is kept. ASSERT_TRUE(callback_deleted_leases6_); @@ -2581,11 +2581,11 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRequestPrefix) { EXPECT_EQ("leases6_committed", callback_name_); ASSERT_TRUE(callback_new_leases6_); - EXPECT_EQ(3, callback_new_leases6_->size()); + EXPECT_EQ(3U, callback_new_leases6_->size()); lease = callback_new_leases6_->at(2); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::", lease->addr_.toText()); - EXPECT_EQ(64, lease->prefixlen_); + EXPECT_EQ(64U, lease->prefixlen_); ASSERT_TRUE(callback_deleted_leases6_); EXPECT_TRUE(callback_deleted_leases6_->empty()); @@ -2613,7 +2613,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRequestPrefix) { EXPECT_EQ("leases6_committed", callback_name_); ASSERT_TRUE(callback_new_leases6_); - EXPECT_EQ(3, callback_new_leases6_->size()); + EXPECT_EQ(3U, callback_new_leases6_->size()); ASSERT_TRUE(callback_deleted_leases6_); EXPECT_TRUE(callback_deleted_leases6_->empty()); @@ -2671,7 +2671,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRenew) { // Newly allocated lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); Lease6Ptr lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::28", lease->addr_.toText()); @@ -2699,7 +2699,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRenew) { // Renewed lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::28", lease->addr_.toText()); @@ -2727,7 +2727,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRenew) { // New lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(2, callback_new_leases6_->size()); + ASSERT_EQ(2U, callback_new_leases6_->size()); lease = callback_new_leases6_->at(1); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::29", lease->addr_.toText()); @@ -2756,7 +2756,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRenew) { EXPECT_EQ("leases6_committed", callback_name_); ASSERT_TRUE(callback_new_leases6_); - EXPECT_EQ(3, callback_new_leases6_->size()); + EXPECT_EQ(3U, callback_new_leases6_->size()); lease = callback_new_leases6_->at(2); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::", lease->addr_.toText()); @@ -2787,7 +2787,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRenew) { EXPECT_EQ("leases6_committed", callback_name_); ASSERT_TRUE(callback_new_leases6_); - EXPECT_EQ(3, callback_new_leases6_->size()); + EXPECT_EQ(3U, callback_new_leases6_->size()); ASSERT_TRUE(callback_deleted_leases6_); EXPECT_TRUE(callback_deleted_leases6_->empty()); @@ -2848,11 +2848,11 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRenewPrefix) { // Newly allocated lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); Lease6Ptr lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1:28::", lease->addr_.toText()); - EXPECT_EQ(64, lease->prefixlen_); + EXPECT_EQ(64U, lease->prefixlen_); // Deleted lease must not be present, because it is a new allocation. ASSERT_TRUE(callback_deleted_leases6_); @@ -2874,11 +2874,11 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRenewPrefix) { // Renewed lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1:28::", lease->addr_.toText()); - EXPECT_EQ(64, lease->prefixlen_); + EXPECT_EQ(64U, lease->prefixlen_); // Deleted lease must not be present, because it is a new allocation. ASSERT_TRUE(callback_deleted_leases6_); @@ -2906,11 +2906,11 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRenewPrefix) { // New lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(2, callback_new_leases6_->size()); + ASSERT_EQ(2U, callback_new_leases6_->size()); lease = callback_new_leases6_->at(1); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1:29::", lease->addr_.toText()); - EXPECT_EQ(64, lease->prefixlen_); + EXPECT_EQ(64U, lease->prefixlen_); // The old lease is kept. ASSERT_TRUE(callback_deleted_leases6_); @@ -2936,11 +2936,11 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRenewPrefix) { EXPECT_EQ("leases6_committed", callback_name_); ASSERT_TRUE(callback_new_leases6_); - EXPECT_EQ(3, callback_new_leases6_->size()); + EXPECT_EQ(3U, callback_new_leases6_->size()); lease = callback_new_leases6_->at(2); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::", lease->addr_.toText()); - EXPECT_EQ(64, lease->prefixlen_); + EXPECT_EQ(64U, lease->prefixlen_); ASSERT_TRUE(callback_deleted_leases6_); EXPECT_TRUE(callback_deleted_leases6_->empty()); @@ -2968,7 +2968,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRenewPrefix) { EXPECT_EQ("leases6_committed", callback_name_); ASSERT_TRUE(callback_new_leases6_); - EXPECT_EQ(3, callback_new_leases6_->size()); + EXPECT_EQ(3U, callback_new_leases6_->size()); ASSERT_TRUE(callback_deleted_leases6_); EXPECT_TRUE(callback_deleted_leases6_->empty()); @@ -3026,7 +3026,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRebind) { // Newly allocated lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); Lease6Ptr lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::28", lease->addr_.toText()); @@ -3054,7 +3054,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRebind) { // Rebound lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::28", lease->addr_.toText()); @@ -3085,7 +3085,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRebind) { // New lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(2, callback_new_leases6_->size()); + ASSERT_EQ(2U, callback_new_leases6_->size()); lease = callback_new_leases6_->at(1); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::29", lease->addr_.toText()); @@ -3114,7 +3114,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRebind) { EXPECT_EQ("leases6_committed", callback_name_); ASSERT_TRUE(callback_new_leases6_); - EXPECT_EQ(3, callback_new_leases6_->size()); + EXPECT_EQ(3U, callback_new_leases6_->size()); lease = callback_new_leases6_->at(2); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::", lease->addr_.toText()); @@ -3145,7 +3145,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRebind) { EXPECT_EQ("leases6_committed", callback_name_); ASSERT_TRUE(callback_new_leases6_); - EXPECT_EQ(3, callback_new_leases6_->size()); + EXPECT_EQ(3U, callback_new_leases6_->size()); ASSERT_TRUE(callback_deleted_leases6_); EXPECT_TRUE(callback_deleted_leases6_->empty()); @@ -3206,11 +3206,11 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRebindPrefix) { // Newly allocated lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); Lease6Ptr lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1:28::", lease->addr_.toText()); - EXPECT_EQ(64, lease->prefixlen_); + EXPECT_EQ(64U, lease->prefixlen_); // Deleted lease must not be present, because it is a new allocation. ASSERT_TRUE(callback_deleted_leases6_); @@ -3235,11 +3235,11 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRebindPrefix) { // Rebound lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1:28::", lease->addr_.toText()); - EXPECT_EQ(64, lease->prefixlen_); + EXPECT_EQ(64U, lease->prefixlen_); // Deleted lease must not be present, because it is a new allocation. ASSERT_TRUE(callback_deleted_leases6_); @@ -3267,11 +3267,11 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRebindPrefix) { // New lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(2, callback_new_leases6_->size()); + ASSERT_EQ(2U, callback_new_leases6_->size()); lease = callback_new_leases6_->at(1); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1:29::", lease->addr_.toText()); - EXPECT_EQ(64, lease->prefixlen_); + EXPECT_EQ(64U, lease->prefixlen_); // The old lease is kept. ASSERT_TRUE(callback_deleted_leases6_); @@ -3297,11 +3297,11 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRebindPrefix) { EXPECT_EQ("leases6_committed", callback_name_); ASSERT_TRUE(callback_new_leases6_); - EXPECT_EQ(3, callback_new_leases6_->size()); + EXPECT_EQ(3U, callback_new_leases6_->size()); lease = callback_new_leases6_->at(2); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::", lease->addr_.toText()); - EXPECT_EQ(64, lease->prefixlen_); + EXPECT_EQ(64U, lease->prefixlen_); ASSERT_TRUE(callback_deleted_leases6_); EXPECT_TRUE(callback_deleted_leases6_->empty()); @@ -3329,7 +3329,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRebindPrefix) { EXPECT_EQ("leases6_committed", callback_name_); ASSERT_TRUE(callback_new_leases6_); - EXPECT_EQ(3, callback_new_leases6_->size()); + EXPECT_EQ(3U, callback_new_leases6_->size()); ASSERT_TRUE(callback_deleted_leases6_); EXPECT_TRUE(callback_deleted_leases6_->empty()); @@ -3392,7 +3392,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedDecline) { // Declined lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); Lease6Ptr lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::28", lease->addr_.toText()); @@ -3458,7 +3458,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedDeclineTwoNAs) { // Declined lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(2, callback_new_leases6_->size()); + ASSERT_EQ(2U, callback_new_leases6_->size()); Lease6Ptr lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::28", lease->addr_.toText()); @@ -3527,7 +3527,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedRelease) { // Released lease should be returned. ASSERT_TRUE(callback_deleted_leases6_); - EXPECT_EQ(1, callback_deleted_leases6_->size()); + EXPECT_EQ(1U, callback_deleted_leases6_->size()); Lease6Ptr lease = callback_deleted_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::28", lease->addr_.toText()); @@ -3596,11 +3596,11 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedReleasePrefix) { // Released lease should be returned. ASSERT_TRUE(callback_deleted_leases6_); - EXPECT_EQ(1, callback_deleted_leases6_->size()); + EXPECT_EQ(1U, callback_deleted_leases6_->size()); Lease6Ptr lease = callback_deleted_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1:28::", lease->addr_.toText()); - EXPECT_EQ(64, lease->prefixlen_); + EXPECT_EQ(64U, lease->prefixlen_); // Pkt passed to a callout must be configured to copy retrieved options. EXPECT_TRUE(callback_qry_options_copy_); @@ -3672,7 +3672,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedReleaseMultiple) { // Released lease should be returned. ASSERT_TRUE(callback_deleted_leases6_); - EXPECT_EQ(4, callback_deleted_leases6_->size()); + EXPECT_EQ(4U, callback_deleted_leases6_->size()); // Pkt passed to a callout must be configured to copy retrieved options. EXPECT_TRUE(callback_qry_options_copy_); @@ -3731,7 +3731,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedCache) { // Newly allocated lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); Lease6Ptr lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::28", lease->addr_.toText()); @@ -3825,11 +3825,11 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedCachePrefix) { // Newly allocated lease should be returned. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); Lease6Ptr lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1:28::", lease->addr_.toText()); - EXPECT_EQ(64, lease->prefixlen_); + EXPECT_EQ(64U, lease->prefixlen_); // Deleted lease must not be present, because it is a new allocation. ASSERT_TRUE(callback_deleted_leases6_); @@ -3920,7 +3920,7 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedParkRequests) { // Newly allocated lease should be passed to the callout. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); Lease6Ptr lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1::28", lease->addr_.toText()); @@ -4030,11 +4030,11 @@ TEST_F(HooksDhcpv6SrvTest, leases6CommittedParkRequestsPrefixes) { // Newly allocated lease should be passed to the callout. ASSERT_TRUE(callback_new_leases6_); - ASSERT_EQ(1, callback_new_leases6_->size()); + ASSERT_EQ(1U, callback_new_leases6_->size()); Lease6Ptr lease = callback_new_leases6_->at(0); ASSERT_TRUE(lease); EXPECT_EQ("2001:db8:1:28::", lease->addr_.toText()); - EXPECT_EQ(64, lease->prefixlen_); + EXPECT_EQ(64U, lease->prefixlen_); // Deleted lease must not be present, because it is a new allocation. ASSERT_TRUE(callback_deleted_leases6_); @@ -4855,16 +4855,16 @@ TEST_F(HooksDhcpv6SrvTest, lease6ReleaseSimpleNoDelete) { l = LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA, addr); ASSERT_TRUE(l); - EXPECT_EQ(l->valid_lft_, 0); - EXPECT_EQ(l->preferred_lft_, 0); + EXPECT_EQ(l->valid_lft_, 0U); + EXPECT_EQ(l->preferred_lft_, 0U); // Get lease by subnetid/duid/iaid combination l = LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA, *duid_, iaid, subnet_->getID()); ASSERT_TRUE(l); - EXPECT_EQ(l->valid_lft_, 0); - EXPECT_EQ(l->preferred_lft_, 0); + EXPECT_EQ(l->valid_lft_, 0U); + EXPECT_EQ(l->preferred_lft_, 0U); // Pkt passed to a callout must be configured to copy retrieved options. EXPECT_TRUE(callback_qry_options_copy_); @@ -5101,16 +5101,16 @@ TEST_F(HooksDhcpv6SrvTest, lease6ReleasePrefixSimpleNoDelete) { l = LeaseMgrFactory::instance().getLease6(Lease::TYPE_PD, prefix); ASSERT_TRUE(l); - EXPECT_EQ(l->valid_lft_, 0); - EXPECT_EQ(l->preferred_lft_, 0); + EXPECT_EQ(l->valid_lft_, 0U); + EXPECT_EQ(l->preferred_lft_, 0U); // Get lease by subnetid/duid/iaid combination l = LeaseMgrFactory::instance().getLease6(Lease::TYPE_PD, *duid_, iaid, subnet_->getID()); ASSERT_TRUE(l); - EXPECT_EQ(l->valid_lft_, 0); - EXPECT_EQ(l->preferred_lft_, 0); + EXPECT_EQ(l->valid_lft_, 0U); + EXPECT_EQ(l->preferred_lft_, 0U); // Pkt passed to a callout must be configured to copy retrieved options. EXPECT_TRUE(callback_qry_options_copy_); @@ -5765,11 +5765,11 @@ TEST_F(HooksDhcpv6SrvTest, leases6ParkedPacketLimit) { auto const& parking_lot = ServerHooks::getServerHooks() .getParkingLotPtr("leases6_committed"); ASSERT_TRUE(parking_lot); - ASSERT_EQ(0, parking_lot->size()); + ASSERT_EQ(0U, parking_lot->size()); // Statistic should not show any drops. - EXPECT_EQ(0, getStatistic("pkt6-queue-full")); - EXPECT_EQ(0, getStatistic("pkt6-receive-drop")); + EXPECT_EQ(0U, getStatistic("pkt6-queue-full")); + EXPECT_EQ(0U, getStatistic("pkt6-receive-drop")); // This callout uses provided IO service object to post a function // that unparks the packet. The packet is parked and can be unparked @@ -5792,9 +5792,9 @@ TEST_F(HooksDhcpv6SrvTest, leases6ParkedPacketLimit) { EXPECT_EQ("leases6_committed", callback_name_); // Verify we have one parked packet and no drops. - ASSERT_EQ(1, parking_lot->size()); - EXPECT_EQ(0, getStatistic("pkt6-queue-full")); - EXPECT_EQ(0, getStatistic("pkt6-receive-drop")); + ASSERT_EQ(1U, parking_lot->size()); + EXPECT_EQ(0U, getStatistic("pkt6-queue-full")); + EXPECT_EQ(0U, getStatistic("pkt6-receive-drop")); // Reset all indicators because we'll be now creating a second client. resetCalloutBuffers(); @@ -5814,9 +5814,9 @@ TEST_F(HooksDhcpv6SrvTest, leases6ParkedPacketLimit) { EXPECT_EQ("", callback_name_); // Verify we have one parked packet and one drop. - ASSERT_EQ(1, parking_lot->size()); - EXPECT_EQ(1, getStatistic("pkt6-queue-full")); - EXPECT_EQ(1, getStatistic("pkt6-receive-drop")); + ASSERT_EQ(1U, parking_lot->size()); + EXPECT_EQ(1U, getStatistic("pkt6-queue-full")); + EXPECT_EQ(1U, getStatistic("pkt6-receive-drop")); // There should now be one action scheduled on our IO service // by the invoked callout. It should unpark the REPLY message @@ -5831,9 +5831,9 @@ TEST_F(HooksDhcpv6SrvTest, leases6ParkedPacketLimit) { EXPECT_TRUE(client1.hasLeaseForAddress(IOAddress("2001:db8:1::28"))); // Verify we have no parked packets and one drop. - ASSERT_EQ(0, parking_lot->size()); - EXPECT_EQ(1, getStatistic("pkt6-queue-full")); - EXPECT_EQ(1, getStatistic("pkt6-receive-drop")); + ASSERT_EQ(0U, parking_lot->size()); + EXPECT_EQ(1U, getStatistic("pkt6-queue-full")); + EXPECT_EQ(1U, getStatistic("pkt6-receive-drop")); // Should not anything to receive for client2. ASSERT_NO_THROW(client2.receiveResponse()); @@ -5855,9 +5855,9 @@ TEST_F(HooksDhcpv6SrvTest, leases6ParkedPacketLimit) { EXPECT_EQ("leases6_committed", callback_name_); // Verify we again have one parked packet and one drop. - ASSERT_EQ(1, parking_lot->size()); - EXPECT_EQ(1, getStatistic("pkt6-queue-full")); - EXPECT_EQ(1, getStatistic("pkt6-receive-drop")); + ASSERT_EQ(1U, parking_lot->size()); + EXPECT_EQ(1U, getStatistic("pkt6-queue-full")); + EXPECT_EQ(1U, getStatistic("pkt6-receive-drop")); // There should now be one action scheduled on our IO service // by the invoked callout. It should unpark the REPLY message @@ -5872,9 +5872,9 @@ TEST_F(HooksDhcpv6SrvTest, leases6ParkedPacketLimit) { EXPECT_TRUE(client2.hasLeaseForAddress(IOAddress("2001:db8:1::29"))); // Verify we no parked packets and one drop. - ASSERT_EQ(0, parking_lot->size()); - EXPECT_EQ(1, getStatistic("pkt6-queue-full")); - EXPECT_EQ(1, getStatistic("pkt6-receive-drop")); + ASSERT_EQ(0U, parking_lot->size()); + EXPECT_EQ(1U, getStatistic("pkt6-queue-full")); + EXPECT_EQ(1U, getStatistic("pkt6-receive-drop")); } // Checks that postponed hook start service can fail. @@ -6027,7 +6027,7 @@ TEST_F(HooksDhcpv6SrvTest, ddns6Update) { // Verify the subnet. ASSERT_TRUE(callback_subnet6_); - EXPECT_EQ(1, callback_subnet6_->getID()); + EXPECT_EQ(1U, callback_subnet6_->getID()); // Verify the hostname. EXPECT_EQ("client-name.example.com.", callback_hostname_); diff --git a/src/bin/dhcp6/tests/host_unittest.cc b/src/bin/dhcp6/tests/host_unittest.cc index 380c0befb9..01296013ab 100644 --- a/src/bin/dhcp6/tests/host_unittest.cc +++ b/src/bin/dhcp6/tests/host_unittest.cc @@ -830,7 +830,7 @@ public: ASSERT_TRUE(opt) << "option " << option_type << " not found or it " "is of incorrect type"; Option6AddrLst::AddressContainer addrs = opt->getAddresses(); - ASSERT_GE(addrs.size(), 1) << "test failed for option type " << option_type; + ASSERT_GE(addrs.size(), 1U) << "test failed for option type " << option_type; EXPECT_EQ(expected_addr, addrs[0].toText()) << "test failed for option type " << option_type; } @@ -852,7 +852,7 @@ public: const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Configure client to request IA_NA and append IA_NA option // to the client's message. @@ -862,7 +862,7 @@ public: ASSERT_NO_THROW(client.doSARR()); // Verify that the client we got the reserved address - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); EXPECT_EQ(exp_ip_address, lease_client.addr_.toText()); } @@ -1121,10 +1121,8 @@ HostTest::doExchange(const uint16_t msg_type, Dhcp6Client& client) { // Make sure that the server has responded with a Reply. ASSERT_TRUE(client.getContext().response_); ASSERT_EQ(DHCPV6_REPLY, client.getContext().response_->getType()); - } - void HostTest::testOverrideRequestedOptions(const uint16_t msg_type) { Dhcp6Client client(srv_); @@ -1233,7 +1231,7 @@ HostTest::testMultipleIAs(const std::function& client_operation, // so as we can test that advertised configuration is correct. ASSERT_NO_THROW(client_operation()); - ASSERT_EQ(6, client_.getLeaseNum()); + ASSERT_EQ(6U, client_.getLeaseNum()); // Count reserved addresses and prefixes assigned from reservations. size_t address_count = 0; @@ -1252,11 +1250,11 @@ HostTest::testMultipleIAs(const std::function& client_operation, IOAddress("2001:db8:1::10")); // There are 3 IA_NAs and for a few we have assigned reserved addresses. // The remaining ones should be assigned from the dynamic pool. - ASSERT_EQ(3 - address_count, leases.size()); + ASSERT_EQ(3U - address_count, leases.size()); // Get all prefixes assigned from the dynamic pool (not reserved). leases = client_.getLeasesByPrefixPool(IOAddress("3001::"), 32, 64); - ASSERT_EQ(3 - prefix_count, leases.size()); + ASSERT_EQ(3U - prefix_count, leases.size()); // Check that the hints have been allocated to respective IAs. if (strict_iaid_check) { @@ -1414,7 +1412,7 @@ HostTest::testOverrideVendorOptions(const uint16_t msg_type) { // Address specified in the host scope should be used. Option6AddrLst::AddressContainer addrs = tftp->getAddresses(); - ASSERT_EQ(addrs.size(), 1); + ASSERT_EQ(addrs.size(), 1U); EXPECT_EQ("3000:1::234", addrs[0].toText()); } @@ -1435,7 +1433,7 @@ HostTest::testGlobalClassSubnetPoolSelection(const int config_idx, // client. client_resrv.requestAddress(1, IOAddress(second_address)); ASSERT_NO_THROW(client_resrv.doSARR()); - ASSERT_EQ(1, client_resrv.getLeaseNum()); + ASSERT_EQ(1U, client_resrv.getLeaseNum()); Lease6 lease_client = client_resrv.getLease(0); EXPECT_EQ(first_address, lease_client.addr_.toText()); @@ -1449,7 +1447,7 @@ HostTest::testGlobalClassSubnetPoolSelection(const int config_idx, // server refuses it in favor of the 2001:db8:2::10. client_no_resrv.requestAddress(1, IOAddress(first_address)); ASSERT_NO_THROW(client_no_resrv.doSARR()); - ASSERT_EQ(1, client_no_resrv.getLeaseNum()); + ASSERT_EQ(1U, client_no_resrv.getLeaseNum()); lease_client = client_no_resrv.getLease(0); EXPECT_EQ(second_address, lease_client.addr_.toText()); } @@ -1503,7 +1501,7 @@ HostTest::sarrTest(Dhcp6Client& client, const std::string& exp_address, ASSERT_NO_THROW(client.doSARR()); // Verify that the client got a dynamic address - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); EXPECT_EQ(exp_address, lease_client.addr_.toText()); @@ -1534,7 +1532,7 @@ TEST_F(HostTest, basicSarrs) { const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Configure client to request IA_NA and append IA_NA option // to the client's message. @@ -1545,7 +1543,7 @@ TEST_F(HostTest, basicSarrs) { ASSERT_NO_THROW(client.doSARR()); // Verify that the client we got the reserved address - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); EXPECT_EQ("2001:db8:1:1::babe", lease_client.addr_.toText()); @@ -1563,7 +1561,7 @@ TEST_F(HostTest, basicSarrs) { ASSERT_NO_THROW(client.doSARR()); // Verify that the client we got the reserved address - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); lease_client = client.getLease(0); EXPECT_EQ("2001:db8:1:1::babf", lease_client.addr_.toText()); @@ -1584,7 +1582,7 @@ TEST_F(HostTest, basicSarrs) { ASSERT_NO_THROW(client.doSARR()); // Verify that the client got a dynamic address - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); lease_client = client.getLease(0); EXPECT_EQ("2001:db8:1:1::", lease_client.addr_.toText()); @@ -1607,7 +1605,7 @@ TEST_F(HostTest, sarrAndRenew) { const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Configure client to request IA_NA and aAppend IA_NA option // to the client's message. @@ -1621,7 +1619,7 @@ TEST_F(HostTest, sarrAndRenew) { client.fastFwdTime(1000); // Verify that the client we got the reserved address - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); EXPECT_EQ("2001:db8:1:1::babe", lease_client.addr_.toText()); @@ -1632,7 +1630,7 @@ TEST_F(HostTest, sarrAndRenew) { ASSERT_NO_THROW(client.doRenew()); // Verify that we got an extended lease back - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client2 = client.getLease(0); EXPECT_EQ("2001:db8:1:1::babe", lease_client2.addr_.toText()); @@ -1659,7 +1657,7 @@ TEST_F(HostTest, sarrAndRebind) { const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Configure client to request IA_NA and aAppend IA_NA option // to the client's message. @@ -1673,7 +1671,7 @@ TEST_F(HostTest, sarrAndRebind) { client.fastFwdTime(1000); // Verify that the client we got the reserved address - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); EXPECT_EQ("2001:db8:1:1::babe", lease_client.addr_.toText()); @@ -1684,7 +1682,7 @@ TEST_F(HostTest, sarrAndRebind) { ASSERT_NO_THROW(client.doRebind()); // Verify that we got an extended lease back - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client2 = client.getLease(0); EXPECT_EQ("2001:db8:1:1::babe", lease_client2.addr_.toText()); @@ -1950,7 +1948,7 @@ TEST_F(HostTest, multipleIAsRenew) { ASSERT_NO_THROW(client_.doRenew()); // Make sure that the client still has the same leases. - ASSERT_EQ(6, client_.getLeaseNum()); + ASSERT_EQ(6U, client_.getLeaseNum()); EXPECT_TRUE(client_.hasLeaseForAddress(IOAddress("2001:db8:1:1::1"))); EXPECT_TRUE(client_.hasLeaseForAddress(IOAddress("2001:db8:1:1::2"))); @@ -1995,7 +1993,7 @@ TEST_F(HostTest, multipleIAsSolicitAfterAcquisition) { // Make sure that the client still has the same leases and the leases // should be assigned to the same IAs. - ASSERT_EQ(6, client_.getLeaseNum()); + ASSERT_EQ(6U, client_.getLeaseNum()); EXPECT_TRUE(client_.hasLeaseForAddress(IOAddress("2001:db8:1:1::1"), IAID(1))); @@ -2040,11 +2038,11 @@ TEST_F(HostTest, appendReservationDuringRenew) { std::vector leases = client_.getLeasesByAddressRange(IOAddress("2001:db8:1::1"), IOAddress("2001:db8:1::10")); - ASSERT_EQ(1, leases.size()); + ASSERT_EQ(1U, leases.size()); IOAddress dynamic_address_lease = leases[0].addr_; leases = client_.getLeasesByPrefixPool(IOAddress("3001::"), 32, 64); - ASSERT_EQ(1, leases.size()); + ASSERT_EQ(1U, leases.size()); IOAddress dynamic_prefix_lease = leases[0].addr_; // Add two additional reservations. @@ -2066,7 +2064,7 @@ TEST_F(HostTest, appendReservationDuringRenew) { // number if leases in the server configuration should include those that // are returned with zero lifetimes. Hence, the total number of leases // should be equal to 6 + 2 = 8. - ASSERT_EQ(8, client_.getLeaseNum()); + ASSERT_EQ(8U, client_.getLeaseNum()); EXPECT_TRUE(client_.hasLeaseForAddress(IOAddress("2001:db8:1:1::1"))); EXPECT_TRUE(client_.hasLeaseForAddress(IOAddress("2001:db8:1:1::2"))); @@ -2092,7 +2090,7 @@ TEST_F(HostTest, appendReservationDuringRenew) { // The total number of leases should include removed leases and newly // allocated once, i.e. 6 + 6 = 12. - ASSERT_EQ(12, client_.getLeaseNum()); + ASSERT_EQ(12U, client_.getLeaseNum()); // All removed leases should be returned with zero lifetimes. EXPECT_TRUE(client_.hasLeaseWithZeroLifetimeForAddress(IOAddress("2001:db8:1:1::1"))); @@ -2105,11 +2103,11 @@ TEST_F(HostTest, appendReservationDuringRenew) { // Make sure that all address leases are within the dynamic pool range. leases = client_.getLeasesByAddressRange(IOAddress("2001:db8:1::1"), IOAddress("2001:db8:1::10")); - EXPECT_EQ(3, leases.size()); + EXPECT_EQ(3U, leases.size()); // Make sure that all prefix leases are also within the dynamic pool range. leases = client_.getLeasesByPrefixPool(IOAddress("3001::"), 32, 64); - EXPECT_EQ(3, leases.size()); + EXPECT_EQ(3U, leases.size()); } // In this test, the client performs 4-way exchange and includes 3 IA_NAs @@ -2142,11 +2140,11 @@ TEST_F(HostTest, insertReservationDuringRenew) { std::vector leases = client_.getLeasesByAddressRange(IOAddress("2001:db8:1::1"), IOAddress("2001:db8:1::10")); - ASSERT_EQ(1, leases.size()); + ASSERT_EQ(1U, leases.size()); IOAddress dynamic_address_lease = leases[0].addr_; leases = client_.getLeasesByPrefixPool(IOAddress("3001::"), 32, 64); - ASSERT_EQ(1, leases.size()); + ASSERT_EQ(1U, leases.size()); IOAddress dynamic_prefix_lease = leases[0].addr_; // Add two additional reservations. @@ -2168,7 +2166,7 @@ TEST_F(HostTest, insertReservationDuringRenew) { // number if leases in the server configuration should include those that // are returned with zero lifetimes. Hence, the total number of leases // should be equal to 6 + 2 = 8. - ASSERT_EQ(8, client_.getLeaseNum()); + ASSERT_EQ(8U, client_.getLeaseNum()); // Even though the new reservations have been added before existing // reservations, the server should assign them to the IAs with @@ -2246,7 +2244,7 @@ TEST_F(HostTest, multipleIAsConflict) { ASSERT_NO_THROW(do_solicit_request_()); // The client should have obtained 4 leases: two prefixes and two addresses. - ASSERT_EQ(4, client_.getLeaseNum()); + ASSERT_EQ(4U, client_.getLeaseNum()); // The address "2001:db8:1::2" is reserved and available so the // server should have assigned it. @@ -2280,7 +2278,7 @@ TEST_F(HostTest, multipleIAsConflict) { // and two leases with address and prefix from the dynamic pools, which // replace previously assigned leases. We don't care too much what those // leases are, though. - EXPECT_EQ(4, client.getLeaseNum()); + EXPECT_EQ(4U, client.getLeaseNum()); // The second client renews and the server should be now able to assign // all reserved leases to this client. @@ -2289,7 +2287,7 @@ TEST_F(HostTest, multipleIAsConflict) { // Client requests 4 leases, but there are additional two with zero // lifetimes to indicate that the client should not use the address // and prefix from the dynamic pools anymore. - ASSERT_EQ(6, client_.getLeaseNum()); + ASSERT_EQ(6U, client_.getLeaseNum()); // Check that the client has all reserved leases. EXPECT_TRUE(client_.hasLeaseForAddress(IOAddress("2001:db8:1::2"), @@ -2377,7 +2375,7 @@ TEST_F(HostTest, globalReservationsNA) { const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(2, subnets->size()); + ASSERT_EQ(2U, subnets->size()); { SCOPED_TRACE("Global HR by DUID with in-range reserved address"); @@ -2458,7 +2456,7 @@ TEST_F(HostTest, globalReservationsPD) { const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(2, subnets->size()); + ASSERT_EQ(2U, subnets->size()); { SCOPED_TRACE("Global HR by DUID with reserved prefix"); @@ -2566,7 +2564,7 @@ TEST_F(HostTest, firstClientGetsReservedAddress) { // Make sure the client2 got a lease from the configured pool. auto leases = client2.getLeasesByAddressRange(IOAddress("2001:db8:1::10"), IOAddress("2001:db8:1::200")); - EXPECT_EQ(1, leases.size()); + EXPECT_EQ(1U, leases.size()); // Verify that the client1 can renew the lease. ASSERT_NO_THROW(client1.doRenew()); @@ -2577,7 +2575,7 @@ TEST_F(HostTest, firstClientGetsReservedAddress) { EXPECT_FALSE(client2.hasLeaseForAddress(IOAddress("2001:db8:1::15"), IAID(1))); leases = client2.getLeasesByAddressRange(IOAddress("2001:db8:1::10"), IOAddress("2001:db8:1::200")); - EXPECT_EQ(1, leases.size()); + EXPECT_EQ(1U, leases.size()); // If the client1 releases the reserved lease, the client2 should acquire it. ASSERT_NO_THROW(client1.doRelease()); diff --git a/src/bin/dhcp6/tests/http_control_socket_unittest.cc b/src/bin/dhcp6/tests/http_control_socket_unittest.cc index f6bababc82..ead85baec5 100644 --- a/src/bin/dhcp6/tests/http_control_socket_unittest.cc +++ b/src/bin/dhcp6/tests/http_control_socket_unittest.cc @@ -426,7 +426,7 @@ public: // Errors can be in a list. if (rsp->getType() == Element::list) { - ASSERT_EQ(1, rsp->size()); + ASSERT_EQ(1U, rsp->size()); rsp = rsp->get(0); } @@ -1205,7 +1205,7 @@ TEST_F(HttpCtrlChannelDhcpv6Test, configSet) { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); @@ -1234,7 +1234,7 @@ TEST_F(HttpCtrlChannelDhcpv6Test, configSet) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); ASSERT_TRUE(def); @@ -1268,7 +1268,7 @@ TEST_F(HttpCtrlChannelDhcpv6Test, configSet) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(2, subnets->size()); + EXPECT_EQ(2U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); @@ -1375,7 +1375,7 @@ TEST_F(HttpCtrlChannelDhcpv6Test, configSetLFCRunning) { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); @@ -1412,7 +1412,7 @@ TEST_F(HttpCtrlChannelDhcpv6Test, configSetLFCRunning) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); ASSERT_TRUE(def); @@ -1525,7 +1525,7 @@ TEST_F(HttpCtrlChannelDhcpv6Test, configSetLFCRunning2) { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); @@ -1562,7 +1562,7 @@ TEST_F(HttpCtrlChannelDhcpv6Test, configSetLFCRunning2) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); ASSERT_TRUE(def); @@ -1687,7 +1687,7 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, configSet) { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); @@ -1720,7 +1720,7 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, configSet) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); ASSERT_TRUE(def); @@ -1754,7 +1754,7 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, configSet) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(2, subnets->size()); + EXPECT_EQ(2U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); @@ -1873,7 +1873,7 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, configSetLFCRunning) { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); @@ -1907,7 +1907,7 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, configSetLFCRunning) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); ASSERT_TRUE(def); @@ -2032,7 +2032,7 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, configSetLFCRunning2) { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); @@ -2066,7 +2066,7 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, configSetLFCRunning2) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); ASSERT_TRUE(def); @@ -2141,7 +2141,7 @@ BaseCtrlChannelDhcpv6Test::testConfigHashGet() { ASSERT_TRUE(hash); ASSERT_EQ(Element::string, hash->getType()); // SHA-256 -> 64 hex digits. - EXPECT_EQ(64, hash->stringValue().size()); + EXPECT_EQ(64U, hash->stringValue().size()); } TEST_F(HttpCtrlChannelDhcpv6Test, configHashGet) { @@ -2231,7 +2231,7 @@ TEST_F(HttpCtrlChannelDhcpv6Test, configTest) { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Create a config with malformed subnet that should fail to parse. os.str(""); @@ -2256,7 +2256,7 @@ TEST_F(HttpCtrlChannelDhcpv6Test, configTest) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Create a valid config with two subnets and no command channel. os.str(""); @@ -2287,7 +2287,7 @@ TEST_F(HttpCtrlChannelDhcpv6Test, configTest) { // Check that the config was not applied. subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); @@ -2384,7 +2384,7 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, configTest) { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Create a config with malformed subnet that should fail to parse. os.str(""); @@ -2413,7 +2413,7 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, configTest) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Create a valid config with two subnets and no command channel. os.str(""); @@ -2444,7 +2444,7 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, configTest) { // Check that the config was not applied. subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); @@ -2553,11 +2553,11 @@ BaseCtrlChannelDhcpv6Test::testStatusGet() { ASSERT_NO_THROW(response_list = Element::fromJSON(response_txt)); ASSERT_TRUE(response_list); ASSERT_EQ(Element::list, response_list->getType()); - EXPECT_EQ(1, response_list->size()); + EXPECT_EQ(1U, response_list->size()); ConstElementPtr response = response_list->get(0); ASSERT_TRUE(response); ASSERT_EQ(Element::map, response->getType()); - EXPECT_EQ(2, response->size()); + EXPECT_EQ(2U, response->size()); ConstElementPtr result = response->get("result"); ASSERT_TRUE(result); ASSERT_EQ(Element::integer, result->getType()); @@ -2612,11 +2612,11 @@ BaseCtrlChannelDhcpv6Test::testStatusGet() { ASSERT_NO_THROW(response_list = Element::fromJSON(response_txt)); ASSERT_TRUE(response_list); ASSERT_EQ(Element::list, response_list->getType()); - EXPECT_EQ(1, response_list->size()); + EXPECT_EQ(1U, response_list->size()); response = response_list->get(0); ASSERT_TRUE(response); ASSERT_EQ(Element::map, response->getType()); - EXPECT_EQ(2, response->size()); + EXPECT_EQ(2U, response->size()); result = response->get("result"); ASSERT_TRUE(result); ASSERT_EQ(Element::integer, result->getType()); @@ -2657,7 +2657,7 @@ BaseCtrlChannelDhcpv6Test::testStatusGet() { found_queue_stats = arguments->get("packet-queue-statistics"); ASSERT_TRUE(found_queue_stats); ASSERT_EQ(Element::list, found_queue_stats->getType()); - EXPECT_EQ(3, found_queue_stats->size()); + EXPECT_EQ(3U, found_queue_stats->size()); } TEST_F(HttpCtrlChannelDhcpv6Test, statusGet) { @@ -2681,7 +2681,7 @@ BaseCtrlChannelDhcpv6Test::testNoManagers() { ASSERT_NO_THROW(response_list = Element::fromJSON(response_text)); ASSERT_TRUE(response_list); ASSERT_EQ(Element::list, response_list->getType()); - EXPECT_EQ(1, response_list->size()); + EXPECT_EQ(1U, response_list->size()); ConstElementPtr response = response_list->get(0); ASSERT_TRUE(response); ASSERT_EQ(Element::map, response->getType()); @@ -2716,7 +2716,7 @@ BaseCtrlChannelDhcpv6Test::testStatusGetSockets() { ASSERT_NO_THROW(response_list = Element::fromJSON(response_text)); ASSERT_TRUE(response_list); ASSERT_EQ(Element::list, response_list->getType()); - EXPECT_EQ(1, response_list->size()); + EXPECT_EQ(1U, response_list->size()); ConstElementPtr response = response_list->get(0); ASSERT_TRUE(response); ASSERT_EQ(Element::map, response->getType()); @@ -2767,7 +2767,7 @@ BaseCtrlChannelDhcpv6Test::testStatusGetSocketsErrors() { ASSERT_NO_THROW(response_list = Element::fromJSON(response_text)); ASSERT_TRUE(response_list); ASSERT_EQ(Element::list, response_list->getType()); - EXPECT_EQ(1, response_list->size()); + EXPECT_EQ(1U, response_list->size()); ConstElementPtr response = response_list->get(0); ASSERT_TRUE(response); ASSERT_EQ(Element::map, response->getType()); @@ -2791,7 +2791,7 @@ BaseCtrlChannelDhcpv6Test::testStatusGetSocketsErrors() { ConstElementPtr errors(sockets->get("errors")); ASSERT_TRUE(errors); ASSERT_EQ(Element::list, errors->getType()); - ASSERT_EQ(1, errors->size()); + ASSERT_EQ(1U, errors->size()); ConstElementPtr error(errors->get(0)); ASSERT_TRUE(error); @@ -3369,7 +3369,7 @@ BaseCtrlChannelDhcpv6Test::testConfigReloadValid() { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(2, subnets->size()); + EXPECT_EQ(2U, subnets->size()); ::remove("test8.json"); } @@ -3448,7 +3448,7 @@ BaseCtrlChannelDhcpv6Test::testConfigReloadDetectInterfaces() { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(2, subnets->size()); + EXPECT_EQ(2U, subnets->size()); ::remove("test8.json"); } @@ -4813,7 +4813,7 @@ TEST_F(HttpCtrlChannelDhcpv6Test, noListenerChange) { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); @@ -4836,7 +4836,7 @@ TEST_F(HttpCtrlChannelDhcpv6Test, noListenerChange) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); @@ -4949,7 +4949,7 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, noListenerChange) { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); @@ -4976,7 +4976,7 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, noListenerChange) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); @@ -5080,7 +5080,7 @@ TEST_F(HttpCtrlChannelDhcpv6Test, handleHttpToHttpsSwitch) { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); @@ -5123,7 +5123,7 @@ TEST_F(HttpCtrlChannelDhcpv6Test, handleHttpToHttpsSwitch) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); @@ -5236,7 +5236,7 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, handleHttpsToHttpSwitch) { // Check that the config was indeed applied. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); OptionDefinitionPtr def = LibDHCP::getRuntimeOptionDef(DHCP6_OPTION_SPACE, 163); @@ -5279,7 +5279,7 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, handleHttpsToHttpSwitch) { // Check that the config was not lost subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); - EXPECT_EQ(1, subnets->size()); + EXPECT_EQ(1U, subnets->size()); // Clean up after the test. CfgMgr::instance().clear(); diff --git a/src/bin/dhcp6/tests/infrequest_unittest.cc b/src/bin/dhcp6/tests/infrequest_unittest.cc index d05fb2594c..ff04a724f5 100644 --- a/src/bin/dhcp6/tests/infrequest_unittest.cc +++ b/src/bin/dhcp6/tests/infrequest_unittest.cc @@ -149,7 +149,7 @@ TEST_F(InfRequestTest, infRequestBasic) { // Make sure we ended-up having expected number of subnets configured. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Perform 2-way exchange (Inf-request/reply) client.requestOption(D6O_NAME_SERVERS); @@ -174,7 +174,7 @@ TEST_F(InfRequestTest, infRequestBasic) { (response->getOption(D6O_NAME_SERVERS)); ASSERT_TRUE(dns); Option6AddrLst::AddressContainer addrs = dns->getAddresses(); - ASSERT_EQ(2, addrs.size()); + ASSERT_EQ(2U, addrs.size()); EXPECT_EQ("2001:db8::1", addrs[0].toText()); EXPECT_EQ("2001:db8::2", addrs[1].toText()); } @@ -190,7 +190,7 @@ TEST_F(InfRequestTest, infRequestAnonymous) { // Make sure we ended-up having expected number of subnets configured. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Perform 2-way exchange (Inf-request/reply) client.requestOption(D6O_NAME_SERVERS); @@ -206,7 +206,7 @@ TEST_F(InfRequestTest, infRequestAnonymous) { (response->getOption(D6O_NAME_SERVERS)); ASSERT_TRUE(dns); Option6AddrLst::AddressContainer addrs = dns->getAddresses(); - ASSERT_EQ(2, addrs.size()); + ASSERT_EQ(2U, addrs.size()); EXPECT_EQ("2001:db8::1", addrs[0].toText()); EXPECT_EQ("2001:db8::2", addrs[1].toText()); } @@ -221,7 +221,7 @@ TEST_F(InfRequestTest, infRequestStateless) { // Make sure we ended-up having expected number of subnets configured. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Perform 2-way exchange (Inf-request/reply) client.requestOption(D6O_SIP_SERVERS_ADDR); @@ -236,7 +236,7 @@ TEST_F(InfRequestTest, infRequestStateless) { (response->getOption(D6O_SIP_SERVERS_ADDR)); ASSERT_TRUE(sip); Option6AddrLst::AddressContainer addrs = sip->getAddresses(); - ASSERT_EQ(1, addrs.size()); + ASSERT_EQ(1U, addrs.size()); EXPECT_EQ("2001:db8::abcd", addrs[0].toText()); } @@ -250,7 +250,7 @@ TEST_F(InfRequestTest, infRequestSubnetAndGlobal) { // Make sure we ended-up having expected number of subnets configured. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Perform 2-way exchange (Inf-request/reply) client.requestOption(D6O_SIP_SERVERS_ADDR); @@ -266,7 +266,7 @@ TEST_F(InfRequestTest, infRequestSubnetAndGlobal) { (response->getOption(D6O_SIP_SERVERS_ADDR)); ASSERT_TRUE(sip); Option6AddrLst::AddressContainer addrs = sip->getAddresses(); - ASSERT_EQ(1, addrs.size()); + ASSERT_EQ(1U, addrs.size()); EXPECT_EQ("2001:db8::1", addrs[0].toText()); // Check that we received the requested dns servers option @@ -274,7 +274,7 @@ TEST_F(InfRequestTest, infRequestSubnetAndGlobal) { (response->getOption(D6O_NAME_SERVERS)); ASSERT_TRUE(dns); addrs = dns->getAddresses(); - ASSERT_EQ(1, addrs.size()); + ASSERT_EQ(1U, addrs.size()); EXPECT_EQ("2001:db8::2", addrs[0].toText()); } @@ -288,7 +288,7 @@ TEST_F(InfRequestTest, infRequestNoSubnets) { // Make sure we ended-up having expected number of subnets configured. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(0, subnets->size()); + ASSERT_EQ(0U, subnets->size()); // Perform 2-way exchange (Inf-request/reply) client.requestOption(D6O_NIS_SERVERS); @@ -303,7 +303,7 @@ TEST_F(InfRequestTest, infRequestNoSubnets) { (response->getOption(D6O_NIS_SERVERS)); ASSERT_TRUE(nis); Option6AddrLst::AddressContainer addrs = nis->getAddresses(); - ASSERT_EQ(2, addrs.size()); + ASSERT_EQ(2U, addrs.size()); EXPECT_EQ("2001:db8::1", addrs[0].toText()); EXPECT_EQ("2001:db8::2", addrs[1].toText()); } @@ -323,7 +323,7 @@ TEST_F(InfRequestTest, infRequestStats) { // Make sure we ended-up having expected number of subnets configured. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Check that the tested statistics is initially set to 0 StatsMgr& mgr = StatsMgr::instance(); diff --git a/src/bin/dhcp6/tests/kea_controller_unittest.cc b/src/bin/dhcp6/tests/kea_controller_unittest.cc index 4bec04af23..04dcc571ca 100644 --- a/src/bin/dhcp6/tests/kea_controller_unittest.cc +++ b/src/bin/dhcp6/tests/kea_controller_unittest.cc @@ -300,9 +300,9 @@ public: // committed so becomes the current one. // - the command is called outside configuration so it must // be the current configuration. The test explicitly checks this. - EXPECT_EQ(1, cb_control->getDatabaseTotalConfigFetchCalls()); - EXPECT_EQ(0, cb_control->getDatabaseCurrentConfigFetchCalls()); - EXPECT_EQ(1, cb_control->getDatabaseStagingConfigFetchCalls()); + EXPECT_EQ(1U, cb_control->getDatabaseTotalConfigFetchCalls()); + EXPECT_EQ(0U, cb_control->getDatabaseCurrentConfigFetchCalls()); + EXPECT_EQ(1U, cb_control->getDatabaseStagingConfigFetchCalls()); if (call_command) { // The case where there is no backend is tested in the @@ -310,13 +310,13 @@ public: // that the command calls the database config fetch. // Count the startup. - EXPECT_EQ(cb_control->getDatabaseTotalConfigFetchCalls(), 1); - EXPECT_EQ(cb_control->getDatabaseCurrentConfigFetchCalls(), 0); - EXPECT_EQ(cb_control->getDatabaseStagingConfigFetchCalls(), 1); + EXPECT_EQ(cb_control->getDatabaseTotalConfigFetchCalls(), 1U); + EXPECT_EQ(cb_control->getDatabaseCurrentConfigFetchCalls(), 0U); + EXPECT_EQ(cb_control->getDatabaseStagingConfigFetchCalls(), 1U); ConstElementPtr list_cmds = createCommand("config-backend-pull"); ConstElementPtr result = CommandMgr::instance().processCommand(list_cmds); - EXPECT_EQ(cb_control->getDatabaseTotalConfigFetchCalls(), 2); + EXPECT_EQ(cb_control->getDatabaseTotalConfigFetchCalls(), 2U); std::string expected; if (throw_during_fetch) { @@ -333,13 +333,13 @@ public: ASSERT_NO_THROW(runTimersWithTimeout(srv->getIOService(), 20)); if (config_wait_fetch_time > 0) { - EXPECT_GE(cb_control->getDatabaseTotalConfigFetchCalls(), 5); - EXPECT_GE(cb_control->getDatabaseCurrentConfigFetchCalls(), 4); - EXPECT_EQ(cb_control->getDatabaseStagingConfigFetchCalls(), 1); + EXPECT_GE(cb_control->getDatabaseTotalConfigFetchCalls(), 5U); + EXPECT_GE(cb_control->getDatabaseCurrentConfigFetchCalls(), 4U); + EXPECT_EQ(cb_control->getDatabaseStagingConfigFetchCalls(), 1U); } else { - EXPECT_EQ(cb_control->getDatabaseTotalConfigFetchCalls(), 2); - EXPECT_EQ(cb_control->getDatabaseCurrentConfigFetchCalls(), 1); - EXPECT_EQ(cb_control->getDatabaseStagingConfigFetchCalls(), 1); + EXPECT_EQ(cb_control->getDatabaseTotalConfigFetchCalls(), 2U); + EXPECT_EQ(cb_control->getDatabaseCurrentConfigFetchCalls(), 1U); + EXPECT_EQ(cb_control->getDatabaseStagingConfigFetchCalls(), 1U); } } else if ((config_wait_fetch_time > 0) && (!throw_during_fetch)) { @@ -354,9 +354,9 @@ public: // least 3 attempts to fetch the updates. return (cb_control->getDatabaseTotalConfigFetchCalls() >= 3); })); - EXPECT_GE(cb_control->getDatabaseTotalConfigFetchCalls(), 3); - EXPECT_GE(cb_control->getDatabaseCurrentConfigFetchCalls(), 2); - EXPECT_EQ(cb_control->getDatabaseStagingConfigFetchCalls(), 1); + EXPECT_GE(cb_control->getDatabaseTotalConfigFetchCalls(), 3U); + EXPECT_GE(cb_control->getDatabaseCurrentConfigFetchCalls(), 2U); + EXPECT_EQ(cb_control->getDatabaseStagingConfigFetchCalls(), 1U); } else { ASSERT_NO_THROW(runTimersWithTimeout(srv->getIOService(), 500)); @@ -367,16 +367,16 @@ public: // the number of recorded fetches should be 12. One at // startup, 10 failures and one that causes the timer // to stop. - EXPECT_EQ(12, cb_control->getDatabaseTotalConfigFetchCalls()); - EXPECT_EQ(11, cb_control->getDatabaseCurrentConfigFetchCalls()); - EXPECT_EQ(1, cb_control->getDatabaseStagingConfigFetchCalls()); + EXPECT_EQ(12U, cb_control->getDatabaseTotalConfigFetchCalls()); + EXPECT_EQ(11U, cb_control->getDatabaseCurrentConfigFetchCalls()); + EXPECT_EQ(1U, cb_control->getDatabaseStagingConfigFetchCalls()); } else { // If the server is not configured to schedule the timer, // we should still have one fetch attempt recorded. - EXPECT_EQ(1, cb_control->getDatabaseTotalConfigFetchCalls()); - EXPECT_EQ(0, cb_control->getDatabaseCurrentConfigFetchCalls()); - EXPECT_EQ(1, cb_control->getDatabaseStagingConfigFetchCalls()); + EXPECT_EQ(1U, cb_control->getDatabaseTotalConfigFetchCalls()); + EXPECT_EQ(0U, cb_control->getDatabaseCurrentConfigFetchCalls()); + EXPECT_EQ(1U, cb_control->getDatabaseStagingConfigFetchCalls()); } } } @@ -432,17 +432,17 @@ TEST_F(JSONFileBackendTest, jsonFile) { const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(3, subnets->size()); // We expect 3 subnets. + ASSERT_EQ(3U, subnets->size()); // We expect 3 subnets. // Check subnet 1. auto subnet = subnets->begin(); ASSERT_TRUE(subnet != subnets->end()); EXPECT_EQ("2001:db8:1::", (*subnet)->get().first.toText()); - EXPECT_EQ(64, (*subnet)->get().second); + EXPECT_EQ(64U, (*subnet)->get().second); // Check pools in the first subnet. const PoolCollection& pools1 = (*subnet)->getPools(Lease::TYPE_NA); - ASSERT_EQ(1, pools1.size()); + ASSERT_EQ(1U, pools1.size()); EXPECT_EQ("2001:db8:1::", pools1.at(0)->getFirstAddress().toText()); EXPECT_EQ("2001:db8:1::ffff:ffff:ffff", pools1.at(0)->getLastAddress().toText()); EXPECT_EQ(Lease::TYPE_NA, pools1.at(0)->getType()); @@ -451,11 +451,11 @@ TEST_F(JSONFileBackendTest, jsonFile) { ++subnet; ASSERT_TRUE(subnet != subnets->end()); EXPECT_EQ("2001:db8:2::", (*subnet)->get().first.toText()); - EXPECT_EQ(64, (*subnet)->get().second); + EXPECT_EQ(64U, (*subnet)->get().second); // Check pools in the second subnet. const PoolCollection& pools2 = (*subnet)->getPools(Lease::TYPE_NA); - ASSERT_EQ(1, pools2.size()); + ASSERT_EQ(1U, pools2.size()); EXPECT_EQ("2001:db8:2::", pools2.at(0)->getFirstAddress().toText()); EXPECT_EQ("2001:db8:2::ffff:ffff:ffff", pools2.at(0)->getLastAddress().toText()); EXPECT_EQ(Lease::TYPE_NA, pools2.at(0)->getType()); @@ -464,7 +464,7 @@ TEST_F(JSONFileBackendTest, jsonFile) { ++subnet; ASSERT_TRUE(subnet != subnets->end()); EXPECT_EQ("2001:db8:3::", (*subnet)->get().first.toText()); - EXPECT_EQ(64, (*subnet)->get().second); + EXPECT_EQ(64U, (*subnet)->get().second); // ... and it's only pool. const PoolCollection& pools3 = (*subnet)->getPools(Lease::TYPE_NA); @@ -510,17 +510,17 @@ TEST_F(JSONFileBackendTest, hashComments) { const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Check subnet 1. auto subnet = subnets->begin(); ASSERT_TRUE(subnet != subnets->end()); EXPECT_EQ("2001:db8:1::", (*subnet)->get().first.toText()); - EXPECT_EQ(64, (*subnet)->get().second); + EXPECT_EQ(64U, (*subnet)->get().second); // Check pools in the first subnet. const PoolCollection& pools1 = (*subnet)->getPools(Lease::TYPE_NA); - ASSERT_EQ(1, pools1.size()); + ASSERT_EQ(1U, pools1.size()); EXPECT_EQ("2001:db8:1::", pools1.at(0)->getFirstAddress().toText()); EXPECT_EQ("2001:db8:1::ffff:ffff:ffff", pools1.at(0)->getLastAddress().toText()); EXPECT_EQ(Lease::TYPE_NA, pools1.at(0)->getType()); @@ -563,17 +563,17 @@ TEST_F(JSONFileBackendTest, cppLineComments) { const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Check subnet 1. auto subnet = subnets->begin(); ASSERT_TRUE(subnet != subnets->end()); EXPECT_EQ("2001:db8:1::", (*subnet)->get().first.toText()); - EXPECT_EQ(64, (*subnet)->get().second); + EXPECT_EQ(64U, (*subnet)->get().second); // Check pools in the first subnet. const PoolCollection& pools1 = (*subnet)->getPools(Lease::TYPE_NA); - ASSERT_EQ(1, pools1.size()); + ASSERT_EQ(1U, pools1.size()); EXPECT_EQ("2001:db8:1::", pools1.at(0)->getFirstAddress().toText()); EXPECT_EQ("2001:db8:1::ffff:ffff:ffff", pools1.at(0)->getLastAddress().toText()); EXPECT_EQ(Lease::TYPE_NA, pools1.at(0)->getType()); @@ -616,17 +616,17 @@ TEST_F(JSONFileBackendTest, cBlockComments) { const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Check subnet 1. auto subnet = subnets->begin(); ASSERT_TRUE(subnet != subnets->end()); EXPECT_EQ("2001:db8:1::", (*subnet)->get().first.toText()); - EXPECT_EQ(64, (*subnet)->get().second); + EXPECT_EQ(64U, (*subnet)->get().second); // Check pools in the first subnet. const PoolCollection& pools1 = (*subnet)->getPools(Lease::TYPE_NA); - ASSERT_EQ(1, pools1.size()); + ASSERT_EQ(1U, pools1.size()); EXPECT_EQ("2001:db8:1::", pools1.at(0)->getFirstAddress().toText()); EXPECT_EQ("2001:db8:1::ffff:ffff:ffff", pools1.at(0)->getLastAddress().toText()); EXPECT_EQ(Lease::TYPE_NA, pools1.at(0)->getType()); @@ -669,17 +669,17 @@ TEST_F(JSONFileBackendTest, include) { const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()->getAll(); ASSERT_TRUE(subnets); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Check subnet 1. auto subnet = subnets->begin(); ASSERT_TRUE(subnet != subnets->end()); EXPECT_EQ("2001:db8:1::", (*subnet)->get().first.toText()); - EXPECT_EQ(64, (*subnet)->get().second); + EXPECT_EQ(64U, (*subnet)->get().second); // Check pools in the first subnet. const PoolCollection& pools1 = (*subnet)->getPools(Lease::TYPE_NA); - ASSERT_EQ(1, pools1.size()); + ASSERT_EQ(1U, pools1.size()); EXPECT_EQ("2001:db8:1::", pools1.at(0)->getFirstAddress().toText()); EXPECT_EQ("2001:db8:1::ffff:ffff:ffff", pools1.at(0)->getLastAddress().toText()); EXPECT_EQ(Lease::TYPE_NA, pools1.at(0)->getType()); @@ -883,7 +883,7 @@ TEST_F(JSONFileBackendTest, serverId) { ConstCfgDUIDPtr duid_cfg = CfgMgr::instance().getCurrentCfg()->getCfgDUID(); ASSERT_TRUE(duid_cfg); EXPECT_EQ(DUID::DUID_EN, duid_cfg->getType()); - EXPECT_EQ(1234, duid_cfg->getEnterpriseId()); + EXPECT_EQ(1234U, duid_cfg->getEnterpriseId()); } // This test verifies that the server uses default (Memfile) lease database diff --git a/src/bin/dhcp6/tests/parser_unittest.cc b/src/bin/dhcp6/tests/parser_unittest.cc index 56a9620527..571bfa75e7 100644 --- a/src/bin/dhcp6/tests/parser_unittest.cc +++ b/src/bin/dhcp6/tests/parser_unittest.cc @@ -841,9 +841,9 @@ TEST(ParserTest, mapEntries) { // Remove deprecated parameters. This needs to be done because even though // they are supported, examples are loaded by yang tests also and they don't // support both old and new syntax. - ASSERT_EQ(syntax_keys.erase("client-class"), 1); - ASSERT_EQ(syntax_keys.erase("only-if-required"), 1); - ASSERT_EQ(syntax_keys.erase("require-client-classes"), 1); + ASSERT_EQ(syntax_keys.erase("client-class"), 1U); + ASSERT_EQ(syntax_keys.erase("only-if-required"), 1U); + ASSERT_EQ(syntax_keys.erase("require-client-classes"), 1U); EXPECT_EQ(syntax_keys, sample_keys) << "syntax has: " << print_keys(syntax_keys) << endl << "sample has: " << print_keys(sample_keys) << endl; diff --git a/src/bin/dhcp6/tests/rebind_unittest.cc b/src/bin/dhcp6/tests/rebind_unittest.cc index 9aab6f9920..250d7d3698 100644 --- a/src/bin/dhcp6/tests/rebind_unittest.cc +++ b/src/bin/dhcp6/tests/rebind_unittest.cc @@ -388,7 +388,7 @@ TEST_F(RebindTest, directClient) { ASSERT_NO_THROW(client.doRebind()); // The client should still have one lease which belong to one of the // subnets. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client2 = client.getLease(0); ASSERT_TRUE(CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()-> selectSubnet(lease_client2.addr_, ClientClasses())); @@ -426,11 +426,11 @@ TEST_F(RebindTest, directClientChangingSubnet) { // subnet and sent zero lifetimes for a previous lease. std::vector old_leases = client.getLeasesWithZeroLifetime(); - ASSERT_EQ(1, old_leases.size()); + ASSERT_EQ(1U, old_leases.size()); EXPECT_EQ(lease_client.addr_, old_leases[0].addr_); std::vector new_leases = client.getLeasesWithNonZeroLifetime(); - ASSERT_EQ(1, new_leases.size()); + ASSERT_EQ(1U, new_leases.size()); // Make sure, that the lease that client has, is matching the lease // in the lease database. @@ -461,12 +461,12 @@ TEST_F(RebindTest, directClientChangingIAID) { // The old lease should be returned with 0 lifetimes. std::vector old_leases = client.getLeasesWithZeroLifetime(); - ASSERT_EQ(1, old_leases.size()); + ASSERT_EQ(1U, old_leases.size()); EXPECT_EQ(lease_client.addr_, old_leases[0].addr_); // The new lease should be allocated. std::vector new_leases = client.getLeasesWithNonZeroLifetime(); - ASSERT_EQ(1, new_leases.size()); + ASSERT_EQ(1U, new_leases.size()); Lease6Ptr lease_server2 = checkLease(new_leases[0]); EXPECT_TRUE(lease_server2); @@ -495,7 +495,7 @@ TEST_F(RebindTest, directClientLostLease) { // The server should re-allocate this lease to the client. std::vector new_leases = client.getLeasesWithNonZeroLifetime(); - ASSERT_EQ(1, new_leases.size()); + ASSERT_EQ(1U, new_leases.size()); EXPECT_EQ(lease_client.addr_, new_leases[0].addr_); // Status code should be Success. EXPECT_EQ(STATUS_Success, client.getStatusCode(1234)); @@ -521,7 +521,7 @@ TEST_F(RebindTest, relayedClient) { ASSERT_NO_THROW(client.doRebind()); // The client should still have one lease which belongs to one of the // subnets. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client2 = client.getLease(0); ASSERT_TRUE(CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()-> selectSubnet(lease_client2.addr_, ClientClasses())); @@ -560,7 +560,7 @@ TEST_F(RebindTest, relayedClientChangingSubnet) { ASSERT_NO_THROW(client.doRebind()); // We are expecting that the server didn't extend the lease because // the address that client is using doesn't match the new subnet. - ASSERT_EQ(0, client.getLeaseNum()); + ASSERT_EQ(0U, client.getLeaseNum()); // Client should have received NoBinding status code. EXPECT_EQ(STATUS_NoBinding, client.getStatusCode(1234)); @@ -592,12 +592,12 @@ TEST_F(RebindTest, relayedClientChangingIAID) { // The old lease should be returned with 0 lifetimes. std::vector old_leases = client.getLeasesWithZeroLifetime(); - ASSERT_EQ(1, old_leases.size()); + ASSERT_EQ(1U, old_leases.size()); EXPECT_EQ(lease_client.addr_, old_leases[0].addr_); // The new lease should be allocated. std::vector new_leases = client.getLeasesWithNonZeroLifetime(); - ASSERT_EQ(1, new_leases.size()); + ASSERT_EQ(1U, new_leases.size()); Lease6Ptr lease_server2 = checkLease(new_leases[0]); EXPECT_TRUE(lease_server2); @@ -630,7 +630,7 @@ TEST_F(RebindTest, relayedClientLostLease) { // The server should re-allocate this lease to the client. std::vector new_leases = client.getLeasesWithNonZeroLifetime(); - ASSERT_EQ(1, new_leases.size()); + ASSERT_EQ(1U, new_leases.size()); EXPECT_EQ(lease_client.addr_, new_leases[0].addr_); // Status code should be Success. EXPECT_EQ(STATUS_Success, client.getStatusCode(1234)); @@ -663,7 +663,7 @@ TEST_F(RebindTest, relayedClientChangingAddress) { // Get the client's leases. He should get two addresses: // the first one for the bogus 3000::100 address with 0 lifetimes. // the second one with the actual lease with non-zero lifetimes. - ASSERT_EQ(2, client.getLeaseNum()); + ASSERT_EQ(2U, client.getLeaseNum()); // Let's check the first one Lease6 lease_client1 = client.getLease(0); @@ -676,21 +676,21 @@ TEST_F(RebindTest, relayedClientChangingAddress) { // The lifetimes should be set to 0, as an explicit notification to the // client to stop using invalid prefix. - EXPECT_EQ(0, lease_client1.valid_lft_); - EXPECT_EQ(0, lease_client1.preferred_lft_); + EXPECT_EQ(0U, lease_client1.valid_lft_); + EXPECT_EQ(0U, lease_client1.preferred_lft_); // Let's check the second lease // The lifetimes should be set to 0, as an explicit notification to the // client to stop using invalid prefix. - EXPECT_NE(0, lease_client2.valid_lft_); - EXPECT_NE(0, lease_client2.preferred_lft_); + EXPECT_NE(0U, lease_client2.valid_lft_); + EXPECT_NE(0U, lease_client2.preferred_lft_); // Check that server still has the same lease. Lease6Ptr lease_server = checkLease(lease_client); EXPECT_TRUE(lease_server); // Make sure that the lease in the data base hasn't been added. - EXPECT_NE(0, lease_server->valid_lft_); - EXPECT_NE(0, lease_server->preferred_lft_); + EXPECT_NE(0U, lease_server->valid_lft_); + EXPECT_NE(0U, lease_server->preferred_lft_); } // Check that the server extends the lease for the client having a prefix. @@ -706,7 +706,7 @@ TEST_F(RebindTest, directClientPD) { ASSERT_NO_THROW(client.doRebind()); // The client should still have one lease which belong to one of the // subnets. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client2 = client.getLease(0); // The client's lease should have been extended. The client will // update the cltt to current time when the lease gets extended. @@ -742,11 +742,11 @@ TEST_F(RebindTest, directClientPDChangingSubnet) { // subnet and sent zero lifetimes for a previous lease. std::vector old_leases = client.getLeasesWithZeroLifetime(); - ASSERT_EQ(1, old_leases.size()); + ASSERT_EQ(1U, old_leases.size()); EXPECT_EQ(lease_client.addr_, old_leases[0].addr_); std::vector new_leases = client.getLeasesWithNonZeroLifetime(); - ASSERT_EQ(1, new_leases.size()); + ASSERT_EQ(1U, new_leases.size()); // Make sure, that the lease that client has, is matching the lease // in the lease database. @@ -778,12 +778,12 @@ TEST_F(RebindTest, directClientPDChangingIAID) { // The old lease should be returned with 0 lifetimes. std::vector old_leases = client.getLeasesWithZeroLifetime(); - ASSERT_EQ(1, old_leases.size()); + ASSERT_EQ(1U, old_leases.size()); EXPECT_EQ(lease_client.addr_, old_leases[0].addr_); // The new lease should be allocated. std::vector new_leases = client.getLeasesWithNonZeroLifetime(); - ASSERT_EQ(1, new_leases.size()); + ASSERT_EQ(1U, new_leases.size()); Lease6Ptr lease_server2 = checkLease(new_leases[0]); EXPECT_TRUE(lease_server2); @@ -822,7 +822,7 @@ TEST_F(RebindTest, directClientPDChangingPrefix) { " sent a response indicating that the client should stop using the" " lease, by setting lifetime values to 0."; // Get the client's lease. - ASSERT_EQ(2, client.getLeaseNum()); + ASSERT_EQ(2U, client.getLeaseNum()); // Client should get two entries. One with the invalid address he requested // with zeroed lifetimes and a second one with the actual prefix he has @@ -830,20 +830,20 @@ TEST_F(RebindTest, directClientPDChangingPrefix) { // Get the lease with 0 lifetimes. std::vector invalid_leases = client.getLeasesWithZeroLifetime(); - ASSERT_EQ(1, invalid_leases.size()); - EXPECT_EQ(0, invalid_leases[0].valid_lft_); - EXPECT_EQ(0, invalid_leases[0].preferred_lft_); + ASSERT_EQ(1U, invalid_leases.size()); + EXPECT_EQ(0U, invalid_leases[0].valid_lft_); + EXPECT_EQ(0U, invalid_leases[0].preferred_lft_); // Get the valid lease with non-zero lifetime. std::vector valid_leases = client.getLeasesWithNonZeroLifetime(); - ASSERT_EQ(1, valid_leases.size()); + ASSERT_EQ(1U, valid_leases.size()); // Check that server still has the same lease. Lease6Ptr lease_server = checkLease(valid_leases[0]); ASSERT_TRUE(lease_server); // Make sure that the lease in the data base hasn't been added. - EXPECT_NE(0, lease_server->valid_lft_); - EXPECT_NE(0, lease_server->preferred_lft_); + EXPECT_NE(0U, lease_server->valid_lft_); + EXPECT_NE(0U, lease_server->preferred_lft_); } /// @todo Extend PD tests for relayed messages. @@ -867,7 +867,7 @@ TEST_F(RebindTest, unicast) { ASSERT_NO_THROW(client.doRebind()); // The client's lease should remain with no change (shouldn't be extended) // because server is supposed to drop the message sent to a unicast address. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client2 = client.getLease(0); ASSERT_TRUE(lease_client2 == lease_client); // Check that server still has the lease. @@ -899,7 +899,7 @@ TEST_F(RebindTest, relayedUnicast) { ASSERT_NO_THROW(client.doRebind()); // The client should still have one lease which belongs to one of the // subnets. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client2 = client.getLease(0); ASSERT_TRUE(CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()-> selectSubnet(lease_client2.addr_, ClientClasses())); @@ -932,7 +932,7 @@ TEST_F(RebindTest, requestPrefixInRebind) { // Make sure that the client has acquired NA lease. std::vector leases_client_na = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na.size()); + ASSERT_EQ(1U, leases_client_na.size()); // The client should not acquire a PD lease. std::vector leases_client_pd = client.getLeasesByType(Lease::TYPE_PD); @@ -955,7 +955,7 @@ TEST_F(RebindTest, requestPrefixInRebind) { // Make sure that the client has acquired NA lease. std::vector leases_client_na_rebound = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na_rebound.size()); + ASSERT_EQ(1U, leases_client_na_rebound.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(1234)); // The lease should have been rebound. @@ -963,7 +963,7 @@ TEST_F(RebindTest, requestPrefixInRebind) { // The client should now also acquire a PD lease. leases_client_pd = client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_client_pd.size()); + ASSERT_EQ(1U, leases_client_pd.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(5678)); } @@ -987,20 +987,20 @@ TEST_F(RebindTest, requestAddressInRebind) { // Make sure that the client has acquired PD lease. std::vector leases_client_pd = client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_client_pd.size()); + ASSERT_EQ(1U, leases_client_pd.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(5678)); // The client should not acquire a NA lease. std::vector leases_client_na = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(0, leases_client_na.size()); + ASSERT_EQ(0U, leases_client_na.size()); ASSERT_EQ(STATUS_NoAddrsAvail, client.getStatusCode(1234)); // Send Rebind message to the server, including IA_PD and requesting IA_NA. // The server should return NoAddrsAvail status code in this case. ASSERT_NO_THROW(client.doRebind()); leases_client_na = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(0, leases_client_na.size()); + ASSERT_EQ(0U, leases_client_na.size()); ASSERT_EQ(STATUS_NoAddrsAvail, client.getStatusCode(1234)); // Reconfigure the server to use both NA and PD pools. @@ -1012,13 +1012,13 @@ TEST_F(RebindTest, requestAddressInRebind) { // Make sure that the client has renewed PD lease. std::vector leases_client_pd_renewed = client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_client_pd_renewed.size()); + ASSERT_EQ(1U, leases_client_pd_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(5678)); EXPECT_GE(leases_client_pd_renewed[0].cltt_ - leases_client_pd[0].cltt_, 1000); // The client should now also acquire a NA lease. leases_client_na = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na.size()); + ASSERT_EQ(1U, leases_client_na.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(1234)); } @@ -1044,7 +1044,7 @@ TEST_F(RebindTest, docsisORO) { ASSERT_NO_THROW(client.doRebind()); // The client should still have one lease which belong to one of the // subnets. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client2 = client.getLease(0); ASSERT_TRUE(CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()-> selectSubnet(lease_client2.addr_, ClientClasses())); @@ -1066,7 +1066,7 @@ TEST_F(RebindTest, docsisORO) { ASSERT_NO_THROW(client.doRebind()); // The client should still have one lease which belong to one of the // subnets. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); lease_client2 = client.getLease(0); ASSERT_TRUE(CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()-> selectSubnet(lease_client2.addr_, ClientClasses())); @@ -1113,7 +1113,7 @@ TEST_F(RebindTest, optionsInheritance) { // Make sure we ended-up having expected number of subnets configured. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Perform 4-way exchange. ASSERT_NO_THROW(client.doSARR()); diff --git a/src/bin/dhcp6/tests/renew_unittest.cc b/src/bin/dhcp6/tests/renew_unittest.cc index 9c908da3cf..eb0098eb0f 100644 --- a/src/bin/dhcp6/tests/renew_unittest.cc +++ b/src/bin/dhcp6/tests/renew_unittest.cc @@ -342,7 +342,7 @@ TEST_F(RenewTest, requestPrefixInRenew) { // Make sure that the client has acquired NA lease. std::vector leases_client_na = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na.size()); + ASSERT_EQ(1U, leases_client_na.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_)); // The client should not acquire a PD lease. @@ -358,7 +358,7 @@ TEST_F(RenewTest, requestPrefixInRenew) { std::vector leases_client_na_renewed = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na_renewed.size()); + ASSERT_EQ(1U, leases_client_na_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_)); // Reconfigure the server to use both NA and PD pools. @@ -369,7 +369,7 @@ TEST_F(RenewTest, requestPrefixInRenew) { // Make sure that the client has acquired NA lease. leases_client_na_renewed = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na_renewed.size()); + ASSERT_EQ(1U, leases_client_na_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_)); // The lease should have been renewed. Allow some time skew. @@ -385,7 +385,7 @@ TEST_F(RenewTest, requestPrefixInRenew) { // The client should now also acquire a PD lease. leases_client_pd = client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_client_pd.size()); + ASSERT_EQ(1U, leases_client_pd.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(pd_iaid_)); } @@ -412,12 +412,12 @@ TEST_F(RenewTest, renewWithExcludedPrefixPool) { // Make sure that the client has acquired NA lease. std::vector leases_client_na = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na.size()); + ASSERT_EQ(1U, leases_client_na.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_)); // The client should also acquire a PD lease. std::vector leases_client_pd = client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_client_pd.size()); + ASSERT_EQ(1U, leases_client_pd.size()); ASSERT_EQ(STATUS_Success, client.getStatusCode(pd_iaid_)); // Send Renew message to the server, including IA_NA and IA_PD. @@ -425,12 +425,12 @@ TEST_F(RenewTest, renewWithExcludedPrefixPool) { std::vector leases_client_na_renewed = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na_renewed.size()); + ASSERT_EQ(1U, leases_client_na_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_)); std::vector leases_client_pd_renewed = client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_client_pd_renewed.size()); + ASSERT_EQ(1U, leases_client_pd_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(pd_iaid_)); // Make sure that Prefix Exclude option hasn't been included. @@ -449,12 +449,12 @@ TEST_F(RenewTest, renewWithExcludedPrefixPool) { // Make sure that the client has acquired NA lease. leases_client_na_renewed = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na_renewed.size()); + ASSERT_EQ(1U, leases_client_na_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_)); // Make sure that the client has acquired PD lease. leases_client_pd_renewed = client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_client_pd_renewed.size()); + ASSERT_EQ(1U, leases_client_pd_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(pd_iaid_)); // The leases should have been renewed. @@ -472,7 +472,7 @@ TEST_F(RenewTest, renewWithExcludedPrefixPool) { ASSERT_TRUE(pd_exclude); EXPECT_EQ("3000::1000", pd_exclude->getExcludedPrefix(IOAddress("3000::"), 80).toText()); - EXPECT_EQ(120, static_cast(pd_exclude->getExcludedPrefixLength())); + EXPECT_EQ(120U, static_cast(pd_exclude->getExcludedPrefixLength())); } // Test that it is possible to renew a prefix lease with a Prefix Exclude @@ -501,12 +501,12 @@ TEST_F(RenewTest, renewWithExcludedPrefixHost) { // Make sure that the client has acquired NA lease. std::vector leases_client_na = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na.size()); + ASSERT_EQ(1U, leases_client_na.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_)); // The client should also acquire a PD lease. std::vector leases_client_pd = client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_client_pd.size()); + ASSERT_EQ(1U, leases_client_pd.size()); ASSERT_EQ(STATUS_Success, client.getStatusCode(pd_iaid_)); // Send Renew message to the server, including IA_NA and IA_PD. @@ -514,12 +514,12 @@ TEST_F(RenewTest, renewWithExcludedPrefixHost) { std::vector leases_client_na_renewed = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na_renewed.size()); + ASSERT_EQ(1U, leases_client_na_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_)); std::vector leases_client_pd_renewed = client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_client_pd_renewed.size()); + ASSERT_EQ(1U, leases_client_pd_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(pd_iaid_)); // Make sure that Prefix Exclude option hasn't been included. @@ -538,12 +538,12 @@ TEST_F(RenewTest, renewWithExcludedPrefixHost) { // Make sure that the client has acquired NA lease. leases_client_na_renewed = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na_renewed.size()); + ASSERT_EQ(1U, leases_client_na_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_)); // Make sure that the client has acquired PD lease. leases_client_pd_renewed = client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_client_pd_renewed.size()); + ASSERT_EQ(1U, leases_client_pd_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(pd_iaid_)); // The leases should have been renewed. @@ -561,7 +561,7 @@ TEST_F(RenewTest, renewWithExcludedPrefixHost) { ASSERT_TRUE(pd_exclude); EXPECT_EQ("3000::2000", pd_exclude->getExcludedPrefix(IOAddress("3000::"), 80).toText()); - EXPECT_EQ(120, static_cast(pd_exclude->getExcludedPrefixLength())); + EXPECT_EQ(120U, static_cast(pd_exclude->getExcludedPrefixLength())); } // This test verifies that the client can request a prefix delegation @@ -584,7 +584,7 @@ TEST_F(RenewTest, requestPrefixInRenewUseHint) { // Make sure that the client has acquired NA lease. std::vector leases_client_na = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na.size()); + ASSERT_EQ(1U, leases_client_na.size()); // The client should not acquire a PD lease. std::vector leases_client_pd = client.getLeasesByType(Lease::TYPE_PD); @@ -599,7 +599,7 @@ TEST_F(RenewTest, requestPrefixInRenewUseHint) { std::vector leases_client_na_renewed = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na_renewed.size()); + ASSERT_EQ(1U, leases_client_na_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_)); // Specify the hint used for IA_PD. @@ -610,7 +610,7 @@ TEST_F(RenewTest, requestPrefixInRenewUseHint) { // Make sure that the client has acquired NA lease. leases_client_na_renewed = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na_renewed.size()); + ASSERT_EQ(1U, leases_client_na_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_)); leases_client_pd = client.getLeasesByType(Lease::TYPE_PD); @@ -625,7 +625,7 @@ TEST_F(RenewTest, requestPrefixInRenewUseHint) { // Make sure that the client has acquired NA lease. leases_client_na_renewed = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na_renewed.size()); + ASSERT_EQ(1U, leases_client_na_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_)); // The lease should have been renewed. @@ -633,7 +633,7 @@ TEST_F(RenewTest, requestPrefixInRenewUseHint) { // The client should now also acquire a PD lease. leases_client_pd = client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_client_pd.size()); + ASSERT_EQ(1U, leases_client_pd.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(pd_iaid_)); } @@ -657,25 +657,25 @@ TEST_F(RenewTest, requestAddressInRenew) { // Make sure that the client has acquired PD lease. std::vector leases_client_pd = client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_client_pd.size()); + ASSERT_EQ(1U, leases_client_pd.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(pd_iaid_)); // The client should not acquire a NA lease. std::vector leases_client_na = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(0, leases_client_na.size()); + ASSERT_EQ(0U, leases_client_na.size()); ASSERT_EQ(STATUS_NoAddrsAvail, client.getStatusCode(na_iaid_)); // Send Renew message to the server, including IA_PD and requesting IA_NA. // The server should return NoAddrsAvail status code in this case. ASSERT_NO_THROW(client.doRenew()); leases_client_na = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(0, leases_client_na.size()); + ASSERT_EQ(0U, leases_client_na.size()); ASSERT_EQ(STATUS_NoAddrsAvail, client.getStatusCode(na_iaid_)); std::vector leases_client_pd_renewed = client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_client_pd_renewed.size()); + ASSERT_EQ(1U, leases_client_pd_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(pd_iaid_)); EXPECT_GE(leases_client_pd_renewed[0].cltt_ - leases_client_pd[0].cltt_, 1000); @@ -687,13 +687,13 @@ TEST_F(RenewTest, requestAddressInRenew) { // Make sure that the client has renewed PD lease. leases_client_pd_renewed = client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_client_pd_renewed.size()); + ASSERT_EQ(1U, leases_client_pd_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(pd_iaid_)); EXPECT_GE(leases_client_pd_renewed[0].cltt_ - leases_client_pd[0].cltt_, 1000); // The client should now also acquire a NA lease. leases_client_na = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na.size()); + ASSERT_EQ(1U, leases_client_na.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_)); } @@ -717,13 +717,13 @@ TEST_F(RenewTest, requestAddressInRenewHint) { // Make sure that the client has acquired PD lease. std::vector leases_client_pd = client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_client_pd.size()); + ASSERT_EQ(1U, leases_client_pd.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(pd_iaid_)); // The client should not acquire a NA lease. std::vector leases_client_na = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(0, leases_client_na.size()); + ASSERT_EQ(0U, leases_client_na.size()); ASSERT_EQ(STATUS_NoAddrsAvail, client.getStatusCode(na_iaid_)); client.requestAddress(na_iaid_, IOAddress("2001:db8:1::100")); @@ -733,14 +733,14 @@ TEST_F(RenewTest, requestAddressInRenewHint) { ASSERT_NO_THROW(client.doRenew()); leases_client_na = client.getLeasesByType(Lease::TYPE_NA); // The server should return the hint with the zero lifetimes. - ASSERT_EQ(1, leases_client_na.size()); - EXPECT_EQ(0, leases_client_na[0].preferred_lft_); - EXPECT_EQ(0, leases_client_na[0].valid_lft_); + ASSERT_EQ(1U, leases_client_na.size()); + EXPECT_EQ(0U, leases_client_na[0].preferred_lft_); + EXPECT_EQ(0U, leases_client_na[0].valid_lft_); ASSERT_EQ(STATUS_NoAddrsAvail, client.getStatusCode(na_iaid_)); std::vector leases_client_pd_renewed = client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_client_pd_renewed.size()); + ASSERT_EQ(1U, leases_client_pd_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(pd_iaid_)); EXPECT_GE(leases_client_pd_renewed[0].cltt_ - leases_client_pd[0].cltt_, 1000); @@ -752,13 +752,13 @@ TEST_F(RenewTest, requestAddressInRenewHint) { // Make sure that the client has renewed PD lease. leases_client_pd_renewed = client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_client_pd_renewed.size()); + ASSERT_EQ(1U, leases_client_pd_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(pd_iaid_)); EXPECT_GE(leases_client_pd_renewed[0].cltt_ - leases_client_pd[0].cltt_, 1000); // The client should now also acquire a NA lease. leases_client_na = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na.size()); + ASSERT_EQ(1U, leases_client_na.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_)); } @@ -789,7 +789,7 @@ TEST_F(RenewTest, docsisORO) { // Make sure that the client has acquired NA lease. std::vector leases_client_na = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na.size()); + ASSERT_EQ(1U, leases_client_na.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_)); // Send Renew message to the server. @@ -797,7 +797,7 @@ TEST_F(RenewTest, docsisORO) { std::vector leases_client_na_renewed = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na_renewed.size()); + ASSERT_EQ(1U, leases_client_na_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_)); // No vendor option was included in the renew so there should be none @@ -812,7 +812,7 @@ TEST_F(RenewTest, docsisORO) { ASSERT_NO_THROW(client.doRenew()); leases_client_na_renewed = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_client_na_renewed.size()); + ASSERT_EQ(1U, leases_client_na_renewed.size()); EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_)); // Verify whether there is a vendor option. @@ -854,7 +854,7 @@ TEST_F(RenewTest, optionsInheritance) { // Make sure we ended-up having expected number of subnets configured. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Perform 4-way exchange. ASSERT_NO_THROW(client.doSARR()); diff --git a/src/bin/dhcp6/tests/sarr_unittest.cc b/src/bin/dhcp6/tests/sarr_unittest.cc index 82b3fbe535..e9a1525e02 100644 --- a/src/bin/dhcp6/tests/sarr_unittest.cc +++ b/src/bin/dhcp6/tests/sarr_unittest.cc @@ -507,22 +507,22 @@ SARRTest::directClientPrefixHint() { // Make sure we ended-up having expected number of subnets configured. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Append IAPREFIX option to the client's message. ASSERT_NO_THROW(client.requestPrefix(5678, 64, asiolink::IOAddress("2001:db8:3:33::33"))); // Perform 4-way exchange. ASSERT_NO_THROW(client.doSARR()); // Server should have assigned a prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); // The server should correctly deal with the least significant bytes // of the hint being set. It should set them to zero and use the // valid portion of the hint. EXPECT_EQ("2001:db8:3:33::", lease_client.addr_.toText()); // Server ignores other parts of the IAPREFIX option. - EXPECT_EQ(64, lease_client.prefixlen_); - EXPECT_EQ(3000, lease_client.preferred_lft_); - EXPECT_EQ(4000, lease_client.valid_lft_); + EXPECT_EQ(64U, lease_client.prefixlen_); + EXPECT_EQ(3000U, lease_client.preferred_lft_); + EXPECT_EQ(4000U, lease_client.valid_lft_); Lease6Ptr lease_server = checkLease(lease_client); // Check that the server recorded the lease. ASSERT_TRUE(lease_server); @@ -537,7 +537,7 @@ SARRTest::directClientPrefixHint() { ASSERT_NO_THROW(client.requestPrefix(5678, 64, IOAddress("2001:db8:3:33::34"))); ASSERT_NO_THROW(client.doSARR()); // Server should assign a lease. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); lease_client = client.getLease(0); // The hint collides with the existing lease, so the server should not // assign for the second client. @@ -546,9 +546,9 @@ SARRTest::directClientPrefixHint() { // Check that the assigned prefix belongs to the pool. ASSERT_TRUE(!subnets->empty()); (*subnets->begin())->inPool(Lease::TYPE_PD, lease_client.addr_); - EXPECT_EQ(64, lease_client.prefixlen_); - EXPECT_EQ(3000, lease_client.preferred_lft_); - EXPECT_EQ(4000, lease_client.valid_lft_); + EXPECT_EQ(64U, lease_client.prefixlen_); + EXPECT_EQ(3000U, lease_client.preferred_lft_); + EXPECT_EQ(4000U, lease_client.valid_lft_); lease_server = checkLease(lease_client); ASSERT_TRUE(lease_server); } @@ -572,20 +572,20 @@ SARRTest::directClientPrefixLengthHintRenewal() { // Make sure we ended-up having expected number of subnets configured. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Append IAPREFIX option to the client's message. ASSERT_NO_THROW(client.requestPrefix(5678, 64, asiolink::IOAddress("2001:db8:3:36::"))); // Perform 4-way exchange. ASSERT_NO_THROW(client.doSARR()); // Server should have assigned a prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); // The server should respect the prefix hint. EXPECT_EQ("2001:db8:3:36::", lease_client.addr_.toText()); // Server ignores other parts of the IAPREFIX option. - EXPECT_EQ(64, lease_client.prefixlen_); - EXPECT_EQ(3000, lease_client.preferred_lft_); - EXPECT_EQ(4000, lease_client.valid_lft_); + EXPECT_EQ(64U, lease_client.prefixlen_); + EXPECT_EQ(3000U, lease_client.preferred_lft_); + EXPECT_EQ(4000U, lease_client.valid_lft_); Lease6Ptr lease_server = checkLease(lease_client); // Check that the server recorded the lease. ASSERT_TRUE(lease_server); @@ -595,20 +595,20 @@ SARRTest::directClientPrefixLengthHintRenewal() { client.clearRequestedIAs(); ASSERT_NO_THROW(client.requestPrefix(5678, 80, IOAddress("2001:db8:3:36::"))); ASSERT_NO_THROW(client.doSARR()); - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); lease_client = client.getLease(0); EXPECT_EQ("2001:db8:3:36::", lease_client.addr_.toText()); - EXPECT_EQ(64, lease_client.prefixlen_); + EXPECT_EQ(64U, lease_client.prefixlen_); // Try to request another prefix. The client should still get the existing // lease. client.clearRequestedIAs(); ASSERT_NO_THROW(client.requestPrefix(5678, 64, IOAddress("2001:db8:3:37::"))); ASSERT_NO_THROW(client.doSARR()); - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); lease_client = client.getLease(0); EXPECT_EQ("2001:db8:3:36::", lease_client.addr_.toText()); - EXPECT_EQ(64, lease_client.prefixlen_); + EXPECT_EQ(64U, lease_client.prefixlen_); } TEST_F(SARRTest, directClientPrefixLengthHintRenewal) { @@ -637,7 +637,7 @@ SARRTest::optionsInheritance() { // Make sure we ended-up having expected number of subnets configured. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Perform 4-way exchange. ASSERT_NO_THROW(client.doSARR()); @@ -703,15 +703,15 @@ SARRTest::directClientExcludedPrefixPool(bool request_pdx) { // Make sure we ended-up having expected number of subnets configured. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Perform 4-way exchange. ASSERT_NO_THROW(client.doSARR()); // Server should have assigned a prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); - EXPECT_EQ(64, lease_client.prefixlen_); - EXPECT_EQ(3000, lease_client.preferred_lft_); - EXPECT_EQ(4000, lease_client.valid_lft_); + EXPECT_EQ(64U, lease_client.prefixlen_); + EXPECT_EQ(3000U, lease_client.preferred_lft_); + EXPECT_EQ(4000U, lease_client.valid_lft_); Lease6Ptr lease_server = checkLease(lease_client); // Check that the server recorded the lease. ASSERT_TRUE(lease_server); @@ -734,7 +734,7 @@ SARRTest::directClientExcludedPrefixPool(bool request_pdx) { ASSERT_TRUE(pd_exclude); EXPECT_EQ("2001:db8:3::1000", pd_exclude->getExcludedPrefix(IOAddress("2001:db8:3::"), 64).toText()); - EXPECT_EQ(120, static_cast(pd_exclude->getExcludedPrefixLength())); + EXPECT_EQ(120U, static_cast(pd_exclude->getExcludedPrefixLength())); } TEST_F(SARRTest, directClientExcludedPrefixPool) { @@ -772,15 +772,15 @@ SARRTest::directClientExcludedPrefixHost(bool request_pdx) { // Make sure we ended-up having expected number of subnets configured. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(1, subnets->size()); + ASSERT_EQ(1U, subnets->size()); // Perform 4-way exchange. ASSERT_NO_THROW(client.doSARR()); // Server should have assigned a prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); - EXPECT_EQ(64, lease_client.prefixlen_); - EXPECT_EQ(3000, lease_client.preferred_lft_); - EXPECT_EQ(4000, lease_client.valid_lft_); + EXPECT_EQ(64U, lease_client.prefixlen_); + EXPECT_EQ(3000U, lease_client.preferred_lft_); + EXPECT_EQ(4000U, lease_client.valid_lft_); Lease6Ptr lease_server = checkLease(lease_client); // Check that the server recorded the lease. ASSERT_TRUE(lease_server); @@ -803,7 +803,7 @@ SARRTest::directClientExcludedPrefixHost(bool request_pdx) { ASSERT_TRUE(pd_exclude); EXPECT_EQ("2001:db8:3::2000", pd_exclude->getExcludedPrefix(IOAddress("2001:db8:3::"), 64).toText()); - EXPECT_EQ(120, static_cast(pd_exclude->getExcludedPrefixLength())); + EXPECT_EQ(120U, static_cast(pd_exclude->getExcludedPrefixLength())); } TEST_F(SARRTest, directClientExcludedPrefixHost) { @@ -836,7 +836,7 @@ SARRTest::rapidCommitEnable() { // Make sure we ended-up having expected number of subnets configured. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(2, subnets->size()); + ASSERT_EQ(2U, subnets->size()); // Perform 2-way exchange. client.useRapidCommit(true); // Include FQDN to trigger generation of name change requests. @@ -846,7 +846,7 @@ SARRTest::rapidCommitEnable() { ASSERT_NO_THROW(client.doSolicit()); // Server should have committed a lease. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease_client = client.getLease(0); // Make sure that the address belongs to the subnet configured. ASSERT_TRUE(CfgMgr::instance().getCurrentCfg()->getCfgSubnets6()-> @@ -860,7 +860,7 @@ SARRTest::rapidCommitEnable() { Lease6Ptr lease_server = checkLease(lease_client); EXPECT_TRUE(lease_server); // There should be one name change request generated. - EXPECT_EQ(1, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + EXPECT_EQ(1U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); } TEST_F(SARRTest, rapidCommitEnable) { @@ -883,7 +883,7 @@ SARRTest::rapidCommitNoOption() { // Make sure we ended-up having expected number of subnets configured. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(2, subnets->size()); + ASSERT_EQ(2U, subnets->size()); // Include FQDN to test that the server will not create name change // requests when it sends Advertise (Rapid Commit disabled). ASSERT_NO_THROW(client.useFQDN(Option6ClientFqdn::FLAG_S, @@ -892,14 +892,14 @@ SARRTest::rapidCommitNoOption() { ASSERT_NO_THROW(client.doSolicit()); // There should be no lease because the server should have responded // with Advertise. - ASSERT_EQ(0, client.getLeaseNum()); + ASSERT_EQ(0U, client.getLeaseNum()); // Make sure that the server responded. ASSERT_TRUE(client.getContext().response_); EXPECT_EQ(DHCPV6_ADVERTISE, client.getContext().response_->getType()); // Make sure that the Rapid Commit option is not included. EXPECT_FALSE(client.getContext().response_->getOption(D6O_RAPID_COMMIT)); // There should be no name change request generated. - EXPECT_EQ(0, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + EXPECT_EQ(0U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); } TEST_F(SARRTest, rapidCommitNoOption) { @@ -924,7 +924,7 @@ SARRTest::rapidCommitDisable() { // Make sure we ended-up having expected number of subnets configured. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(2, subnets->size()); + ASSERT_EQ(2U, subnets->size()); // Send Rapid Commit option to the server. client.useRapidCommit(true); // Include FQDN to test that the server will not create name change @@ -935,14 +935,14 @@ SARRTest::rapidCommitDisable() { ASSERT_NO_THROW(client.doSolicit()); // There should be no lease because the server should have responded // with Advertise. - ASSERT_EQ(0, client.getLeaseNum()); + ASSERT_EQ(0U, client.getLeaseNum()); // Make sure that the server responded. ASSERT_TRUE(client.getContext().response_); EXPECT_EQ(DHCPV6_ADVERTISE, client.getContext().response_->getType()); // Make sure that the Rapid Commit option is not included. EXPECT_FALSE(client.getContext().response_->getOption(D6O_RAPID_COMMIT)); // There should be no name change request generated. - EXPECT_EQ(0, CfgMgr::instance().getD2ClientMgr().getQueueSize()); + EXPECT_EQ(0U, CfgMgr::instance().getD2ClientMgr().getQueueSize()); } TEST_F(SARRTest, rapidCommitDisable) { @@ -974,7 +974,7 @@ SARRTest::sarrStats() { // Make sure we ended-up having expected number of subnets configured. const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()-> getCfgSubnets6()->getAll(); - ASSERT_EQ(2, subnets->size()); + ASSERT_EQ(2U, subnets->size()); // Check that the tested statistics is initially set to 0 using namespace isc::stats; @@ -1001,7 +1001,7 @@ SARRTest::sarrStats() { // Perform 4-way exchange. ASSERT_NO_THROW(client.doSARR()); // Server should have assigned a prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); // All expected statistics must be present now. pkt6_rcvd = mgr.getObservation("pkt6-received"); @@ -1157,7 +1157,7 @@ SARRTest::reservationModeOutOfPool() { // Perform 4-way exchange. ASSERT_NO_THROW(client.doSARR()); // Server should have assigned a prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease = client.getLease(0); // Check that the server allocated the reserved address. @@ -1172,7 +1172,7 @@ SARRTest::reservationModeOutOfPool() { // Perform 4-way exchange. ASSERT_NO_THROW(client.doSARR()); // Server should have assigned a prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); lease = client.getLease(0); // Check that the requested address was assigned. @@ -1202,7 +1202,7 @@ SARRTest::reservationIgnoredInOutOfPoolMode() { // Perform 4-way exchange. ASSERT_NO_THROW(client.doSARR()); // Server should have assigned a prefix. - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); Lease6 lease = client.getLease(0); // Check that the server allocated the reserved address. @@ -1240,9 +1240,9 @@ SARRTest::randomAddressAllocation() { ASSERT_NO_THROW(next_client.doSARR()); // We should have one IA_NA and one IA_PD. auto leases_na = next_client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_na.size()); + ASSERT_EQ(1U, leases_na.size()); auto leases_pd = next_client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_pd.size()); + ASSERT_EQ(1U, leases_pd.size()); // Remember allocated address and delegated prefix uniqueness // and order. allocated_na_set.insert(leases_na[0].toText()); @@ -1251,10 +1251,10 @@ SARRTest::randomAddressAllocation() { allocated_pd_vector.push_back(leases_pd[0].addr_); } // Make sure that we have 30 distinct allocations for each lease type. - ASSERT_EQ(30, allocated_na_set.size()); - ASSERT_EQ(30, allocated_na_vector.size()); - ASSERT_EQ(30, allocated_pd_set.size()); - ASSERT_EQ(30, allocated_pd_vector.size()); + ASSERT_EQ(30U, allocated_na_set.size()); + ASSERT_EQ(30U, allocated_na_vector.size()); + ASSERT_EQ(30U, allocated_pd_set.size()); + ASSERT_EQ(30U, allocated_pd_vector.size()); // Make sure that the addresses are not allocated iteratively. size_t consecutives = 0; @@ -1267,7 +1267,7 @@ SARRTest::randomAddressAllocation() { ++consecutives; } } - EXPECT_LT(consecutives, 10); + EXPECT_LT(consecutives, 10U); // Make sure that delegated prefixes have been allocated iteratively. consecutives = 0; @@ -1276,7 +1276,7 @@ SARRTest::randomAddressAllocation() { ++consecutives; } } - EXPECT_EQ(29, consecutives); + EXPECT_EQ(29U, consecutives); } TEST_F(SARRTest, randomAddressAllocation) { @@ -1310,9 +1310,9 @@ SARRTest::randomPrefixAllocation() { ASSERT_NO_THROW(next_client.doSARR()); // We should have one IA_NA and one IA_PD. auto leases_na = next_client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases_na.size()); + ASSERT_EQ(1U, leases_na.size()); auto leases_pd = next_client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases_pd.size()); + ASSERT_EQ(1U, leases_pd.size()); // Remember allocated address and delegated prefix uniqueness // and order. allocated_na_set.insert(leases_na[0].toText()); @@ -1321,10 +1321,10 @@ SARRTest::randomPrefixAllocation() { allocated_pd_vector.push_back(leases_pd[0].addr_); } // Make sure that we have 30 distinct allocations for each lease type. - ASSERT_EQ(30, allocated_na_set.size()); - ASSERT_EQ(30, allocated_na_vector.size()); - ASSERT_EQ(30, allocated_pd_set.size()); - ASSERT_EQ(30, allocated_pd_vector.size()); + ASSERT_EQ(30U, allocated_na_set.size()); + ASSERT_EQ(30U, allocated_na_vector.size()); + ASSERT_EQ(30U, allocated_pd_set.size()); + ASSERT_EQ(30U, allocated_pd_vector.size()); // Make sure that the addresses have been allocated iteratively. size_t consecutives = 0; @@ -1337,7 +1337,7 @@ SARRTest::randomPrefixAllocation() { } // Make sure that addresses have been allocated iteratively. - EXPECT_EQ(29, consecutives); + EXPECT_EQ(29U, consecutives); // Make sure that delegated prefixes have been allocated randomly. consecutives = 0; @@ -1346,7 +1346,7 @@ SARRTest::randomPrefixAllocation() { ++consecutives; } } - EXPECT_LT(consecutives, 10); + EXPECT_LT(consecutives, 10U); } TEST_F(SARRTest, randomPrefixAllocation) { @@ -1393,23 +1393,23 @@ SARRTest::leaseCaching() { // Start D2 client mgr and verify the NCR queue is empty. ASSERT_NO_THROW(client.getServer()->startD2()); auto& d2_mgr = CfgMgr::instance().getD2ClientMgr(); - ASSERT_EQ(0, d2_mgr.getQueueSize()); + ASSERT_EQ(0U, d2_mgr.getQueueSize()); // Perform 4-way exchange. ASSERT_NO_THROW(client.doSARR()); // Server should have assigned an address and a prefix. - ASSERT_EQ(2, client.getLeaseNum()); + ASSERT_EQ(2U, client.getLeaseNum()); // The server should respect the hints. Lease6 lease_client(client.getLease(0)); EXPECT_EQ("2001:db8::10", lease_client.addr_.toText()); - EXPECT_EQ(128, lease_client.prefixlen_); + EXPECT_EQ(128U, lease_client.prefixlen_); Lease6Ptr lease_server(checkLease(lease_client)); EXPECT_TRUE(lease_server); lease_client = client.getLease(1); EXPECT_EQ("2001:db8:1::", lease_client.addr_.toText()); - EXPECT_EQ(96, lease_client.prefixlen_); + EXPECT_EQ(96U, lease_client.prefixlen_); lease_server = checkLease(lease_client); EXPECT_TRUE(lease_server); @@ -1422,10 +1422,10 @@ SARRTest::leaseCaching() { checkStat("subnet[2].v6-ia-pd-lease-reuses", 1, 0); // There should be a single NCR. - ASSERT_EQ(1, d2_mgr.getQueueSize()); + ASSERT_EQ(1U, d2_mgr.getQueueSize()); // Clear the NCR queue. ASSERT_NO_THROW(d2_mgr.runReadyIO()); - ASSERT_EQ(0, d2_mgr.getQueueSize()); + ASSERT_EQ(0U, d2_mgr.getQueueSize()); // Request the same prefix with a different length. The server should // return an existing lease. @@ -1433,13 +1433,13 @@ SARRTest::leaseCaching() { ASSERT_NO_THROW(client.requestAddress(1234, asiolink::IOAddress("2001:db8::10"))); ASSERT_NO_THROW(client.requestPrefix(5678, 80, IOAddress("2001:db8:1::"))); ASSERT_NO_THROW(client.doSARR()); - ASSERT_EQ(2, client.getLeaseNum()); + ASSERT_EQ(2U, client.getLeaseNum()); lease_client = client.getLease(0); EXPECT_EQ("2001:db8::10", lease_client.addr_.toText()); - EXPECT_EQ(128, lease_client.prefixlen_); + EXPECT_EQ(128U, lease_client.prefixlen_); lease_client = client.getLease(1); EXPECT_EQ("2001:db8:1::", lease_client.addr_.toText()); - EXPECT_EQ(96, lease_client.prefixlen_); + EXPECT_EQ(96U, lease_client.prefixlen_); // Check statistics. checkStat("v6-ia-na-lease-reuses", 2, 1); @@ -1450,7 +1450,7 @@ SARRTest::leaseCaching() { checkStat("subnet[2].v6-ia-pd-lease-reuses", 1, 0); // There should be no NCRs queued. - ASSERT_EQ(0, d2_mgr.getQueueSize()); + ASSERT_EQ(0U, d2_mgr.getQueueSize()); // Try to request another prefix. The client should still get the existing // lease. @@ -1458,13 +1458,13 @@ SARRTest::leaseCaching() { ASSERT_NO_THROW(client.requestAddress(1234, asiolink::IOAddress("2001:db8::10"))); ASSERT_NO_THROW(client.requestPrefix(5678, 64, IOAddress("2001:db8:2::"))); ASSERT_NO_THROW(client.doRequest()); - ASSERT_EQ(2, client.getLeaseNum()); + ASSERT_EQ(2U, client.getLeaseNum()); lease_client = client.getLease(0); EXPECT_EQ("2001:db8::10", lease_client.addr_.toText()); - EXPECT_EQ(128, lease_client.prefixlen_); + EXPECT_EQ(128U, lease_client.prefixlen_); lease_client = client.getLease(1); EXPECT_EQ("2001:db8:1::", lease_client.addr_.toText()); - EXPECT_EQ(96, lease_client.prefixlen_); + EXPECT_EQ(96U, lease_client.prefixlen_); // Check statistics. checkStat("v6-ia-na-lease-reuses", 3, 2); @@ -1475,7 +1475,7 @@ SARRTest::leaseCaching() { checkStat("subnet[2].v6-ia-pd-lease-reuses", 1, 0); // There should be no NCRs queued. - ASSERT_EQ(0, d2_mgr.getQueueSize()); + ASSERT_EQ(0U, d2_mgr.getQueueSize()); } TEST_F(SARRTest, leaseCaching) { diff --git a/src/bin/dhcp6/tests/shared_network_unittest.cc b/src/bin/dhcp6/tests/shared_network_unittest.cc index 6cc67a1bce..8302b7881d 100644 --- a/src/bin/dhcp6/tests/shared_network_unittest.cc +++ b/src/bin/dhcp6/tests/shared_network_unittest.cc @@ -1463,7 +1463,7 @@ public: ASSERT_NO_FATAL_FAILURE(configure(config, *client1.getServer())); // Ok, client should have one - EXPECT_EQ(0, client1.getLeaseNum()); + EXPECT_EQ(0U, client1.getLeaseNum()); // Client #1 should be assigned an address from shared network. The first // subnet has rapid-commit enabled, so the address should be assigned. @@ -1496,7 +1496,7 @@ public: EXPECT_EQ(DHCPV6_ADVERTISE, client1.getContext().response_->getType()); // And that it doesn't have any leases. - EXPECT_EQ(0, client1.getLeaseNum()); + EXPECT_EQ(0U, client1.getLeaseNum()); } // Create client #2. This client behaves the same as the first one, but the @@ -1526,7 +1526,7 @@ public: EXPECT_EQ(DHCPV6_ADVERTISE, client1.getContext().response_->getType()); // And that it doesn't have any leases. - EXPECT_EQ(0, client1.getLeaseNum()); + EXPECT_EQ(0U, client1.getLeaseNum()); } } @@ -1550,7 +1550,7 @@ public: ASSERT_NO_THROW(client.doSARR()); // Check response. - EXPECT_EQ(1, client.getLeaseNum()); + EXPECT_EQ(1U, client.getLeaseNum()); Pkt6Ptr resp = client.getContext().response_; ASSERT_TRUE(resp); @@ -1561,7 +1561,7 @@ public: boost::dynamic_pointer_cast(opt); ASSERT_TRUE(servers); auto addrs = servers->getAddresses(); - ASSERT_EQ(1, addrs.size()); + ASSERT_EQ(1U, addrs.size()); EXPECT_EQ(ns_address, addrs[0].toText()); } @@ -1591,14 +1591,14 @@ public: // Make sure that the server responded. ASSERT_TRUE(next_client.getContext().response_); auto leases = next_client.getLeasesByType(Lease::TYPE_PD); - ASSERT_EQ(1, leases.size()); + ASSERT_EQ(1U, leases.size()); // Make sure that the prefix is not zero. ASSERT_FALSE(leases[0].addr_.isV6Zero()); // Remember the allocated prefix uniqueness. allocated_set.insert(leases[0].addr_.toText()); } // Make sure that we have 32 distinct allocations. - ASSERT_EQ(32, allocated_set.size()); + ASSERT_EQ(32U, allocated_set.size()); // Try one more time. This time no leases should be allocated because // the pools are exhausted. @@ -1642,7 +1642,7 @@ TEST_F(Dhcpv6SharedNetworkTest, parse) { SharedNetwork6Ptr network = cfg->getByName("frog"); ConstElementPtr context = network->getContext(); ASSERT_TRUE(context); - ASSERT_EQ(1, context->size()); + ASSERT_EQ(1U, context->size()); ASSERT_TRUE(context->get("comment")); EXPECT_EQ("\"example\"", context->get("comment")->str()); } @@ -1682,27 +1682,27 @@ TEST_F(Dhcpv6SharedNetworkTest, addressPoolInSharedNetworkShortage) { testAssigned([&client3] { ASSERT_NO_THROW(client3.doSolicit(true)); }); - EXPECT_EQ(0, client3.getLeaseNum()); + EXPECT_EQ(0U, client3.getLeaseNum()); // Client #3 should be assigned an address if subnet 3 is selected for it. client3.setInterface("eth0"); testAssigned([&client3] { ASSERT_NO_THROW(client3.doSolicit(true)); }); - EXPECT_EQ(1, client3.getLeaseNum()); + EXPECT_EQ(1U, client3.getLeaseNum()); // Client #1 should be able to renew its lease. testAssigned([&client1] { ASSERT_NO_THROW(client1.doRenew()); }); - EXPECT_EQ(1, client1.getLeaseNum()); + EXPECT_EQ(1U, client1.getLeaseNum()); EXPECT_TRUE(hasLeaseForAddress(client1, IOAddress("2001:db8:1::20"))); // Client #2 should be able to renew its lease too. testAssigned([&client2] { ASSERT_NO_THROW(client2.doRenew()); }); - EXPECT_EQ(1, client2.getLeaseNum()); + EXPECT_EQ(1U, client2.getLeaseNum()); EXPECT_TRUE(hasLeaseForAddress(client2, IOAddress("2001:db8:2::20"))); } @@ -1772,7 +1772,7 @@ TEST_F(Dhcpv6SharedNetworkTest, hintWithinSharedNetwork) { ASSERT_NO_THROW(client.doSolicit(true)); }); std::vector leases = client.getLeasesByType(Lease::TYPE_NA); - ASSERT_EQ(1, leases.size()); + ASSERT_EQ(1U, leases.size()); if (!hasLeaseForAddress(client, IOAddress("2001:db8:1::20"), LeaseOnServer::MUST_NOT_EXIST) && !hasLeaseForAddress(client, IOAddress("2001:db8:2::20"), @@ -1831,7 +1831,7 @@ TEST_F(Dhcpv6SharedNetworkTest, subnetInSharedNetworkSelectedByClass) { testAssigned([&client2] { ASSERT_NO_THROW(client2.doRenew()); }); - EXPECT_EQ(0, client2.getLeaseNum()); + EXPECT_EQ(0U, client2.getLeaseNum()); // If we add option 1234 with a value matching this class, the lease should // get renewed. @@ -1840,7 +1840,7 @@ TEST_F(Dhcpv6SharedNetworkTest, subnetInSharedNetworkSelectedByClass) { testAssigned([&client2] { ASSERT_NO_THROW(client2.doRenew()); }); - EXPECT_EQ(1, client2.getLeaseNum()); + EXPECT_EQ(1U, client2.getLeaseNum()); } // IPv6 address reservation exists in one of the subnets within shared network. @@ -2352,7 +2352,7 @@ TEST_F(Dhcpv6SharedNetworkTest, reservedAddressAndPrefix) { testAssigned([&client] { ASSERT_NO_THROW(client.doSARR()); }); - ASSERT_EQ(4, client.getLeaseNum()); + ASSERT_EQ(4U, client.getLeaseNum()); // The client should have got one reserved address and one reserved prefix. ASSERT_TRUE(hasLeaseForAddress(client, IOAddress("2001:db8:2::28"))); ASSERT_TRUE(hasLeaseForPrefix(client, IOAddress("5000::8:0000"), 112, IAID(0x1111))); @@ -2360,28 +2360,28 @@ TEST_F(Dhcpv6SharedNetworkTest, reservedAddressAndPrefix) { // The client should have got dynamically allocated address too and it must be // different than the reserved address. std::vector leases_1234 = client.getLeasesByIAID(0x1234); - ASSERT_EQ(1, leases_1234.size()); + ASSERT_EQ(1U, leases_1234.size()); ASSERT_NE("2001:db8:2::28", leases_1234[0].addr_.toText()); // Same for prefix. std::vector leases_2222 = client.getLeasesByIAID(0x2222); - ASSERT_EQ(1, leases_2222.size()); + ASSERT_EQ(1U, leases_2222.size()); ASSERT_NE("1234::", leases_2222[0].addr_.toText()); // Try to renew and check this again. testAssigned([&client] { ASSERT_NO_THROW(client.doRenew()); }); - ASSERT_EQ(4, client.getLeaseNum()); + ASSERT_EQ(4U, client.getLeaseNum()); ASSERT_TRUE(hasLeaseForAddress(client, IOAddress("2001:db8:2::28"))); ASSERT_TRUE(hasLeaseForPrefix(client, IOAddress("5000::8:0000"), 112, IAID(0x1111))); leases_1234 = client.getLeasesByIAID(0x1234); - ASSERT_EQ(1, leases_1234.size()); + ASSERT_EQ(1U, leases_1234.size()); ASSERT_NE("2001:db8:2::28", leases_1234[0].addr_.toText()); leases_2222 = client.getLeasesByIAID(0x2222); - ASSERT_EQ(1, leases_2222.size()); + ASSERT_EQ(1U, leases_2222.size()); ASSERT_NE(IOAddress("5000::8:0000").toText(), leases_2222[0].addr_.toText()); } @@ -2404,7 +2404,7 @@ TEST_F(Dhcpv6SharedNetworkTest, relaySpecifiedForEachSubnet) { testAssigned([&client] { ASSERT_NO_THROW(client.doSARR()); }); - ASSERT_EQ(2, client.getLeaseNum()); + ASSERT_EQ(2U, client.getLeaseNum()); // The client should have got two leases, one from each subnet within the // shared network. @@ -2546,7 +2546,7 @@ TEST_F(Dhcpv6SharedNetworkTest, poolInSharedNetworkSelectedByClass) { testAssigned([&client2] { ASSERT_NO_THROW(client2.doRenew()); }); - EXPECT_EQ(0, client2.getLeasesWithNonZeroLifetime().size()); + EXPECT_EQ(0U, client2.getLeasesWithNonZeroLifetime().size()); // If we add option 1234 with a value matching this class, the lease should // get renewed. @@ -2555,8 +2555,8 @@ TEST_F(Dhcpv6SharedNetworkTest, poolInSharedNetworkSelectedByClass) { testAssigned([&client2] { ASSERT_NO_THROW(client2.doRenew()); }); - EXPECT_EQ(1, client2.getLeaseNum()); - EXPECT_EQ(1, client2.getLeasesWithNonZeroLifetime().size()); + EXPECT_EQ(1U, client2.getLeaseNum()); + EXPECT_EQ(1U, client2.getLeasesWithNonZeroLifetime().size()); } // Pool is selected based on the client class specified using a plain subnet. @@ -2609,7 +2609,7 @@ TEST_F(Dhcpv6SharedNetworkTest, poolInSubnetSelectedByClass) { testAssigned([&client2] { ASSERT_NO_THROW(client2.doRenew()); }); - EXPECT_EQ(0, client2.getLeasesWithNonZeroLifetime().size()); + EXPECT_EQ(0U, client2.getLeasesWithNonZeroLifetime().size()); // If we add option 1234 with a value matching this class, the lease should // get renewed. @@ -2618,8 +2618,8 @@ TEST_F(Dhcpv6SharedNetworkTest, poolInSubnetSelectedByClass) { testAssigned([&client2] { ASSERT_NO_THROW(client2.doRenew()); }); - EXPECT_EQ(1, client2.getLeaseNum()); - EXPECT_EQ(1, client2.getLeasesWithNonZeroLifetime().size()); + EXPECT_EQ(1U, client2.getLeaseNum()); + EXPECT_EQ(1U, client2.getLeasesWithNonZeroLifetime().size()); } // Test that different allocator types can be used within a shared network. @@ -3141,11 +3141,11 @@ TEST_F(Dhcpv6SharedNetworkTest, useReclaimedReservedLease) { // Check response. Pkt6Ptr resp = client.getContext().response_; ASSERT_TRUE(resp); - ASSERT_EQ(1, client.getLeaseNum()); + ASSERT_EQ(1U, client.getLeaseNum()); ASSERT_TRUE(hasLeaseForAddress(client, IOAddress("2001:db8:2::88"))); // We should see the reselect twice, once on solicit, once on request. - EXPECT_EQ(2, countFile("DHCP6_SUBNET_DYNAMICALLY_CHANGED duid=[01:02:03:04:05:06]")); + EXPECT_EQ(2U, countFile("DHCP6_SUBNET_DYNAMICALLY_CHANGED duid=[01:02:03:04:05:06]")); // The FQDN should be generated using the hostname from the reservation. auto fqdn_opt = boost::dynamic_pointer_cast diff --git a/src/bin/dhcp6/tests/simple_parser6_unittest.cc b/src/bin/dhcp6/tests/simple_parser6_unittest.cc index 23951a4f8f..2d143c36cb 100644 --- a/src/bin/dhcp6/tests/simple_parser6_unittest.cc +++ b/src/bin/dhcp6/tests/simple_parser6_unittest.cc @@ -171,18 +171,18 @@ TEST_F(SimpleParser6Test, inheritGlobalToSubnet6) { // as it was already defined in the subnet scope. size_t num; EXPECT_NO_THROW(num = SimpleParser6::deriveParameters(global)); - EXPECT_EQ(7, num); + EXPECT_EQ(7U, num); // Check the values. 3 of them are inherited, while the fourth one // was already defined in the subnet, so should not be inherited. - checkIntegerValue(subnet, "renew-timer", 100); - checkIntegerValue(subnet, "rebind-timer", 2); - checkIntegerValue(subnet, "preferred-lifetime", 3); - checkIntegerValue(subnet, "min-preferred-lifetime", 2); - checkIntegerValue(subnet, "max-preferred-lifetime", 4); - checkIntegerValue(subnet, "valid-lifetime", 4); - checkIntegerValue(subnet, "min-valid-lifetime", 3); - checkIntegerValue(subnet, "max-valid-lifetime", 5); + checkIntegerValue(subnet, "renew-timer", 100U); + checkIntegerValue(subnet, "rebind-timer", 2U); + checkIntegerValue(subnet, "preferred-lifetime", 3U); + checkIntegerValue(subnet, "min-preferred-lifetime", 2U); + checkIntegerValue(subnet, "max-preferred-lifetime", 4U); + checkIntegerValue(subnet, "valid-lifetime", 4U); + checkIntegerValue(subnet, "min-valid-lifetime", 3U); + checkIntegerValue(subnet, "max-valid-lifetime", 5U); } // This test checks if the parameters in "subnet6" are assigned default values @@ -197,7 +197,7 @@ TEST_F(SimpleParser6Test, subnetDefaults6) { size_t num = 0; EXPECT_NO_THROW(num = SimpleParser6::setAllDefaults(global)); - EXPECT_LE(1, num); // at least 1 parameter has to be modified + EXPECT_LE(1U, num); // at least 1 parameter has to be modified ConstElementPtr subnets = global->find("subnet6"); ASSERT_TRUE(subnets); @@ -220,7 +220,7 @@ TEST_F(SimpleParser6Test, optionDataDefaults6) { size_t num = 0; EXPECT_NO_THROW(num = SimpleParser6::setAllDefaults(global)); - EXPECT_LE(1, num); // at least 1 parameter has to be modified + EXPECT_LE(1U, num); // at least 1 parameter has to be modified ConstElementPtr options = global->find("option-data"); ASSERT_TRUE(options); @@ -242,11 +242,11 @@ TEST_F(SimpleParser6Test, optionDefDefaults6) { size_t num = 0; EXPECT_NO_THROW(num = SimpleParser6::setAllDefaults(global)); - EXPECT_LE(1, num); // at least 1 parameter has to be modified + EXPECT_LE(1U, num); // at least 1 parameter has to be modified ConstElementPtr defs = global->find("option-def"); ASSERT_TRUE(defs); - ASSERT_EQ(1, defs->size()); + ASSERT_EQ(1U, defs->size()); ConstElementPtr def = defs->get(0); ASSERT_TRUE(def); diff --git a/src/bin/dhcp6/tests/tee_times_unittest.cc b/src/bin/dhcp6/tests/tee_times_unittest.cc index a63ecbd090..32152ab1eb 100644 --- a/src/bin/dhcp6/tests/tee_times_unittest.cc +++ b/src/bin/dhcp6/tests/tee_times_unittest.cc @@ -135,24 +135,24 @@ TEST_F(TeeTest, explicitTimers) { uint32_t actual_t2; ASSERT_TRUE(client.getTeeTimes(na_iaid, actual_t1, actual_t2)); - EXPECT_EQ(1000, actual_t1); - EXPECT_EQ(2000, actual_t2); + EXPECT_EQ(1000U, actual_t1); + EXPECT_EQ(2000U, actual_t2); ASSERT_TRUE(client.getTeeTimes(pd_iaid, actual_t1, actual_t2)); - EXPECT_EQ(1000, actual_t1); - EXPECT_EQ(2000, actual_t2); + EXPECT_EQ(1000U, actual_t1); + EXPECT_EQ(2000U, actual_t2); // Let's renew the leases. ASSERT_NO_THROW(client.doRenew()); // Now check the timers again. ASSERT_TRUE(client.getTeeTimes(na_iaid, actual_t1, actual_t2)); - EXPECT_EQ(1000, actual_t1); - EXPECT_EQ(2000, actual_t2); + EXPECT_EQ(1000U, actual_t1); + EXPECT_EQ(2000U, actual_t2); ASSERT_TRUE(client.getTeeTimes(pd_iaid, actual_t1, actual_t2)); - EXPECT_EQ(1000, actual_t1); - EXPECT_EQ(2000, actual_t2); + EXPECT_EQ(1000U, actual_t1); + EXPECT_EQ(2000U, actual_t2); } // This test verifies that T1 and T2 are calculated by @@ -178,24 +178,24 @@ TEST_F(TeeTest, defaultTimers) { uint32_t actual_t2; ASSERT_TRUE(client.getTeeTimes(na_iaid, actual_t1, actual_t2)); - EXPECT_EQ(1500, actual_t1); - EXPECT_EQ(2400, actual_t2); + EXPECT_EQ(1500U, actual_t1); + EXPECT_EQ(2400U, actual_t2); ASSERT_TRUE(client.getTeeTimes(pd_iaid, actual_t1, actual_t2)); - EXPECT_EQ(1500, actual_t1); - EXPECT_EQ(2400, actual_t2); + EXPECT_EQ(1500U, actual_t1); + EXPECT_EQ(2400U, actual_t2); // Let's renew the leases. ASSERT_NO_THROW(client.doRenew()); // Now check the timers again. ASSERT_TRUE(client.getTeeTimes(na_iaid, actual_t1, actual_t2)); - EXPECT_EQ(1500, actual_t1); - EXPECT_EQ(2400, actual_t2); + EXPECT_EQ(1500U, actual_t1); + EXPECT_EQ(2400U, actual_t2); ASSERT_TRUE(client.getTeeTimes(pd_iaid, actual_t1, actual_t2)); - EXPECT_EQ(1500, actual_t1); - EXPECT_EQ(2400, actual_t2); + EXPECT_EQ(1500U, actual_t1); + EXPECT_EQ(2400U, actual_t2); } // This test verifies that custom percentages for T1 and T2 @@ -220,26 +220,24 @@ TEST_F(TeeTest, calculateTimers) { uint32_t actual_t2; ASSERT_TRUE(client.getTeeTimes(na_iaid, actual_t1, actual_t2)); - EXPECT_EQ(1350, actual_t1); - EXPECT_EQ(2100, actual_t2); + EXPECT_EQ(1350U, actual_t1); + EXPECT_EQ(2100U, actual_t2); ASSERT_TRUE(client.getTeeTimes(pd_iaid, actual_t1, actual_t2)); - EXPECT_EQ(1350, actual_t1); - EXPECT_EQ(2100, actual_t2); + EXPECT_EQ(1350U, actual_t1); + EXPECT_EQ(2100U, actual_t2); // Let's renew the leases. ASSERT_NO_THROW(client.doRenew()); // Now check the timers again. ASSERT_TRUE(client.getTeeTimes(na_iaid, actual_t1, actual_t2)); - EXPECT_EQ(1350, actual_t1); - EXPECT_EQ(2100, actual_t2); + EXPECT_EQ(1350U, actual_t1); + EXPECT_EQ(2100U, actual_t2); ASSERT_TRUE(client.getTeeTimes(pd_iaid, actual_t1, actual_t2)); - EXPECT_EQ(1350, actual_t1); - EXPECT_EQ(2100, actual_t2); + EXPECT_EQ(1350U, actual_t1); + EXPECT_EQ(2100U, actual_t2); } - - } // end of anonymous namespace diff --git a/src/bin/dhcp6/tests/vendor_opts_unittest.cc b/src/bin/dhcp6/tests/vendor_opts_unittest.cc index a990a501db..c2b3b6aab8 100644 --- a/src/bin/dhcp6/tests/vendor_opts_unittest.cc +++ b/src/bin/dhcp6/tests/vendor_opts_unittest.cc @@ -1435,7 +1435,7 @@ TEST_F(VendorOptsTest, vendorNeverSend) { // But the vendor option response is not empty. const OptionCollection& opts = vendor_resp->getOptions(); - ASSERT_EQ(1, opts.size()); + ASSERT_EQ(1U, opts.size()); EXPECT_TRUE(vendor_resp->getOption(10)); } @@ -1589,7 +1589,7 @@ TEST_F(VendorOptsTest, vendorOpsInResponseOnly) { // Check that it includes vendor opts with vendor-id = 25167 OptionVendorPtr rsp_vopts = boost::dynamic_pointer_cast(rsp); ASSERT_TRUE(rsp_vopts); - EXPECT_EQ(25167, rsp_vopts->getVendorId()); + EXPECT_EQ(25167U, rsp_vopts->getVendorId()); // Now check that it contains suboption 2 with appropriate content. OptionPtr subopt2 = rsp_vopts->getOption(2); @@ -1694,7 +1694,7 @@ TEST_F(VendorOptsTest, twoVendors) { // Check whether there are vendor-class options. const OptionCollection& classes = client.getContext().response_->getOptions(D6O_VENDOR_CLASS); - ASSERT_EQ(2, classes.size()); + ASSERT_EQ(2U, classes.size()); OptionVendorClassPtr opt_class1234; OptionVendorClassPtr opt_class5678; for (auto const& opt : classes) { @@ -1703,30 +1703,30 @@ TEST_F(VendorOptsTest, twoVendors) { boost::dynamic_pointer_cast(opt.second); ASSERT_TRUE(opt_class); uint32_t vendor_id = opt_class->getVendorId(); - if (vendor_id == 1234) { + if (vendor_id == 1234U) { ASSERT_FALSE(opt_class1234); opt_class1234 = opt_class; continue; } - ASSERT_EQ(5678, vendor_id); + ASSERT_EQ(5678U, vendor_id); ASSERT_FALSE(opt_class5678); opt_class5678 = opt_class; } // Verify first vendor-class option. ASSERT_TRUE(opt_class1234); - ASSERT_EQ(1, opt_class1234->getTuplesNum()); + ASSERT_EQ(1U, opt_class1234->getTuplesNum()); EXPECT_EQ("foo", opt_class1234->getTuple(0).getText()); // Verify second vendor-class option. ASSERT_TRUE(opt_class5678); - ASSERT_EQ(1, opt_class5678->getTuplesNum()); + ASSERT_EQ(1U, opt_class5678->getTuplesNum()); EXPECT_EQ("bar", opt_class5678->getTuple(0).getText()); // Check whether there are vendor-opts options. const OptionCollection& options = client.getContext().response_->getOptions(D6O_VENDOR_OPTS); - ASSERT_EQ(2, options.size()); + ASSERT_EQ(2U, options.size()); OptionVendorPtr opt_opts1234; OptionVendorPtr opt_opts5678; for (auto const& opt : options) { @@ -1735,12 +1735,12 @@ TEST_F(VendorOptsTest, twoVendors) { boost::dynamic_pointer_cast(opt.second); ASSERT_TRUE(opt_opts); uint32_t vendor_id = opt_opts->getVendorId(); - if (vendor_id == 1234) { + if (vendor_id == 1234U) { ASSERT_FALSE(opt_opts1234); opt_opts1234 = opt_opts; continue; } - ASSERT_EQ(5678, vendor_id); + ASSERT_EQ(5678U, vendor_id); ASSERT_FALSE(opt_opts5678); opt_opts5678 = opt_opts; } @@ -1748,10 +1748,10 @@ TEST_F(VendorOptsTest, twoVendors) { // Verify first vendor-opts option. ASSERT_TRUE(opt_opts1234); OptionCollection subs1234 = opt_opts1234->getOptions(); - ASSERT_EQ(1, subs1234.size()); + ASSERT_EQ(1U, subs1234.size()); OptionPtr sub1234 = subs1234.begin()->second; ASSERT_TRUE(sub1234); - EXPECT_EQ(123, sub1234->getType()); + EXPECT_EQ(123U, sub1234->getType()); OptionStringPtr opt_foo = boost::dynamic_pointer_cast(sub1234); ASSERT_TRUE(opt_foo); @@ -1760,10 +1760,10 @@ TEST_F(VendorOptsTest, twoVendors) { // Verify second vendor-opts option. ASSERT_TRUE(opt_opts5678); OptionCollection subs5678 = opt_opts5678->getOptions(); - ASSERT_EQ(1, subs5678.size()); + ASSERT_EQ(1U, subs5678.size()); OptionPtr sub5678 = subs5678.begin()->second; ASSERT_TRUE(sub5678); - EXPECT_EQ(456, sub5678->getType()); + EXPECT_EQ(456U, sub5678->getType()); OptionStringPtr opt_bar = boost::dynamic_pointer_cast(sub5678); ASSERT_TRUE(opt_bar); @@ -1862,7 +1862,7 @@ TEST_F(VendorOptsTest, threeVendors) { // Check whether there are vendor-opts options. const OptionCollection& options = client.getContext().response_->getOptions(D6O_VENDOR_OPTS); - ASSERT_EQ(3, options.size()); + ASSERT_EQ(3U, options.size()); OptionVendorPtr opt_opts1234; OptionVendorPtr opt_docsis; OptionVendorPtr opt_opts5678; @@ -1872,7 +1872,7 @@ TEST_F(VendorOptsTest, threeVendors) { boost::dynamic_pointer_cast(opt.second); ASSERT_TRUE(opt_opts); uint32_t vendor_id = opt_opts->getVendorId(); - if (vendor_id == 1234) { + if (vendor_id == 1234U) { ASSERT_FALSE(opt_opts1234); opt_opts1234 = opt_opts; continue; @@ -1882,7 +1882,7 @@ TEST_F(VendorOptsTest, threeVendors) { opt_docsis = opt_opts; continue; } - ASSERT_EQ(5678, vendor_id); + ASSERT_EQ(5678U, vendor_id); ASSERT_FALSE(opt_opts5678); opt_opts5678 = opt_opts; } @@ -1890,10 +1890,10 @@ TEST_F(VendorOptsTest, threeVendors) { // Verify first vendor-opts option. ASSERT_TRUE(opt_opts1234); OptionCollection subs1234 = opt_opts1234->getOptions(); - ASSERT_EQ(1, subs1234.size()); + ASSERT_EQ(1U, subs1234.size()); OptionPtr sub1234 = subs1234.begin()->second; ASSERT_TRUE(sub1234); - EXPECT_EQ(123, sub1234->getType()); + EXPECT_EQ(123U, sub1234->getType()); OptionStringPtr opt_foo = boost::dynamic_pointer_cast(sub1234); ASSERT_TRUE(opt_foo); @@ -1902,10 +1902,10 @@ TEST_F(VendorOptsTest, threeVendors) { // Verify DOCSIS vendor-opts option. ASSERT_TRUE(opt_docsis); OptionCollection subs_docsis = opt_docsis->getOptions(); - ASSERT_EQ(1, subs_docsis.size()); + ASSERT_EQ(1U, subs_docsis.size()); OptionPtr cfile = subs_docsis.begin()->second; ASSERT_TRUE(cfile); - EXPECT_EQ(33, cfile->getType()); + EXPECT_EQ(33U, cfile->getType()); OptionStringPtr cfile_str = boost::dynamic_pointer_cast(cfile); ASSERT_TRUE(cfile_str); EXPECT_EQ("normal_erouter_v6.cm", cfile_str->getValue()); @@ -1913,10 +1913,10 @@ TEST_F(VendorOptsTest, threeVendors) { // Verify last vendor-opts option. ASSERT_TRUE(opt_opts5678); OptionCollection subs5678 = opt_opts5678->getOptions(); - ASSERT_EQ(1, subs5678.size()); + ASSERT_EQ(1U, subs5678.size()); OptionPtr sub5678 = subs5678.begin()->second; ASSERT_TRUE(sub5678); - EXPECT_EQ(456, sub5678->getType()); + EXPECT_EQ(456U, sub5678->getType()); OptionStringPtr opt_bar = boost::dynamic_pointer_cast(sub5678); ASSERT_TRUE(opt_bar); diff --git a/src/bin/netconf/tests/netconf_cfg_mgr_unittests.cc b/src/bin/netconf/tests/netconf_cfg_mgr_unittests.cc index da85551be8..9252a32354 100644 --- a/src/bin/netconf/tests/netconf_cfg_mgr_unittests.cc +++ b/src/bin/netconf/tests/netconf_cfg_mgr_unittests.cc @@ -71,7 +71,7 @@ TEST(NetconfCfgMgr, contextServer) { // Check managed server parameters. // By default, there are no server stored. ASSERT_TRUE(ctx.getCfgServersMap()); - EXPECT_EQ(0, ctx.getCfgServersMap()->size()); + EXPECT_EQ(0U, ctx.getCfgServersMap()->size()); CfgControlSocketPtr socket1(new CfgControlSocket(CfgControlSocket::Type::UNIX, @@ -93,7 +93,7 @@ TEST(NetconfCfgMgr, contextServer) { EXPECT_NO_THROW_LOG(ctx.getCfgServersMap()->insert(make_pair("d2", server1))); // Now check the values returned - EXPECT_EQ(1, ctx.getCfgServersMap()->size()); + EXPECT_EQ(1U, ctx.getCfgServersMap()->size()); ASSERT_NO_THROW_LOG(ctx.getCfgServersMap()->at("d2")); EXPECT_EQ(server1, ctx.getCfgServersMap()->at("d2")); EXPECT_FALSE(ctx.getCfgServersMap()->contains("dhcp4")); @@ -102,7 +102,7 @@ TEST(NetconfCfgMgr, contextServer) { EXPECT_NO_THROW_LOG(ctx.getCfgServersMap()->insert(make_pair("dhcp6", server2))); // Should be possible to retrieve two servers - EXPECT_EQ(2, ctx.getCfgServersMap()->size()); + EXPECT_EQ(2U, ctx.getCfgServersMap()->size()); ASSERT_NO_THROW_LOG(ctx.getCfgServersMap()->at("dhcp6")); EXPECT_EQ(server1, ctx.getCfgServersMap()->at("d2")); EXPECT_EQ(server2, ctx.getCfgServersMap()->at("dhcp6")); @@ -126,7 +126,7 @@ TEST(NetconfCfgMgr, contextHookParams) { libs.add("libthree.so", Element::fromJSON("{\"bar\": 42}")); const HooksConfig& stored_libs = ctx.getHooksConfig(); - EXPECT_EQ(3, stored_libs.get().size()); + EXPECT_EQ(3U, stored_libs.get().size()); EXPECT_EQ(libs.get(), stored_libs.get()); } @@ -139,7 +139,7 @@ TEST(NetconfCfgMgr, contextGlobals) { ElementPtr globals = ctx.getConfiguredGlobals(); ASSERT_TRUE(globals); ASSERT_EQ(Element::map, globals->getType()); - EXPECT_EQ(0, globals->mapValue().size()); + EXPECT_EQ(0U, globals->mapValue().size()); // Attempting to extract globals from a non-map should throw. EXPECT_THROW_MSG(ctx.extractConfiguredGlobals(Element::create(777)), BadValue, @@ -166,7 +166,7 @@ TEST(NetconfCfgMgr, contextGlobals) { globals = ctx.getConfiguredGlobals(); ASSERT_TRUE(globals); ASSERT_EQ(Element::map, globals->getType()); - EXPECT_NE(0, globals->mapValue().size()); + EXPECT_NE(0U, globals->mapValue().size()); // Maps and lists should be excluded. for (auto const& it : globals->mapValue()) { @@ -442,7 +442,7 @@ TEST_F(NetconfParserTest, configParseEmpty) { NetconfConfigPtr ctx = cfg_mgr_.getNetconfConfig(); ASSERT_TRUE(ctx); ASSERT_TRUE(ctx->getCfgServersMap()); - EXPECT_EQ(0, ctx->getCfgServersMap()->size()); + EXPECT_EQ(0U, ctx->getCfgServersMap()->size()); } // This test verifies if a config with only globals is handled properly. @@ -452,7 +452,7 @@ TEST_F(NetconfParserTest, configParseGlobalOnly) { NetconfConfigPtr ctx = cfg_mgr_.getNetconfConfig(); ASSERT_TRUE(ctx); ASSERT_TRUE(ctx->getCfgServersMap()); - EXPECT_EQ(0, ctx->getCfgServersMap()->size()); + EXPECT_EQ(0U, ctx->getCfgServersMap()->size()); ConstElementPtr globals = ctx->getConfiguredGlobals(); ASSERT_TRUE(globals); string expected = "{ " @@ -470,7 +470,7 @@ TEST_F(NetconfParserTest, configParseEmptyCfgServer) { NetconfConfigPtr ctx = cfg_mgr_.getNetconfConfig(); ASSERT_TRUE(ctx); ASSERT_TRUE(ctx->getCfgServersMap()); - EXPECT_EQ(1, ctx->getCfgServersMap()->size()); + EXPECT_EQ(1U, ctx->getCfgServersMap()->size()); ASSERT_NO_THROW_LOG(ctx->getCfgServersMap()->at("dhcp4")); CfgServerPtr server = ctx->getCfgServersMap()->at("dhcp4"); ASSERT_TRUE(server); @@ -502,7 +502,7 @@ TEST_F(NetconfParserTest, configParseServerDhcp4) { NetconfConfigPtr ctx = cfg_mgr_.getNetconfConfig(); ASSERT_TRUE(ctx); ASSERT_TRUE(ctx->getCfgServersMap()); - EXPECT_EQ(1, ctx->getCfgServersMap()->size()); + EXPECT_EQ(1U, ctx->getCfgServersMap()->size()); ASSERT_NO_THROW_LOG(ctx->getCfgServersMap()->at("dhcp4")); CfgServerPtr server = ctx->getCfgServersMap()->at("dhcp4"); ASSERT_TRUE(server); @@ -525,7 +525,7 @@ TEST_F(NetconfParserTest, configParseServerD2) { NetconfConfigPtr ctx = cfg_mgr_.getNetconfConfig(); ASSERT_TRUE(ctx); ASSERT_TRUE(ctx->getCfgServersMap()); - EXPECT_EQ(1, ctx->getCfgServersMap()->size()); + EXPECT_EQ(1U, ctx->getCfgServersMap()->size()); ASSERT_NO_THROW_LOG(ctx->getCfgServersMap()->at("d2")); CfgServerPtr server = ctx->getCfgServersMap()->at("d2"); ASSERT_TRUE(server); @@ -547,7 +547,7 @@ TEST_F(NetconfParserTest, configParseServerDhcp6) { NetconfConfigPtr ctx = cfg_mgr_.getNetconfConfig(); ASSERT_TRUE(ctx); ASSERT_TRUE(ctx->getCfgServersMap()); - EXPECT_EQ(1, ctx->getCfgServersMap()->size()); + EXPECT_EQ(1U, ctx->getCfgServersMap()->size()); ASSERT_NO_THROW_LOG(ctx->getCfgServersMap()->at("dhcp6")); CfgServerPtr server = ctx->getCfgServersMap()->at("dhcp6"); ASSERT_TRUE(server); @@ -567,7 +567,7 @@ TEST_F(NetconfParserTest, configParse4Servers) { NetconfConfigPtr ctx = cfg_mgr_.getNetconfConfig(); ASSERT_TRUE(ctx); ASSERT_TRUE(ctx->getCfgServersMap()); - EXPECT_EQ(3, ctx->getCfgServersMap()->size()); + EXPECT_EQ(3U, ctx->getCfgServersMap()->size()); ASSERT_NO_THROW_LOG(ctx->getCfgServersMap()->at("dhcp4")); CfgServerPtr server = ctx->getCfgServersMap()->at("dhcp4"); @@ -678,7 +678,7 @@ TEST_F(NetconfParserTest, configParseHooks) { // The context now should have the library specified. NetconfConfigPtr ctx = cfg_mgr_.getNetconfConfig(); const HookLibsCollection libs = ctx->getHooksConfig().get(); - ASSERT_EQ(1, libs.size()); + ASSERT_EQ(1U, libs.size()); EXPECT_EQ(string(BASIC_CALLOUT_LIBRARY), libs[0].libname_); ASSERT_TRUE(libs[0].parameters_); EXPECT_EQ("{ \"param1\": \"foo\" }", libs[0].parameters_->str()); @@ -693,7 +693,7 @@ TEST_F(NetconfParserTest, comments) { // Check global user context. ConstElementPtr ctx = netconf_ctx->getContext(); ASSERT_TRUE(ctx); - ASSERT_EQ(1, ctx->size()); + ASSERT_EQ(1U, ctx->size()); ASSERT_TRUE(ctx->get("comment")); EXPECT_EQ("\"Indirect comment\"", ctx->get("comment")->str()); @@ -706,7 +706,7 @@ TEST_F(NetconfParserTest, comments) { // Check DHCP4 server user context. ConstElementPtr ctx4 = server->getContext(); ASSERT_TRUE(ctx4); - ASSERT_EQ(1, ctx4->size()); + ASSERT_EQ(1U, ctx4->size()); ASSERT_TRUE(ctx4->get("comment")); EXPECT_EQ("\"dhcp4 server\"", ctx4->get("comment")->str()); @@ -722,7 +722,7 @@ TEST_F(NetconfParserTest, comments) { // Check DHCP6 control socket user context. ConstElementPtr ctx6 = socket->getContext(); ASSERT_TRUE(ctx6); - ASSERT_EQ(1, ctx6->size()); + ASSERT_EQ(1U, ctx6->size()); ASSERT_TRUE(ctx6->get("version")); EXPECT_EQ("1", ctx6->get("version")->str()); } diff --git a/src/bin/netconf/tests/netconf_unittests.cc b/src/bin/netconf/tests/netconf_unittests.cc index 4959ebd672..33a762cfff 100644 --- a/src/bin/netconf/tests/netconf_unittests.cc +++ b/src/bin/netconf/tests/netconf_unittests.cc @@ -352,29 +352,29 @@ TEST_F(NetconfAgentTest, initSysrepo) { EXPECT_NO_THROW_LOG(agent_->initSysrepo()); EXPECT_TRUE(agent_->startup_sess_); EXPECT_TRUE(agent_->running_sess_); - EXPECT_EQ(0, agent_->subscriptions_.size()); - EXPECT_LE(16, agent_->modules_.size()); + EXPECT_EQ(0U, agent_->subscriptions_.size()); + EXPECT_LE(16U, agent_->modules_.size()); } // Verifies that the checkModule method emits expected errors. TEST_F(NetconfAgentLogTest, checkModule) { // Various modules should be available. - EXPECT_EQ(1, YANG_REVISIONS.count("keatest-module")); - ASSERT_EQ(1, YANG_REVISIONS.count("kea-dhcp4-server")); - ASSERT_EQ(1, YANG_REVISIONS.count("kea-dhcp6-server")); + EXPECT_EQ(1U, YANG_REVISIONS.count("keatest-module")); + ASSERT_EQ(1U, YANG_REVISIONS.count("kea-dhcp4-server")); + ASSERT_EQ(1U, YANG_REVISIONS.count("kea-dhcp6-server")); // Non-existing modules should not. - EXPECT_EQ(0, agent_->modules_.count("does-not-exist")); + EXPECT_EQ(0U, agent_->modules_.count("does-not-exist")); // kea-dhcp[46]-server should be available. EXPECT_NO_THROW_LOG(agent_->initSysrepo()); - EXPECT_EQ(1, agent_->modules_.count("kea-dhcp4-server")); - EXPECT_EQ(1, agent_->modules_.count("kea-dhcp6-server")); + EXPECT_EQ(1U, agent_->modules_.count("kea-dhcp4-server")); + EXPECT_EQ(1U, agent_->modules_.count("kea-dhcp6-server")); EXPECT_TRUE(agent_->checkModule("kea-dhcp4-server")); EXPECT_TRUE(agent_->checkModule("kea-dhcp6-server")); // Unknown module should emit a missing error. - EXPECT_EQ(0, agent_->modules_.count("does-not-exist")); + EXPECT_EQ(0U, agent_->modules_.count("does-not-exist")); EXPECT_FALSE(agent_->checkModule("does-not-exist")); addString("NETCONF_MODULE_MISSING_ERR Missing essential module " "does-not-exist in sysrepo"); @@ -401,13 +401,13 @@ TEST_F(NetconfAgentLogTest, checkModule) { // Verifies that the checkModules method emits expected warnings. TEST_F(NetconfAgentLogTest, checkModules) { // kea-dhcp[46]-server must be in YANG_REVISIONS. - ASSERT_EQ(1, YANG_REVISIONS.count("kea-dhcp4-server")); - ASSERT_EQ(1, YANG_REVISIONS.count("kea-dhcp6-server")); + ASSERT_EQ(1U, YANG_REVISIONS.count("kea-dhcp4-server")); + ASSERT_EQ(1U, YANG_REVISIONS.count("kea-dhcp6-server")); // kea-dhcp[46]-server should be available. EXPECT_NO_THROW_LOG(agent_->initSysrepo()); - EXPECT_EQ(1, agent_->modules_.count("kea-dhcp4-server")); - EXPECT_EQ(1, agent_->modules_.count("kea-dhcp6-server")); + EXPECT_EQ(1U, agent_->modules_.count("kea-dhcp4-server")); + EXPECT_EQ(1U, agent_->modules_.count("kea-dhcp6-server")); // Run checkModules but it will be indirectly checked as // emitting nothing. @@ -601,7 +601,7 @@ TEST_F(NetconfAgentTest, keaConfig) { // Get service pair. CfgServersMapPtr servers_map = ctx->getCfgServersMap(); ASSERT_TRUE(servers_map); - ASSERT_EQ(1, servers_map->size()); + ASSERT_EQ(1U, servers_map->size()); CfgServersMapPair service_pair = *servers_map->begin(); // Launch server. @@ -617,7 +617,7 @@ TEST_F(NetconfAgentTest, keaConfig) { waitStopped(); // Check request. - ASSERT_EQ(1, requests_.size()); + ASSERT_EQ(1U, requests_.size()); const string& request_str = requests_[0]; ElementPtr request; ASSERT_NO_THROW_LOG(request = Element::fromJSON(request_str)); @@ -631,7 +631,7 @@ TEST_F(NetconfAgentTest, keaConfig) { // EXPECT_EQ(prettyPrint(expected), prettyPrint(request)); // Check response. - ASSERT_EQ(1, responses_.size()); + ASSERT_EQ(1U, responses_.size()); const string& response_str = responses_[0]; ElementPtr response; ASSERT_NO_THROW_LOG(response = Element::fromJSON(response_str)); @@ -702,7 +702,7 @@ TEST_F(NetconfAgentTest, yangConfig) { // Get service pair. CfgServersMapPtr servers_map = ctx->getCfgServersMap(); ASSERT_TRUE(servers_map); - ASSERT_EQ(1, servers_map->size()); + ASSERT_EQ(1U, servers_map->size()); CfgServersMapPair service_pair = *servers_map->begin(); // Launch server. @@ -718,7 +718,7 @@ TEST_F(NetconfAgentTest, yangConfig) { waitStopped(); // Check request. - ASSERT_EQ(1, requests_.size()); + ASSERT_EQ(1U, requests_.size()); const string& request_str = requests_[0]; ElementPtr request; ASSERT_NO_THROW_LOG(request = Element::fromJSON(request_str)); @@ -747,7 +747,7 @@ TEST_F(NetconfAgentTest, yangConfig) { EXPECT_EQ(prettyPrint(expected), prettyPrint(request)); // Check response. - ASSERT_EQ(1, responses_.size()); + ASSERT_EQ(1U, responses_.size()); const string& response_str = responses_[0]; ElementPtr response; ASSERT_NO_THROW_LOG(response = Element::fromJSON(response_str)); @@ -798,15 +798,15 @@ TEST_F(NetconfAgentTest, subscribeToDataChanges) { // Get service pair. CfgServersMapPtr servers_map = ctx->getCfgServersMap(); ASSERT_TRUE(servers_map); - ASSERT_EQ(1, servers_map->size()); + ASSERT_EQ(1U, servers_map->size()); CfgServersMapPair service_pair = *servers_map->begin(); // Try subscribeToDataChanges. - EXPECT_EQ(0, agent_->subscriptions_.size()); + EXPECT_EQ(0U, agent_->subscriptions_.size()); ASSERT_NO_THROW_LOG(agent_->initSysrepo()); - EXPECT_EQ(0, agent_->subscriptions_.size()); + EXPECT_EQ(0U, agent_->subscriptions_.size()); EXPECT_NO_THROW_LOG(agent_->subscribeToDataChanges(service_pair)); - EXPECT_EQ(1, agent_->subscriptions_.size()); + EXPECT_EQ(1U, agent_->subscriptions_.size()); /// Unsubscribe. EXPECT_NO_THROW_LOG(agent_->subscriptions_.clear()); @@ -871,13 +871,13 @@ TEST_F(NetconfAgentTest, update) { // Get service pair. CfgServersMapPtr servers_map = ctx->getCfgServersMap(); ASSERT_TRUE(servers_map); - ASSERT_EQ(1, servers_map->size()); + ASSERT_EQ(1U, servers_map->size()); CfgServersMapPair service_pair = *servers_map->begin(); // Subscribe to YANG changes. - EXPECT_EQ(0, agent_->subscriptions_.size()); + EXPECT_EQ(0U, agent_->subscriptions_.size()); EXPECT_NO_THROW_LOG(agent_->subscribeToDataChanges(service_pair)); - EXPECT_EQ(1, agent_->subscriptions_.size()); + EXPECT_EQ(1U, agent_->subscriptions_.size()); // Launch server. thread_.reset(new thread([this]() { fakeServer(); signalStopped(); })); @@ -902,7 +902,7 @@ TEST_F(NetconfAgentTest, update) { waitStopped(); // Check request. - ASSERT_EQ(1, requests_.size()); + ASSERT_EQ(1U, requests_.size()); const string& request_str = requests_[0]; ElementPtr request; ASSERT_NO_THROW_LOG(request = Element::fromJSON(request_str)); @@ -931,7 +931,7 @@ TEST_F(NetconfAgentTest, update) { EXPECT_EQ(prettyPrint(expected), prettyPrint(request)); // Check response. - ASSERT_EQ(1, responses_.size()); + ASSERT_EQ(1U, responses_.size()); const string& response_str = responses_[0]; ElementPtr response; ASSERT_NO_THROW_LOG(response = Element::fromJSON(response_str)); @@ -1000,13 +1000,13 @@ TEST_F(NetconfAgentTest, validate) { // Get service pair. CfgServersMapPtr servers_map = ctx->getCfgServersMap(); ASSERT_TRUE(servers_map); - ASSERT_EQ(1, servers_map->size()); + ASSERT_EQ(1U, servers_map->size()); CfgServersMapPair service_pair = *servers_map->begin(); // Subscribe to YANG changes. - EXPECT_EQ(0, agent_->subscriptions_.size()); + EXPECT_EQ(0U, agent_->subscriptions_.size()); EXPECT_NO_THROW_LOG(agent_->subscribeToDataChanges(service_pair)); - EXPECT_EQ(1, agent_->subscriptions_.size()); + EXPECT_EQ(1U, agent_->subscriptions_.size()); // Launch server twice. thread_.reset(new thread([this]() { @@ -1035,7 +1035,7 @@ TEST_F(NetconfAgentTest, validate) { waitStopped(); // Check that the fake server received the first request. - ASSERT_LE(1, requests_.size()); + ASSERT_LE(1U, requests_.size()); string request_str = requests_[0]; ElementPtr request; ASSERT_NO_THROW_LOG(request = Element::fromJSON(request_str)); @@ -1064,7 +1064,7 @@ TEST_F(NetconfAgentTest, validate) { EXPECT_EQ(prettyPrint(expected), prettyPrint(request)); // Check that the fake server received the second request. - ASSERT_EQ(2, requests_.size()); + ASSERT_EQ(2U, requests_.size()); request_str = requests_[1]; ASSERT_NO_THROW_LOG(request = Element::fromJSON(request_str)); expected_str = "{\n" @@ -1091,7 +1091,7 @@ TEST_F(NetconfAgentTest, validate) { EXPECT_EQ(prettyPrint(expected), prettyPrint(request)); // Check responses. - ASSERT_EQ(2, responses_.size()); + ASSERT_EQ(2U, responses_.size()); string response_str = responses_[0]; ElementPtr response; ASSERT_NO_THROW_LOG(response = Element::fromJSON(response_str)); @@ -1162,13 +1162,13 @@ TEST_F(NetconfAgentTest, noValidate) { // Get service pair. CfgServersMapPtr servers_map = ctx->getCfgServersMap(); ASSERT_TRUE(servers_map); - ASSERT_EQ(1, servers_map->size()); + ASSERT_EQ(1U, servers_map->size()); CfgServersMapPair service_pair = *servers_map->begin(); // Subscribe to YANG changes. - EXPECT_EQ(0, agent_->subscriptions_.size()); + EXPECT_EQ(0U, agent_->subscriptions_.size()); EXPECT_NO_THROW_LOG(agent_->subscribeToDataChanges(service_pair)); - EXPECT_EQ(1, agent_->subscriptions_.size()); + EXPECT_EQ(1U, agent_->subscriptions_.size()); // Change configuration (add invalid user context). const YRTree tree1 = YangRepr::buildTreeFromVector({ diff --git a/src/bin/perfdhcp/tests/avalanche_scen_unittest.cc b/src/bin/perfdhcp/tests/avalanche_scen_unittest.cc index 3631848d0c..c1d956b256 100644 --- a/src/bin/perfdhcp/tests/avalanche_scen_unittest.cc +++ b/src/bin/perfdhcp/tests/avalanche_scen_unittest.cc @@ -230,10 +230,10 @@ TEST_F(AvalancheScenTest, Packet4Exchange) { // Check if basic exchange of packets happened. No retransmissions expected. EXPECT_EQ(as.total_resent_, 0); EXPECT_EQ(as.fake_sock_.sent_cnt_, 20); // Discovery + Request - EXPECT_EQ(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::DO), 10); - EXPECT_EQ(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::DO), 10); - EXPECT_EQ(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RA), 10); - EXPECT_EQ(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RA), 10); + EXPECT_EQ(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::DO), 10U); + EXPECT_EQ(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::DO), 10U); + EXPECT_EQ(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RA), 10U); + EXPECT_EQ(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RA), 10U); } @@ -247,8 +247,8 @@ TEST_F(AvalancheScenTest, Packet4ExchangeOnlyDO) { // Check if DO exchange of packets happened only. No retransmissions expected. EXPECT_EQ(as.total_resent_, 0); EXPECT_EQ(as.fake_sock_.sent_cnt_, 10); // Discovery + Request - EXPECT_EQ(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::DO), 10); - EXPECT_EQ(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::DO), 10); + EXPECT_EQ(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::DO), 10U); + EXPECT_EQ(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::DO), 10U); EXPECT_THROW(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RA), isc::BadValue); } @@ -264,10 +264,10 @@ TEST_F(AvalancheScenTest, Packet4ExchangeWithRetransmissions) { // Check if basic exchange of packets happened. No retransmissions expected. EXPECT_EQ(as.total_resent_, 2); EXPECT_EQ(as.fake_sock_.sent_cnt_, 22); // Discovery + Request - EXPECT_EQ(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::DO), 10); - EXPECT_EQ(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::DO), 10); - EXPECT_EQ(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RA), 10); - EXPECT_EQ(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RA), 10); + EXPECT_EQ(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::DO), 10U); + EXPECT_EQ(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::DO), 10U); + EXPECT_EQ(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RA), 10U); + EXPECT_EQ(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RA), 10U); } @@ -281,10 +281,10 @@ TEST_F(AvalancheScenTest, Packet6Exchange) { // Check if basic exchange of packets happened. No retransmissions expected. EXPECT_EQ(as.total_resent_, 0); EXPECT_GE(as.fake_sock_.sent_cnt_, 20); // Solicit + Request - EXPECT_GE(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::SA), 10); - EXPECT_GE(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::SA), 10); - EXPECT_GE(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RR), 10); - EXPECT_GE(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RR), 10); + EXPECT_GE(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::SA), 10U); + EXPECT_GE(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::SA), 10U); + EXPECT_GE(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RR), 10U); + EXPECT_GE(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RR), 10U); } @@ -298,8 +298,8 @@ TEST_F(AvalancheScenTest, Packet6ExchangeOnlySA) { // Check if SA exchange of packets happened only. No retransmissions expected. EXPECT_EQ(as.total_resent_, 0); EXPECT_GE(as.fake_sock_.sent_cnt_, 10); // Solicit + Request - EXPECT_GE(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::SA), 10); - EXPECT_GE(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::SA), 10); + EXPECT_GE(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::SA), 10U); + EXPECT_GE(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::SA), 10U); EXPECT_THROW(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RR), isc::BadValue); } @@ -315,8 +315,8 @@ TEST_F(AvalancheScenTest, Packet6ExchangeWithRetransmissions) { // Check if basic exchange of packets happened. No retransmissions expected. EXPECT_EQ(as.total_resent_, 2); EXPECT_EQ(as.fake_sock_.sent_cnt_, 22); // Discovery + Request - EXPECT_EQ(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::SA), 10); - EXPECT_EQ(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::SA), 10); - EXPECT_EQ(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RR), 10); - EXPECT_EQ(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RR), 10); + EXPECT_EQ(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::SA), 10U); + EXPECT_EQ(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::SA), 10U); + EXPECT_EQ(as.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RR), 10U); + EXPECT_EQ(as.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RR), 10U); } diff --git a/src/bin/perfdhcp/tests/basic_scen_unittest.cc b/src/bin/perfdhcp/tests/basic_scen_unittest.cc index dcab97f6bb..1f8fcc1f6b 100644 --- a/src/bin/perfdhcp/tests/basic_scen_unittest.cc +++ b/src/bin/perfdhcp/tests/basic_scen_unittest.cc @@ -225,9 +225,9 @@ TEST_F(BasicScenTest, initial_settings) { processCmdLine(opt, "perfdhcp -6 -l ethx -r 50 -f 30 -F 10 all"); NakedBasicScen bs(opt); - EXPECT_EQ(50, bs.basic_rate_control_.getRate()); - EXPECT_EQ(30, bs.renew_rate_control_.getRate()); - EXPECT_EQ(10, bs.release_rate_control_.getRate()); + EXPECT_EQ(50U, bs.basic_rate_control_.getRate()); + EXPECT_EQ(30U, bs.renew_rate_control_.getRate()); + EXPECT_EQ(10U, bs.release_rate_control_.getRate()); } @@ -239,10 +239,10 @@ TEST_F(BasicScenTest, Packet4Exchange) { // The command line restricts the number of iterations to 10 // with -n 10 parameter. EXPECT_GE(bs.fake_sock_.sent_cnt_, 20); // Discovery + Request - EXPECT_GE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::DO), 10); - EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::DO), 10); - EXPECT_GE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RA), 10); - EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RA), 10); + EXPECT_GE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::DO), 10U); + EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::DO), 10U); + EXPECT_GE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RA), 10U); + EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RA), 10U); } TEST_F(BasicScenTest, Address4Unique) { @@ -253,12 +253,12 @@ TEST_F(BasicScenTest, Address4Unique) { NakedBasicScen bs(opt); bs.run(); EXPECT_GE(bs.fake_sock_.sent_cnt_, 5); // Discovery + Request - EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::DO), 1); - EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RA), 1); - EXPECT_GE(bs.tc_.getAllUniqueAddrReply().size(), 1); - EXPECT_GE(bs.tc_.getAllUniqueAddrAdvert().size(), 1); - EXPECT_EQ(bs.tc_.getStatsMgr().getNonUniqueAddrNum(ExchangeType::DO), 9); - EXPECT_EQ(bs.tc_.getStatsMgr().getNonUniqueAddrNum(ExchangeType::RA), 9); + EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::DO), 1U); + EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RA), 1U); + EXPECT_GE(bs.tc_.getAllUniqueAddrReply().size(), 1U); + EXPECT_GE(bs.tc_.getAllUniqueAddrAdvert().size(), 1U); + EXPECT_EQ(bs.tc_.getStatsMgr().getNonUniqueAddrNum(ExchangeType::DO), 9U); + EXPECT_EQ(bs.tc_.getStatsMgr().getNonUniqueAddrNum(ExchangeType::RA), 9U); } TEST_F(BasicScenTest, Address6Unique) { @@ -269,12 +269,12 @@ TEST_F(BasicScenTest, Address6Unique) { NakedBasicScen bs(opt); bs.run(); EXPECT_GE(bs.fake_sock_.sent_cnt_, 5); // Solicit + Request - EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::SA), 1); - EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RR), 1); - EXPECT_GE(bs.tc_.getAllUniqueAddrReply().size(), 1); - EXPECT_GE(bs.tc_.getAllUniqueAddrAdvert().size(), 1); - EXPECT_EQ(bs.tc_.getStatsMgr().getNonUniqueAddrNum(ExchangeType::SA), 9); - EXPECT_EQ(bs.tc_.getStatsMgr().getNonUniqueAddrNum(ExchangeType::RR), 9); + EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::SA), 1U); + EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RR), 1U); + EXPECT_GE(bs.tc_.getAllUniqueAddrReply().size(), 1U); + EXPECT_GE(bs.tc_.getAllUniqueAddrAdvert().size(), 1U); + EXPECT_EQ(bs.tc_.getStatsMgr().getNonUniqueAddrNum(ExchangeType::SA), 9U); + EXPECT_EQ(bs.tc_.getStatsMgr().getNonUniqueAddrNum(ExchangeType::RR), 9U); } TEST_F(BasicScenTest, Packet4ExchangeMaxDrop10Proc) { @@ -297,17 +297,17 @@ TEST_F(BasicScenTest, Packet4ExchangeMaxDrop10Proc) { EXPECT_GE(bs.fake_sock_.sent_cnt_, 15); // Discovery + Request EXPECT_LE(bs.fake_sock_.sent_cnt_, 20); // Discovery + Request - EXPECT_GE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::DO), 1); - EXPECT_LE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::DO), 15); + EXPECT_GE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::DO), 1U); + EXPECT_LE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::DO), 15U); - EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::DO), 1); - EXPECT_LE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::DO), 15); + EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::DO), 1U); + EXPECT_LE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::DO), 15U); - EXPECT_GE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RA), 1); - EXPECT_LE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RA), 15); + EXPECT_GE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RA), 1U); + EXPECT_LE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RA), 15U); - EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RA), 1); - EXPECT_LE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RA), 15); + EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RA), 1U); + EXPECT_LE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RA), 15U); } @@ -320,10 +320,10 @@ TEST_F(BasicScenTest, Packet6Exchange) { NakedBasicScen bs(opt); bs.run(); EXPECT_GE(bs.fake_sock_.sent_cnt_, 20); // Solicit + Request - EXPECT_GE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::SA), 10); - EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::SA), 10); - EXPECT_GE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RR), 10); - EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RR), 10); + EXPECT_GE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::SA), 10U); + EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::SA), 10U); + EXPECT_GE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RR), 10U); + EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RR), 10U); } TEST_F(BasicScenTest, Packet6ExchangeMaxDrop3Pkt) { @@ -349,15 +349,15 @@ TEST_F(BasicScenTest, Packet6ExchangeMaxDrop3Pkt) { EXPECT_GE(bs.fake_sock_.sent_cnt_, 10); EXPECT_LE(bs.fake_sock_.sent_cnt_, 20); - EXPECT_GE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::SA), 1); - EXPECT_LE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::SA), 15); + EXPECT_GE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::SA), 1U); + EXPECT_LE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::SA), 15U); - EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::SA), 1); - EXPECT_LE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::SA), 15); + EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::SA), 1U); + EXPECT_LE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::SA), 15U); - EXPECT_GE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RR), 1); - EXPECT_LE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RR), 15); + EXPECT_GE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RR), 1U); + EXPECT_LE(bs.tc_.getStatsMgr().getSentPacketsNum(ExchangeType::RR), 15U); - EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RR), 1); - EXPECT_LE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RR), 15); + EXPECT_GE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RR), 1U); + EXPECT_LE(bs.tc_.getStatsMgr().getRcvdPacketsNum(ExchangeType::RR), 15U); } diff --git a/src/bin/perfdhcp/tests/command_options_unittest.cc b/src/bin/perfdhcp/tests/command_options_unittest.cc index b068a5c5bb..84173afdec 100644 --- a/src/bin/perfdhcp/tests/command_options_unittest.cc +++ b/src/bin/perfdhcp/tests/command_options_unittest.cc @@ -169,19 +169,19 @@ protected: TEST_F(CommandOptionsTest, Defaults) { CommandOptions opt; EXPECT_NO_THROW(process(opt, "perfdhcp 192.168.0.1")); - EXPECT_EQ(4, opt.getIpVersion()); + EXPECT_EQ(4U, opt.getIpVersion()); EXPECT_EQ(CommandOptions::DORA_SARR, opt.getExchangeMode()); EXPECT_TRUE(opt.getLeaseType().is(CommandOptions::LeaseType::ADDRESS)); EXPECT_EQ(0, opt.getRate()); EXPECT_EQ(0, opt.getRenewRate()); EXPECT_EQ(0, opt.getReleaseRate()); EXPECT_EQ(0, opt.getReportDelay()); - EXPECT_EQ(0, opt.getClientsNum()); + EXPECT_EQ(0U, opt.getClientsNum()); // default mac const uint8_t mac[6] = { 0x00, 0x0C, 0x01, 0x02, 0x03, 0x04 }; std::vector v1 = opt.getMacTemplate(); - ASSERT_EQ(6, v1.size()); + ASSERT_EQ(6U, v1.size()); EXPECT_TRUE(std::equal(v1.begin(), v1.end(), mac)); // Check if DUID is initialized. The DUID-LLT is expected @@ -192,7 +192,7 @@ TEST_F(CommandOptionsTest, Defaults) { // DUID_LLT value, two octets of hardware type, 4 octets // of time value and 6 octets of variable link layer (MAC) // address. - const int duid_llt_size = 14; + const size_t duid_llt_size = 14; // DUID is not given from the command line but it is supposed // to be initialized by the CommandOptions private method // generateDuidTemplate(). @@ -218,8 +218,8 @@ TEST_F(CommandOptionsTest, Defaults) { EXPECT_GE(duration_sec, duration_from_template); } - EXPECT_EQ(0, opt.getBase().size()); - EXPECT_EQ(0, opt.getNumRequests().size()); + EXPECT_EQ(0U, opt.getBase().size()); + EXPECT_EQ(0U, opt.getNumRequests().size()); EXPECT_EQ(0, opt.getPeriod()); for (size_t i = 0; i < opt.getDropTime().size(); ++i) { EXPECT_DOUBLE_EQ(1, opt.getDropTime()[i]); @@ -234,16 +234,16 @@ TEST_F(CommandOptionsTest, Defaults) { EXPECT_EQ(0, opt.getPreload()); EXPECT_EQ(0, opt.getLocalPort()); EXPECT_FALSE(opt.isSeeded()); - EXPECT_EQ(0, opt.getSeed()); + EXPECT_EQ(0U, opt.getSeed()); EXPECT_FALSE(opt.isBroadcast()); EXPECT_FALSE(opt.isRapidCommit()); EXPECT_FALSE(opt.isUseFirst()); EXPECT_FALSE(opt.getAddrUnique()); EXPECT_EQ(-1, opt.getIncreaseElapsedTime()); EXPECT_EQ(-1, opt.getWaitForElapsedTime()); - EXPECT_EQ(0, opt.getTemplateFiles().size()); - EXPECT_EQ(0, opt.getTransactionIdOffset().size()); - EXPECT_EQ(0, opt.getRandomOffset().size()); + EXPECT_EQ(0U, opt.getTemplateFiles().size()); + EXPECT_EQ(0U, opt.getTransactionIdOffset().size()); + EXPECT_EQ(0U, opt.getRandomOffset().size()); EXPECT_GT(0, opt.getElapsedTimeOffset()); EXPECT_GT(0, opt.getServerIdOffset()); EXPECT_GT(0, opt.getRequestedIpOffset()); @@ -296,12 +296,12 @@ TEST_F(CommandOptionsTest, UseRelayV6) { TEST_F(CommandOptionsTest, IpVersion) { CommandOptions opt; EXPECT_NO_THROW(process(opt, "perfdhcp -6 -l ethx -c -i all")); - EXPECT_EQ(6, opt.getIpVersion()); + EXPECT_EQ(6U, opt.getIpVersion()); EXPECT_EQ("ethx", opt.getLocalName()); EXPECT_TRUE(opt.isRapidCommit()); EXPECT_FALSE(opt.isBroadcast()); process(opt, "perfdhcp -4 -B -l ethx all"); - EXPECT_EQ(4, opt.getIpVersion()); + EXPECT_EQ(4U, opt.getIpVersion()); EXPECT_TRUE(opt.isBroadcast()); EXPECT_FALSE(opt.isRapidCommit()); @@ -318,17 +318,17 @@ TEST_F(CommandOptionsTest, LeaseType) { CommandOptions opt; // Check that the -e address-only works for IPv6. ASSERT_NO_THROW(process(opt, "perfdhcp -6 -l etx -e address-only all")); - EXPECT_EQ(6, opt.getIpVersion()); + EXPECT_EQ(6U, opt.getIpVersion()); EXPECT_EQ("etx", opt.getLocalName()); EXPECT_TRUE(opt.getLeaseType().is(CommandOptions::LeaseType::ADDRESS)); // Check that the -e address-only works for IPv4. ASSERT_NO_THROW(process(opt, "perfdhcp -4 -l etx -e address-only all")); - EXPECT_EQ(4, opt.getIpVersion()); + EXPECT_EQ(4U, opt.getIpVersion()); EXPECT_EQ("etx", opt.getLocalName()); EXPECT_TRUE(opt.getLeaseType().is(CommandOptions::LeaseType::ADDRESS)); // Check that the -e prefix-only works. ASSERT_NO_THROW(process(opt, "perfdhcp -6 -l etx -e prefix-only all")); - EXPECT_EQ(6, opt.getIpVersion()); + EXPECT_EQ(6U, opt.getIpVersion()); EXPECT_EQ("etx", opt.getLocalName()); EXPECT_TRUE(opt.getLeaseType().is(CommandOptions::LeaseType::PREFIX)); // Check that -e prefix-only must not coexist with -4 option. @@ -458,9 +458,9 @@ TEST_F(CommandOptionsTest, ReportDelay) { TEST_F(CommandOptionsTest, ClientsNum) { CommandOptions opt; EXPECT_NO_THROW(process(opt, "perfdhcp -R 200 -l ethx all")); - EXPECT_EQ(200, opt.getClientsNum()); + EXPECT_EQ(200U, opt.getClientsNum()); process(opt, "perfdhcp -R 0 -l ethx all"); - EXPECT_EQ(0, opt.getClientsNum()); + EXPECT_EQ(0U, opt.getClientsNum()); // Negative test cases // Number of clients must be non-negative integer @@ -535,12 +535,12 @@ TEST_F(CommandOptionsTest, Base) { TEST_F(CommandOptionsTest, DropTime) { CommandOptions opt; EXPECT_NO_THROW(process(opt, "perfdhcp -l ethx -d 12 all")); - ASSERT_EQ(2, opt.getDropTime().size()); + ASSERT_EQ(2U, opt.getDropTime().size()); EXPECT_DOUBLE_EQ(12, opt.getDropTime()[0]); EXPECT_DOUBLE_EQ(1, opt.getDropTime()[1]); EXPECT_NO_THROW(process(opt, "perfdhcp -l ethx -d 2 -d 4.7 all")); - ASSERT_EQ(2, opt.getDropTime().size()); + ASSERT_EQ(2U, opt.getDropTime().size()); EXPECT_DOUBLE_EQ(2, opt.getDropTime()[0]); EXPECT_DOUBLE_EQ(4.7, opt.getDropTime()[1]); @@ -596,10 +596,10 @@ TEST_F(CommandOptionsTest, Offsets) { EXPECT_EQ(2, opt.getRequestedIpOffset()); EXPECT_EQ(5, opt.getElapsedTimeOffset()); EXPECT_EQ(3, opt.getServerIdOffset()); - ASSERT_EQ(2, opt.getRandomOffset().size()); + ASSERT_EQ(2U, opt.getRandomOffset().size()); EXPECT_EQ(30, opt.getRandomOffset()[0]); EXPECT_EQ(30, opt.getRandomOffset()[1]); - ASSERT_EQ(2, opt.getTransactionIdOffset().size()); + ASSERT_EQ(2U, opt.getTransactionIdOffset().size()); EXPECT_EQ(7, opt.getTransactionIdOffset()[0]); EXPECT_EQ(3, opt.getTransactionIdOffset()[1]); @@ -644,11 +644,11 @@ TEST_F(CommandOptionsTest, Preload) { TEST_F(CommandOptionsTest, Seed) { CommandOptions opt; EXPECT_NO_THROW(process(opt, "perfdhcp -6 -P 2 -s 23 -l ethx all")); - EXPECT_EQ(23, opt.getSeed()); + EXPECT_EQ(23U, opt.getSeed()); EXPECT_TRUE(opt.isSeeded()); EXPECT_NO_THROW(process(opt, "perfdhcp -6 -P 2 -s 0 -l ethx all")); - EXPECT_EQ(0, opt.getSeed()); + EXPECT_EQ(0U, opt.getSeed()); EXPECT_FALSE(opt.isSeeded()); // Negative test cases @@ -662,11 +662,11 @@ TEST_F(CommandOptionsTest, Seed) { TEST_F(CommandOptionsTest, TemplateFiles) { CommandOptions opt; EXPECT_NO_THROW(process(opt, "perfdhcp -T file1.x -l ethx all")); - ASSERT_EQ(1, opt.getTemplateFiles().size()); + ASSERT_EQ(1U, opt.getTemplateFiles().size()); EXPECT_EQ("file1.x", opt.getTemplateFiles()[0]); EXPECT_NO_THROW(process(opt, "perfdhcp -T file1.x -s 12 -w start -T file2.x -4 -l ethx all")); - ASSERT_EQ(2, opt.getTemplateFiles().size()); + ASSERT_EQ(2U, opt.getTemplateFiles().size()); EXPECT_EQ("file1.x", opt.getTemplateFiles()[0]); EXPECT_EQ("file2.x", opt.getTemplateFiles()[1]); @@ -838,7 +838,7 @@ TEST_F(CommandOptionsTest, LoadMacsFromFile) { EXPECT_EQ(mac_list_full_path, opt.getMacListFile()); const CommandOptions::MacAddrsVector& m = opt.getMacsFromFile(); - EXPECT_EQ(4, m.size()); + EXPECT_EQ(4U, m.size()); } TEST_F(CommandOptionsTest, LoadRelay4AddrFromFile) { @@ -849,7 +849,7 @@ TEST_F(CommandOptionsTest, LoadRelay4AddrFromFile) { EXPECT_NO_THROW(process(opt, cmd.str())); EXPECT_EQ(relay_addr_list_full_path, opt.getRelayAddrListFile()); EXPECT_TRUE(opt.checkMultiSubnet()); - EXPECT_EQ(5, opt.getRelayAddrList().size()); + EXPECT_EQ(5U, opt.getRelayAddrList().size()); } TEST_F(CommandOptionsTest, LoadRelay6AddrFromFile) { @@ -860,7 +860,7 @@ TEST_F(CommandOptionsTest, LoadRelay6AddrFromFile) { EXPECT_NO_THROW(process(opt, cmd.str())); EXPECT_EQ(relay_addr_list_full_path, opt.getRelayAddrListFile()); EXPECT_TRUE(opt.checkMultiSubnet()); - EXPECT_EQ(2, opt.getRelayAddrList().size()); + EXPECT_EQ(2U, opt.getRelayAddrList().size()); } TEST_F(CommandOptionsTest, RelayAddr6ForVersion4) { @@ -870,7 +870,7 @@ TEST_F(CommandOptionsTest, RelayAddr6ForVersion4) { cmd << "perfdhcp -4 -J " << relay_addr_list_full_path << " abc"; EXPECT_THROW(process(opt, cmd.str()), isc::InvalidParameter); EXPECT_FALSE(opt.checkMultiSubnet()); - EXPECT_EQ(0, opt.getRelayAddrList().size()); + EXPECT_EQ(0U, opt.getRelayAddrList().size()); } TEST_F(CommandOptionsTest, RelayAddr4ForVersion6) { @@ -880,10 +880,9 @@ TEST_F(CommandOptionsTest, RelayAddr4ForVersion6) { cmd << "perfdhcp -6 -J " << relay_addr_list_full_path << " abc"; EXPECT_THROW(process(opt, cmd.str()), isc::InvalidParameter); EXPECT_FALSE(opt.checkMultiSubnet()); - EXPECT_EQ(0, opt.getRelayAddrList().size()); + EXPECT_EQ(0U, opt.getRelayAddrList().size()); } - TEST_F(CommandOptionsTest, LoadMacsFromFileNegativeCases) { CommandOptions opt; // Negative test cases @@ -906,7 +905,7 @@ TEST_F(CommandOptionsTest, UseRelayV6OptionsWithoutV6) { CommandOptions opt; EXPECT_NO_THROW(process(opt, "perfdhcp -6 -A1 --or 32,00000E10 -l ethx all")); EXPECT_TRUE(opt.isUseRelayedV6()); - EXPECT_EQ(1, opt.getRelayOpts().size()); + EXPECT_EQ(1U, opt.getRelayOpts().size()); // --or must be used together with -6 EXPECT_THROW(process(opt, "perfdhcp -A1 --or 32,00000E10 -l ethx all"), isc::InvalidParameter); @@ -916,7 +915,7 @@ TEST_F(CommandOptionsTest, UseRelayV6OptionsWithoutRelayEncapsulation) { CommandOptions opt; EXPECT_NO_THROW(process(opt, "perfdhcp -6 -A1 --or 32,00000E10 -l ethx all")); EXPECT_TRUE(opt.isUseRelayedV6()); - EXPECT_EQ(1, opt.getRelayOpts().size()); + EXPECT_EQ(1U, opt.getRelayOpts().size()); // --or must be used together with -A EXPECT_THROW(process(opt, "perfdhcp -6 --or 32,00000E10 -l ethx all"), isc::InvalidParameter); @@ -928,7 +927,7 @@ TEST_F(CommandOptionsTest, UseMultipleRelayV6Options) { "23,20010DB800010000000000000000CAFE -l ethx all")); EXPECT_TRUE(opt.isUseRelayedV6()); // 2 options expected at 1st level of encapsulation - EXPECT_EQ(2, opt.getRelayOpts().size()); + EXPECT_EQ(2U, opt.getRelayOpts().size()); // no options expected at 2nd level of encapsulation EXPECT_THROW(opt.getRelayOpts(2), isc::OutOfRange); } @@ -942,10 +941,10 @@ TEST_F(CommandOptionsTest, UseRelayV6OptionsWithMultiSubnets) { EXPECT_NO_THROW(process(opt, cmd.str())); EXPECT_EQ(relay_addr_list_full_path, opt.getRelayAddrListFile()); EXPECT_TRUE(opt.checkMultiSubnet()); - EXPECT_EQ(2, opt.getRelayAddrList().size()); + EXPECT_EQ(2U, opt.getRelayAddrList().size()); EXPECT_TRUE(opt.isUseRelayedV6()); // 2 options expected at 1st level of encapsulation - EXPECT_EQ(2, opt.getRelayOpts().size()); + EXPECT_EQ(2U, opt.getRelayOpts().size()); // no options expected at 2nd level of encapsulation EXPECT_THROW(opt.getRelayOpts(2), isc::OutOfRange); } @@ -977,7 +976,7 @@ TEST_F(CommandOptionsTest, UseRelayV6OptionsWithEncapsulationLevel) { CommandOptions opt; EXPECT_NO_THROW(process(opt, "perfdhcp -6 -A1 --or 1:32,00000E10 -l ethx all")); EXPECT_TRUE(opt.isUseRelayedV6()); - EXPECT_EQ(1, opt.getRelayOpts().size()); + EXPECT_EQ(1U, opt.getRelayOpts().size()); } TEST_F(CommandOptionsTest, UseRelayV6OptionsWithNegativeEncapsulationLevel) { @@ -1014,7 +1013,7 @@ TEST_F(CommandOptionsTest, UseRelayV6OptionsDuplicated) { // multiple relayed options with the same option code are supported. EXPECT_NO_THROW(process(opt, "perfdhcp -6 -A1 --or 1:32,00000E10 --or 32,00000E11 -l ethx all")); EXPECT_TRUE(opt.isUseRelayedV6()); - EXPECT_EQ(2, opt.getRelayOpts().size()); + EXPECT_EQ(2U, opt.getRelayOpts().size()); } diff --git a/src/bin/perfdhcp/tests/localized_option_unittest.cc b/src/bin/perfdhcp/tests/localized_option_unittest.cc index 6b849bdb40..dda63be511 100644 --- a/src/bin/perfdhcp/tests/localized_option_unittest.cc +++ b/src/bin/perfdhcp/tests/localized_option_unittest.cc @@ -29,14 +29,14 @@ TEST(LocalizedOptionTest, Constructor) { opt_buf)); EXPECT_EQ(Option::V6, opt1->getUniverse()); EXPECT_EQ(D6O_CLIENTID, opt1->getType()); - EXPECT_EQ(0, opt1->getOffset()); + EXPECT_EQ(0U, opt1->getOffset()); // Create option with non-default offset. boost::scoped_ptr opt2(new LocalizedOption(Option::V6, D6O_CLIENTID, opt_buf, 40)); - EXPECT_EQ(40, opt2->getOffset()); + EXPECT_EQ(40U, opt2->getOffset()); } } diff --git a/src/bin/perfdhcp/tests/packet_storage_unittest.cc b/src/bin/perfdhcp/tests/packet_storage_unittest.cc index d585baf065..b05573ab8d 100644 --- a/src/bin/perfdhcp/tests/packet_storage_unittest.cc +++ b/src/bin/perfdhcp/tests/packet_storage_unittest.cc @@ -75,9 +75,9 @@ TEST_F(PacketStorageTest, getNext) { // "recovers" from being empty, i.e. that the internal indicator // which points to current packet reinitializes correctly. storage_.append(createPacket6(DHCPV6_REPLY, 100)); - ASSERT_EQ(1, storage_.size()); + ASSERT_EQ(1U, storage_.size()); Pkt6Ptr packet = storage_.getNext(); - EXPECT_EQ(100, packet->getTransid()); + EXPECT_EQ(100U, packet->getTransid()); EXPECT_FALSE(storage_.getNext()); } @@ -114,10 +114,10 @@ TEST_F(PacketStorageTest, getRandom) { // "recovers" from being empty, i.e. that the internal indicator // which points to the current packet reinitializes correctly. storage_.append(createPacket6(DHCPV6_REPLY, 100)); - ASSERT_EQ(1, storage_.size()); + ASSERT_EQ(1U, storage_.size()); Pkt6Ptr packet = storage_.getRandom(); ASSERT_TRUE(packet); - EXPECT_EQ(100, packet->getTransid()); + EXPECT_EQ(100U, packet->getTransid()); EXPECT_FALSE(storage_.getRandom()); } @@ -144,20 +144,20 @@ TEST_F(PacketStorageTest, getNextAndRandom) { // from being empty and that new elements can be accessed. storage_.append(createPacket6(DHCPV6_REPLY, 100)); storage_.append(createPacket6(DHCPV6_REPLY, 101)); - ASSERT_EQ(2, storage_.size()); + ASSERT_EQ(2U, storage_.size()); // The newly added elements haven't been accessed yet. So, if we // call getNext the first one should be returned. Pkt6Ptr packet_next = storage_.getNext(); ASSERT_TRUE(packet_next); // The first packet has transaction id equal to 100. - EXPECT_EQ(100, packet_next->getTransid()); + EXPECT_EQ(100U, packet_next->getTransid()); // There should be just one packet left in the storage. - ASSERT_EQ(1, storage_.size()); + ASSERT_EQ(1U, storage_.size()); // The call to getRandom should return the sole packet from the // storage. Pkt6Ptr packet_random = storage_.getRandom(); ASSERT_TRUE(packet_random); - EXPECT_EQ(101, packet_random->getTransid()); + EXPECT_EQ(101U, packet_random->getTransid()); // Any further calls to getRandom and getNext should return NULL. EXPECT_FALSE(storage_.getRandom()); EXPECT_FALSE(storage_.getNext()); @@ -181,13 +181,13 @@ TEST_F(PacketStorageTest, clear) { // Remove 10 of them. ASSERT_NO_THROW(storage_.clear(10)); // We should have 10 remaining. - ASSERT_EQ(10, storage_.size()); + ASSERT_EQ(10U, storage_.size()); // Check that the retrieval still works after partial clear. EXPECT_TRUE(storage_.getNext()); EXPECT_TRUE(storage_.getRandom()); // We should have 10 - 2 = 8 packets in the storage after retrieval. - ASSERT_EQ(8, storage_.size()); + ASSERT_EQ(8U, storage_.size()); // Try to remove more elements that actually is. It // should result in removal of all elements. diff --git a/src/bin/perfdhcp/tests/perf_pkt4_unittest.cc b/src/bin/perfdhcp/tests/perf_pkt4_unittest.cc index 0a3328b49f..59916bccc9 100644 --- a/src/bin/perfdhcp/tests/perf_pkt4_unittest.cc +++ b/src/bin/perfdhcp/tests/perf_pkt4_unittest.cc @@ -119,7 +119,7 @@ TEST_F(PerfPkt4Test, Constructor) { boost::scoped_ptr pkt1(new PerfPkt4(data, sizeof(data), offset_transid[0])); - EXPECT_EQ(1, pkt1->getTransidOffset()); + EXPECT_EQ(1U, pkt1->getTransidOffset()); // Test constructor to be used for outgoing messages. // Use non-zero offset and specify transaction id. @@ -132,7 +132,7 @@ TEST_F(PerfPkt4Test, Constructor) { // Test default constructor. Transaction id offset is expected to be 1. boost::scoped_ptr pkt3(new PerfPkt4(data, sizeof(data))); - EXPECT_EQ(1, pkt3->getTransidOffset()); + EXPECT_EQ(1U, pkt3->getTransidOffset()); } TEST_F(PerfPkt4Test, RawPack) { @@ -233,8 +233,8 @@ TEST_F(PerfPkt4Test, RawUnpack) { OptionBuffer opt_msg_type_data = opt_msg_type->getData(); // Expect one byte of message type payload. - ASSERT_EQ(1, opt_msg_type_data.size()); - EXPECT_EQ(1, opt_msg_type_data[0]); + ASSERT_EQ(1U, opt_msg_type_data.size()); + EXPECT_EQ(1U, opt_msg_type_data[0]); } TEST_F(PerfPkt4Test, InvalidOptions) { @@ -359,7 +359,7 @@ TEST_F(PerfPkt4Test, UnpackTransactionId) { ASSERT_TRUE(pkt1->rawUnpack()); // Get unpacked transaction id and compare with reference. - EXPECT_EQ(0x01020304, pkt1->getTransid()); + EXPECT_EQ(0x01020304U, pkt1->getTransid()); // Create packet with transaction id at invalid offset. boost::scoped_ptr pkt2(new PerfPkt4(&in_data[0], @@ -403,21 +403,21 @@ TEST_F(PerfPkt4Test, Writes) { pkt1->writeValueAt(10, 0x51); ASSERT_TRUE(pkt1->rawPack()); ASSERT_EQ(in_data.size(), pkt1->getBuffer().getLength()); - EXPECT_EQ(0x51, pkt1->getBuffer()[10]); + EXPECT_EQ(0x51U, pkt1->getBuffer()[10]); // Write 2 octets (0x5251) at position 20. pkt1->writeValueAt(20, 0x5251); ASSERT_TRUE(pkt1->rawPack()); ASSERT_EQ(in_data.size(), pkt1->getBuffer().getLength()); - EXPECT_EQ(0x52, pkt1->getBuffer()[20]); - EXPECT_EQ(0x51, pkt1->getBuffer()[21]); + EXPECT_EQ(0x52U, pkt1->getBuffer()[20]); + EXPECT_EQ(0x51U, pkt1->getBuffer()[21]); // Write 4 octets (0x54535251) at position 30. pkt1->writeValueAt(30, 0x54535251); ASSERT_TRUE(pkt1->rawPack()); ASSERT_EQ(in_data.size(), pkt1->getBuffer().getLength()); - EXPECT_EQ(0x54, pkt1->getBuffer()[30]); - EXPECT_EQ(0x53, pkt1->getBuffer()[31]); - EXPECT_EQ(0x52, pkt1->getBuffer()[32]); - EXPECT_EQ(0x51, pkt1->getBuffer()[33]); + EXPECT_EQ(0x54U, pkt1->getBuffer()[30]); + EXPECT_EQ(0x53U, pkt1->getBuffer()[31]); + EXPECT_EQ(0x52U, pkt1->getBuffer()[32]); + EXPECT_EQ(0x51U, pkt1->getBuffer()[33]); } } diff --git a/src/bin/perfdhcp/tests/perf_pkt6_unittest.cc b/src/bin/perfdhcp/tests/perf_pkt6_unittest.cc index f4e5b41b75..8a47230a16 100644 --- a/src/bin/perfdhcp/tests/perf_pkt6_unittest.cc +++ b/src/bin/perfdhcp/tests/perf_pkt6_unittest.cc @@ -107,7 +107,7 @@ TEST_F(PerfPkt6Test, Constructor) { boost::scoped_ptr pkt1(new PerfPkt6(data, sizeof(data))); EXPECT_EQ(sizeof(data), pkt1->data_.size()); EXPECT_EQ(0, memcmp(&pkt1->data_[0], data, sizeof(data))); - EXPECT_EQ(1, pkt1->getTransidOffset()); + EXPECT_EQ(1U, pkt1->getTransidOffset()); // Test constructor to be used for outgoing messages. // Use non-zero offset and specify transaction id. @@ -117,8 +117,8 @@ TEST_F(PerfPkt6Test, Constructor) { offset_transid, transid)); EXPECT_EQ(sizeof(data), pkt2->data_.size()); EXPECT_EQ(0, memcmp(&pkt2->data_[0], data, sizeof(data))); - EXPECT_EQ(0x010203, pkt2->getTransid()); - EXPECT_EQ(10, pkt2->getTransidOffset()); + EXPECT_EQ(0x010203U, pkt2->getTransid()); + EXPECT_EQ(10U, pkt2->getTransidOffset()); } TEST_F(PerfPkt6Test, RawPackUnpack) { @@ -194,7 +194,7 @@ TEST_F(PerfPkt6Test, RawPackUnpack) { // Expecting option contents be the same as original. OptionBuffer pkt2_elapsed_time_data = pkt2_elapsed_time->getData(); OptionBuffer pkt2_duid_data = pkt2_duid->getData(); - EXPECT_EQ(0x0101, pkt2_elapsed_time->getUint16()); + EXPECT_EQ(0x0101U, pkt2_elapsed_time->getUint16()); EXPECT_TRUE(std::equal(pkt2_duid_data.begin(), pkt2_duid_data.end(), buf_duid)); @@ -309,7 +309,7 @@ TEST_F(PerfPkt6Test, UnpackTransactionId) { // Get transaction id out of buffer and store in class member. ASSERT_TRUE(pkt1->rawUnpack()); // Test value of transaction id. - EXPECT_EQ(0x010203, pkt1->getTransid()); + EXPECT_EQ(0x010203U, pkt1->getTransid()); // Out of bounds transaction id offset. boost::scoped_ptr pkt2(new PerfPkt6(data, diff --git a/src/bin/perfdhcp/tests/rate_control_unittest.cc b/src/bin/perfdhcp/tests/rate_control_unittest.cc index 5619fd31c9..859f56eb16 100644 --- a/src/bin/perfdhcp/tests/rate_control_unittest.cc +++ b/src/bin/perfdhcp/tests/rate_control_unittest.cc @@ -39,7 +39,7 @@ public: // Test default constructor. TEST(RateControl, constructorDefault) { NakedRateControl rc; - EXPECT_EQ(0, rc.getRate()); + EXPECT_EQ(0U, rc.getRate()); } // Test the constructor which sets the rate. @@ -47,22 +47,22 @@ TEST(RateControl, constructor) { // Call the constructor and verify that it sets the appropriate // values. NakedRateControl rc1(3); - EXPECT_EQ(3, rc1.getRate()); + EXPECT_EQ(3U, rc1.getRate()); // Call the constructor again and make sure that different values // will be set correctly. NakedRateControl rc2(5); - EXPECT_EQ(5, rc2.getRate()); + EXPECT_EQ(5U, rc2.getRate()); } // Check the rate accessor. TEST(RateControl, getRate) { RateControl rc; - ASSERT_EQ(0, rc.getRate()); + ASSERT_EQ(0U, rc.getRate()); rc.setRate(5); - ASSERT_EQ(5, rc.getRate()); + ASSERT_EQ(5U, rc.getRate()); rc.setRate(10); - EXPECT_EQ(10, rc.getRate()); + EXPECT_EQ(10U, rc.getRate()); } // Check that the function returns the number of messages to be sent "now" @@ -79,7 +79,7 @@ TEST(RateControl, getOutboundMessageCount) { // no good estimate at the beginning how many packets to send. uint64_t count = 0; ASSERT_NO_THROW(count = rc.getOutboundMessageCount()); - EXPECT_EQ(count, 1); + EXPECT_EQ(count, 1U); // After a given amount of time number of packets to send should // allow to catch up with requested rate, ie for rate 2pks/s after 1500ms @@ -87,13 +87,13 @@ TEST(RateControl, getOutboundMessageCount) { // To simulate 1500ms lets get back start time by 1500ms. rc.start_time_ -= boost::posix_time::milliseconds(1500); ASSERT_NO_THROW(count = rc.getOutboundMessageCount()); - EXPECT_EQ(count, 2); + EXPECT_EQ(count, 2U); // If elapsed time is big then a big number of packets would need to be sent. // But the pkts number is capped to 3. Check it. rc.start_time_ -= boost::posix_time::milliseconds(10000); ASSERT_NO_THROW(count = rc.getOutboundMessageCount()); - EXPECT_EQ(count, 3); + EXPECT_EQ(count, 3U); } // Test the rate modifier for valid and invalid rate values. diff --git a/src/bin/perfdhcp/tests/stats_mgr_unittest.cc b/src/bin/perfdhcp/tests/stats_mgr_unittest.cc index 498ab51773..b221b9772c 100644 --- a/src/bin/perfdhcp/tests/stats_mgr_unittest.cc +++ b/src/bin/perfdhcp/tests/stats_mgr_unittest.cc @@ -263,12 +263,12 @@ TEST_F(StatsMgrTest, Constructor) { stats_mgr->getMinDelay(ExchangeType::DO) ); EXPECT_DOUBLE_EQ(0, stats_mgr->getMaxDelay(ExchangeType::DO)); - EXPECT_EQ(0, stats_mgr->getOrphans(ExchangeType::DO)); - EXPECT_EQ(0, stats_mgr->getOrderedLookups(ExchangeType::DO)); - EXPECT_EQ(0, stats_mgr->getUnorderedLookups(ExchangeType::DO)); - EXPECT_EQ(0, stats_mgr->getSentPacketsNum(ExchangeType::DO)); - EXPECT_EQ(0, stats_mgr->getRcvdPacketsNum(ExchangeType::DO)); - EXPECT_EQ(0, stats_mgr->getCollectedNum(ExchangeType::DO)); + EXPECT_EQ(0U, stats_mgr->getOrphans(ExchangeType::DO)); + EXPECT_EQ(0U, stats_mgr->getOrderedLookups(ExchangeType::DO)); + EXPECT_EQ(0U, stats_mgr->getUnorderedLookups(ExchangeType::DO)); + EXPECT_EQ(0U, stats_mgr->getSentPacketsNum(ExchangeType::DO)); + EXPECT_EQ(0U, stats_mgr->getRcvdPacketsNum(ExchangeType::DO)); + EXPECT_EQ(0U, stats_mgr->getCollectedNum(ExchangeType::DO)); EXPECT_THROW(stats_mgr->getAvgDelay(ExchangeType::DO), InvalidOperation); EXPECT_THROW(stats_mgr->getStdDevDelay(ExchangeType::DO), @@ -330,7 +330,7 @@ TEST_F(StatsMgrTest, MultipleExchanges) { stats_mgr->addExchangeStats(ExchangeType::RR); // Simulate sending number of solicit packets. - const int solicit_packets_num = 10; + const size_t solicit_packets_num = 10; passMultiplePackets6(stats_mgr, ExchangeType::SA, DHCPV6_SOLICIT, solicit_packets_num); @@ -338,7 +338,7 @@ TEST_F(StatsMgrTest, MultipleExchanges) { // number of request packets is different then number of solicit // packets. We can now check if right number packets went to // the right exchange type group. - const int request_packets_num = 5; + const size_t request_packets_num = 5; passMultiplePackets6(stats_mgr, ExchangeType::RR, DHCPV6_REQUEST, request_packets_num); @@ -387,19 +387,19 @@ TEST_F(StatsMgrTest, SendReceiveSimple) { ASSERT_NO_THROW( stats_mgr->passRcvdPacket(ExchangeType::DO, rcvd_packet) ); - EXPECT_EQ(1, stats_mgr->getOrphans(ExchangeType::DO)); + EXPECT_EQ(1U, stats_mgr->getOrphans(ExchangeType::DO)); } TEST_F(StatsMgrTest, SendReceiveUnordered) { CommandOptions opt; - const int packets_num = 10; + const size_t packets_num = 10; boost::scoped_ptr stats_mgr(new StatsMgr(opt)); stats_mgr->addExchangeStats(ExchangeType::DO); // Transaction ids of 10 packets to be sent and received. uint32_t transid[packets_num] = { 1, 1024, 2, 1025, 3, 1026, 4, 1027, 5, 1028 }; - for (int i = 0; i < packets_num; ++i) { + for (size_t i = 0; i < packets_num; ++i) { boost::shared_ptr sent_packet(createPacket4(DHCPDISCOVER, transid[i])); ASSERT_NO_THROW( @@ -409,7 +409,7 @@ TEST_F(StatsMgrTest, SendReceiveUnordered) { // We are simulating that received packets are coming in reverse order: // 1028, 5, 1027 .... - for (int i = 0; i < packets_num; ++i) { + for (size_t i = 0; i < packets_num; ++i) { boost::shared_ptr rcvd_packet(createPacket4(DHCPDISCOVER, transid[packets_num - 1 - i])); @@ -418,13 +418,13 @@ TEST_F(StatsMgrTest, SendReceiveUnordered) { ); } // All packets are expected to match (we did not drop any) - EXPECT_EQ(0, stats_mgr->getOrphans(ExchangeType::DO)); + EXPECT_EQ(0U, stats_mgr->getOrphans(ExchangeType::DO)); // Most of the time we have to do unordered lookups except for the last // one. Packets are removed from the sent list every time we have a match // so eventually we come up with the single packet that caching iterator // is pointing to. This is counted as ordered lookup. - EXPECT_EQ(1, stats_mgr->getOrderedLookups(ExchangeType::DO)); - EXPECT_EQ(9, stats_mgr->getUnorderedLookups(ExchangeType::DO)); + EXPECT_EQ(1U, stats_mgr->getOrderedLookups(ExchangeType::DO)); + EXPECT_EQ(9U, stats_mgr->getUnorderedLookups(ExchangeType::DO)); } TEST_F(StatsMgrTest, SendReceiveCollected) { @@ -437,19 +437,19 @@ TEST_F(StatsMgrTest, SendReceiveCollected) { TEST_F(StatsMgrTest, Orphans) { CommandOptions opt; - const int packets_num = 6; + const size_t packets_num = 6; boost::scoped_ptr stats_mgr(new StatsMgr(opt)); stats_mgr->addExchangeStats(ExchangeType::DO); // We skip every second packet to simulate drops. - for (int i = 0; i < packets_num; i += 2) { + for (size_t i = 0; i < packets_num; i += 2) { boost::shared_ptr sent_packet(createPacket4(DHCPDISCOVER, i)); ASSERT_NO_THROW( stats_mgr->passSentPacket(ExchangeType::DO, sent_packet) ); } // We pass all received packets. - for (int i = 0; i < packets_num; ++i) { + for (size_t i = 0; i < packets_num; ++i) { boost::shared_ptr rcvd_packet(createPacket4(DHCPOFFER, i)); ASSERT_NO_THROW( stats_mgr->passRcvdPacket(ExchangeType::DO, rcvd_packet); @@ -542,7 +542,7 @@ TEST_F(StatsMgrTest, PrintStats) { // Simulate sending and receiving one packet. Otherwise printing // functions will complain about lack of packets. - const int packets_num = 1; + const size_t packets_num = 1; passMultiplePackets6(stats_mgr, ExchangeType::SA, DHCPV6_SOLICIT, packets_num); passMultiplePackets6(stats_mgr, ExchangeType::SA, DHCPV6_ADVERTISE, diff --git a/src/bin/perfdhcp/tests/test_control_unittest.cc b/src/bin/perfdhcp/tests/test_control_unittest.cc index 94224fcb51..2cc357515e 100644 --- a/src/bin/perfdhcp/tests/test_control_unittest.cc +++ b/src/bin/perfdhcp/tests/test_control_unittest.cc @@ -48,8 +48,8 @@ public: IfacePtr iface_; ///< Local fake interface. - int sent_cnt_; ///< Counter of sent packets - int recv_cnt_; ///< Counter of received packets. + size_t sent_cnt_; ///< Counter of sent packets + size_t recv_cnt_; ///< Counter of received packets. /// \brief Simulate receiving DHCPv4 packet. virtual dhcp::Pkt4Ptr receive4(uint32_t timeout_sec, uint32_t timeout_usec) override { @@ -362,7 +362,7 @@ public: /// of MAC address has to change if multiple clients are simulated /// and do not change if single client is simulated. void testDuid(CommandOptions &opt) const { - int clients_num = opt.getClientsNum(); + uint32_t clients_num = opt.getClientsNum(); // Initialize Test Control class. NakedTestControl tc(opt); // The old duid will be holding the previously generated DUID. @@ -384,7 +384,7 @@ public: // Keep generated DUIDs in this container. std::list > duids; // Perform number of iterations to generate number of DUIDs. - for (int i = 0; i < 10 * clients_num; ++i) { + for (uint32_t i = 0; i < 10 * clients_num; ++i) { if (new_duid.empty()) { new_duid = old_duid; } else { @@ -398,7 +398,7 @@ public: // DUID_LLT value, two octets of hardware type, 4 octets // of time value and 6 octets of variable link layer (MAC) // address. - const int duid_llt_size = 14; + const size_t duid_llt_size = 14; ASSERT_EQ(duid_llt_size, new_duid.size()); // The first four octets do not change. EXPECT_TRUE(std::equal(new_duid.begin(), new_duid.begin() + 4, @@ -428,13 +428,14 @@ public: std::pair mismatch_pos = std::mismatch(old_duid.begin(), old_duid.end(), new_duid.begin()); - size_t mismatch_dist = + int mismatch_dist = std::distance(mismatch_pos.first, old_duid.end()); // For single client total_dist is expected to be 0 because // old_duid and new_duid should always match. If we have // more clients then duids have to differ except the case // if randomization algorithm generates the same values but // this would be an error in randomization algorithm. + ASSERT_LE(0, mismatch_dist); total_dist += mismatch_dist; // Mismatch may have occurred on the DUID octet position // up to calculated earlier unequal_pos. @@ -468,7 +469,7 @@ public: } // If we have more than one client at least one mismatch occurred. if (clients_num < 2) { - EXPECT_EQ(0, total_dist); + EXPECT_EQ(0U, total_dist); } } @@ -485,8 +486,8 @@ public: /// \param iterations_num number of exchanges to simulate. /// \param receive_num number of received OFFER packets. /// \param tc test control instance - void testPkt4Exchange(int iterations_num, - int receive_num, + void testPkt4Exchange(size_t iterations_num, + size_t receive_num, bool use_templates, NakedTestControl& tc) const { //int sock_handle = 0; @@ -506,7 +507,7 @@ public: NakedTestControl::IncrementalGeneratorPtr generator(new NakedTestControl::IncrementalGenerator()); tc.setTransidGenerator(generator); - for (int i = 0; i < iterations_num; ++i) { + for (size_t i = 0; i < iterations_num; ++i) { // Get next transaction id, without actually using it. The same // id will be used by the TestControl class for DHCPDISCOVER. uint32_t transid = generator->getNext(); @@ -539,8 +540,8 @@ public: /// \param iterations_num number of exchanges to simulate. /// \param receive_num number of received OFFER packets. /// \param tc test control instance - void testPkt6Exchange(int iterations_num, - int receive_num, + void testPkt6Exchange(size_t iterations_num, + size_t receive_num, bool use_templates, NakedTestControl& tc) const { //int sock_handle = 0; @@ -561,7 +562,7 @@ public: generator(new NakedTestControl::IncrementalGenerator()); tc.setTransidGenerator(generator); uint32_t transid = 0; - for (int i = 0; i < iterations_num; ++i) { + for (size_t i = 0; i < iterations_num; ++i) { // Do not simulate responses for packets later // that specified as receive_num. This simulates // packet drops. @@ -590,7 +591,7 @@ public: /// greater than 1. It also checks if the same MAC addresses is /// generated if only 1 client is simulated. void testMacAddress(CommandOptions &opt) const { - int clients_num = opt.getClientsNum(); + uint32_t clients_num = opt.getClientsNum(); // The old_mac will be holding the value of previously generated // MAC address. We will be comparing the newly generated one with it // to see if it changes when multiple clients are simulated or if it @@ -610,7 +611,7 @@ public: // Keep generated MACs in this container. std::list > macs; // Do many iterations to generate and test MAC address values. - for (int i = 0; i < clients_num * 10; ++i) { + for (uint32_t i = 0; i < clients_num * 10; ++i) { // Generate new MAC address. uint8_t randomized = 0; MacAddress new_mac(tc.generateMacAddress(randomized)); @@ -619,13 +620,14 @@ public: // and current. std::pair mismatch_pos = std::mismatch(old_mac.begin(), old_mac.end(), new_mac.begin()); - size_t mismatch_dist = + int mismatch_dist = std::distance(mismatch_pos.first, old_mac.end()); // For single client total_dist is expected to be 0 because // old_mac and new_mac should always match. If we have // more clients then MAC addresses have to differ except // the case if randomization algorithm generates the same // values but this would be an error in randomization algorithm. + ASSERT_LE(0, mismatch_dist); total_dist += mismatch_dist; // Mismatch may have occurred on the MAC address's octet position // up to calculated earlier unequal_pos. @@ -659,7 +661,7 @@ public: } if (clients_num < 2) { - EXPECT_EQ(total_dist, 0); + EXPECT_EQ(total_dist, 0U); } } @@ -727,19 +729,19 @@ public: // should be able to send renewal. msg_num = tc.sendMultipleMessages4(msg_type, 5); // Make sure that we have sent 5 messages. - EXPECT_EQ(5, msg_num); + EXPECT_EQ(5U, msg_num); // Try to do it again. We should still have 5 Reply packets for // which renews haven't been sent yet. msg_num = tc.sendMultipleMessages4(msg_type, 5); - EXPECT_EQ(5, msg_num); + EXPECT_EQ(5U, msg_num); // We used all the DHCPACK packets (we sent renew or release for each of // them already). Therefore, no further renew messages should be sent // before we acquire new leases. msg_num = tc.sendMultipleMessages4(msg_type, 5); // Make sure that no message has been sent. - EXPECT_EQ(0, msg_num); + EXPECT_EQ(0U, msg_num); } /// \brief Test that the DHCPREQUEST message is created correctly and @@ -825,7 +827,7 @@ public: ASSERT_TRUE(msg); // Check that the message type and transaction id is correct. EXPECT_EQ(msg_type, msg->getType()); - EXPECT_EQ(1, msg->getTransid()); + EXPECT_EQ(1U, msg->getTransid()); // Check that the message has expected options. These are the same for // Release and Renew. @@ -924,19 +926,19 @@ public: // send Renew or Release. msg_num = tc.sendMultipleMessages6(msg_type, 5); // Make sure that we have sent 5 messages. - EXPECT_EQ(5, msg_num); + EXPECT_EQ(5U, msg_num); // Try to do it again. We should still have 5 Reply packets for // which Renews or Releases haven't been sent yet. msg_num = tc.sendMultipleMessages6(msg_type, 5); - EXPECT_EQ(5, msg_num); + EXPECT_EQ(5U, msg_num); // We used all the Reply packets (we sent Renew or Release for each of // them already). Therefore, no further Renew or Release messages should // be sent before we acquire new leases. msg_num = tc.sendMultipleMessages6(msg_type, 5); // Make sure that no message has been sent. - EXPECT_EQ(0, msg_num); + EXPECT_EQ(0U, msg_num); } @@ -971,7 +973,7 @@ public: tc.processReceivedPacket6(advertise); } // counter of rejected leases has to be 6 - EXPECT_EQ(tc.stats_mgr_.getRejLeasesNum(ExchangeType::SA), 6); + EXPECT_EQ(tc.stats_mgr_.getRejLeasesNum(ExchangeType::SA), 6U); // Simulate Advertise responses from the server. Each advertise is // assigned a transaction id from the range of 7 to 10 with correct IA // included in the message @@ -980,7 +982,7 @@ public: tc.processReceivedPacket6(advertise); } // counter of rejected leases can't change at this point - EXPECT_EQ(tc.stats_mgr_.getRejLeasesNum(ExchangeType::SA), 6); + EXPECT_EQ(tc.stats_mgr_.getRejLeasesNum(ExchangeType::SA), 6U); } /// \brief Parse command line string with CommandOptions. @@ -1193,12 +1195,12 @@ TEST_F(TestControlTest, generateClientId) { // Extract the client id data. const OptionBuffer& client_id = opt_client_id->getData(); - ASSERT_EQ(7, client_id.size()); + ASSERT_EQ(7U, client_id.size()); // Verify that the client identifier is generated correctly. // First byte is the HW type. - EXPECT_EQ(5, client_id[0]); + EXPECT_EQ(5U, client_id[0]); // The rest of the client identifier should be equal to the HW address. std::vector sub(client_id.begin() + 1, client_id.end()); EXPECT_TRUE(hwaddr == sub); @@ -1227,7 +1229,7 @@ TEST_F(TestControlTest, GenerateDuid) { std::vector generated_duid = tc.generateDuid(randomized); // Check that generated_duid is DUID_LL - ASSERT_EQ(10, generated_duid.size()); + ASSERT_EQ(10U, generated_duid.size()); DuidPtr duid(new DUID(generated_duid)); ASSERT_EQ(duid->getType(), DUID::DUID_LL); @@ -1264,7 +1266,7 @@ TEST_F(TestControlTest, GenerateMacAddress) { uint8_t randomized = 0; // Generate MAC address and sanity check its size. std::vector mac = tc.generateMacAddress(randomized); - ASSERT_EQ(6, mac.size()); + ASSERT_EQ(6U, mac.size()); // Make sure that the generated MAC address belongs to the MAC addresses // read from a file. const CommandOptions::MacAddrsVector& macs = opt.getMacsFromFile(); @@ -1343,7 +1345,7 @@ TEST_F(TestControlTest, Options6) { // The default value of elapsed time is zero. uint16_t elapsed_time; elapsed_time = opt_elapsed_time->getUint16(); - EXPECT_EQ(0, elapsed_time); + EXPECT_EQ(0U, elapsed_time); // With the factory function we may also specify the actual // value of elapsed time. Let's make use of std::vector @@ -1371,7 +1373,7 @@ TEST_F(TestControlTest, Options6) { // buffer is shorter than 2 octets. elapsed_time = opt_elapsed_time2->getUint16(); // Check the expected value of elapsed time. - EXPECT_EQ(0x0101, elapsed_time); + EXPECT_EQ(0x0101U, elapsed_time); // Validate the D6O_RAPID_COMMIT option. OptionPtr opt_rapid_commit(Option::factory(Option::V6, D6O_RAPID_COMMIT)); @@ -1401,7 +1403,7 @@ TEST_F(TestControlTest, Options6) { // Each option code in ORO is 2 bytes long. We calculate the number of // requested options by dividing the size of the buffer holding options // by the size of each individual option. - int requested_options_num = sizeof(requested_options) / sizeof(uint16_t); + size_t requested_options_num = sizeof(requested_options) / sizeof(uint16_t); OptionBuffer requested_options_ref(requested_options, requested_options + sizeof(requested_options)); @@ -1445,10 +1447,10 @@ TEST_F(TestControlTest, Packet4) { tc.setDefaults4(pkt4); // Validate that packet has been setup correctly. EXPECT_EQ(tc.fake_sock_.iface_->getName(), pkt4->getIface()); - EXPECT_EQ(tc.fake_sock_.ifindex_, pkt4->getIndex()); + EXPECT_EQ(tc.fake_sock_.ifindex_, static_cast(pkt4->getIndex())); EXPECT_EQ(DHCP4_CLIENT_PORT, pkt4->getLocalPort()); EXPECT_EQ(DHCP4_SERVER_PORT, pkt4->getRemotePort()); - EXPECT_EQ(1, pkt4->getHops()); + EXPECT_EQ(1U, pkt4->getHops()); EXPECT_EQ(asiolink::IOAddress("255.255.255.255"), pkt4->getRemoteAddr()); EXPECT_EQ(asiolink::IOAddress(tc.socket_.addr_), pkt4->getLocalAddr()); @@ -1465,7 +1467,7 @@ TEST_F(TestControlTest, Packet6) { tc.setDefaults6(pkt6); // Validate if parameters have been set correctly. EXPECT_EQ(tc.fake_sock_.iface_->getName(), pkt6->getIface()); - EXPECT_EQ(tc.socket_.ifindex_, pkt6->getIndex()); + EXPECT_EQ(tc.socket_.ifindex_, static_cast(pkt6->getIndex())); EXPECT_EQ(DHCP6_CLIENT_PORT, pkt6->getLocalPort()); EXPECT_EQ(DHCP6_SERVER_PORT, pkt6->getRemotePort()); EXPECT_EQ(tc.socket_.addr_, pkt6->getLocalAddr()); @@ -1484,14 +1486,14 @@ TEST_F(TestControlTest, Packet6Relayed) { tc.setDefaults6(pkt6); // Validate if parameters have been set correctly. EXPECT_EQ(tc.fake_sock_.iface_->getName(), pkt6->getIface()); - EXPECT_EQ(tc.socket_.ifindex_, pkt6->getIndex()); + EXPECT_EQ(tc.socket_.ifindex_, static_cast(pkt6->getIndex())); EXPECT_EQ(DHCP6_CLIENT_PORT, pkt6->getLocalPort()); EXPECT_EQ(DHCP6_SERVER_PORT, pkt6->getRemotePort()); EXPECT_EQ(tc.socket_.addr_, pkt6->getLocalAddr()); EXPECT_EQ(asiolink::IOAddress("FF05::1:3"), pkt6->getRemoteAddr()); // Packet should be relayed. - EXPECT_EQ(pkt6->relay_info_.size(), 1); - EXPECT_EQ(pkt6->relay_info_[0].hop_count_, 0); + EXPECT_EQ(pkt6->relay_info_.size(), 1U); + EXPECT_EQ(pkt6->relay_info_[0].hop_count_, 0U); EXPECT_EQ(pkt6->relay_info_[0].msg_type_, DHCPV6_RELAY_FORW); EXPECT_EQ(pkt6->relay_info_[0].linkaddr_, tc.socket_.addr_); EXPECT_EQ(pkt6->relay_info_[0].peeraddr_, tc.socket_.addr_); @@ -1507,25 +1509,25 @@ TEST_F(TestControlTest, Packet6RelayedWithRelayOpts) { tc.setDefaults6(pkt6); // Validate if parameters have been set correctly. EXPECT_EQ(tc.fake_sock_.iface_->getName(), pkt6->getIface()); - EXPECT_EQ(tc.socket_.ifindex_, pkt6->getIndex()); + EXPECT_EQ(tc.socket_.ifindex_, static_cast(pkt6->getIndex())); EXPECT_EQ(DHCP6_CLIENT_PORT, pkt6->getLocalPort()); EXPECT_EQ(DHCP6_SERVER_PORT, pkt6->getRemotePort()); EXPECT_EQ(tc.socket_.addr_, pkt6->getLocalAddr()); EXPECT_EQ(asiolink::IOAddress("FF05::1:3"), pkt6->getRemoteAddr()); // Packet should be relayed. - EXPECT_EQ(pkt6->relay_info_.size(), 1); - EXPECT_EQ(pkt6->relay_info_[0].hop_count_, 0); + EXPECT_EQ(pkt6->relay_info_.size(), 1U); + EXPECT_EQ(pkt6->relay_info_[0].hop_count_, 0U); EXPECT_EQ(pkt6->relay_info_[0].msg_type_, DHCPV6_RELAY_FORW); EXPECT_EQ(pkt6->relay_info_[0].linkaddr_, tc.socket_.addr_); EXPECT_EQ(pkt6->relay_info_[0].peeraddr_, tc.socket_.addr_); // Checking if relayed option is there. OptionBuffer opt_data = pkt6->relay_info_[0].options_.find(32)->second->getData(); - EXPECT_EQ(4, opt_data.size()); + EXPECT_EQ(4U, opt_data.size()); EXPECT_EQ("0x00000E10", pkt6->relay_info_[0].options_.find(32)->second->toHexString()); } TEST_F(TestControlTest, Packet4Exchange) { - const int iterations_num = 100; + const size_t iterations_num = 100; CommandOptions opt; processCmdLine(opt, "perfdhcp -l fake -r 100 -n 10 -R 20 -L 10547 127.0.0.1"); bool use_templates = false; @@ -1536,18 +1538,18 @@ TEST_F(TestControlTest, Packet4Exchange) { EXPECT_EQ(tc.stats_mgr_.getSentPacketsNum(ExchangeType::DO), iterations_num); EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::DO), iterations_num); EXPECT_EQ(tc.stats_mgr_.getSentPacketsNum(ExchangeType::RA), iterations_num); - EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::RA), 0); + EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::RA), 0U); } TEST_F(TestControlTest, Packet4ExchangeFromTemplate) { - const int iterations_num = 100; + const size_t iterations_num = 100; CommandOptions opt; processCmdLine(opt, "perfdhcp -l fake -r 100 -R 20 -n 20 -L 10547" " -T " + getFullPath("discover-example.hex") + " -T " + getFullPath("request4-example.hex") + " 127.0.0.1"); - const int received_num = 10; + const size_t received_num = 10; bool use_templates = true; NakedTestControl tc(opt); testPkt4Exchange(iterations_num, received_num, use_templates, tc); @@ -1556,11 +1558,11 @@ TEST_F(TestControlTest, Packet4ExchangeFromTemplate) { EXPECT_EQ(tc.stats_mgr_.getSentPacketsNum(ExchangeType::DO), iterations_num); EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::DO), received_num); EXPECT_EQ(tc.stats_mgr_.getSentPacketsNum(ExchangeType::RA), received_num); - EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::RA), 0); + EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::RA), 0U); } TEST_F(TestControlTest, Packet6Exchange) { - const int iterations_num = 100; + const size_t iterations_num = 100; CommandOptions opt; processCmdLine(opt, "perfdhcp -l fake -6 -r 100 -n 10 -R 20 -L 10547 ::1"); bool use_templates = false; @@ -1571,11 +1573,11 @@ TEST_F(TestControlTest, Packet6Exchange) { EXPECT_EQ(tc.stats_mgr_.getSentPacketsNum(ExchangeType::SA), iterations_num); EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::SA), iterations_num); EXPECT_EQ(tc.stats_mgr_.getSentPacketsNum(ExchangeType::RR), iterations_num); - EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::RR), 0); + EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::RR), 0U); } TEST_F(TestControlTest, Packet6ExchangeFromTemplate) { - const int iterations_num = 100; + const size_t iterations_num = 100; CommandOptions opt; processCmdLine(opt, "perfdhcp -l fake -6 -r 100 -n 10 -R 20 -L 10547" " -T " + getFullPath("solicit-example.hex") @@ -1586,7 +1588,7 @@ TEST_F(TestControlTest, Packet6ExchangeFromTemplate) { // For other packets we don't so packet as 4,5,6 will be dropped and // then test should be interrupted and actual number of iterations will // be 6. - const int received_num = 3; + const size_t received_num = 3; // Simulate the number of Solicit-Advertise-Request-Reply (SARR) exchanges. // The test function generates server's responses and passes it to the // TestControl class methods for processing. All exchanged packets carry @@ -1599,11 +1601,11 @@ TEST_F(TestControlTest, Packet6ExchangeFromTemplate) { EXPECT_EQ(tc.stats_mgr_.getSentPacketsNum(ExchangeType::SA), iterations_num); EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::SA), received_num); EXPECT_EQ(tc.stats_mgr_.getSentPacketsNum(ExchangeType::RR), received_num); - EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::RR), 0); + EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::RR), 0U); } TEST_F(TestControlTest, Packet6ExchangeAddressOnly) { - const int iterations_num = 100; + const size_t iterations_num = 100; CommandOptions opt; processCmdLine(opt, "perfdhcp -l fake -e address-only" " -6 -r 100 -n 10 -R 20 -L 10547 ::1"); @@ -1623,11 +1625,11 @@ TEST_F(TestControlTest, Packet6ExchangeAddressOnly) { EXPECT_EQ(tc.stats_mgr_.getSentPacketsNum(ExchangeType::SA), iterations_num); EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::SA), iterations_num); EXPECT_EQ(tc.stats_mgr_.getSentPacketsNum(ExchangeType::RR), iterations_num); - EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::RR), 0); + EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::RR), 0U); } TEST_F(TestControlTest, Packet6ExchangePrefixDelegation) { - const int iterations_num = 100; + const size_t iterations_num = 100; CommandOptions opt; processCmdLine(opt, "perfdhcp -l fake -e prefix-only" " -6 -r 100 -n 10 -R 20 -L 10547 ::1"); @@ -1647,11 +1649,11 @@ TEST_F(TestControlTest, Packet6ExchangePrefixDelegation) { EXPECT_EQ(tc.stats_mgr_.getSentPacketsNum(ExchangeType::SA), iterations_num); EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::SA), iterations_num); EXPECT_EQ(tc.stats_mgr_.getSentPacketsNum(ExchangeType::RR), iterations_num); - EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::RR), 0); + EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::RR), 0U); } TEST_F(TestControlTest, Packet6ExchangeAddressAndPrefix) { - const int iterations_num = 100; + const size_t iterations_num = 100; CommandOptions opt; processCmdLine(opt, "perfdhcp -l fake -e address-and-prefix" " -6 -r 100 -n 10 -R 20 -L 10547 ::1"); @@ -1671,7 +1673,7 @@ TEST_F(TestControlTest, Packet6ExchangeAddressAndPrefix) { EXPECT_EQ(tc.stats_mgr_.getSentPacketsNum(ExchangeType::SA), iterations_num); EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::SA), iterations_num); EXPECT_EQ(tc.stats_mgr_.getSentPacketsNum(ExchangeType::RR), iterations_num); - EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::RR), 0); + EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::RR), 0U); } TEST_F(TestControlTest, PacketTemplates) { @@ -1812,7 +1814,7 @@ TEST_F(TestControlTest, Packet4ExchangeExtraOpts) { // -xT - save first packet of each type for templates (useful for packet inspection) // -o 200,abcdef1234 - send option 200 with hex content: ab:cd:ef:12:34 // -o 201,00 - send option 201 with hex content: 00 - const int iterations_num = 1; + const size_t iterations_num = 1; CommandOptions opt; processCmdLine(opt, "perfdhcp -l fake -4 -o 200,abcdef1234 -o 201,00 " "-r 100 -n 10 -R 20 -xT -L 10547 127.0.0.1"); @@ -1827,7 +1829,7 @@ TEST_F(TestControlTest, Packet4ExchangeExtraOpts) { EXPECT_EQ(tc.stats_mgr_.getSentPacketsNum(ExchangeType::DO), iterations_num); EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::DO), iterations_num); EXPECT_EQ(tc.stats_mgr_.getSentPacketsNum(ExchangeType::RA), iterations_num); - EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::RA), 0); + EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::RA), 0U); // Check if Discover was recored and if it contains options 200 and 201. auto disc = tc.template_packets_v4_.find(DHCPDISCOVER); @@ -1847,7 +1849,7 @@ TEST_F(TestControlTest, Packet6ExchangeExtraOpts) { // -xT - save first packet of each type for templates (useful for packet inspection) // -o 200,abcdef1234 - send option 200 with hex content: ab:cd:ef:12:34 // -o 201,00 - send option 201 with hex content: 00 - const int iterations_num = 1; + const size_t iterations_num = 1; CommandOptions opt; processCmdLine(opt, "perfdhcp -l fake" " -6 -e address-only" @@ -1866,7 +1868,7 @@ TEST_F(TestControlTest, Packet6ExchangeExtraOpts) { EXPECT_EQ(tc.stats_mgr_.getSentPacketsNum(ExchangeType::SA), iterations_num); EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::SA), iterations_num); EXPECT_EQ(tc.stats_mgr_.getSentPacketsNum(ExchangeType::RR), iterations_num); - EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::RR), 0); + EXPECT_EQ(tc.stats_mgr_.getRcvdPacketsNum(ExchangeType::RR), 0U); // Check if Solicit was recorded and if it contains options 200 and 201. auto sol = tc.template_packets_v6_.find(DHCPV6_SOLICIT); @@ -1931,17 +1933,17 @@ TEST_F(TestControlTest, haFailure4) { sleep(1); // wait a second... tc.sendPackets(1); // and send another packet. This should have secs set to 2. - EXPECT_EQ(tc.fake_sock_.sent_cnt_, 2); // Make sure the stats are up. - ASSERT_EQ(tc.fake_sock_.sent_pkts4_.size(), 2); // And the packets were captured. + EXPECT_EQ(tc.fake_sock_.sent_cnt_, 2U); // Make sure the stats are up. + ASSERT_EQ(tc.fake_sock_.sent_pkts4_.size(), 2U); // And the packets were captured. Pkt4Ptr dis1 = tc.fake_sock_.sent_pkts4_[0]; Pkt4Ptr dis2 = tc.fake_sock_.sent_pkts4_[1]; ASSERT_TRUE(dis1); ASSERT_TRUE(dis2); - EXPECT_EQ(dis1->getSecs(), 1); // Make sure it has secs set to 1. - EXPECT_GT(dis2->getSecs(), 1); // Should be 2, but we want to avoid rare cases when the test - // could fall exactly on the second boundary, so checking for - // greater than 1. + EXPECT_EQ(dis1->getSecs(), 1U); // Make sure it has secs set to 1. + EXPECT_GT(dis2->getSecs(), 1U); // Should be 2, but we want to avoid rare cases when the test + // could fall exactly on the second boundary, so checking for + // greater than 1. } // This test checks if HA failure can be simulated using -y and -Y options with DHCPv6. @@ -1954,8 +1956,8 @@ TEST_F(TestControlTest, haFailure6) { sleep(1); // wait a second... tc.sendPackets(1); // and send another packet. This should have secs set to 2. - EXPECT_EQ(tc.fake_sock_.sent_cnt_, 2); // Make sure the stats are up. - ASSERT_EQ(tc.fake_sock_.sent_pkts6_.size(), 2); // And the packets were captured. + EXPECT_EQ(tc.fake_sock_.sent_cnt_, 2U); // Make sure the stats are up. + ASSERT_EQ(tc.fake_sock_.sent_pkts6_.size(), 2U); // And the packets were captured. Pkt6Ptr sol1 = tc.fake_sock_.sent_pkts6_[0]; Pkt6Ptr sol2 = tc.fake_sock_.sent_pkts6_[1]; ASSERT_TRUE(sol1); @@ -1965,6 +1967,6 @@ TEST_F(TestControlTest, haFailure6) { ASSERT_TRUE(elapsed1); ASSERT_TRUE(elapsed2); - EXPECT_EQ(elapsed1->getValue(), 100); - EXPECT_GT(elapsed2->getValue(), 100); + EXPECT_EQ(elapsed1->getValue(), 100U); + EXPECT_GT(elapsed2->getValue(), 100U); }