blob: 11ca06def92aefb19c890bd755f47828af90e6c8 [file] [log] [blame]
Nick Gordond5c1a372016-10-31 13:56:23 -05001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2014-2017, The University of Memphis,
4 * Regents of the University of California
5 *
6 * This file is part of NLSR (Named-data Link State Routing).
7 * See AUTHORS.md for complete list of NLSR authors and contributors.
8 *
9 * NLSR is free software: you can redistribute it and/or modify it under the terms
10 * of the GNU General Public License as published by the Free Software Foundation,
11 * either version 3 of the License, or (at your option) any later version.
12 *
13 * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
14 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
19 **/
20
21#include "test-common.hpp"
22
23namespace nlsr {
24namespace test {
25
26ndn::Data&
27signData(ndn::Data& data)
28{
29 ndn::SignatureSha256WithRsa fakeSignature;
30 fakeSignature.setValue(ndn::encoding::makeEmptyBlock(ndn::tlv::SignatureValue));
31 data.setSignature(fakeSignature);
32 data.wireEncode();
33
34 return data;
35}
36
37MockNfdMgmtFixture::MockNfdMgmtFixture()
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050038 : m_face(m_ioService, m_keyChain, {true, true})
Nick Gordond5c1a372016-10-31 13:56:23 -050039{
40}
41
42void
43MockNfdMgmtFixture::signDatasetReply(ndn::Data& data)
44{
45 signData(data);
46}
47
48void
49UnitTestTimeFixture::advanceClocks(const ndn::time::nanoseconds& tick, size_t nTicks)
50{
51 for (size_t i = 0; i < nTicks; ++i) {
52 steadyClock->advance(tick);
53 systemClock->advance(tick);
54
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050055 if (m_ioService.stopped()) {
56 m_ioService.reset();
Nick Gordond5c1a372016-10-31 13:56:23 -050057 }
58
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050059 m_ioService.poll();
Nick Gordond5c1a372016-10-31 13:56:23 -050060 }
61}
62
63} // namespace test
64} // namespace nlsr