Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Junxiao Shi | 2bea5c4 | 2017-08-14 20:10:32 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2013-2017 Regents of the University of California. |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 4 | * |
Alexander Afanasyev | 80b68e1 | 2015-09-17 17:01:04 -0700 | [diff] [blame] | 5 | * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 6 | * |
Alexander Afanasyev | 80b68e1 | 2015-09-17 17:01:04 -0700 | [diff] [blame] | 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. |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 10 | * |
Alexander Afanasyev | 80b68e1 | 2015-09-17 17:01:04 -0700 | [diff] [blame] | 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. |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 14 | * |
Alexander Afanasyev | 80b68e1 | 2015-09-17 17:01:04 -0700 | [diff] [blame] | 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. |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 20 | */ |
| 21 | |
| 22 | #include "mgmt/status-dataset-context.hpp" |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 23 | |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 24 | #include "boost-test.hpp" |
Junxiao Shi | 2bea5c4 | 2017-08-14 20:10:32 +0000 | [diff] [blame] | 25 | #include "make-interest-data.hpp" |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 26 | |
| 27 | namespace ndn { |
| 28 | namespace mgmt { |
| 29 | namespace tests { |
| 30 | |
Junxiao Shi | 85d9083 | 2016-08-04 03:19:46 +0000 | [diff] [blame] | 31 | using namespace ndn::tests; |
| 32 | |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 33 | class StatusDatasetContextFixture |
| 34 | { |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 35 | private: |
Yanbiao Li | 4b4f754 | 2016-03-11 02:04:43 +0800 | [diff] [blame] | 36 | struct SendDataArgs |
| 37 | { |
| 38 | Name dataName; |
| 39 | Block content; |
| 40 | time::milliseconds imsFresh; |
| 41 | bool isFinalBlock; |
| 42 | }; |
| 43 | |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 44 | protected: |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 45 | StatusDatasetContextFixture() |
Junxiao Shi | 85d9083 | 2016-08-04 03:19:46 +0000 | [diff] [blame] | 46 | : interest(makeInterest("/test/context/interest")) |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 47 | , contentBlock(makeStringBlock(tlv::Content, "/test/data/content")) |
Yanbiao Li | 4b4f754 | 2016-03-11 02:04:43 +0800 | [diff] [blame] | 48 | , context(*interest, |
| 49 | [this] (const Name& dataName, const Block& content, |
| 50 | time::milliseconds imsFresh, bool isFinalBlock) { |
| 51 | SendDataArgs args{dataName, content, imsFresh, isFinalBlock}; |
| 52 | sendDataHistory.push_back(args); |
| 53 | }, |
| 54 | [this] (const ControlResponse& resp) { |
| 55 | sendNackHistory.push_back(resp); |
| 56 | }) |
| 57 | , defaultImsFresh(time::milliseconds(1000)) |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 58 | { |
| 59 | } |
| 60 | |
Yanbiao Li | 4b4f754 | 2016-03-11 02:04:43 +0800 | [diff] [blame] | 61 | Name |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 62 | makeSegmentName(size_t segmentNo) const |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 63 | { |
Yanbiao Li | 4b4f754 | 2016-03-11 02:04:43 +0800 | [diff] [blame] | 64 | auto name = context.getPrefix(); |
| 65 | return name.appendSegment(segmentNo); |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | Block |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 69 | concatenateDataContent() const |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 70 | { |
| 71 | EncodingBuffer encoder; |
| 72 | size_t valueLength = 0; |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 73 | for (const auto& args : sendDataHistory) { |
Yanbiao Li | 4b4f754 | 2016-03-11 02:04:43 +0800 | [diff] [blame] | 74 | const auto& content = args.content; |
| 75 | valueLength += encoder.appendByteArray(content.value(), content.value_size()); |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 76 | } |
| 77 | encoder.prependVarNumber(valueLength); |
| 78 | encoder.prependVarNumber(tlv::Content); |
| 79 | return encoder.block(); |
| 80 | } |
| 81 | |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 82 | protected: |
Yanbiao Li | 4b4f754 | 2016-03-11 02:04:43 +0800 | [diff] [blame] | 83 | std::vector<SendDataArgs> sendDataHistory; |
| 84 | std::vector<ControlResponse> sendNackHistory; |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 85 | shared_ptr<Interest> interest; |
| 86 | Block contentBlock; |
| 87 | mgmt::StatusDatasetContext context; |
Yanbiao Li | 4b4f754 | 2016-03-11 02:04:43 +0800 | [diff] [blame] | 88 | time::milliseconds defaultImsFresh; |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 89 | }; |
| 90 | |
Yanbiao Li | 4b4f754 | 2016-03-11 02:04:43 +0800 | [diff] [blame] | 91 | BOOST_AUTO_TEST_SUITE(Mgmt) |
| 92 | BOOST_FIXTURE_TEST_SUITE(TestStatusDatasetContext, StatusDatasetContextFixture) |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 93 | |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 94 | BOOST_AUTO_TEST_SUITE(Prefix) |
| 95 | |
| 96 | BOOST_AUTO_TEST_CASE(Get) |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 97 | { |
| 98 | Name dataName = context.getPrefix(); |
| 99 | BOOST_CHECK(dataName[-1].isVersion()); |
| 100 | BOOST_CHECK(dataName.getPrefix(-1) == interest->getName()); |
| 101 | } |
| 102 | |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 103 | BOOST_AUTO_TEST_CASE(SetValid) |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 104 | { |
| 105 | Name validPrefix = Name(interest->getName()).append("/valid"); |
| 106 | BOOST_CHECK_NO_THROW(context.setPrefix(validPrefix)); |
| 107 | BOOST_CHECK(context.getPrefix()[-1].isVersion()); |
| 108 | BOOST_CHECK(context.getPrefix().getPrefix(-1) == validPrefix); |
| 109 | } |
| 110 | |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 111 | BOOST_AUTO_TEST_CASE(SetInvalid) |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 112 | { |
| 113 | Name invalidPrefix = Name(interest->getName()).getPrefix(-1).append("/invalid"); |
| 114 | BOOST_CHECK_THROW(context.setPrefix(invalidPrefix), std::invalid_argument); |
| 115 | } |
| 116 | |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 117 | BOOST_AUTO_TEST_CASE(SetValidWithAppendCalled) |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 118 | { |
| 119 | Name validPrefix = Name(interest->getName()).append("/valid"); |
| 120 | context.append(contentBlock); |
| 121 | BOOST_CHECK_THROW(context.setPrefix(validPrefix), std::domain_error); |
| 122 | } |
| 123 | |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 124 | BOOST_AUTO_TEST_CASE(SetValidWithEndCalled) |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 125 | { |
| 126 | Name validPrefix = Name(interest->getName()).append("/valid"); |
| 127 | context.end(); |
| 128 | BOOST_CHECK_THROW(context.setPrefix(validPrefix), std::domain_error); |
| 129 | } |
| 130 | |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 131 | BOOST_AUTO_TEST_CASE(SetValidWithRejectCalled) |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 132 | { |
| 133 | Name validPrefix = Name(interest->getName()).append("/valid"); |
| 134 | context.reject(); |
| 135 | BOOST_CHECK_THROW(context.setPrefix(validPrefix), std::domain_error); |
| 136 | } |
| 137 | |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 138 | BOOST_AUTO_TEST_SUITE_END() // Prefix |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 139 | |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 140 | BOOST_AUTO_TEST_SUITE(Expiry) |
| 141 | |
| 142 | BOOST_AUTO_TEST_CASE(GetAndSet) |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 143 | { |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 144 | auto period = time::milliseconds(9527); |
| 145 | BOOST_CHECK_EQUAL(context.getExpiry(), time::milliseconds(1000)); |
| 146 | BOOST_CHECK_EQUAL(context.setExpiry(period).getExpiry(), period); |
| 147 | } |
| 148 | |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 149 | BOOST_AUTO_TEST_SUITE_END() // Expiry |
| 150 | |
| 151 | BOOST_AUTO_TEST_SUITE(Respond) |
| 152 | |
| 153 | BOOST_AUTO_TEST_CASE(Basic) |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 154 | { |
| 155 | BOOST_CHECK_NO_THROW(context.append(contentBlock)); |
Yanbiao Li | 4b4f754 | 2016-03-11 02:04:43 +0800 | [diff] [blame] | 156 | BOOST_CHECK(sendDataHistory.empty()); // does not call end yet |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 157 | |
| 158 | BOOST_CHECK_NO_THROW(context.end()); |
Yanbiao Li | 4b4f754 | 2016-03-11 02:04:43 +0800 | [diff] [blame] | 159 | |
| 160 | BOOST_REQUIRE_EQUAL(sendDataHistory.size(), 1); |
| 161 | const auto& args = sendDataHistory[0]; |
| 162 | |
| 163 | BOOST_CHECK_EQUAL(args.dataName, makeSegmentName(0)); |
| 164 | BOOST_CHECK(args.content.blockFromValue() == contentBlock); |
| 165 | BOOST_CHECK_EQUAL(args.imsFresh, defaultImsFresh); |
| 166 | BOOST_CHECK_EQUAL(args.isFinalBlock, true); |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 167 | } |
| 168 | |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 169 | BOOST_AUTO_TEST_CASE(Large) |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 170 | { |
| 171 | static Block largeBlock = [] () -> Block { |
| 172 | EncodingBuffer encoder; |
| 173 | size_t maxBlockSize = MAX_NDN_PACKET_SIZE >> 1; |
| 174 | for (size_t i = 0; i < maxBlockSize; ++i) { |
| 175 | encoder.prependByte(1); |
| 176 | } |
| 177 | encoder.prependVarNumber(maxBlockSize); |
| 178 | encoder.prependVarNumber(tlv::Content); |
| 179 | return encoder.block(); |
| 180 | }(); |
| 181 | |
| 182 | BOOST_CHECK_NO_THROW(context.append(largeBlock)); |
| 183 | BOOST_CHECK_NO_THROW(context.end()); |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 184 | |
Yanbiao Li | 4b4f754 | 2016-03-11 02:04:43 +0800 | [diff] [blame] | 185 | // two segments are generated |
| 186 | BOOST_REQUIRE_EQUAL(sendDataHistory.size(), 2); |
| 187 | |
| 188 | // check segment0 |
| 189 | BOOST_CHECK_EQUAL(sendDataHistory[0].dataName, makeSegmentName(0)); |
| 190 | BOOST_CHECK_EQUAL(sendDataHistory[0].imsFresh, defaultImsFresh); |
| 191 | BOOST_CHECK_EQUAL(sendDataHistory[0].isFinalBlock, false); |
| 192 | |
| 193 | // check segment1 |
| 194 | BOOST_CHECK_EQUAL(sendDataHistory[1].dataName, makeSegmentName(1)); |
| 195 | BOOST_CHECK_EQUAL(sendDataHistory[1].imsFresh, defaultImsFresh); |
| 196 | BOOST_CHECK_EQUAL(sendDataHistory[1].isFinalBlock, true); |
| 197 | |
| 198 | // check data content |
| 199 | auto contentLargeBlock = concatenateDataContent(); |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 200 | BOOST_CHECK_NO_THROW(contentLargeBlock.parse()); |
Yanbiao Li | 4b4f754 | 2016-03-11 02:04:43 +0800 | [diff] [blame] | 201 | BOOST_REQUIRE_EQUAL(contentLargeBlock.elements().size(), 1); |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 202 | BOOST_CHECK(contentLargeBlock.elements()[0] == largeBlock); |
| 203 | } |
| 204 | |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 205 | BOOST_AUTO_TEST_CASE(MultipleSmall) |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 206 | { |
| 207 | size_t nBlocks = 100; |
| 208 | for (size_t i = 0 ; i < nBlocks ; i ++) { |
| 209 | BOOST_CHECK_NO_THROW(context.append(contentBlock)); |
| 210 | } |
| 211 | BOOST_CHECK_NO_THROW(context.end()); |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 212 | |
Yanbiao Li | 4b4f754 | 2016-03-11 02:04:43 +0800 | [diff] [blame] | 213 | // check data to in-memory storage |
| 214 | BOOST_REQUIRE_EQUAL(sendDataHistory.size(), 1); |
| 215 | BOOST_CHECK_EQUAL(sendDataHistory[0].dataName, makeSegmentName(0)); |
| 216 | BOOST_CHECK_EQUAL(sendDataHistory[0].imsFresh, defaultImsFresh); |
| 217 | BOOST_CHECK_EQUAL(sendDataHistory[0].isFinalBlock, true); |
| 218 | |
| 219 | auto contentMultiBlocks = concatenateDataContent(); |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 220 | BOOST_CHECK_NO_THROW(contentMultiBlocks.parse()); |
| 221 | BOOST_CHECK_EQUAL(contentMultiBlocks.elements().size(), nBlocks); |
| 222 | for (auto&& element : contentMultiBlocks.elements()) { |
| 223 | BOOST_CHECK(element == contentBlock); |
| 224 | } |
| 225 | } |
| 226 | |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 227 | BOOST_AUTO_TEST_SUITE_END() // Respond |
| 228 | |
| 229 | BOOST_AUTO_TEST_SUITE(Reject) |
| 230 | |
| 231 | BOOST_AUTO_TEST_CASE(Basic) |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 232 | { |
| 233 | BOOST_CHECK_NO_THROW(context.reject()); |
Yanbiao Li | 4b4f754 | 2016-03-11 02:04:43 +0800 | [diff] [blame] | 234 | BOOST_REQUIRE_EQUAL(sendNackHistory.size(), 1); |
| 235 | BOOST_CHECK_EQUAL(sendNackHistory[0].getCode(), 400); |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 236 | } |
| 237 | |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 238 | BOOST_AUTO_TEST_SUITE_END() // Reject |
| 239 | |
Yanbiao Li | 4b4f754 | 2016-03-11 02:04:43 +0800 | [diff] [blame] | 240 | class AbnormalStateTestFixture |
| 241 | { |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 242 | protected: |
Yanbiao Li | 4b4f754 | 2016-03-11 02:04:43 +0800 | [diff] [blame] | 243 | AbnormalStateTestFixture() |
| 244 | : context(Interest("/abnormal-state"), bind([]{}), bind([]{})) |
| 245 | { |
| 246 | } |
| 247 | |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 248 | protected: |
Yanbiao Li | 4b4f754 | 2016-03-11 02:04:43 +0800 | [diff] [blame] | 249 | mgmt::StatusDatasetContext context; |
| 250 | }; |
| 251 | |
| 252 | BOOST_FIXTURE_TEST_SUITE(AbnormalState, AbnormalStateTestFixture) |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 253 | |
| 254 | BOOST_AUTO_TEST_CASE(AppendReject) |
| 255 | { |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 256 | BOOST_CHECK_NO_THROW(context.append(Block("\x82\x01\x02", 3))); |
| 257 | BOOST_CHECK_THROW(context.reject(), std::domain_error); |
| 258 | } |
| 259 | |
| 260 | BOOST_AUTO_TEST_CASE(AppendEndReject) |
| 261 | { |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 262 | BOOST_CHECK_NO_THROW(context.append(Block("\x82\x01\x02", 3))); |
| 263 | BOOST_CHECK_NO_THROW(context.end()); |
| 264 | BOOST_CHECK_THROW(context.reject(), std::domain_error); |
| 265 | } |
| 266 | |
| 267 | BOOST_AUTO_TEST_CASE(EndAppend) |
| 268 | { |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 269 | BOOST_CHECK_NO_THROW(context.end()); |
| 270 | // end, append -> error |
| 271 | BOOST_CHECK_THROW(context.append(Block("\x82\x01\x02", 3)), std::domain_error); |
| 272 | } |
| 273 | |
| 274 | BOOST_AUTO_TEST_CASE(EndEnd) |
| 275 | { |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 276 | BOOST_CHECK_NO_THROW(context.end()); |
| 277 | BOOST_CHECK_THROW(context.end(), std::domain_error); |
| 278 | } |
| 279 | |
| 280 | BOOST_AUTO_TEST_CASE(EndReject) |
| 281 | { |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 282 | BOOST_CHECK_NO_THROW(context.end()); |
| 283 | BOOST_CHECK_THROW(context.reject(), std::domain_error); |
| 284 | } |
| 285 | |
| 286 | BOOST_AUTO_TEST_CASE(RejectAppend) |
| 287 | { |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 288 | BOOST_CHECK_NO_THROW(context.reject()); |
| 289 | BOOST_CHECK_THROW(context.append(Block("\x82\x01\x02", 3)), std::domain_error); |
| 290 | } |
| 291 | |
| 292 | BOOST_AUTO_TEST_CASE(RejectEnd) |
| 293 | { |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 294 | BOOST_CHECK_NO_THROW(context.reject()); |
| 295 | BOOST_CHECK_THROW(context.end(), std::domain_error); |
| 296 | } |
| 297 | |
| 298 | BOOST_AUTO_TEST_SUITE_END() // AbnormalState |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 299 | |
Yanbiao Li | 4b4f754 | 2016-03-11 02:04:43 +0800 | [diff] [blame] | 300 | BOOST_AUTO_TEST_SUITE_END() // TestStatusDatasetContext |
| 301 | BOOST_AUTO_TEST_SUITE_END() // Mgmt |
Yanbiao Li | 8ee37ed | 2015-05-19 12:44:04 -0700 | [diff] [blame] | 302 | |
| 303 | } // namespace tests |
| 304 | } // namespace mgmt |
| 305 | } // namespace ndn |