fw: FaceTable iterator dereferences to Face& instead of shared_ptr
This commit also improves the speed and reliability of
Mgmt/TestFaceManager/CreateFace test suite.
refs #3205
Change-Id: Idd013488ced2d7f8072ef8a3d910f94da2e0c8ac
diff --git a/tests/daemon/fw/face-table.t.cpp b/tests/daemon/fw/face-table.t.cpp
index 4616efb..e8962b8 100644
--- a/tests/daemon/fw/face-table.t.cpp
+++ b/tests/daemon/fw/face-table.t.cpp
@@ -113,41 +113,31 @@
BOOST_CHECK_EQUAL(std::distance(faceTable.begin(), faceTable.end()), faceTable.size());
hasFace1 = hasFace2 = false;
for (FaceTable::const_iterator it = faceTable.begin(); it != faceTable.end(); ++it) {
- if (*it == face1) {
- hasFace1 = true;
- }
+ hasFace1 = hasFace1 || &*it == face1.get();
}
- BOOST_CHECK(hasFace1);
+ BOOST_CHECK_EQUAL(hasFace1, true);
faceTable.add(face2);
BOOST_CHECK_EQUAL(faceTable.size(), 2);
BOOST_CHECK_EQUAL(std::distance(faceTable.begin(), faceTable.end()), faceTable.size());
hasFace1 = hasFace2 = false;
for (FaceTable::const_iterator it = faceTable.begin(); it != faceTable.end(); ++it) {
- if (*it == face1) {
- hasFace1 = true;
- }
- if (*it == face2) {
- hasFace2 = true;
- }
+ hasFace1 = hasFace1 || &*it == face1.get();
+ hasFace2 = hasFace2 || &*it == face2.get();
}
- BOOST_CHECK(hasFace1);
- BOOST_CHECK(hasFace2);
+ BOOST_CHECK_EQUAL(hasFace1, true);
+ BOOST_CHECK_EQUAL(hasFace2, true);
face1->close();
BOOST_CHECK_EQUAL(faceTable.size(), 1);
BOOST_CHECK_EQUAL(std::distance(faceTable.begin(), faceTable.end()), faceTable.size());
hasFace1 = hasFace2 = false;
for (FaceTable::const_iterator it = faceTable.begin(); it != faceTable.end(); ++it) {
- if (*it == face1) {
- hasFace1 = true;
- }
- if (*it == face2) {
- hasFace2 = true;
- }
+ hasFace1 = hasFace1 || &*it == face1.get();
+ hasFace2 = hasFace2 || &*it == face2.get();
}
- BOOST_CHECK(!hasFace1);
- BOOST_CHECK(hasFace2);
+ BOOST_CHECK_EQUAL(hasFace1, false);
+ BOOST_CHECK_EQUAL(hasFace2, true);
}
BOOST_AUTO_TEST_SUITE_END() // TestFaceTable