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/table/cs.cpp b/tests/table/cs.cpp
index b7bdbb8..eeca6b5 100644
--- a/tests/table/cs.cpp
+++ b/tests/table/cs.cpp
@@ -6,11 +6,12 @@
#include "table/cs.hpp"
-#include <boost/test/unit_test.hpp>
+#include "tests/test-common.hpp"
namespace nfd {
+namespace tests {
-BOOST_AUTO_TEST_SUITE(TableCs)
+BOOST_FIXTURE_TEST_SUITE(TableCs, BaseFixture)
BOOST_AUTO_TEST_CASE(FakeInsertFind)
{
@@ -25,4 +26,5 @@
BOOST_AUTO_TEST_SUITE_END()
+} // namespace tests
} // namespace nfd
diff --git a/tests/table/fib.cpp b/tests/table/fib.cpp
index d1fe068..1615876 100644
--- a/tests/table/fib.cpp
+++ b/tests/table/fib.cpp
@@ -5,13 +5,14 @@
*/
#include "table/fib.hpp"
-#include "../face/dummy-face.hpp"
+#include "tests/face/dummy-face.hpp"
-#include <boost/test/unit_test.hpp>
+#include "tests/test-common.hpp"
namespace nfd {
+namespace tests {
-BOOST_AUTO_TEST_SUITE(TableFib)
+BOOST_FIXTURE_TEST_SUITE(TableFib, BaseFixture)
BOOST_AUTO_TEST_CASE(Entry)
{
@@ -302,4 +303,5 @@
BOOST_AUTO_TEST_SUITE_END()
+} // namespace tests
} // namespace nfd
diff --git a/tests/table/measurements-accessor.cpp b/tests/table/measurements-accessor.cpp
index 9738701..3d7e24f 100644
--- a/tests/table/measurements-accessor.cpp
+++ b/tests/table/measurements-accessor.cpp
@@ -7,11 +7,12 @@
#include "table/measurements-accessor.hpp"
#include "fw/forwarder.hpp"
-#include <boost/test/unit_test.hpp>
+#include "tests/test-common.hpp"
namespace nfd {
+namespace tests {
-BOOST_AUTO_TEST_SUITE(TableMeasurementsAccessor)
+BOOST_FIXTURE_TEST_SUITE(TableMeasurementsAccessor, BaseFixture)
class MeasurementsAccessorTestStrategy : public fw::Strategy
{
@@ -47,7 +48,6 @@
BOOST_AUTO_TEST_CASE(Access)
{
- resetGlobalIoService();
Forwarder forwarder;
shared_ptr<MeasurementsAccessorTestStrategy> strategy1 =
@@ -87,4 +87,5 @@
BOOST_AUTO_TEST_SUITE_END()
+} // namespace tests
} // namespace nfd
diff --git a/tests/table/measurements.cpp b/tests/table/measurements.cpp
index 4643fb8..69e2506 100644
--- a/tests/table/measurements.cpp
+++ b/tests/table/measurements.cpp
@@ -6,15 +6,15 @@
#include "table/measurements.hpp"
-#include <boost/test/unit_test.hpp>
+#include "tests/test-common.hpp"
namespace nfd {
+namespace tests {
-BOOST_AUTO_TEST_SUITE(TableMeasurements)
+BOOST_FIXTURE_TEST_SUITE(TableMeasurements, BaseFixture)
BOOST_AUTO_TEST_CASE(Get_Parent)
{
- resetGlobalIoService();
Measurements measurements;
Name name0;
@@ -38,4 +38,5 @@
BOOST_AUTO_TEST_SUITE_END()
+} // namespace tests
} // namespace nfd
diff --git a/tests/table/name-tree.cpp b/tests/table/name-tree.cpp
index bc34c15..4411fd2 100644
--- a/tests/table/name-tree.cpp
+++ b/tests/table/name-tree.cpp
@@ -5,15 +5,17 @@
*/
#include "table/name-tree.hpp"
-#include <boost/test/unit_test.hpp>
+
+#include "tests/test-common.hpp"
namespace nfd {
+namespace tests {
using name_tree::Entry;
-BOOST_AUTO_TEST_SUITE(TableNameTree)
+BOOST_FIXTURE_TEST_SUITE(TableNameTree, BaseFixture)
-BOOST_AUTO_TEST_CASE (Entry)
+BOOST_AUTO_TEST_CASE(Entry)
{
Name prefix("ndn:/named-data/research/abc/def/ghi");
@@ -99,7 +101,7 @@
erasePitEntry(PitEntry2), false);
}
-BOOST_AUTO_TEST_CASE (NameTreeBasic)
+BOOST_AUTO_TEST_CASE(NameTreeBasic)
{
size_t nBuckets = 16;
NameTree nt(nBuckets);
@@ -266,6 +268,5 @@
BOOST_AUTO_TEST_SUITE_END()
+} // namespace tests
} // namespace nfd
-
-
diff --git a/tests/table/pit.cpp b/tests/table/pit.cpp
index 916db81..f366ea2 100644
--- a/tests/table/pit.cpp
+++ b/tests/table/pit.cpp
@@ -5,13 +5,14 @@
*/
#include "table/pit.hpp"
-#include "../face/dummy-face.hpp"
+#include "tests/face/dummy-face.hpp"
-#include <boost/test/unit_test.hpp>
+#include "tests/test-common.hpp"
namespace nfd {
+namespace tests {
-BOOST_AUTO_TEST_SUITE(TablePit)
+BOOST_FIXTURE_TEST_SUITE(TablePit, BaseFixture)
BOOST_AUTO_TEST_CASE(EntryInOutRecords)
{
@@ -288,4 +289,5 @@
BOOST_AUTO_TEST_SUITE_END()
+} // namespace tests
} // namespace nfd
diff --git a/tests/table/strategy-info-host.cpp b/tests/table/strategy-info-host.cpp
index af3351e..b2d1f07 100644
--- a/tests/table/strategy-info-host.cpp
+++ b/tests/table/strategy-info-host.cpp
@@ -6,9 +6,10 @@
#include "table/strategy-info-host.hpp"
-#include <boost/test/unit_test.hpp>
+#include "tests/test-common.hpp"
namespace nfd {
+namespace tests {
static int g_DummyStrategyInfo_count = 0;
@@ -29,7 +30,7 @@
int m_id;
};
-BOOST_AUTO_TEST_SUITE(TableStrategyInfoHost)
+BOOST_FIXTURE_TEST_SUITE(TableStrategyInfoHost, BaseFixture)
BOOST_AUTO_TEST_CASE(SetGetClear)
{
@@ -56,4 +57,5 @@
BOOST_AUTO_TEST_SUITE_END()
+} // namespace tests
} // namespace nfd