Skip to content

Commit

Permalink
[#3446] addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Razvan Becheriu committed Jul 16, 2024
1 parent 797512d commit a7f5c38
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/lib/dhcpsrv/tests/network_state_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ using namespace isc::asiolink;
using namespace isc::dhcp;
using namespace isc::util;

namespace {
namespace {

/// @brief Test fixture class for @c NetworkState class.
class NetworkStateTest : public ::testing::Test {
Expand Down Expand Up @@ -201,32 +201,33 @@ class NetworkStateTest : public ::testing::Test {
std::vector<uint32_t> local,
std::vector<uint32_t> remote,
bool global) {
std::string expected = "{ \"disabled-by-db-connection\": ";
expected += db_connection ? "true" : "false";
expected += ", \"disabled-by-local-command\": [ ";
std::ostringstream data;
data << std::boolalpha
<< "{ \"disabled-by-db-connection\": " << db_connection
<< ", \"disabled-by-local-command\": [ ";
bool not_first = false;
for (auto const value : local) {
if (not_first) {
expected += ", ";
data << ", ";
}
expected += std::to_string(value);
data << value;
not_first = true;
}
expected += " ], \"disabled-by-remote-command\": [ ";
data << " ], \"disabled-by-remote-command\": [ ";
not_first = false;
for (auto const value : remote) {
if (not_first) {
expected += ", ";
data << ", ";
}
expected += std::to_string(value);
data << value;
not_first = true;
}
expected += " ], \"disabled-by-user\": ";
expected += user ? "true" : "false";
expected += ", \"globally-disabled\": ";
expected += global ? "true" : "false";
expected += " }";
EXPECT_EQ(expected, state.toElement()->str());
data << " ], \"disabled-by-user\": " << user
<< ", \"globally-disabled\": " << global
<< " }";
auto const& expected = data.str();
auto const& actual = state.toElement()->str();
EXPECT_EQ(expected, actual);
EXPECT_EQ(!global, state.isServiceEnabled());
}

Expand Down

0 comments on commit a7f5c38

Please sign in to comment.