src: Reorganizing source code in preparation to merge NRD code
Note that as of this commit, there are several changes in location of
compiled binaries in `build/` folder:
* `nfd` has been moved to `build/bin/nfd`
* `unit-tests` has been split into `unit-tests-core` and `unit-tests-daemon`
Change-Id: I2c830c117879edbaa5457d6423c13f0273285919
Refs: #1486
diff --git a/tests/core/config-file.cpp b/tests/core/config-file.cpp
new file mode 100644
index 0000000..bb75b77
--- /dev/null
+++ b/tests/core/config-file.cpp
@@ -0,0 +1,367 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014 Regents of the University of California,
+ * Arizona Board of Regents,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University,
+ * Washington University in St. Louis,
+ * Beijing Institute of Technology
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#include "core/config-file.hpp"
+
+#include "tests/test-common.hpp"
+
+#include <fstream>
+
+namespace nfd {
+namespace tests {
+
+NFD_LOG_INIT("ConfigFileTest");
+
+BOOST_FIXTURE_TEST_SUITE(MgmtConfigFile, BaseFixture)
+
+// a
+// {
+// akey "avalue"
+// }
+// b
+// {
+// bkey "bvalue"
+// }
+
+const std::string CONFIG =
+"a\n"
+"{\n"
+" akey \"avalue\"\n"
+"}\n"
+"b\n"
+"{\n"
+" bkey \"bvalue\"\n"
+"}\n";
+
+
+// a
+// {
+// akey "avalue"
+// }
+// b
+//
+// bkey "bvalue"
+// }
+
+const std::string MALFORMED_CONFIG =
+"a\n"
+"{\n"
+" akey \"avalue\"\n"
+"}\n"
+"b\n"
+"\n"
+" bkey \"bvalue\"\n"
+"}\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)
+ {
+
+ }
+
+ 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;
+ }
+
+ bool
+ allCallbacksFired() const
+ {
+ return m_nRemainingACallbacks == 0 &&
+ m_nRemainingBCallbacks == 0;
+ }
+
+ bool
+ noCallbacksFired() const
+ {
+ return m_nRemainingACallbacks == m_nASections &&
+ m_nRemainingBCallbacks == m_nBSections;
+ }
+
+ virtual
+ ~DummySubscriber()
+ {
+
+ }
+
+private:
+ int m_nASections;
+ int m_nBSections;
+ int m_nRemainingACallbacks;
+ int m_nRemainingBCallbacks;
+ bool m_expectDryRun;
+};
+
+class DummyAllSubscriber : public DummySubscriber
+{
+public:
+ DummyAllSubscriber(ConfigFile& config, bool expectDryRun=false)
+ : DummySubscriber(config,
+ CONFIG_N_A_SECTIONS,
+ CONFIG_N_B_SECTIONS,
+ expectDryRun)
+ {
+ config.addSectionHandler("a", bind(&DummySubscriber::onA, this, _1, _2));
+ config.addSectionHandler("b", bind(&DummySubscriber::onB, this, _1, _2));
+ }
+
+ virtual
+ ~DummyAllSubscriber()
+ {
+
+ }
+};
+
+class DummyOneSubscriber : public DummySubscriber
+{
+public:
+ DummyOneSubscriber(ConfigFile& config,
+ const std::string& sectionName,
+ bool expectDryRun=false)
+ : DummySubscriber(config,
+ (sectionName == "a"),
+ (sectionName == "b"),
+ expectDryRun)
+ {
+ if (sectionName == "a")
+ {
+ config.addSectionHandler(sectionName, bind(&DummySubscriber::onA, this, _1, _2));
+ }
+ else if (sectionName == "b")
+ {
+ config.addSectionHandler(sectionName, bind(&DummySubscriber::onB, this, _1, _2));
+ }
+ else
+ {
+ BOOST_FAIL("Test setup error: "
+ << "Unexpected section name "
+ <<"\"" << sectionName << "\"");
+ }
+
+ }
+
+ virtual
+ ~DummyOneSubscriber()
+ {
+
+ }
+};
+
+class DummyNoSubscriber : public DummySubscriber
+{
+public:
+ DummyNoSubscriber(ConfigFile& config, bool expectDryRun)
+ : DummySubscriber(config, 0, 0, expectDryRun)
+ {
+
+ }
+
+ virtual
+ ~DummyNoSubscriber()
+ {
+
+ }
+};
+
+BOOST_AUTO_TEST_CASE(OnConfigStream)
+{
+ ConfigFile file;
+ DummyAllSubscriber sub(file);
+ std::ifstream input;
+
+ input.open("tests/core/config_example.info");
+ BOOST_REQUIRE(input.is_open());
+
+ file.parse(input, false, "config_example.info");
+ BOOST_CHECK(sub.allCallbacksFired());
+}
+
+BOOST_AUTO_TEST_CASE(OnConfigStreamEmptyStream)
+{
+ ConfigFile file;
+ DummyAllSubscriber sub(file);
+
+ std::ifstream input;
+
+ BOOST_CHECK_THROW(file.parse(input, false, "unknown"), ConfigFile::Error);
+ BOOST_CHECK(sub.noCallbacksFired());
+}
+
+
+BOOST_AUTO_TEST_CASE(OnConfigString)
+{
+ ConfigFile file;
+ DummyAllSubscriber sub(file);
+
+ file.parse(CONFIG, false, "dummy-config");
+
+ BOOST_CHECK(sub.allCallbacksFired());
+}
+
+BOOST_AUTO_TEST_CASE(OnConfigStringEmpty)
+{
+ ConfigFile file;
+ DummyAllSubscriber sub(file);
+
+ BOOST_CHECK_THROW(file.parse(std::string(), false, "dummy-config"), ConfigFile::Error);
+ BOOST_CHECK(sub.noCallbacksFired());
+}
+
+BOOST_AUTO_TEST_CASE(OnConfigStringMalformed)
+{
+ ConfigFile file;
+ DummyAllSubscriber sub(file);
+
+ BOOST_CHECK_THROW(file.parse(MALFORMED_CONFIG, false, "dummy-config"), ConfigFile::Error);
+ BOOST_CHECK(sub.noCallbacksFired());
+}
+
+BOOST_AUTO_TEST_CASE(OnConfigStringDryRun)
+{
+ ConfigFile file;
+ DummyAllSubscriber sub(file, true);
+
+ file.parse(CONFIG, true, "dummy-config");
+
+ BOOST_CHECK(sub.allCallbacksFired());
+}
+
+BOOST_AUTO_TEST_CASE(OnConfigFilename)
+{
+ ConfigFile file;
+ DummyAllSubscriber sub(file);
+
+ file.parse("tests/core/config_example.info", false);
+
+ BOOST_CHECK(sub.allCallbacksFired());
+}
+
+BOOST_AUTO_TEST_CASE(OnConfigFilenameNoFile)
+{
+ ConfigFile file;
+ DummyAllSubscriber sub(file);
+
+ BOOST_CHECK_THROW(file.parse("i_made_this_up.info", false), ConfigFile::Error);
+
+ BOOST_CHECK(sub.noCallbacksFired());
+}
+
+BOOST_AUTO_TEST_CASE(OnConfigFilenameMalformed)
+{
+ ConfigFile file;
+ DummyAllSubscriber sub(file);
+
+ BOOST_CHECK_THROW(file.parse("tests/core/config_malformed.info", false), ConfigFile::Error);
+
+ BOOST_CHECK(sub.noCallbacksFired());
+}
+
+BOOST_AUTO_TEST_CASE(OnConfigStreamDryRun)
+{
+ ConfigFile file;
+ DummyAllSubscriber sub(file, true);
+ std::ifstream input;
+
+ input.open("tests/core/config_example.info");
+ BOOST_REQUIRE(input.is_open());
+
+ file.parse(input, true, "tests/core/config_example.info");
+
+ BOOST_CHECK(sub.allCallbacksFired());
+
+ input.close();
+}
+
+BOOST_AUTO_TEST_CASE(OnConfigFilenameDryRun)
+{
+ ConfigFile file;
+ DummyAllSubscriber sub(file, true);
+
+ file.parse("tests/core/config_example.info", true);
+ BOOST_CHECK(sub.allCallbacksFired());
+}
+
+BOOST_AUTO_TEST_CASE(OnConfigReplaceSubscriber)
+{
+ ConfigFile file;
+ DummyAllSubscriber sub1(file);
+ DummyAllSubscriber sub2(file);
+
+ file.parse(CONFIG, false, "dummy-config");
+
+ BOOST_CHECK(sub1.noCallbacksFired());
+ BOOST_CHECK(sub2.allCallbacksFired());
+}
+
+BOOST_AUTO_TEST_CASE(OnConfigUncoveredSections)
+{
+ ConfigFile file;
+
+ BOOST_CHECK_THROW(file.parse(CONFIG, false, "dummy-config"), ConfigFile::Error);
+}
+
+BOOST_AUTO_TEST_CASE(OnConfigCoveredByPartialSubscribers)
+{
+ ConfigFile file;
+ DummyOneSubscriber subA(file, "a");
+ DummyOneSubscriber subB(file, "b");
+
+ file.parse(CONFIG, false, "dummy-config");
+
+ BOOST_CHECK(subA.allCallbacksFired());
+ BOOST_CHECK(subB.allCallbacksFired());
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace nfd
diff --git a/tests/core/config_example.info b/tests/core/config_example.info
new file mode 100644
index 0000000..d61691f
--- /dev/null
+++ b/tests/core/config_example.info
@@ -0,0 +1,9 @@
+a
+{
+ akey "avalue"
+}
+
+b
+{
+ bkey "bvalue"
+}
\ No newline at end of file
diff --git a/tests/core/config_malformed.info b/tests/core/config_malformed.info
new file mode 100644
index 0000000..d3a1f9e
--- /dev/null
+++ b/tests/core/config_malformed.info
@@ -0,0 +1,9 @@
+a
+{
+ akey "avalue"
+}
+
+b
+
+ bkey "bvalue"
+}
\ No newline at end of file
diff --git a/tests/core/ethernet.cpp b/tests/core/ethernet.cpp
new file mode 100644
index 0000000..157f574
--- /dev/null
+++ b/tests/core/ethernet.cpp
@@ -0,0 +1,89 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014 Regents of the University of California,
+ * Arizona Board of Regents,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University,
+ * Washington University in St. Louis,
+ * Beijing Institute of Technology
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#include "core/ethernet.hpp"
+#include "tests/test-common.hpp"
+
+namespace nfd {
+namespace tests {
+
+BOOST_FIXTURE_TEST_SUITE(FaceEthernetAddress, BaseFixture)
+
+BOOST_AUTO_TEST_CASE(Checks)
+{
+ BOOST_CHECK(ethernet::Address().isNull());
+ BOOST_CHECK(ethernet::getBroadcastAddress().isBroadcast());
+ BOOST_CHECK(ethernet::getDefaultMulticastAddress().isMulticast());
+}
+
+BOOST_AUTO_TEST_CASE(ToString)
+{
+ BOOST_CHECK_EQUAL(ethernet::Address().toString('-'),
+ "00-00-00-00-00-00");
+ BOOST_CHECK_EQUAL(ethernet::getBroadcastAddress().toString(),
+ "ff:ff:ff:ff:ff:ff");
+ BOOST_CHECK_EQUAL(ethernet::Address(0x01, 0x23, 0x45, 0x67, 0x89, 0xAB).toString('-'),
+ "01-23-45-67-89-ab");
+ BOOST_CHECK_EQUAL(ethernet::Address(0x01, 0x23, 0x45, 0x67, 0x89, 0xAB).toString(),
+ "01:23:45:67:89:ab");
+}
+
+BOOST_AUTO_TEST_CASE(FromString)
+{
+ BOOST_CHECK_EQUAL(ethernet::Address::fromString("0:0:0:0:0:0"),
+ ethernet::Address());
+ BOOST_CHECK_EQUAL(ethernet::Address::fromString("ff-ff-ff-ff-ff-ff"),
+ ethernet::getBroadcastAddress());
+ BOOST_CHECK_EQUAL(ethernet::Address::fromString("de:ad:be:ef:1:2"),
+ ethernet::Address(0xde, 0xad, 0xbe, 0xef, 0x01, 0x02));
+ BOOST_CHECK_EQUAL(ethernet::Address::fromString("DE:AD:BE:EF:1:2"),
+ ethernet::Address(0xde, 0xad, 0xbe, 0xef, 0x01, 0x02));
+
+ // malformed inputs
+ BOOST_CHECK_EQUAL(ethernet::Address::fromString("01.23.45.67.89.ab"),
+ ethernet::Address());
+ BOOST_CHECK_EQUAL(ethernet::Address::fromString("01:23:45 :67:89:ab"),
+ ethernet::Address());
+ BOOST_CHECK_EQUAL(ethernet::Address::fromString("01:23:45:67:89::1"),
+ ethernet::Address());
+ BOOST_CHECK_EQUAL(ethernet::Address::fromString("01-23-45-67-89"),
+ ethernet::Address());
+ BOOST_CHECK_EQUAL(ethernet::Address::fromString("01:23:45:67:89:ab:cd"),
+ ethernet::Address());
+ BOOST_CHECK_EQUAL(ethernet::Address::fromString("01:23:45:67-89-ab"),
+ ethernet::Address());
+ BOOST_CHECK_EQUAL(ethernet::Address::fromString("qw-er-ty-12-34-56"),
+ ethernet::Address());
+ BOOST_CHECK_EQUAL(ethernet::Address::fromString("this-is-not-an-ethernet-address"),
+ ethernet::Address());
+ BOOST_CHECK_EQUAL(ethernet::Address::fromString("foobar"),
+ ethernet::Address());
+ BOOST_CHECK_EQUAL(ethernet::Address::fromString(""),
+ ethernet::Address());
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace nfd
diff --git a/tests/core/face-uri.cpp b/tests/core/face-uri.cpp
index 5d31f66..0e54f04 100644
--- a/tests/core/face-uri.cpp
+++ b/tests/core/face-uri.cpp
@@ -24,7 +24,7 @@
#include "core/face-uri.hpp"
#ifdef HAVE_LIBPCAP
-#include "face/ethernet.hpp"
+#include "core/ethernet.hpp"
#endif // HAVE_LIBPCAP
#include "tests/test-common.hpp"
diff --git a/tests/core/global-configuration.cpp b/tests/core/global-configuration.cpp
deleted file mode 100644
index 77c28c4..0000000
--- a/tests/core/global-configuration.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014 Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-#include "../test-common.hpp"
-#include "core/logger.hpp"
-#include "mgmt/config-file.hpp"
-
-#include <boost/filesystem.hpp>
-
-namespace nfd {
-namespace tests {
-
-class GlobalConfigurationFixture
-{
-public:
- GlobalConfigurationFixture()
- {
- const std::string filename = "unit-tests.conf";
- if (boost::filesystem::exists(filename))
- {
- ConfigFile config;
- LoggerFactory::getInstance().setConfigFile(config);
-
- config.parse(filename, false);
- }
- }
-};
-
-BOOST_GLOBAL_FIXTURE(GlobalConfigurationFixture)
-
-} // namespace tests
-} // namespace nfd
diff --git a/tests/core/limited-io.cpp b/tests/core/limited-io.cpp
deleted file mode 100644
index b22be89..0000000
--- a/tests/core/limited-io.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014 Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-#include "limited-io.hpp"
-#include "core/logger.hpp"
-
-namespace nfd {
-namespace tests {
-
-NFD_LOG_INIT("LimitedIo");
-
-const int LimitedIo::UNLIMITED_OPS = std::numeric_limits<int>::max();
-const time::nanoseconds LimitedIo::UNLIMITED_TIME = time::nanoseconds::min();
-
-LimitedIo::LimitedIo()
- : m_isRunning(false)
- , m_nOpsRemaining(0)
-{
-}
-
-LimitedIo::StopReason
-LimitedIo::run(int nOpsLimit, const time::nanoseconds& nTimeLimit)
-{
- BOOST_ASSERT(!m_isRunning);
- m_isRunning = true;
-
- m_reason = NO_WORK;
- m_nOpsRemaining = nOpsLimit;
- if (nTimeLimit >= time::nanoseconds::zero()) {
- m_timeout = scheduler::schedule(nTimeLimit, bind(&LimitedIo::afterTimeout, this));
- }
-
- try {
- getGlobalIoService().run();
- }
- catch (std::exception& ex) {
- m_reason = EXCEPTION;
- NFD_LOG_ERROR("g_io.run() exception: " << ex.what());
- m_lastException = ex;
- }
-
- getGlobalIoService().reset();
- scheduler::cancel(m_timeout);
- m_isRunning = false;
- return m_reason;
-}
-
-void
-LimitedIo::afterOp()
-{
- --m_nOpsRemaining;
- if (m_nOpsRemaining <= 0) {
- m_reason = EXCEED_OPS;
- getGlobalIoService().stop();
- }
-}
-
-void
-LimitedIo::afterTimeout()
-{
- m_reason = EXCEED_TIME;
- getGlobalIoService().stop();
-}
-
-const std::exception&
-LimitedIo::getLastException() const
-{
- return m_lastException;
-}
-
-} // namespace tests
-} // namespace nfd
diff --git a/tests/core/limited-io.hpp b/tests/core/limited-io.hpp
deleted file mode 100644
index 2d5788c..0000000
--- a/tests/core/limited-io.hpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014 Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-#ifndef NFD_TEST_CORE_LIMITED_IO_HPP
-#define NFD_TEST_CORE_LIMITED_IO_HPP
-
-#include "core/global-io.hpp"
-#include "core/scheduler.hpp"
-
-namespace nfd {
-namespace tests {
-
-/** \brief provides IO operations limit and/or time limit for unit testing
- */
-class LimitedIo
-{
-public:
- LimitedIo();
-
- /// indicates why .run returns
- enum StopReason
- {
- /// g_io.run() runs normally because there's no work to do
- NO_WORK,
- /// .afterOp() has been invoked nOpsLimit times
- EXCEED_OPS,
- /// nTimeLimit has elapsed
- EXCEED_TIME,
- /// an exception is thrown
- EXCEPTION
- };
-
- /** \brief g_io.run() with operation count and/or time limit
- *
- * \param nOpsLimit operation count limit, pass UNLIMITED_OPS for no limit
- * \param nTimeLimit time limit, pass UNLIMITED_TIME for no limit
- */
- StopReason
- run(int nOpsLimit, const time::nanoseconds& nTimeLimit);
-
- /// count an operation
- void
- afterOp();
-
- const std::exception&
- getLastException() const;
-
-private:
- void
- afterTimeout();
-
-public:
- static const int UNLIMITED_OPS;
- static const time::nanoseconds UNLIMITED_TIME;
-
-private:
- bool m_isRunning;
- int m_nOpsRemaining;
- EventId m_timeout;
- StopReason m_reason;
- std::exception m_lastException;
-};
-
-} // namespace tests
-} // namespace nfd
-
-#endif // NFD_TEST_CORE_LIMITED_IO_HPP
diff --git a/tests/core/version.cpp b/tests/core/version.cpp
index ee29615..669a866 100644
--- a/tests/core/version.cpp
+++ b/tests/core/version.cpp
@@ -22,7 +22,7 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
-#include "core/version.hpp"
+#include "version.hpp"
#include "core/logger.hpp"
#include "tests/test-common.hpp"