mgmt: ForwarderStatus equality operators and formatted output
Change-Id: I6d814ef427a9db38ef46427888f3b3ba982bf641
Refs: #3903
diff --git a/tests/unit-tests/mgmt/nfd/channel-status.t.cpp b/tests/unit-tests/mgmt/nfd/channel-status.t.cpp
index 0ffe2de..7c89533 100644
--- a/tests/unit-tests/mgmt/nfd/channel-status.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/channel-status.t.cpp
@@ -36,44 +36,44 @@
{
ChannelStatus status1;
status1.setLocalUri("udp4://192.168.2.1");
-
- Block wire;
- BOOST_REQUIRE_NO_THROW(wire = status1.wireEncode());
+ Block wire = status1.wireEncode();
// These octets are obtained by the snippet below.
// This check is intended to detect unexpected encoding change in the future.
// for (Buffer::const_iterator it = wire.begin(); it != wire.end(); ++it) {
- // printf("0x%02x, ", *it);
+ // printf("0x%02x, ", *it);
// }
static const uint8_t expected[] = {
0x82, 0x14, 0x81, 0x12, 0x75, 0x64, 0x70, 0x34, 0x3a, 0x2f, 0x2f, 0x31, 0x39, 0x32,
0x2e, 0x31, 0x36, 0x38, 0x2e, 0x32, 0x2e, 0x31
};
- BOOST_REQUIRE_EQUAL_COLLECTIONS(expected, expected + sizeof(expected),
- wire.begin(), wire.end());
+ BOOST_CHECK_EQUAL_COLLECTIONS(expected, expected + sizeof(expected),
+ wire.begin(), wire.end());
- BOOST_REQUIRE_NO_THROW(ChannelStatus(wire));
ChannelStatus status2(wire);
- BOOST_CHECK_EQUAL(status1.getLocalUri(), status2.getLocalUri());
+ BOOST_CHECK_EQUAL(status1, status2);
}
BOOST_AUTO_TEST_CASE(Equality)
{
- ChannelStatus cs1, cs2;
+ ChannelStatus status1, status2;
- cs1.setLocalUri("udp4://127.0.0.1:6363");
- cs2 = cs1;
- BOOST_CHECK_EQUAL(cs1, cs2);
+ status1.setLocalUri("udp4://127.0.0.1:6363");
+ status2 = status1;
+ BOOST_CHECK_EQUAL(status1, status2);
- cs2.setLocalUri("dev://eth0");
- BOOST_CHECK_NE(cs1, cs2);
+ status2.setLocalUri("dev://eth0");
+ BOOST_CHECK_NE(status1, status2);
}
BOOST_AUTO_TEST_CASE(Print)
{
- ChannelStatus cs;
- cs.setLocalUri("udp4://127.0.0.1:6363");
- BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(cs),
+ ChannelStatus status;
+ BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(status),
+ "Channel(LocalUri: )");
+
+ status.setLocalUri("udp4://127.0.0.1:6363");
+ BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(status),
"Channel(LocalUri: udp4://127.0.0.1:6363)");
}