Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Alexander Afanasyev | 6dfeffe | 2017-01-30 22:40:32 -0800 | [diff] [blame] | 2 | /* |
Muktadir Chowdhury | 1c109b4 | 2018-01-10 08:36:00 +0000 | [diff] [blame] | 3 | * Copyright (c) 2013-2018 Regents of the University of California. |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 4 | * |
| 5 | * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). |
| 6 | * |
| 7 | * ndn-cxx library is free software: you can redistribute it and/or modify it under the |
| 8 | * terms of the GNU Lesser General Public License as published by the Free Software |
| 9 | * Foundation, either version 3 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY |
| 12 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 13 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received copies of the GNU General Public License and GNU Lesser |
| 16 | * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see |
| 17 | * <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | * See AUTHORS.md for complete list of ndn-cxx authors and contributors. |
| 20 | */ |
| 21 | |
| 22 | #include "util/segment-fetcher.hpp" |
Davide Pesavento | 5d0b010 | 2017-10-07 13:43:16 -0400 | [diff] [blame] | 23 | |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 24 | #include "data.hpp" |
Davide Pesavento | 5d0b010 | 2017-10-07 13:43:16 -0400 | [diff] [blame] | 25 | #include "lp/nack.hpp" |
Junxiao Shi | 2bea5c4 | 2017-08-14 20:10:32 +0000 | [diff] [blame] | 26 | #include "util/dummy-client-face.hpp" |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 27 | |
| 28 | #include "boost-test.hpp" |
Junxiao Shi | 2bea5c4 | 2017-08-14 20:10:32 +0000 | [diff] [blame] | 29 | #include "dummy-validator.hpp" |
| 30 | #include "make-interest-data.hpp" |
Alexander Afanasyev | e4f8c3b | 2016-06-23 16:03:48 -0700 | [diff] [blame] | 31 | #include "../identity-management-time-fixture.hpp" |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 32 | |
| 33 | namespace ndn { |
| 34 | namespace util { |
| 35 | namespace tests { |
| 36 | |
Junxiao Shi | 0f3f0b4 | 2016-07-14 13:26:37 +0000 | [diff] [blame] | 37 | using namespace ndn::tests; |
| 38 | |
Junxiao Shi | d5827ce | 2016-07-14 20:49:37 +0000 | [diff] [blame] | 39 | BOOST_AUTO_TEST_SUITE(Util) |
| 40 | BOOST_AUTO_TEST_SUITE(TestSegmentFetcher) |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 41 | |
Alexander Afanasyev | 80782e0 | 2017-01-04 13:16:54 -0800 | [diff] [blame] | 42 | class Fixture : public IdentityManagementTimeFixture |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 43 | { |
| 44 | public: |
| 45 | Fixture() |
Alexander Afanasyev | e4f8c3b | 2016-06-23 16:03:48 -0700 | [diff] [blame] | 46 | : face(io, m_keyChain) |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 47 | { |
| 48 | } |
| 49 | |
Davide Pesavento | 5d0b010 | 2017-10-07 13:43:16 -0400 | [diff] [blame] | 50 | static shared_ptr<Data> |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 51 | makeDataSegment(const Name& baseName, uint64_t segment, bool isFinal) |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 52 | { |
| 53 | const uint8_t buffer[] = "Hello, world!"; |
| 54 | |
Junxiao Shi | d5827ce | 2016-07-14 20:49:37 +0000 | [diff] [blame] | 55 | auto data = make_shared<Data>(Name(baseName).appendSegment(segment)); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 56 | data->setContent(buffer, sizeof(buffer)); |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 57 | if (isFinal) { |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 58 | data->setFinalBlockId(data->getName()[-1]); |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 59 | } |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 60 | |
Davide Pesavento | 5d0b010 | 2017-10-07 13:43:16 -0400 | [diff] [blame] | 61 | return signData(data); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | void |
| 65 | onError(uint32_t errorCode) |
| 66 | { |
| 67 | ++nErrors; |
| 68 | lastError = errorCode; |
| 69 | } |
| 70 | |
| 71 | void |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 72 | onComplete(const ConstBufferPtr& data) |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 73 | { |
Junxiao Shi | d5827ce | 2016-07-14 20:49:37 +0000 | [diff] [blame] | 74 | ++nData; |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 75 | dataSize = data->size(); |
Davide Pesavento | 5d0b010 | 2017-10-07 13:43:16 -0400 | [diff] [blame] | 76 | dataString = std::string(data->get<char>()); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 77 | } |
| 78 | |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 79 | void |
| 80 | nackLastInterest(lp::NackReason nackReason) |
| 81 | { |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 82 | const Interest& lastInterest = face.sentInterests.back(); |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 83 | lp::Nack nack = makeNack(lastInterest, nackReason); |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 84 | face.receive(nack); |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 85 | advanceClocks(10_ms); |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 86 | } |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 87 | |
| 88 | public: |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 89 | DummyClientFace face; |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 90 | |
Davide Pesavento | 5d0b010 | 2017-10-07 13:43:16 -0400 | [diff] [blame] | 91 | uint32_t nErrors = 0; |
| 92 | uint32_t lastError = 0; |
| 93 | uint32_t nData = 0; |
| 94 | size_t dataSize = 0; |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 95 | std::string dataString; |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 96 | }; |
| 97 | |
| 98 | BOOST_FIXTURE_TEST_CASE(Timeout, Fixture) |
| 99 | { |
Alexander Afanasyev | 6dfeffe | 2017-01-30 22:40:32 -0800 | [diff] [blame] | 100 | DummyValidator acceptValidator; |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 101 | SegmentFetcher::fetch(face, Interest("/hello/world", 100_ms), |
Alexander Afanasyev | 6dfeffe | 2017-01-30 22:40:32 -0800 | [diff] [blame] | 102 | acceptValidator, |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 103 | bind(&Fixture::onComplete, this, _1), |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 104 | bind(&Fixture::onError, this, _1)); |
| 105 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 106 | advanceClocks(1_ms); |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 107 | BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 108 | |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 109 | const Interest& interest = face.sentInterests[0]; |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 110 | BOOST_CHECK_EQUAL(interest.getName(), "/hello/world"); |
| 111 | BOOST_CHECK_EQUAL(interest.getMustBeFresh(), true); |
| 112 | BOOST_CHECK_EQUAL(interest.getChildSelector(), 1); |
Alexander Afanasyev | d3a55b2 | 2014-11-18 19:23:28 -0800 | [diff] [blame] | 113 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 114 | advanceClocks(98_ms); |
Junxiao Shi | d5827ce | 2016-07-14 20:49:37 +0000 | [diff] [blame] | 115 | BOOST_CHECK_EQUAL(nErrors, 0); |
| 116 | BOOST_CHECK_EQUAL(nData, 0); |
| 117 | BOOST_CHECK_EQUAL(face.sentData.size(), 0); |
Alexander Afanasyev | d3a55b2 | 2014-11-18 19:23:28 -0800 | [diff] [blame] | 118 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 119 | advanceClocks(1_ms, 2); |
Alexander Afanasyev | d3a55b2 | 2014-11-18 19:23:28 -0800 | [diff] [blame] | 120 | BOOST_CHECK_EQUAL(nErrors, 1); |
| 121 | BOOST_CHECK_EQUAL(lastError, static_cast<uint32_t>(SegmentFetcher::INTEREST_TIMEOUT)); |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 122 | BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1); |
| 123 | BOOST_CHECK_EQUAL(face.sentData.size(), 0); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 124 | } |
| 125 | |
| 126 | |
| 127 | BOOST_FIXTURE_TEST_CASE(Basic, Fixture) |
| 128 | { |
Alexander Afanasyev | 6dfeffe | 2017-01-30 22:40:32 -0800 | [diff] [blame] | 129 | DummyValidator acceptValidator; |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 130 | SegmentFetcher::fetch(face, Interest("/hello/world", 1000_s), |
Alexander Afanasyev | 6dfeffe | 2017-01-30 22:40:32 -0800 | [diff] [blame] | 131 | acceptValidator, |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 132 | bind(&Fixture::onComplete, this, _1), |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 133 | bind(&Fixture::onError, this, _1)); |
| 134 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 135 | advanceClocks(10_ms); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 136 | |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 137 | face.receive(*makeDataSegment("/hello/world/version0", 0, true)); |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 138 | advanceClocks(10_ms); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 139 | |
| 140 | BOOST_CHECK_EQUAL(nErrors, 0); |
Junxiao Shi | d5827ce | 2016-07-14 20:49:37 +0000 | [diff] [blame] | 141 | BOOST_CHECK_EQUAL(nData, 1); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 142 | |
| 143 | BOOST_CHECK_EQUAL(dataSize, 14); |
| 144 | |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 145 | const uint8_t buffer[] = "Hello, world!"; |
Davide Pesavento | 5d0b010 | 2017-10-07 13:43:16 -0400 | [diff] [blame] | 146 | std::string bufferString(reinterpret_cast<const char*>(buffer)); |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 147 | |
| 148 | BOOST_CHECK_EQUAL(dataString, bufferString); |
| 149 | |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 150 | BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1); |
| 151 | BOOST_CHECK_EQUAL(face.sentData.size(), 0); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 152 | |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 153 | const Interest& interest = face.sentInterests[0]; |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 154 | BOOST_CHECK_EQUAL(interest.getName(), "/hello/world"); |
| 155 | BOOST_CHECK_EQUAL(interest.getMustBeFresh(), true); |
| 156 | BOOST_CHECK_EQUAL(interest.getChildSelector(), 1); |
| 157 | } |
| 158 | |
| 159 | BOOST_FIXTURE_TEST_CASE(NoSegmentInData, Fixture) |
| 160 | { |
Alexander Afanasyev | 6dfeffe | 2017-01-30 22:40:32 -0800 | [diff] [blame] | 161 | DummyValidator acceptValidator; |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 162 | SegmentFetcher::fetch(face, Interest("/hello/world", 1000_s), |
Alexander Afanasyev | 6dfeffe | 2017-01-30 22:40:32 -0800 | [diff] [blame] | 163 | acceptValidator, |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 164 | bind(&Fixture::onComplete, this, _1), |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 165 | bind(&Fixture::onError, this, _1)); |
| 166 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 167 | advanceClocks(10_ms); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 168 | |
| 169 | const uint8_t buffer[] = "Hello, world!"; |
Davide Pesavento | 5d0b010 | 2017-10-07 13:43:16 -0400 | [diff] [blame] | 170 | auto data = makeData("/hello/world/version0/no-segment"); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 171 | data->setContent(buffer, sizeof(buffer)); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 172 | |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 173 | face.receive(*data); |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 174 | advanceClocks(10_ms); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 175 | |
| 176 | BOOST_CHECK_EQUAL(nErrors, 1); |
| 177 | BOOST_CHECK_EQUAL(lastError, static_cast<uint32_t>(SegmentFetcher::DATA_HAS_NO_SEGMENT)); |
Junxiao Shi | d5827ce | 2016-07-14 20:49:37 +0000 | [diff] [blame] | 178 | BOOST_CHECK_EQUAL(nData, 0); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 179 | } |
| 180 | |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 181 | BOOST_FIXTURE_TEST_CASE(SegmentValidationFailure, Fixture) |
| 182 | { |
Alexander Afanasyev | 6dfeffe | 2017-01-30 22:40:32 -0800 | [diff] [blame] | 183 | DummyValidator rejectValidator(false); |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 184 | SegmentFetcher::fetch(face, Interest("/hello/world", 1000_s), |
Junxiao Shi | 0f3f0b4 | 2016-07-14 13:26:37 +0000 | [diff] [blame] | 185 | rejectValidator, |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 186 | bind(&Fixture::onComplete, this, _1), |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 187 | bind(&Fixture::onError, this, _1)); |
| 188 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 189 | advanceClocks(10_ms); |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 190 | face.receive(*makeDataSegment("/hello/world/version0", 0, true)); |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 191 | advanceClocks(10_ms); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 192 | |
| 193 | BOOST_CHECK_EQUAL(nErrors, 1); |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 194 | BOOST_CHECK_EQUAL(lastError, static_cast<uint32_t>(SegmentFetcher::SEGMENT_VALIDATION_FAIL)); |
Junxiao Shi | d5827ce | 2016-07-14 20:49:37 +0000 | [diff] [blame] | 195 | BOOST_CHECK_EQUAL(nData, 0); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 196 | } |
| 197 | |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 198 | BOOST_FIXTURE_TEST_CASE(Triple, Fixture) |
| 199 | { |
Alexander Afanasyev | 6dfeffe | 2017-01-30 22:40:32 -0800 | [diff] [blame] | 200 | DummyValidator acceptValidator; |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 201 | SegmentFetcher::fetch(face, Interest("/hello/world", 1000_s), |
Alexander Afanasyev | 6dfeffe | 2017-01-30 22:40:32 -0800 | [diff] [blame] | 202 | acceptValidator, |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 203 | bind(&Fixture::onComplete, this, _1), |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 204 | bind(&Fixture::onError, this, _1)); |
| 205 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 206 | advanceClocks(10_ms); |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 207 | face.receive(*makeDataSegment("/hello/world/version0", 0, false)); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 208 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 209 | advanceClocks(10_ms); |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 210 | face.receive(*makeDataSegment("/hello/world/version0", 1, false)); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 211 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 212 | advanceClocks(10_ms); |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 213 | face.receive(*makeDataSegment("/hello/world/version0", 2, true)); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 214 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 215 | advanceClocks(10_ms); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 216 | |
| 217 | BOOST_CHECK_EQUAL(nErrors, 0); |
Junxiao Shi | d5827ce | 2016-07-14 20:49:37 +0000 | [diff] [blame] | 218 | BOOST_CHECK_EQUAL(nData, 1); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 219 | |
| 220 | BOOST_CHECK_EQUAL(dataSize, 42); |
| 221 | |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 222 | BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 3); |
| 223 | BOOST_CHECK_EQUAL(face.sentData.size(), 0); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 224 | |
| 225 | { |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 226 | const Interest& interest = face.sentInterests[0]; |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 227 | BOOST_CHECK_EQUAL(interest.getName(), "/hello/world"); |
| 228 | BOOST_CHECK_EQUAL(interest.getMustBeFresh(), true); |
| 229 | BOOST_CHECK_EQUAL(interest.getChildSelector(), 1); |
| 230 | } |
| 231 | |
| 232 | { |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 233 | const Interest& interest = face.sentInterests[1]; |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 234 | BOOST_CHECK_EQUAL(interest.getName(), "/hello/world/version0/%00%01"); |
| 235 | BOOST_CHECK_EQUAL(interest.getMustBeFresh(), false); |
| 236 | BOOST_CHECK_EQUAL(interest.getChildSelector(), 0); |
| 237 | } |
| 238 | |
| 239 | { |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 240 | const Interest& interest = face.sentInterests[2]; |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 241 | BOOST_CHECK_EQUAL(interest.getName(), "/hello/world/version0/%00%02"); |
| 242 | BOOST_CHECK_EQUAL(interest.getMustBeFresh(), false); |
| 243 | BOOST_CHECK_EQUAL(interest.getChildSelector(), 0); |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | BOOST_FIXTURE_TEST_CASE(TripleWithInitialSegmentFetching, Fixture) |
| 248 | { |
Alexander Afanasyev | 6dfeffe | 2017-01-30 22:40:32 -0800 | [diff] [blame] | 249 | DummyValidator acceptValidator; |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 250 | SegmentFetcher::fetch(face, Interest("/hello/world", 1000_s), |
Alexander Afanasyev | 6dfeffe | 2017-01-30 22:40:32 -0800 | [diff] [blame] | 251 | acceptValidator, |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 252 | bind(&Fixture::onComplete, this, _1), |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 253 | bind(&Fixture::onError, this, _1)); |
| 254 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 255 | advanceClocks(10_ms); |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 256 | face.receive(*makeDataSegment("/hello/world/version0", 1, false)); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 257 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 258 | advanceClocks(10_ms); |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 259 | face.receive(*makeDataSegment("/hello/world/version0", 0, false)); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 260 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 261 | advanceClocks(10_ms); |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 262 | face.receive(*makeDataSegment("/hello/world/version0", 1, false)); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 263 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 264 | advanceClocks(10_ms); |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 265 | face.receive(*makeDataSegment("/hello/world/version0", 2, true)); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 266 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 267 | advanceClocks(10_ms); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 268 | |
| 269 | BOOST_CHECK_EQUAL(nErrors, 0); |
Junxiao Shi | d5827ce | 2016-07-14 20:49:37 +0000 | [diff] [blame] | 270 | BOOST_CHECK_EQUAL(nData, 1); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 271 | |
| 272 | BOOST_CHECK_EQUAL(dataSize, 42); |
| 273 | |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 274 | BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 4); |
| 275 | BOOST_CHECK_EQUAL(face.sentData.size(), 0); |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 276 | |
| 277 | { |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 278 | const Interest& interest = face.sentInterests[0]; |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 279 | BOOST_CHECK_EQUAL(interest.getName(), "/hello/world"); |
| 280 | BOOST_CHECK_EQUAL(interest.getMustBeFresh(), true); |
| 281 | BOOST_CHECK_EQUAL(interest.getChildSelector(), 1); |
| 282 | } |
| 283 | |
| 284 | { |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 285 | const Interest& interest = face.sentInterests[1]; |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 286 | BOOST_CHECK_EQUAL(interest.getName(), "/hello/world/version0/%00%00"); |
| 287 | BOOST_CHECK_EQUAL(interest.getMustBeFresh(), false); |
| 288 | BOOST_CHECK_EQUAL(interest.getChildSelector(), 0); |
| 289 | } |
| 290 | |
| 291 | { |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 292 | const Interest& interest = face.sentInterests[2]; |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 293 | BOOST_CHECK_EQUAL(interest.getName(), "/hello/world/version0/%00%01"); |
| 294 | BOOST_CHECK_EQUAL(interest.getMustBeFresh(), false); |
| 295 | BOOST_CHECK_EQUAL(interest.getChildSelector(), 0); |
| 296 | } |
| 297 | |
| 298 | { |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 299 | const Interest& interest = face.sentInterests[3]; |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 300 | BOOST_CHECK_EQUAL(interest.getName(), "/hello/world/version0/%00%02"); |
| 301 | BOOST_CHECK_EQUAL(interest.getMustBeFresh(), false); |
| 302 | BOOST_CHECK_EQUAL(interest.getChildSelector(), 0); |
| 303 | } |
| 304 | } |
| 305 | |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 306 | BOOST_FIXTURE_TEST_CASE(MultipleSegmentFetching, Fixture) |
| 307 | { |
Alexander Afanasyev | 6dfeffe | 2017-01-30 22:40:32 -0800 | [diff] [blame] | 308 | DummyValidator acceptValidator; |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 309 | SegmentFetcher::fetch(face, Interest("/hello/world", 1000_s), |
Alexander Afanasyev | 6dfeffe | 2017-01-30 22:40:32 -0800 | [diff] [blame] | 310 | acceptValidator, |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 311 | bind(&Fixture::onComplete, this, _1), |
| 312 | bind(&Fixture::onError, this, _1)); |
| 313 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 314 | advanceClocks(10_ms); |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 315 | |
| 316 | for (uint64_t i = 0; i < 400; i++) { |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 317 | advanceClocks(10_ms); |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 318 | face.receive(*makeDataSegment("/hello/world/version0", i, false)); |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 319 | } |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 320 | advanceClocks(10_ms); |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 321 | face.receive(*makeDataSegment("/hello/world/version0", 400, true)); |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 322 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 323 | advanceClocks(10_ms); |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 324 | |
| 325 | BOOST_CHECK_EQUAL(nErrors, 0); |
Junxiao Shi | d5827ce | 2016-07-14 20:49:37 +0000 | [diff] [blame] | 326 | BOOST_CHECK_EQUAL(nData, 1); |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 327 | } |
| 328 | |
Muktadir R Chowdhury | 2bc2df0 | 2016-04-05 16:55:41 -0500 | [diff] [blame] | 329 | BOOST_FIXTURE_TEST_CASE(DuplicateNack, Fixture) |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 330 | { |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 331 | SegmentFetcher::fetch(face, Interest("/hello/world", 1000_s), |
Alexander Afanasyev | 6dfeffe | 2017-01-30 22:40:32 -0800 | [diff] [blame] | 332 | make_shared<DummyValidator>(true), |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 333 | bind(&Fixture::onComplete, this, _1), |
| 334 | bind(&Fixture::onError, this, _1)); |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 335 | advanceClocks(10_ms); |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 336 | |
| 337 | // receive nack for the original interest |
| 338 | nackLastInterest(lp::NackReason::DUPLICATE); |
| 339 | |
| 340 | // receive nack due to Duplication for the reexpressed interests |
| 341 | for (uint32_t i = 1; i <= SegmentFetcher::MAX_INTEREST_REEXPRESS; ++i) { |
| 342 | nackLastInterest(lp::NackReason::DUPLICATE); |
| 343 | } |
| 344 | |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 345 | BOOST_CHECK_EQUAL(face.sentInterests.size(), (SegmentFetcher::MAX_INTEREST_REEXPRESS + 1)); |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 346 | BOOST_CHECK_EQUAL(lastError, static_cast<uint32_t>(SegmentFetcher::NACK_ERROR)); |
| 347 | } |
| 348 | |
Muktadir R Chowdhury | 2bc2df0 | 2016-04-05 16:55:41 -0500 | [diff] [blame] | 349 | BOOST_FIXTURE_TEST_CASE(CongestionNack, Fixture) |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 350 | { |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 351 | SegmentFetcher::fetch(face, Interest("/hello/world", 1000_s), |
Alexander Afanasyev | 6dfeffe | 2017-01-30 22:40:32 -0800 | [diff] [blame] | 352 | make_shared<DummyValidator>(true), |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 353 | bind(&Fixture::onComplete, this, _1), |
| 354 | bind(&Fixture::onError, this, _1)); |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 355 | advanceClocks(10_ms); |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 356 | |
| 357 | // receive nack for the original interest |
| 358 | nackLastInterest(lp::NackReason::CONGESTION); |
| 359 | |
| 360 | // receive nack due to Congestion for the reexpressed interests |
| 361 | for (uint32_t i = 1; i <= SegmentFetcher::MAX_INTEREST_REEXPRESS; ++i) { |
| 362 | nackLastInterest(lp::NackReason::CONGESTION); |
| 363 | } |
| 364 | |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 365 | BOOST_CHECK_EQUAL(face.sentInterests.size(), (SegmentFetcher::MAX_INTEREST_REEXPRESS + 1)); |
Muktadir R Chowdhury | f58f8f4 | 2015-09-02 11:56:49 -0500 | [diff] [blame] | 366 | BOOST_CHECK_EQUAL(lastError, static_cast<uint32_t>(SegmentFetcher::NACK_ERROR)); |
| 367 | } |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 368 | |
Muktadir R Chowdhury | 2bc2df0 | 2016-04-05 16:55:41 -0500 | [diff] [blame] | 369 | BOOST_FIXTURE_TEST_CASE(SegmentZero, Fixture) |
| 370 | { |
| 371 | int nNacks = 2; |
| 372 | |
| 373 | ndn::Name interestName("ndn:/A"); |
| 374 | SegmentFetcher::fetch(face, |
| 375 | Interest(interestName), |
Alexander Afanasyev | 6dfeffe | 2017-01-30 22:40:32 -0800 | [diff] [blame] | 376 | make_shared<DummyValidator>(true), |
Muktadir R Chowdhury | 2bc2df0 | 2016-04-05 16:55:41 -0500 | [diff] [blame] | 377 | bind(&Fixture::onComplete, this, _1), |
| 378 | bind(&Fixture::onError, this, _1)); |
| 379 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 380 | advanceClocks(1000_ms); |
Muktadir R Chowdhury | 2bc2df0 | 2016-04-05 16:55:41 -0500 | [diff] [blame] | 381 | |
| 382 | for (uint64_t segmentNo = 0; segmentNo <= 3; segmentNo++) { |
| 383 | if (segmentNo == 1) { |
| 384 | while (nNacks--) { |
| 385 | nackLastInterest(lp::NackReason::CONGESTION); |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 386 | advanceClocks(10_ms); |
Muktadir R Chowdhury | 2bc2df0 | 2016-04-05 16:55:41 -0500 | [diff] [blame] | 387 | } |
| 388 | } |
| 389 | |
| 390 | auto data = makeDataSegment(interestName, segmentNo, segmentNo == 3); |
| 391 | face.receive(*data); |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 392 | advanceClocks(10_ms); |
Muktadir R Chowdhury | 2bc2df0 | 2016-04-05 16:55:41 -0500 | [diff] [blame] | 393 | } |
| 394 | |
| 395 | // Total number of sent interests should be 6: one interest for segment zero and segment one each, |
| 396 | // two re-expressed interests for segment one after getting nack twice, and two interests for |
| 397 | // segment two and three |
| 398 | BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 6); |
| 399 | |
| 400 | BOOST_CHECK_EQUAL(face.sentInterests[0].getName(), ndn::Name("ndn:/A")); |
| 401 | BOOST_CHECK_EQUAL(face.sentInterests[1].getName(), ndn::Name("ndn:/A/%00%01")); |
| 402 | BOOST_CHECK_EQUAL(face.sentInterests[2].getName(), ndn::Name("ndn:/A/%00%01")); |
| 403 | BOOST_CHECK_EQUAL(face.sentInterests[3].getName(), ndn::Name("ndn:/A/%00%01")); |
| 404 | BOOST_CHECK_EQUAL(face.sentInterests[4].getName(), ndn::Name("ndn:/A/%00%02")); |
| 405 | BOOST_CHECK_EQUAL(face.sentInterests[5].getName(), ndn::Name("ndn:/A/%00%03")); |
| 406 | } |
| 407 | |
| 408 | BOOST_FIXTURE_TEST_CASE(ZeroComponentName, Fixture) |
| 409 | { |
| 410 | SegmentFetcher::fetch(face, Interest("ndn:/"), |
Alexander Afanasyev | 6dfeffe | 2017-01-30 22:40:32 -0800 | [diff] [blame] | 411 | make_shared<DummyValidator>(true), |
Muktadir R Chowdhury | 2bc2df0 | 2016-04-05 16:55:41 -0500 | [diff] [blame] | 412 | bind(&Fixture::onComplete, this, _1), |
| 413 | bind(&Fixture::onError, this, _1)); |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 414 | advanceClocks(10_ms); |
Muktadir R Chowdhury | 2bc2df0 | 2016-04-05 16:55:41 -0500 | [diff] [blame] | 415 | nackLastInterest(lp::NackReason::DUPLICATE); |
| 416 | face.receive(*makeDataSegment("/hello/world", 0, true)); |
| 417 | |
| 418 | BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 2); |
| 419 | BOOST_CHECK_EQUAL(face.sentInterests[0].getName(), ndn::Name("ndn:/")); |
| 420 | BOOST_CHECK_EQUAL(face.sentInterests[1].getName(), ndn::Name("ndn:/")); |
Junxiao Shi | d5827ce | 2016-07-14 20:49:37 +0000 | [diff] [blame] | 421 | BOOST_REQUIRE_EQUAL(nData, 1); |
Muktadir R Chowdhury | 2bc2df0 | 2016-04-05 16:55:41 -0500 | [diff] [blame] | 422 | } |
| 423 | |
Muktadir Chowdhury | 1c109b4 | 2018-01-10 08:36:00 +0000 | [diff] [blame] | 424 | BOOST_FIXTURE_TEST_CASE(Signals, Fixture) |
| 425 | { |
| 426 | DummyValidator validator; |
| 427 | bool flipResult = false; |
| 428 | validator.getPolicy().setResultCallback([&flipResult] (const Name&) { |
| 429 | flipResult = !flipResult; |
| 430 | return flipResult; |
| 431 | }); |
| 432 | shared_ptr<SegmentFetcher> fetcher = |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 433 | SegmentFetcher::fetch(face, Interest("/hello/world", 1000_s), |
Muktadir Chowdhury | 1c109b4 | 2018-01-10 08:36:00 +0000 | [diff] [blame] | 434 | validator, |
| 435 | bind(&Fixture::onComplete, this, _1), |
| 436 | bind(&Fixture::onError, this, _1)); |
| 437 | |
| 438 | auto data1 = makeDataSegment("/hello/world", 0, false); |
| 439 | auto data2 = makeDataSegment("/hello/world", 1, true); |
| 440 | |
| 441 | size_t nRecvSegments = 0; |
| 442 | fetcher->afterSegmentReceived.connect([&nRecvSegments] (const Data& receivedSegment) { |
| 443 | ++nRecvSegments; |
| 444 | }); |
| 445 | |
| 446 | size_t nValidatedSegments = 0; |
| 447 | fetcher->afterSegmentValidated.connect([&nValidatedSegments] (const Data& validatedSegment) { |
| 448 | ++nValidatedSegments; |
| 449 | }); |
| 450 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 451 | advanceClocks(10_ms, 10); |
Muktadir Chowdhury | 1c109b4 | 2018-01-10 08:36:00 +0000 | [diff] [blame] | 452 | |
| 453 | face.receive(*data1); |
| 454 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 455 | advanceClocks(10_ms, 10); |
Muktadir Chowdhury | 1c109b4 | 2018-01-10 08:36:00 +0000 | [diff] [blame] | 456 | |
| 457 | face.receive(*data2); |
| 458 | |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 459 | advanceClocks(10_ms, 10); |
Muktadir Chowdhury | 1c109b4 | 2018-01-10 08:36:00 +0000 | [diff] [blame] | 460 | |
| 461 | BOOST_CHECK_EQUAL(nRecvSegments, 2); |
| 462 | BOOST_CHECK_EQUAL(nValidatedSegments, 1); |
| 463 | BOOST_CHECK_EQUAL(nErrors, 1); |
| 464 | } |
| 465 | |
Junxiao Shi | d5827ce | 2016-07-14 20:49:37 +0000 | [diff] [blame] | 466 | BOOST_AUTO_TEST_SUITE_END() // TestSegmentFetcher |
| 467 | BOOST_AUTO_TEST_SUITE_END() // Util |
Alexander Afanasyev | f3cfab5 | 2014-08-17 22:15:25 -0700 | [diff] [blame] | 468 | |
| 469 | } // namespace tests |
| 470 | } // namespace util |
| 471 | } // namespace ndn |