Alexander Afanasyev | c169a81 | 2014-05-20 20:37:29 -0400 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Davide Pesavento | 10b24be | 2017-07-12 23:23:46 -0400 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2013-2017 Regents of the University of California. |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 4 | * |
| 5 | * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 6 | * |
Alexander Afanasyev | c169a81 | 2014-05-20 20:37:29 -0400 | [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. |
| 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. |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 20 | */ |
| 21 | |
| 22 | #include "exclude.hpp" |
Junxiao Shi | 6938e34 | 2017-07-25 21:56:58 +0000 | [diff] [blame^] | 23 | #include "util/sha256.hpp" |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 24 | |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 25 | #include "boost-test.hpp" |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 26 | |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 27 | #include <boost/lexical_cast.hpp> |
| 28 | |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 29 | namespace ndn { |
Spyridon Mastorakis | 429634f | 2015-02-19 17:35:33 -0800 | [diff] [blame] | 30 | namespace tests { |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 31 | |
| 32 | BOOST_AUTO_TEST_SUITE(TestExclude) |
| 33 | |
Junxiao Shi | df4b24e | 2016-07-14 21:41:43 +0000 | [diff] [blame] | 34 | BOOST_AUTO_TEST_SUITE(GenericComponent) // exclude generic NameComponent |
| 35 | |
| 36 | BOOST_AUTO_TEST_CASE(One) |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 37 | { |
| 38 | Exclude e; |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 39 | std::vector<Exclude::Range> enumerated; |
| 40 | |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 41 | e.excludeOne(name::Component("b")); |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 42 | BOOST_CHECK_EQUAL(e.toUri(), "b"); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 43 | BOOST_CHECK_EQUAL(e.size(), 1); |
| 44 | enumerated.clear(); |
| 45 | std::copy(e.begin(), e.end(), std::back_inserter(enumerated)); |
| 46 | BOOST_REQUIRE_EQUAL(enumerated.size(), 1); |
| 47 | BOOST_CHECK_EQUAL(enumerated[0].isSingular(), true); |
| 48 | BOOST_CHECK_EQUAL(enumerated[0].from, name::Component("b")); |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 49 | |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 50 | e.excludeOne(name::Component("d")); |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 51 | BOOST_CHECK_EQUAL(e.toUri(), "b,d"); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 52 | BOOST_CHECK_EQUAL(e.size(), 2); |
| 53 | enumerated.clear(); |
| 54 | std::copy(e.begin(), e.end(), std::back_inserter(enumerated)); |
| 55 | BOOST_REQUIRE_EQUAL(enumerated.size(), 2); |
| 56 | BOOST_CHECK_EQUAL(enumerated[0].isSingular(), true); |
| 57 | BOOST_CHECK_EQUAL(enumerated[0].from, name::Component("b")); |
| 58 | BOOST_CHECK_EQUAL(enumerated[1].isSingular(), true); |
| 59 | BOOST_CHECK_EQUAL(enumerated[1].from, name::Component("d")); |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 60 | |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 61 | e.excludeOne(name::Component("a")); |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 62 | BOOST_CHECK_EQUAL(e.toUri(), "a,b,d"); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 63 | BOOST_CHECK_EQUAL(e.size(), 3); |
| 64 | enumerated.clear(); |
| 65 | std::copy(e.begin(), e.end(), std::back_inserter(enumerated)); |
| 66 | BOOST_REQUIRE_EQUAL(enumerated.size(), 3); |
| 67 | BOOST_CHECK_EQUAL(enumerated[0].isSingular(), true); |
| 68 | BOOST_CHECK_EQUAL(enumerated[0].from, name::Component("a")); |
| 69 | BOOST_CHECK_EQUAL(enumerated[1].isSingular(), true); |
| 70 | BOOST_CHECK_EQUAL(enumerated[1].from, name::Component("b")); |
| 71 | BOOST_CHECK_EQUAL(enumerated[2].isSingular(), true); |
| 72 | BOOST_CHECK_EQUAL(enumerated[2].from, name::Component("d")); |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 73 | |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 74 | e.excludeOne(name::Component("aa")); |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 75 | BOOST_CHECK_EQUAL(e.toUri(), "a,b,d,aa"); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 76 | BOOST_CHECK_EQUAL(e.size(), 4); |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 77 | |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 78 | e.excludeOne(name::Component("cc")); |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 79 | BOOST_CHECK_EQUAL(e.toUri(), "a,b,d,aa,cc"); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 80 | BOOST_CHECK_EQUAL(e.size(), 5); |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 81 | |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 82 | e.excludeOne(name::Component("c")); |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 83 | BOOST_CHECK_EQUAL(e.toUri(), "a,b,c,d,aa,cc"); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 84 | BOOST_CHECK_EQUAL(e.size(), 6); |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 85 | } |
| 86 | |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 87 | BOOST_AUTO_TEST_CASE(Before) |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 88 | { |
Davide Pesavento | 10b24be | 2017-07-12 23:23:46 -0400 | [diff] [blame] | 89 | // based on https://redmine.named-data.net/issues/1158 |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 90 | ndn::Exclude e; |
| 91 | BOOST_REQUIRE_NO_THROW(e.excludeBefore(name::Component("PuQxMaf91"))); |
| 92 | |
| 93 | BOOST_CHECK_EQUAL(e.toUri(), "*,PuQxMaf91"); |
| 94 | } |
| 95 | |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 96 | BOOST_AUTO_TEST_CASE(Ranges) |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 97 | { |
Junxiao Shi | df4b24e | 2016-07-14 21:41:43 +0000 | [diff] [blame] | 98 | // example: ANY /b /d ANY /f |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 99 | |
| 100 | Exclude e; |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 101 | std::vector<Exclude::Range> enumerated; |
| 102 | |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 103 | e.excludeOne(name::Component("b0")); |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 104 | BOOST_CHECK_EQUAL(e.toUri(), "b0"); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 105 | BOOST_CHECK_EQUAL(e.size(), 1); |
| 106 | enumerated.clear(); |
| 107 | std::copy(e.begin(), e.end(), std::back_inserter(enumerated)); |
| 108 | BOOST_REQUIRE_EQUAL(enumerated.size(), 1); |
| 109 | BOOST_CHECK_EQUAL(enumerated[0].isSingular(), true); |
| 110 | BOOST_CHECK_EQUAL(enumerated[0].from, name::Component("b0")); |
| 111 | BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(enumerated[0]), "{b0}"); |
| 112 | BOOST_CHECK_EQUAL(enumerated[0], (Exclude::Range{false, name::Component("b0"), false, name::Component("b0")})); |
| 113 | BOOST_CHECK_NE(enumerated[0], (Exclude::Range{false, name::Component("b0"), false, name::Component("b1")})); |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 114 | |
Junxiao Shi | df4b24e | 2016-07-14 21:41:43 +0000 | [diff] [blame] | 115 | e.excludeBefore(name::Component("b1")); |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 116 | BOOST_CHECK_EQUAL(e.toUri(), "*,b1"); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 117 | BOOST_CHECK_EQUAL(e.size(), 1); |
| 118 | enumerated.clear(); |
| 119 | std::copy(e.begin(), e.end(), std::back_inserter(enumerated)); |
| 120 | BOOST_REQUIRE_EQUAL(enumerated.size(), 1); |
| 121 | BOOST_CHECK_EQUAL(enumerated[0].fromInfinity, true); |
| 122 | BOOST_CHECK_EQUAL(enumerated[0].toInfinity, false); |
| 123 | BOOST_CHECK_EQUAL(enumerated[0].to, name::Component("b1")); |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 124 | |
Junxiao Shi | df4b24e | 2016-07-14 21:41:43 +0000 | [diff] [blame] | 125 | e.excludeBefore(name::Component("c0")); |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 126 | BOOST_CHECK_EQUAL(e.toUri(), "*,c0"); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 127 | BOOST_CHECK_EQUAL(e.size(), 1); |
| 128 | enumerated.clear(); |
| 129 | std::copy(e.begin(), e.end(), std::back_inserter(enumerated)); |
| 130 | BOOST_REQUIRE_EQUAL(enumerated.size(), 1); |
| 131 | BOOST_CHECK_EQUAL(enumerated[0].fromInfinity, true); |
| 132 | BOOST_CHECK_EQUAL(enumerated[0].toInfinity, false); |
| 133 | BOOST_CHECK_EQUAL(enumerated[0].to, name::Component("c0")); |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 134 | |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 135 | e.excludeRange(name::Component("a0"), name::Component("c0")); |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 136 | BOOST_CHECK_EQUAL(e.toUri(), "*,c0"); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 137 | BOOST_CHECK_EQUAL(e.size(), 1); |
| 138 | enumerated.clear(); |
| 139 | std::copy(e.begin(), e.end(), std::back_inserter(enumerated)); |
| 140 | BOOST_REQUIRE_EQUAL(enumerated.size(), 1); |
| 141 | BOOST_CHECK_EQUAL(enumerated[0].fromInfinity, true); |
| 142 | BOOST_CHECK_EQUAL(enumerated[0].toInfinity, false); |
| 143 | BOOST_CHECK_EQUAL(enumerated[0].to, name::Component("c0")); |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 144 | |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 145 | e.excludeRange(name::Component("d0"), name::Component("e0")); |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 146 | BOOST_CHECK_EQUAL(e.toUri(), "*,c0,d0,*,e0"); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 147 | BOOST_CHECK_EQUAL(e.size(), 2); |
| 148 | enumerated.clear(); |
| 149 | std::copy(e.begin(), e.end(), std::back_inserter(enumerated)); |
| 150 | BOOST_REQUIRE_EQUAL(enumerated.size(), 2); |
| 151 | BOOST_CHECK_EQUAL(enumerated[0].fromInfinity, true); |
| 152 | BOOST_CHECK_EQUAL(enumerated[0].toInfinity, false); |
| 153 | BOOST_CHECK_EQUAL(enumerated[0].to, name::Component("c0")); |
| 154 | BOOST_CHECK_EQUAL(enumerated[1].fromInfinity, false); |
| 155 | BOOST_CHECK_EQUAL(enumerated[1].from, name::Component("d0")); |
| 156 | BOOST_CHECK_EQUAL(enumerated[1].toInfinity, false); |
| 157 | BOOST_CHECK_EQUAL(enumerated[1].to, name::Component("e0")); |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 158 | |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 159 | e.excludeRange(name::Component("c1"), name::Component("d1")); |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 160 | BOOST_CHECK_EQUAL(e.toUri(), "*,c0,c1,*,e0"); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 161 | BOOST_CHECK_EQUAL(e.size(), 2); |
| 162 | enumerated.clear(); |
| 163 | std::copy(e.begin(), e.end(), std::back_inserter(enumerated)); |
| 164 | BOOST_REQUIRE_EQUAL(enumerated.size(), 2); |
| 165 | BOOST_CHECK_EQUAL(enumerated[0].fromInfinity, true); |
| 166 | BOOST_CHECK_EQUAL(enumerated[0].toInfinity, false); |
| 167 | BOOST_CHECK_EQUAL(enumerated[0].to, name::Component("c0")); |
| 168 | BOOST_CHECK_EQUAL(enumerated[1].fromInfinity, false); |
| 169 | BOOST_CHECK_EQUAL(enumerated[1].from, name::Component("c1")); |
| 170 | BOOST_CHECK_EQUAL(enumerated[1].toInfinity, false); |
| 171 | BOOST_CHECK_EQUAL(enumerated[1].to, name::Component("e0")); |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 172 | |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 173 | e.excludeRange(name::Component("a1"), name::Component("d1")); |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 174 | BOOST_CHECK_EQUAL(e.toUri(), "*,e0"); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 175 | BOOST_CHECK_EQUAL(e.size(), 1); |
| 176 | enumerated.clear(); |
| 177 | std::copy(e.begin(), e.end(), std::back_inserter(enumerated)); |
| 178 | BOOST_REQUIRE_EQUAL(enumerated.size(), 1); |
| 179 | BOOST_CHECK_EQUAL(enumerated[0].fromInfinity, true); |
| 180 | BOOST_CHECK_EQUAL(enumerated[0].toInfinity, false); |
| 181 | BOOST_CHECK_EQUAL(enumerated[0].to, name::Component("e0")); |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 182 | |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 183 | e.excludeBefore(name::Component("e2")); |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 184 | BOOST_CHECK_EQUAL(e.toUri(), "*,e2"); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 185 | BOOST_CHECK_EQUAL(e.size(), 1); |
| 186 | enumerated.clear(); |
| 187 | std::copy(e.begin(), e.end(), std::back_inserter(enumerated)); |
| 188 | BOOST_REQUIRE_EQUAL(enumerated.size(), 1); |
| 189 | BOOST_CHECK_EQUAL(enumerated[0].fromInfinity, true); |
| 190 | BOOST_CHECK_EQUAL(enumerated[0].toInfinity, false); |
| 191 | BOOST_CHECK_EQUAL(enumerated[0].to, name::Component("e2")); |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 192 | |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 193 | e.excludeAfter(name::Component("f0")); |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 194 | BOOST_CHECK_EQUAL(e.toUri(), "*,e2,f0,*"); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 195 | BOOST_CHECK_EQUAL(e.size(), 2); |
| 196 | enumerated.clear(); |
| 197 | std::copy(e.begin(), e.end(), std::back_inserter(enumerated)); |
| 198 | BOOST_REQUIRE_EQUAL(enumerated.size(), 2); |
| 199 | BOOST_CHECK_EQUAL(enumerated[0].fromInfinity, true); |
| 200 | BOOST_CHECK_EQUAL(enumerated[0].toInfinity, false); |
| 201 | BOOST_CHECK_EQUAL(enumerated[0].to, name::Component("e2")); |
| 202 | BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(enumerated[0]), "(-∞,e2]"); |
| 203 | BOOST_CHECK_EQUAL(enumerated[0], (Exclude::Range{true, name::Component("ignore"), false, name::Component("e2")})); |
| 204 | BOOST_CHECK_EQUAL(enumerated[1].fromInfinity, false); |
| 205 | BOOST_CHECK_EQUAL(enumerated[1].from, name::Component("f0")); |
| 206 | BOOST_CHECK_EQUAL(enumerated[1].toInfinity, true); |
| 207 | BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(enumerated[1]), "[f0,+∞)"); |
| 208 | BOOST_CHECK_EQUAL(enumerated[1], (Exclude::Range{false, name::Component("f0"), true, name::Component("ignore")})); |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 209 | |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 210 | e.excludeAfter(name::Component("e5")); |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 211 | BOOST_CHECK_EQUAL(e.toUri(), "*,e2,e5,*"); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 212 | BOOST_CHECK_EQUAL(e.size(), 2); |
| 213 | enumerated.clear(); |
| 214 | std::copy(e.begin(), e.end(), std::back_inserter(enumerated)); |
| 215 | BOOST_REQUIRE_EQUAL(enumerated.size(), 2); |
| 216 | BOOST_CHECK_EQUAL(enumerated[0].fromInfinity, true); |
| 217 | BOOST_CHECK_EQUAL(enumerated[0].toInfinity, false); |
| 218 | BOOST_CHECK_EQUAL(enumerated[0].to, name::Component("e2")); |
| 219 | BOOST_CHECK_EQUAL(enumerated[1].fromInfinity, false); |
| 220 | BOOST_CHECK_EQUAL(enumerated[1].from, name::Component("e5")); |
| 221 | BOOST_CHECK_EQUAL(enumerated[1].toInfinity, true); |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 222 | |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 223 | e.excludeAfter(name::Component("b2")); |
Alexander Afanasyev | b1db7c6 | 2014-04-03 14:57:25 -0700 | [diff] [blame] | 224 | BOOST_CHECK_EQUAL(e.toUri(), "*"); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 225 | BOOST_CHECK_EQUAL(e.size(), 1); |
| 226 | enumerated.clear(); |
| 227 | std::copy(e.begin(), e.end(), std::back_inserter(enumerated)); |
| 228 | BOOST_REQUIRE_EQUAL(enumerated.size(), 1); |
| 229 | BOOST_CHECK_EQUAL(enumerated[0].fromInfinity, true); |
| 230 | BOOST_CHECK_EQUAL(enumerated[0].toInfinity, true); |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 231 | |
Junxiao Shi | 7520302 | 2014-09-11 10:01:50 -0700 | [diff] [blame] | 232 | BOOST_REQUIRE_THROW(e.excludeRange(name::Component("d0"), name::Component("a0")), |
| 233 | Exclude::Error); |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 234 | } |
| 235 | |
Junxiao Shi | df4b24e | 2016-07-14 21:41:43 +0000 | [diff] [blame] | 236 | BOOST_AUTO_TEST_SUITE_END() // GenericComponent |
| 237 | |
Junxiao Shi | df4b24e | 2016-07-14 21:41:43 +0000 | [diff] [blame] | 238 | BOOST_AUTO_TEST_SUITE(ImplicitDigest) // exclude ImplicitSha256DigestComponent |
| 239 | |
Davide Pesavento | 10b24be | 2017-07-12 23:23:46 -0400 | [diff] [blame] | 240 | /** \brief make a name::Component with an octet repeated util::Sha256::DIGEST_SIZE times |
Junxiao Shi | df4b24e | 2016-07-14 21:41:43 +0000 | [diff] [blame] | 241 | * \param octet the octet to fill the component |
| 242 | * \param isDigest whether to make an ImplicitSha256DigestComponent or a generic NameComponent |
| 243 | * \param lastOctet if non-negative, set the last octet to a different value |
| 244 | */ |
| 245 | static name::Component |
| 246 | makeComponent(uint8_t octet, bool isDigest, int lastOctet = -1) |
| 247 | { |
Davide Pesavento | 10b24be | 2017-07-12 23:23:46 -0400 | [diff] [blame] | 248 | uint8_t wire[util::Sha256::DIGEST_SIZE]; |
Junxiao Shi | df4b24e | 2016-07-14 21:41:43 +0000 | [diff] [blame] | 249 | std::memset(wire, octet, sizeof(wire)); |
| 250 | if (lastOctet >= 0) { |
Davide Pesavento | 10b24be | 2017-07-12 23:23:46 -0400 | [diff] [blame] | 251 | wire[util::Sha256::DIGEST_SIZE - 1] = static_cast<uint8_t>(lastOctet); |
Junxiao Shi | df4b24e | 2016-07-14 21:41:43 +0000 | [diff] [blame] | 252 | } |
| 253 | |
| 254 | if (isDigest) { |
| 255 | return name::Component::fromImplicitSha256Digest(wire, sizeof(wire)); |
| 256 | } |
| 257 | else { |
| 258 | return name::Component(wire, sizeof(wire)); |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | BOOST_AUTO_TEST_CASE(One) |
| 263 | { |
| 264 | name::Component digestC = makeComponent(0xCC, true);; |
| 265 | name::Component genericC = makeComponent(0xCC, false); |
| 266 | name::Component digestD = makeComponent(0xDD, true); |
| 267 | |
| 268 | Exclude e; |
| 269 | e.excludeOne(digestC); |
| 270 | BOOST_CHECK_EQUAL(e.isExcluded(digestC), true); |
| 271 | BOOST_CHECK_EQUAL(e.isExcluded(genericC), false); |
| 272 | BOOST_CHECK_EQUAL(e.isExcluded(digestD), false); |
| 273 | |
| 274 | e.clear(); |
| 275 | e.excludeOne(genericC); |
| 276 | BOOST_CHECK_EQUAL(e.isExcluded(digestC), false); |
| 277 | BOOST_CHECK_EQUAL(e.isExcluded(genericC), true); |
| 278 | } |
| 279 | |
| 280 | BOOST_AUTO_TEST_CASE(BeforeDigest) |
| 281 | { |
| 282 | name::Component digestBA = makeComponent(0xBB, true, 0xBA); |
| 283 | name::Component digestBB = makeComponent(0xBB, true); |
| 284 | name::Component digestBC = makeComponent(0xBB, true, 0xBC); |
| 285 | |
| 286 | Exclude e; |
| 287 | e.excludeBefore(digestBB); |
| 288 | BOOST_CHECK_EQUAL(e.isExcluded(digestBA), true); |
| 289 | BOOST_CHECK_EQUAL(e.isExcluded(digestBB), true); |
| 290 | BOOST_CHECK_EQUAL(e.isExcluded(digestBC), false); |
| 291 | BOOST_CHECK_EQUAL(e.isExcluded(name::Component("")), false); |
| 292 | BOOST_CHECK_EQUAL(e.isExcluded(name::Component("generic")), false); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 293 | |
| 294 | BOOST_CHECK_EQUAL(e.size(), 1); |
| 295 | std::vector<Exclude::Range> enumerated; |
| 296 | std::copy(e.begin(), e.end(), std::back_inserter(enumerated)); |
| 297 | BOOST_REQUIRE_EQUAL(enumerated.size(), 1); |
| 298 | BOOST_CHECK_EQUAL(enumerated[0].fromInfinity, true); |
| 299 | BOOST_CHECK_EQUAL(enumerated[0].toInfinity, false); |
| 300 | BOOST_CHECK_EQUAL(enumerated[0].to, digestBB); |
Junxiao Shi | df4b24e | 2016-07-14 21:41:43 +0000 | [diff] [blame] | 301 | } |
| 302 | |
| 303 | BOOST_AUTO_TEST_CASE(BeforeGeneric) |
| 304 | { |
| 305 | name::Component digest0 = makeComponent(0x00, true); |
| 306 | name::Component digest9 = makeComponent(0x99, true); |
| 307 | name::Component digestF = makeComponent(0xFF, true); |
| 308 | |
| 309 | Exclude e; |
| 310 | e.excludeBefore(name::Component("")); |
| 311 | BOOST_CHECK_EQUAL(e.isExcluded(digest0), true); |
| 312 | BOOST_CHECK_EQUAL(e.isExcluded(digest9), true); |
| 313 | BOOST_CHECK_EQUAL(e.isExcluded(digestF), true); |
| 314 | BOOST_CHECK_EQUAL(e.isExcluded(name::Component("")), true); |
| 315 | BOOST_CHECK_EQUAL(e.isExcluded(name::Component("generic")), false); |
| 316 | } |
| 317 | |
| 318 | BOOST_AUTO_TEST_CASE(AfterDigest) |
| 319 | { |
| 320 | name::Component digestBA = makeComponent(0xBB, true, 0xBA); |
| 321 | name::Component digestBB = makeComponent(0xBB, true); |
| 322 | name::Component digestBC = makeComponent(0xBB, true, 0xBC); |
| 323 | |
| 324 | Exclude e; |
| 325 | e.excludeAfter(digestBB); |
| 326 | BOOST_CHECK_EQUAL(e.isExcluded(digestBA), false); |
| 327 | BOOST_CHECK_EQUAL(e.isExcluded(digestBB), true); |
| 328 | BOOST_CHECK_EQUAL(e.isExcluded(digestBC), true); |
| 329 | BOOST_CHECK_EQUAL(e.isExcluded(name::Component("")), true); |
| 330 | BOOST_CHECK_EQUAL(e.isExcluded(name::Component("generic")), true); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 331 | |
| 332 | BOOST_CHECK_EQUAL(e.size(), 1); |
| 333 | std::vector<Exclude::Range> enumerated; |
| 334 | std::copy(e.begin(), e.end(), std::back_inserter(enumerated)); |
| 335 | BOOST_REQUIRE_EQUAL(enumerated.size(), 1); |
| 336 | BOOST_CHECK_EQUAL(enumerated[0].fromInfinity, false); |
| 337 | BOOST_CHECK_EQUAL(enumerated[0].from, digestBB); |
| 338 | BOOST_CHECK_EQUAL(enumerated[0].toInfinity, true); |
Junxiao Shi | df4b24e | 2016-07-14 21:41:43 +0000 | [diff] [blame] | 339 | } |
| 340 | |
| 341 | BOOST_AUTO_TEST_CASE(AfterDigestFF) |
| 342 | { |
| 343 | name::Component digest00 = makeComponent(0x00, true); |
| 344 | name::Component digest99 = makeComponent(0x99, true); |
| 345 | name::Component digestFE = makeComponent(0xFF, true, 0xFE); |
| 346 | name::Component digestFF = makeComponent(0xFF, true); |
| 347 | |
| 348 | Exclude e; |
| 349 | e.excludeAfter(digestFF); |
| 350 | BOOST_CHECK_EQUAL(e.isExcluded(digest00), false); |
| 351 | BOOST_CHECK_EQUAL(e.isExcluded(digest99), false); |
| 352 | BOOST_CHECK_EQUAL(e.isExcluded(digestFE), false); |
| 353 | BOOST_CHECK_EQUAL(e.isExcluded(digestFF), true); |
| 354 | BOOST_CHECK_EQUAL(e.isExcluded(name::Component("")), true); |
| 355 | BOOST_CHECK_EQUAL(e.isExcluded(name::Component("generic")), true); |
| 356 | } |
| 357 | |
| 358 | BOOST_AUTO_TEST_CASE(AfterGeneric) |
| 359 | { |
| 360 | name::Component digest0 = makeComponent(0x00, true); |
| 361 | name::Component digest9 = makeComponent(0x99, true); |
| 362 | name::Component digestF = makeComponent(0xFF, true); |
| 363 | |
| 364 | Exclude e; |
| 365 | e.excludeAfter(name::Component("")); |
| 366 | BOOST_CHECK_EQUAL(e.isExcluded(digest0), false); |
| 367 | BOOST_CHECK_EQUAL(e.isExcluded(digest9), false); |
| 368 | BOOST_CHECK_EQUAL(e.isExcluded(digestF), false); |
| 369 | BOOST_CHECK_EQUAL(e.isExcluded(name::Component("")), true); |
| 370 | BOOST_CHECK_EQUAL(e.isExcluded(name::Component("generic")), true); |
| 371 | } |
| 372 | |
| 373 | BOOST_AUTO_TEST_CASE(RangeDigest) |
| 374 | { |
| 375 | name::Component digest0 = makeComponent(0x00, true); |
| 376 | name::Component digest7 = makeComponent(0x77, true); |
| 377 | name::Component digest8 = makeComponent(0x88, true); |
| 378 | name::Component digest9 = makeComponent(0x99, true); |
| 379 | name::Component digestF = makeComponent(0xFF, true); |
| 380 | |
| 381 | Exclude e; |
| 382 | e.excludeRange(digest7, digest9); |
| 383 | BOOST_CHECK_EQUAL(e.isExcluded(digest0), false); |
| 384 | BOOST_CHECK_EQUAL(e.isExcluded(digest7), true); |
| 385 | BOOST_CHECK_EQUAL(e.isExcluded(digest8), true); |
| 386 | BOOST_CHECK_EQUAL(e.isExcluded(digest9), true); |
| 387 | BOOST_CHECK_EQUAL(e.isExcluded(digestF), false); |
| 388 | BOOST_CHECK_EQUAL(e.isExcluded(name::Component("")), false); |
| 389 | BOOST_CHECK_EQUAL(e.isExcluded(name::Component("generic")), false); |
| 390 | } |
| 391 | |
| 392 | BOOST_AUTO_TEST_CASE(RangeDigestReverse) |
| 393 | { |
| 394 | name::Component digest7 = makeComponent(0x77, true); |
| 395 | name::Component digest9 = makeComponent(0x99, true); |
| 396 | |
| 397 | Exclude e; |
| 398 | BOOST_CHECK_THROW(e.excludeRange(digest9, digest7), Exclude::Error); |
| 399 | } |
| 400 | |
| 401 | BOOST_AUTO_TEST_CASE(RangeDigestGeneric) |
| 402 | { |
| 403 | name::Component digest0 = makeComponent(0x00, true); |
| 404 | name::Component digest7 = makeComponent(0x77, true); |
| 405 | name::Component digest9 = makeComponent(0x99, true); |
| 406 | name::Component digestF = makeComponent(0xFF, true); |
| 407 | |
| 408 | Exclude e; |
| 409 | e.excludeRange(digest9, name::Component("")); |
| 410 | BOOST_CHECK_EQUAL(e.isExcluded(digest0), false); |
| 411 | BOOST_CHECK_EQUAL(e.isExcluded(digest7), false); |
| 412 | BOOST_CHECK_EQUAL(e.isExcluded(digest9), true); |
| 413 | BOOST_CHECK_EQUAL(e.isExcluded(digestF), true); |
| 414 | BOOST_CHECK_EQUAL(e.isExcluded(name::Component("")), true); |
| 415 | BOOST_CHECK_EQUAL(e.isExcluded(name::Component("generic")), false); |
Junxiao Shi | b80e947 | 2016-07-20 13:45:24 +0000 | [diff] [blame] | 416 | |
| 417 | BOOST_CHECK_EQUAL(e.size(), 1); |
| 418 | std::vector<Exclude::Range> enumerated; |
| 419 | std::copy(e.begin(), e.end(), std::back_inserter(enumerated)); |
| 420 | BOOST_REQUIRE_EQUAL(enumerated.size(), 1); |
| 421 | BOOST_CHECK_EQUAL(enumerated[0].fromInfinity, false); |
| 422 | BOOST_CHECK_EQUAL(enumerated[0].from, digest9); |
| 423 | BOOST_CHECK_EQUAL(enumerated[0].toInfinity, false); |
| 424 | BOOST_CHECK_EQUAL(enumerated[0].to, name::Component("")); |
Junxiao Shi | df4b24e | 2016-07-14 21:41:43 +0000 | [diff] [blame] | 425 | } |
| 426 | |
| 427 | BOOST_AUTO_TEST_CASE(RangeGenericDigest) |
| 428 | { |
| 429 | name::Component digestF = makeComponent(0xFF, true); |
| 430 | |
| 431 | Exclude e; |
| 432 | BOOST_CHECK_THROW(e.excludeRange(name::Component(""), digestF), Exclude::Error); |
| 433 | } |
| 434 | |
| 435 | BOOST_AUTO_TEST_SUITE_END() // ImplicitDigest |
| 436 | |
Junxiao Shi | df4b24e | 2016-07-14 21:41:43 +0000 | [diff] [blame] | 437 | BOOST_AUTO_TEST_SUITE(WireCompare) // wireEncode, wireDecode, operator==, operator!= |
| 438 | |
| 439 | BOOST_AUTO_TEST_CASE(EqualityComparable) |
| 440 | { |
| 441 | Exclude e1; |
| 442 | Exclude e2; |
| 443 | BOOST_CHECK_EQUAL(e1, e2); |
| 444 | |
| 445 | e1.excludeOne(name::Component("T")); |
| 446 | BOOST_CHECK_NE(e1, e2); |
| 447 | |
| 448 | e2.excludeOne(name::Component("D")); |
| 449 | BOOST_CHECK_NE(e1, e2); |
| 450 | |
| 451 | e2.clear(); |
| 452 | e2.excludeOne(name::Component("T")); |
| 453 | BOOST_CHECK_EQUAL(e1, e2); |
| 454 | |
| 455 | e2.clear(); |
| 456 | const uint8_t EXCLUDE[] = { 0x10, 0x15, 0x13, 0x00, 0x08, 0x01, 0x41, 0x08, 0x01, 0x42, |
| 457 | 0x08, 0x01, 0x43, 0x13, 0x00, 0x08, 0x01, 0x44, 0x08, 0x01, |
| 458 | 0x45, 0x13, 0x00 }; |
| 459 | e2.wireDecode(Block(EXCLUDE, sizeof(EXCLUDE))); |
| 460 | |
| 461 | e1.clear(); |
| 462 | e1.excludeBefore(name::Component("A")); |
| 463 | e1.excludeOne(name::Component("B")); |
| 464 | e1.excludeRange(name::Component("C"), name::Component("D")); |
| 465 | e1.excludeAfter(name::Component("E")); |
| 466 | BOOST_CHECK_EQUAL(e1, e2); |
| 467 | } |
| 468 | |
Junxiao Shi | 7284a40 | 2014-09-12 13:42:16 -0700 | [diff] [blame] | 469 | BOOST_AUTO_TEST_CASE(Malformed) |
| 470 | { |
| 471 | Exclude e1; |
| 472 | BOOST_CHECK_THROW(e1.wireEncode(), Exclude::Error); |
| 473 | |
| 474 | Exclude e2; |
| 475 | |
| 476 | // top-level TLV-TYPE is not tlv::Exclude |
| 477 | const uint8_t NON_EXCLUDE[] = { 0x01, 0x02, 0x13, 0x00 }; |
| 478 | BOOST_CHECK_THROW(e2.wireDecode(Block(NON_EXCLUDE, sizeof(NON_EXCLUDE))), |
| 479 | tlv::Error); |
| 480 | |
| 481 | // Exclude element is empty |
| 482 | const uint8_t EMPTY_EXCLUDE[] = { 0x10, 0x00 }; |
| 483 | BOOST_CHECK_THROW(e2.wireDecode(Block(EMPTY_EXCLUDE, sizeof(EMPTY_EXCLUDE))), |
| 484 | Exclude::Error); |
| 485 | |
| 486 | // Exclude element contains unknown element |
| 487 | const uint8_t UNKNOWN_COMP1[] = { 0x10, 0x02, 0xAA, 0x00 }; |
| 488 | BOOST_CHECK_THROW(e2.wireDecode(Block(UNKNOWN_COMP1, sizeof(UNKNOWN_COMP1))), |
| 489 | Exclude::Error); |
| 490 | |
| 491 | // Exclude element contains unknown element |
| 492 | const uint8_t UNKNOWN_COMP2[] = { 0x10, 0x05, 0x08, 0x01, 0x54, 0xAA, 0x00 }; |
| 493 | BOOST_CHECK_THROW(e2.wireDecode(Block(UNKNOWN_COMP2, sizeof(UNKNOWN_COMP2))), |
| 494 | Exclude::Error); |
| 495 | |
| 496 | // // <Exclude><Any/></Exclude> |
| 497 | // const uint8_t ONLY_ANY[] = { 0x10, 0x02, 0x13, 0x00 }; |
| 498 | // BOOST_CHECK_THROW(e2.wireDecode(Block(ONLY_ANY, sizeof(ONLY_ANY))), |
| 499 | // Exclude::Error); |
| 500 | |
| 501 | // <Exclude><Any/><Any/></Exclude> |
| 502 | const uint8_t ANY_ANY[] = { 0x10, 0x04, 0x13, 0x00, 0x13, 0x00 }; |
| 503 | BOOST_CHECK_THROW(e2.wireDecode(Block(ANY_ANY, sizeof(ANY_ANY))), |
| 504 | Exclude::Error); |
| 505 | |
| 506 | // // <Exclude><Any/><NameComponent>T</NameComponent><Any/></Exclude> |
| 507 | // const uint8_t ANY_COMPONENT_ANY[] = { 0x10, 0x07, 0x13, 0x00, 0x08, 0x01, 0x54, 0x13, 0x00 }; |
| 508 | // BOOST_CHECK_THROW(e2.wireDecode(Block(ANY_COMPONENT_ANY, sizeof(ANY_COMPONENT_ANY))), |
| 509 | // Exclude::Error); |
Ilya Moiseenko | 741771f | 2015-03-10 16:53:44 -0700 | [diff] [blame] | 510 | |
| 511 | uint8_t WIRE[] = { |
| 512 | 0x10, 0x20, // Exclude |
| 513 | 0x01, 0x1E, // ImplicitSha256DigestComponent with incorrect length |
| 514 | 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, |
| 515 | 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, |
| 516 | 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, |
| 517 | 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd |
| 518 | }; |
| 519 | |
| 520 | BOOST_CHECK_THROW(Exclude().wireDecode(Block(WIRE, sizeof(WIRE))), Exclude::Error); |
| 521 | } |
| 522 | |
| 523 | BOOST_AUTO_TEST_CASE(ImplicitSha256Digest) |
| 524 | { |
| 525 | uint8_t WIRE[] = { |
| 526 | 0x10, 0x22, // Exclude |
| 527 | 0x01, 0x20, // ImplicitSha256DigestComponent |
| 528 | 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, |
| 529 | 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, |
| 530 | 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, |
| 531 | 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd |
| 532 | }; |
| 533 | |
| 534 | Block block(WIRE, sizeof(WIRE)); |
| 535 | |
| 536 | Exclude exclude; |
| 537 | BOOST_CHECK_NO_THROW(exclude.wireDecode(block)); |
Junxiao Shi | df4b24e | 2016-07-14 21:41:43 +0000 | [diff] [blame] | 538 | BOOST_CHECK(exclude.wireEncode() == block); |
Junxiao Shi | 7284a40 | 2014-09-12 13:42:16 -0700 | [diff] [blame] | 539 | } |
| 540 | |
Junxiao Shi | df4b24e | 2016-07-14 21:41:43 +0000 | [diff] [blame] | 541 | BOOST_AUTO_TEST_CASE(EmptyComponent) // Bug #2660 |
Alexander Afanasyev | c076e6d | 2015-04-02 20:07:13 -0700 | [diff] [blame] | 542 | { |
| 543 | Exclude e1, e2; |
| 544 | |
| 545 | e1.excludeOne(name::Component()); |
| 546 | e2.excludeOne(name::Component("")); |
| 547 | |
| 548 | BOOST_CHECK_EQUAL(e1, e2); |
| 549 | BOOST_CHECK_EQUAL(e1.toUri(), e2.toUri()); |
| 550 | BOOST_CHECK(e1.wireEncode() == e2.wireEncode()); |
| 551 | |
| 552 | BOOST_CHECK_EQUAL("...", e1.toUri()); |
| 553 | |
| 554 | uint8_t WIRE[] {0x10, 0x02, 0x08, 0x00}; |
| 555 | BOOST_CHECK_EQUAL_COLLECTIONS(e1.wireEncode().begin(), e1.wireEncode().end(), |
| 556 | WIRE, WIRE + sizeof(WIRE)); |
| 557 | |
| 558 | Exclude e3(Block(WIRE, sizeof(WIRE))); |
| 559 | BOOST_CHECK_EQUAL(e1, e3); |
| 560 | BOOST_CHECK_EQUAL(e1.toUri(), e3.toUri()); |
| 561 | } |
| 562 | |
Junxiao Shi | df4b24e | 2016-07-14 21:41:43 +0000 | [diff] [blame] | 563 | BOOST_AUTO_TEST_SUITE_END() // WireCompare |
| 564 | |
Davide Pesavento | eee3e82 | 2016-11-26 19:19:34 +0100 | [diff] [blame] | 565 | BOOST_AUTO_TEST_SUITE_END() // TestExclude |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 566 | |
Spyridon Mastorakis | 429634f | 2015-02-19 17:35:33 -0800 | [diff] [blame] | 567 | } // namespace tests |
Alexander Afanasyev | 035c7b4 | 2014-02-06 18:26:19 -0800 | [diff] [blame] | 568 | } // namespace ndn |