tests: respect naming conventions and improve nesting of some test suites
Change-Id: I65af858bc6d10197c6ee11111fa9f7c1faa617ef
Refs: #2497
diff --git a/tests/core/config-file.t.cpp b/tests/core/config-file.t.cpp
index 15ae377..8a41ac2 100644
--- a/tests/core/config-file.t.cpp
+++ b/tests/core/config-file.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -75,40 +75,34 @@
"}\n";
// counts of the respective section counts in config_example.info
-
const int CONFIG_N_A_SECTIONS = 1;
const int CONFIG_N_B_SECTIONS = 1;
class DummySubscriber
{
public:
-
- DummySubscriber(ConfigFile& config,
- int nASections,
- int nBSections,
- bool expectDryRun)
- : m_nASections(nASections),
- m_nBSections(nBSections),
- m_nRemainingACallbacks(nASections),
- m_nRemainingBCallbacks(nBSections),
- m_expectDryRun(expectDryRun)
+ DummySubscriber(ConfigFile& config, int nASections, int nBSections, bool expectDryRun)
+ : m_nASections(nASections)
+ , m_nBSections(nBSections)
+ , m_nRemainingACallbacks(nASections)
+ , m_nRemainingBCallbacks(nBSections)
+ , m_expectDryRun(expectDryRun)
{
-
}
+ virtual
+ ~DummySubscriber() = default;
+
void
onA(const ConfigSection& section, bool isDryRun)
{
- // NFD_LOG_DEBUG("a");
BOOST_CHECK_EQUAL(isDryRun, m_expectDryRun);
--m_nRemainingACallbacks;
}
-
void
onB(const ConfigSection& section, bool isDryRun)
{
- // NFD_LOG_DEBUG("b");
BOOST_CHECK_EQUAL(isDryRun, m_expectDryRun);
--m_nRemainingBCallbacks;
}
@@ -127,12 +121,6 @@
m_nRemainingBCallbacks == m_nBSections;
}
- virtual
- ~DummySubscriber()
- {
-
- }
-
private:
int m_nASections;
int m_nBSections;
@@ -144,7 +132,7 @@
class DummyAllSubscriber : public DummySubscriber
{
public:
- DummyAllSubscriber(ConfigFile& config, bool expectDryRun=false)
+ DummyAllSubscriber(ConfigFile& config, bool expectDryRun = false)
: DummySubscriber(config,
CONFIG_N_A_SECTIONS,
CONFIG_N_B_SECTIONS,
@@ -153,12 +141,6 @@
config.addSectionHandler("a", bind(&DummySubscriber::onA, this, _1, _2));
config.addSectionHandler("b", bind(&DummySubscriber::onB, this, _1, _2));
}
-
- virtual
- ~DummyAllSubscriber()
- {
-
- }
};
class DummyOneSubscriber : public DummySubscriber
@@ -166,7 +148,7 @@
public:
DummyOneSubscriber(ConfigFile& config,
const std::string& sectionName,
- bool expectDryRun=false)
+ bool expectDryRun = false)
: DummySubscriber(config,
(sectionName == "a"),
(sectionName == "b"),
@@ -188,12 +170,6 @@
}
}
-
- virtual
- ~DummyOneSubscriber()
- {
-
- }
};
class DummyNoSubscriber : public DummySubscriber
@@ -202,13 +178,6 @@
DummyNoSubscriber(ConfigFile& config, bool expectDryRun)
: DummySubscriber(config, 0, 0, expectDryRun)
{
-
- }
-
- virtual
- ~DummyNoSubscriber()
- {
-
}
};
@@ -375,8 +344,6 @@
bool m_missingFired;
};
-
-
BOOST_FIXTURE_TEST_CASE(OnConfigUncoveredSections, MissingCallbackFixture)
{
ConfigFile file;
diff --git a/tests/core/manager-base.t.cpp b/tests/core/manager-base.t.cpp
index 49f35b9..2137a01 100644
--- a/tests/core/manager-base.t.cpp
+++ b/tests/core/manager-base.t.cpp
@@ -84,7 +84,6 @@
ManagerTester m_manager;
};
-BOOST_AUTO_TEST_SUITE(Core)
BOOST_FIXTURE_TEST_SUITE(TestManagerBase, ManagerBaseFixture)
BOOST_AUTO_TEST_CASE(RegisterCommandHandler)
@@ -170,7 +169,6 @@
}
BOOST_AUTO_TEST_SUITE_END() // TestManagerBase
-BOOST_AUTO_TEST_SUITE_END() // Core
} // namespace tests
} // namespace nfd
diff --git a/tests/core/ndebug.t.cpp b/tests/core/ndebug.t.cpp
index a624b6b..3af09aa 100644
--- a/tests/core/ndebug.t.cpp
+++ b/tests/core/ndebug.t.cpp
@@ -38,6 +38,8 @@
// in release builds, assertion shouldn't execute
BOOST_ASSERT(false);
#endif
+ // Trivial check to avoid "test case did not check any assertions" message from Boost.Test
+ BOOST_CHECK(true);
}
BOOST_AUTO_TEST_CASE(SideEffect)
diff --git a/tests/core/network.t.cpp b/tests/core/network.t.cpp
index 74ceaac..043a7dd 100644
--- a/tests/core/network.t.cpp
+++ b/tests/core/network.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -144,7 +144,7 @@
boost::lexical_cast<Network>("2001:db8:3f9:0::/64"));
}
-BOOST_AUTO_TEST_SUITE_END() // CoreNetwork
+BOOST_AUTO_TEST_SUITE_END() // TestNetwork
} // namespace tests
} // namespace nfd
diff --git a/tests/core/scheduler.t.cpp b/tests/core/scheduler.t.cpp
index 45e6e06..a2ad752 100644
--- a/tests/core/scheduler.t.cpp
+++ b/tests/core/scheduler.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -74,6 +74,7 @@
++count3;
}
+public:
int count1;
int count2;
int count3;
@@ -102,17 +103,21 @@
{
EventId i;
scheduler::cancel(i);
+
+ // Trivial check to avoid "test case did not check any assertions" message from Boost.Test
+ BOOST_CHECK(true);
}
class SelfCancelFixture : protected BaseFixture
{
public:
void
- cancelSelf()
+ cancelSelf() const
{
scheduler::cancel(m_selfEventId);
}
+public:
EventId m_selfEventId;
};
@@ -182,7 +187,7 @@
BOOST_CHECK(s1 != s2);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestScheduler
} // namespace tests
} // namespace nfd