ec43b3634b
add segment publisher refs: #4662 Change-Id: I62e7a2247bac58aeec364cd2a4e4d34259eae4af
61 lines
2.0 KiB
C++
61 lines
2.0 KiB
C++
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
|
/*
|
|
* Copyright (c) 2014-2018, The University of Memphis
|
|
*
|
|
* This file is part of PSync.
|
|
* See AUTHORS.md for complete list of PSync authors and contributors.
|
|
*
|
|
* PSync 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.
|
|
*
|
|
* PSync 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
|
|
* PSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
|
|
**/
|
|
|
|
#include "consumer.hpp"
|
|
|
|
#include <boost/test/unit_test.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_AUTO_TEST_CASE(AddSubscription)
|
|
{
|
|
util::DummyClientFace face({true, true});
|
|
Consumer consumer(Name("/psync"), face,
|
|
[] (const vector<Name>&) {},
|
|
[] (const vector<MissingDataInfo>&) {},
|
|
40, 0.001);
|
|
|
|
Name subscription("test");
|
|
|
|
BOOST_CHECK(!consumer.isSubscribed(subscription));
|
|
BOOST_CHECK(consumer.addSubscription(subscription));
|
|
BOOST_CHECK(!consumer.addSubscription(subscription));
|
|
}
|
|
|
|
BOOST_AUTO_TEST_SUITE_END()
|
|
|
|
} // namespace psync
|