tests: resetGlobalIoService for every test
All tests must use BaseFixture or a fixture derived from it to get this feature.
This commit also fixes a few warnings in tests/mgmt, and moves test cases into nfd::tests namespace.
refs #1290
Change-Id: I891441a5abce170e35648d463f7157b18429f79f
diff --git a/tests/face/dummy-face.hpp b/tests/face/dummy-face.hpp
index 45a3d43..969053a 100644
--- a/tests/face/dummy-face.hpp
+++ b/tests/face/dummy-face.hpp
@@ -11,6 +11,7 @@
#include "face/local-face.hpp"
namespace nfd {
+namespace tests {
/** \class DummyFace
* \brief a Face for unit testing
@@ -50,11 +51,7 @@
this->onReceiveData(data);
}
-protected:
- virtual void
- afterSend()
- {
- }
+ EventEmitter<> afterSend;
public:
std::vector<Interest> m_sentInterests;
@@ -64,6 +61,7 @@
typedef DummyFaceImpl<Face> DummyFace;
typedef DummyFaceImpl<LocalFace> DummyLocalFace;
+} // namespace tests
} // namespace nfd
#endif // TEST_FACE_DUMMY_FACE_HPP
diff --git a/tests/face/ethernet.cpp b/tests/face/ethernet.cpp
index 6803a1a..cd84008 100644
--- a/tests/face/ethernet.cpp
+++ b/tests/face/ethernet.cpp
@@ -5,14 +5,14 @@
*/
#include "face/ethernet-channel-factory.hpp"
-
#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <boost/test/unit_test.hpp>
+#include "tests/test-common.hpp"
namespace nfd {
+namespace tests {
-BOOST_AUTO_TEST_SUITE(FaceEthernet)
+BOOST_FIXTURE_TEST_SUITE(FaceEthernet, BaseFixture)
BOOST_AUTO_TEST_CASE(MulticastFacesMap)
{
@@ -104,4 +104,5 @@
BOOST_AUTO_TEST_SUITE_END()
+} // namespace tests
} // namespace nfd
diff --git a/tests/face/face.cpp b/tests/face/face.cpp
index 5f8ab6e..d48ed70 100644
--- a/tests/face/face.cpp
+++ b/tests/face/face.cpp
@@ -8,11 +8,12 @@
#include "face/local-face.hpp"
#include "dummy-face.hpp"
-#include <boost/test/unit_test.hpp>
+#include "tests/test-common.hpp"
namespace nfd {
+namespace tests {
-BOOST_AUTO_TEST_SUITE(FaceFace)
+BOOST_FIXTURE_TEST_SUITE(FaceFace, BaseFixture)
BOOST_AUTO_TEST_CASE(Description)
{
@@ -52,4 +53,5 @@
BOOST_AUTO_TEST_SUITE_END()
+} // namespace tests
} // namespace nfd
diff --git a/tests/face/ndnlp.cpp b/tests/face/ndnlp.cpp
index 77e99e2..77ac7e9 100644
--- a/tests/face/ndnlp.cpp
+++ b/tests/face/ndnlp.cpp
@@ -8,11 +8,12 @@
#include "face/ndnlp-slicer.hpp"
#include "face/ndnlp-partial-message-store.hpp"
-#include <boost/test/unit_test.hpp>
+#include "tests/test-common.hpp"
namespace nfd {
+namespace tests {
-BOOST_AUTO_TEST_SUITE(FaceNdnlp)
+BOOST_FIXTURE_TEST_SUITE(FaceNdnlp, BaseFixture)
BOOST_AUTO_TEST_CASE(SequenceBlock)
{
@@ -129,7 +130,7 @@
BOOST_CHECK_EQUAL(totalPayloadSize, block.size());
}
-class ReassembleFixture
+class ReassembleFixture : protected BaseFixture
{
protected:
ReassembleFixture()
@@ -210,4 +211,5 @@
BOOST_AUTO_TEST_SUITE_END()
+} // namespace tests
} // namespace nfd
diff --git a/tests/face/tcp.cpp b/tests/face/tcp.cpp
index cfe0ba5..5990ab4 100644
--- a/tests/face/tcp.cpp
+++ b/tests/face/tcp.cpp
@@ -6,14 +6,14 @@
#include "face/tcp-channel-factory.hpp"
#include "core/scheduler.hpp"
-
#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <boost/test/unit_test.hpp>
+#include "tests/test-common.hpp"
namespace nfd {
+namespace tests {
-BOOST_AUTO_TEST_SUITE(FaceTcp)
+BOOST_FIXTURE_TEST_SUITE(FaceTcp, BaseFixture)
BOOST_AUTO_TEST_CASE(ChannelMap)
{
@@ -28,7 +28,7 @@
BOOST_CHECK_NE(channel1, channel2);
}
-class EndToEndFixture
+class EndToEndFixture : protected BaseFixture
{
public:
void
@@ -373,4 +373,5 @@
BOOST_AUTO_TEST_SUITE_END()
+} // namespace tests
} // namespace nfd
diff --git a/tests/face/unix-stream.cpp b/tests/face/unix-stream.cpp
index 9d6a6cf..8fba080 100644
--- a/tests/face/unix-stream.cpp
+++ b/tests/face/unix-stream.cpp
@@ -6,16 +6,16 @@
#include "face/unix-stream-channel-factory.hpp"
#include "core/scheduler.hpp"
-
#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <boost/test/unit_test.hpp>
+#include "tests/test-common.hpp"
+
+namespace nfd {
+namespace tests {
using namespace boost::asio::local;
-namespace nfd {
-
-BOOST_AUTO_TEST_SUITE(FaceUnixStream)
+BOOST_FIXTURE_TEST_SUITE(FaceUnixStream, BaseFixture)
BOOST_AUTO_TEST_CASE(ChannelMap)
{
@@ -30,7 +30,7 @@
BOOST_CHECK_NE(channel1, channel2);
}
-class EndToEndFixture
+class EndToEndFixture : protected BaseFixture
{
public:
void
@@ -444,4 +444,5 @@
BOOST_AUTO_TEST_SUITE_END()
+} // namespace tests
} // namespace nfd