rib: fix incorrect operator<< output

refs #3423

Change-Id: I22137a1ad2c3b64d74b7ba2fe6b5f7f55486c276
This commit is contained in:
Weiwei Liu committed 2016-11-29 23:48:28 -07:00
1 parent 52fa45c6ee
commit aaa58a6c10
2 files changed
+44 -1

No files matched your search

+1 -1
View File
@@ -507,7 +507,7 @@ std::ostream&
operator<<(std::ostream& os, const Rib& rib)
{
for (const auto& item : rib) {
os << item.second << "\n";
os << *item.second << "\n";
}
return os;
+43
View File
@@ -336,6 +336,49 @@ BOOST_AUTO_TEST_CASE(RibSignals)
}
BOOST_AUTO_TEST_CASE(Output)
{
rib::Rib rib;
Route root;
Name name1("/");
root.faceId = 1;
root.origin = 20;
root.expires = time::steady_clock::TimePoint::max();
rib.insert(name1, root);
Route route1;
Name name2("/hello");
route1.faceId = 2;
route1.origin = 20;
route1.expires = time::steady_clock::TimePoint::max();
rib.insert(name2, route1);
Route route2;
Name name3("/hello/world");
route2.faceId = 3;
route2.origin = 20;
route2.expires = time::steady_clock::TimePoint::max();
rib.insert(name3, route2);
const std::string ribStr = std::string(R"TEXT(
RibEntry {
Name: /
Route(faceid: 1, origin: 20, cost: 0, flags: 0, never expires)
}
RibEntry {
Name: /hello
Route(faceid: 2, origin: 20, cost: 0, flags: 0, never expires)
}
RibEntry {
Name: /hello/world
Route(faceid: 3, origin: 20, cost: 0, flags: 0, never expires)
}
)TEXT").substr(1);
BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(rib), ribStr);
}
BOOST_AUTO_TEST_SUITE_END() // TestRib
} // namespace tests