tests: use BOOST_REQUIRE and Name::at() to prevent out-of-bound accesses
Various other cleanups
Change-Id: Ie099e618b12b7b6cf36c32be96d753221f14a8b6
diff --git a/tests/test-consumer.cpp b/tests/test-consumer.cpp
index 9b08d53..e5560cd 100644
--- a/tests/test-consumer.cpp
+++ b/tests/test-consumer.cpp
@@ -18,36 +18,34 @@
**/
#include "PSync/consumer.hpp"
-#include "unit-test-time-fixture.hpp"
-#include <boost/test/unit_test.hpp>
+#include "tests/boost-test.hpp"
+#include "tests/unit-test-time-fixture.hpp"
+
#include <ndn-cxx/name.hpp>
#include <ndn-cxx/util/dummy-client-face.hpp>
namespace psync {
using namespace ndn;
-using namespace std;
BOOST_AUTO_TEST_SUITE(TestConsumer)
BOOST_AUTO_TEST_CASE(Constructor)
{
util::DummyClientFace face({true, true});
- BOOST_REQUIRE_NO_THROW(Consumer(Name("/psync"),
- face,
- [] (const vector<Name>&) {},
- [] (const vector<MissingDataInfo>&) {},
- 40,
- 0.001));
+ BOOST_REQUIRE_NO_THROW(Consumer(Name("/psync"), face,
+ [] (const std::vector<Name>&) {},
+ [] (const std::vector<MissingDataInfo>&) {},
+ 40, 0.001));
}
BOOST_AUTO_TEST_CASE(AddSubscription)
{
util::DummyClientFace face({true, true});
Consumer consumer(Name("/psync"), face,
- [] (const vector<Name>&) {},
- [] (const vector<MissingDataInfo>&) {},
+ [] (const auto&) {},
+ [] (const auto&) {},
40, 0.001);
Name subscription("test");
@@ -57,12 +55,12 @@
BOOST_CHECK(!consumer.addSubscription(subscription));
}
-BOOST_FIXTURE_TEST_CASE(ConstantTimeoutForFirstSegment, ndn::tests::UnitTestTimeFixture)
+BOOST_FIXTURE_TEST_CASE(ConstantTimeoutForFirstSegment, tests::UnitTestTimeFixture)
{
util::DummyClientFace face(io, {true, true});
Consumer consumer(Name("/psync"), face,
- [] (const vector<Name>&) {},
- [] (const vector<MissingDataInfo>&) {},
+ [] (const auto&) {},
+ [] (const auto&) {},
40, 0.001,
ndn::time::milliseconds(4000),
ndn::time::milliseconds(4000));
@@ -82,4 +80,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace psync
\ No newline at end of file
+} // namespace psync