HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Junxiao Shi | a6de429 | 2016-07-12 02:08:10 +0000 | [diff] [blame] | 3 | * Copyright (c) 2014-2016, Regents of the University of California, |
Spyridon Mastorakis | d0381c0 | 2015-02-19 10:29:41 -0800 | [diff] [blame] | 4 | * Arizona Board of Regents, |
| 5 | * Colorado State University, |
| 6 | * University Pierre & Marie Curie, Sorbonne University, |
| 7 | * Washington University in St. Louis, |
| 8 | * Beijing Institute of Technology, |
| 9 | * The University of Memphis. |
Alexander Afanasyev | 9bcbc7c | 2014-04-06 19:37:37 -0700 | [diff] [blame] | 10 | * |
| 11 | * This file is part of NFD (Named Data Networking Forwarding Daemon). |
| 12 | * See AUTHORS.md for complete list of NFD authors and contributors. |
| 13 | * |
| 14 | * NFD is free software: you can redistribute it and/or modify it under the terms |
| 15 | * of the GNU General Public License as published by the Free Software Foundation, |
| 16 | * either version 3 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 19 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 20 | * PURPOSE. See the GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License along with |
| 23 | * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
Alexander Afanasyev | 28d586a | 2014-07-10 20:10:54 -0700 | [diff] [blame] | 24 | */ |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 25 | |
| 26 | #include "table/name-tree.hpp" |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 27 | |
Junxiao Shi | d9ee45c | 2014-02-27 15:38:11 -0700 | [diff] [blame] | 28 | #include "tests/test-common.hpp" |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 29 | |
| 30 | namespace nfd { |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 31 | namespace name_tree { |
Junxiao Shi | d9ee45c | 2014-02-27 15:38:11 -0700 | [diff] [blame] | 32 | namespace tests { |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 33 | |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 34 | using namespace nfd::tests; |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 35 | |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 36 | BOOST_AUTO_TEST_SUITE(Table) |
| 37 | BOOST_FIXTURE_TEST_SUITE(TestNameTree, BaseFixture) |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 38 | |
Haowei Yuan | f52dac7 | 2014-03-24 23:35:03 -0500 | [diff] [blame] | 39 | BOOST_AUTO_TEST_CASE(Hash) |
| 40 | { |
| 41 | Name root("/"); |
| 42 | root.wireEncode(); |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 43 | size_t hashValue = computeHash(root); |
| 44 | BOOST_CHECK_EQUAL(hashValue, 0); |
Haowei Yuan | f52dac7 | 2014-03-24 23:35:03 -0500 | [diff] [blame] | 45 | |
| 46 | Name prefix("/nohello/world/ndn/research"); |
| 47 | prefix.wireEncode(); |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 48 | std::vector<size_t> hashSet = computeHashSet(prefix); |
Haowei Yuan | f52dac7 | 2014-03-24 23:35:03 -0500 | [diff] [blame] | 49 | BOOST_CHECK_EQUAL(hashSet.size(), prefix.size() + 1); |
| 50 | } |
| 51 | |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 52 | BOOST_AUTO_TEST_CASE(NameTreeEntry) |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 53 | { |
| 54 | Name prefix("ndn:/named-data/research/abc/def/ghi"); |
| 55 | |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 56 | auto npe = make_shared<Entry>(prefix); |
Junxiao Shi | efceadc | 2014-03-09 18:52:57 -0700 | [diff] [blame] | 57 | BOOST_CHECK_EQUAL(npe->getPrefix(), prefix); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 58 | |
| 59 | // examine all the get methods |
| 60 | |
Haowei Yuan | f52dac7 | 2014-03-24 23:35:03 -0500 | [diff] [blame] | 61 | size_t hash = npe->getHash(); |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 62 | BOOST_CHECK_EQUAL(hash, 0); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 63 | |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 64 | shared_ptr<Entry> parent = npe->getParent(); |
| 65 | BOOST_CHECK(parent == nullptr); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 66 | |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 67 | std::vector<shared_ptr<Entry>>& childList = npe->getChildren(); |
| 68 | BOOST_CHECK_EQUAL(childList.size(), 0); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 69 | |
Junxiao Shi | a6de429 | 2016-07-12 02:08:10 +0000 | [diff] [blame] | 70 | fib::Entry* fib = npe->getFibEntry(); |
| 71 | BOOST_CHECK(fib == nullptr); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 72 | |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 73 | const std::vector<shared_ptr<pit::Entry>>& pitList = npe->getPitEntries(); |
| 74 | BOOST_CHECK_EQUAL(pitList.size(), 0); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 75 | |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 76 | // examine all the set method |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 77 | |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 78 | npe->setHash(12345); |
| 79 | BOOST_CHECK_EQUAL(npe->getHash(), 12345); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 80 | |
| 81 | Name parentName("ndn:/named-data/research/abc/def"); |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 82 | parent = make_shared<Entry>(parentName); |
Junxiao Shi | efceadc | 2014-03-09 18:52:57 -0700 | [diff] [blame] | 83 | npe->setParent(parent); |
| 84 | BOOST_CHECK_EQUAL(npe->getParent(), parent); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 85 | |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 86 | // Insert FIB |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 87 | |
Junxiao Shi | a6de429 | 2016-07-12 02:08:10 +0000 | [diff] [blame] | 88 | npe->setFibEntry(make_unique<fib::Entry>(prefix)); |
| 89 | BOOST_REQUIRE(npe->getFibEntry() != nullptr); |
| 90 | BOOST_CHECK_EQUAL(npe->getFibEntry()->getPrefix(), prefix); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 91 | |
Junxiao Shi | a6de429 | 2016-07-12 02:08:10 +0000 | [diff] [blame] | 92 | npe->setFibEntry(nullptr); |
| 93 | BOOST_CHECK(npe->getFibEntry() == nullptr); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 94 | |
| 95 | // Insert a PIT |
| 96 | |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 97 | auto pitEntry = make_shared<pit::Entry>(*makeInterest(prefix)); |
| 98 | auto pitEntry2 = make_shared<pit::Entry>(*makeInterest(parentName)); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 99 | |
Alexander Afanasyev | 28d586a | 2014-07-10 20:10:54 -0700 | [diff] [blame] | 100 | npe->insertPitEntry(pitEntry); |
Junxiao Shi | efceadc | 2014-03-09 18:52:57 -0700 | [diff] [blame] | 101 | BOOST_CHECK_EQUAL(npe->getPitEntries().size(), 1); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 102 | |
Alexander Afanasyev | 28d586a | 2014-07-10 20:10:54 -0700 | [diff] [blame] | 103 | npe->insertPitEntry(pitEntry2); |
Junxiao Shi | efceadc | 2014-03-09 18:52:57 -0700 | [diff] [blame] | 104 | BOOST_CHECK_EQUAL(npe->getPitEntries().size(), 2); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 105 | |
Alexander Afanasyev | 28d586a | 2014-07-10 20:10:54 -0700 | [diff] [blame] | 106 | npe->erasePitEntry(pitEntry); |
Junxiao Shi | efceadc | 2014-03-09 18:52:57 -0700 | [diff] [blame] | 107 | BOOST_CHECK_EQUAL(npe->getPitEntries().size(), 1); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 108 | |
Alexander Afanasyev | 28d586a | 2014-07-10 20:10:54 -0700 | [diff] [blame] | 109 | npe->erasePitEntry(pitEntry2); |
Junxiao Shi | efceadc | 2014-03-09 18:52:57 -0700 | [diff] [blame] | 110 | BOOST_CHECK_EQUAL(npe->getPitEntries().size(), 0); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 111 | } |
| 112 | |
Alexander Afanasyev | b303324 | 2014-08-04 11:09:05 -0700 | [diff] [blame] | 113 | BOOST_AUTO_TEST_CASE(Basic) |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 114 | { |
| 115 | size_t nBuckets = 16; |
| 116 | NameTree nt(nBuckets); |
| 117 | |
| 118 | BOOST_CHECK_EQUAL(nt.size(), 0); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 119 | BOOST_CHECK_EQUAL(nt.getNBuckets(), nBuckets); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 120 | |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 121 | Name nameABC("ndn:/a/b/c"); |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 122 | shared_ptr<Entry> npeABC = nt.lookup(nameABC); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 123 | BOOST_CHECK_EQUAL(nt.size(), 4); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 124 | |
| 125 | Name nameABD("/a/b/d"); |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 126 | shared_ptr<Entry> npeABD = nt.lookup(nameABD); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 127 | BOOST_CHECK_EQUAL(nt.size(), 5); |
| 128 | |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 129 | Name nameAE("/a/e/"); |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 130 | shared_ptr<Entry> npeAE = nt.lookup(nameAE); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 131 | BOOST_CHECK_EQUAL(nt.size(), 6); |
| 132 | |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 133 | Name nameF("/f"); |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 134 | shared_ptr<Entry> npeF = nt.lookup(nameF); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 135 | BOOST_CHECK_EQUAL(nt.size(), 7); |
| 136 | |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 137 | // validate lookup() and findExactMatch() |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 138 | |
| 139 | Name nameAB ("/a/b"); |
| 140 | BOOST_CHECK_EQUAL(npeABC->getParent(), nt.findExactMatch(nameAB)); |
| 141 | BOOST_CHECK_EQUAL(npeABD->getParent(), nt.findExactMatch(nameAB)); |
| 142 | |
| 143 | Name nameA ("/a"); |
| 144 | BOOST_CHECK_EQUAL(npeAE->getParent(), nt.findExactMatch(nameA)); |
| 145 | |
| 146 | Name nameRoot ("/"); |
| 147 | BOOST_CHECK_EQUAL(npeF->getParent(), nt.findExactMatch(nameRoot)); |
| 148 | BOOST_CHECK_EQUAL(nt.size(), 7); |
| 149 | |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 150 | Name name0("/does/not/exist"); |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 151 | shared_ptr<Entry> npe0 = nt.findExactMatch(name0); |
| 152 | BOOST_CHECK(npe0 == nullptr); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 153 | |
| 154 | |
| 155 | // Longest Prefix Matching |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 156 | shared_ptr<Entry> temp; |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 157 | Name nameABCLPM("/a/b/c/def/asdf/nlf"); |
| 158 | temp = nt.findLongestPrefixMatch(nameABCLPM); |
| 159 | BOOST_CHECK_EQUAL(temp, nt.findExactMatch(nameABC)); |
| 160 | |
| 161 | Name nameABDLPM("/a/b/d/def/asdf/nlf"); |
| 162 | temp = nt.findLongestPrefixMatch(nameABDLPM); |
| 163 | BOOST_CHECK_EQUAL(temp, nt.findExactMatch(nameABD)); |
| 164 | |
| 165 | Name nameABLPM("/a/b/hello/world"); |
| 166 | temp = nt.findLongestPrefixMatch(nameABLPM); |
| 167 | BOOST_CHECK_EQUAL(temp, nt.findExactMatch(nameAB)); |
| 168 | |
| 169 | Name nameAELPM("/a/e/hello/world"); |
| 170 | temp = nt.findLongestPrefixMatch(nameAELPM); |
| 171 | BOOST_CHECK_EQUAL(temp, nt.findExactMatch(nameAE)); |
| 172 | |
| 173 | Name nameALPM("/a/hello/world"); |
| 174 | temp = nt.findLongestPrefixMatch(nameALPM); |
| 175 | BOOST_CHECK_EQUAL(temp, nt.findExactMatch(nameA)); |
| 176 | |
| 177 | Name nameFLPM("/f/hello/world"); |
| 178 | temp = nt.findLongestPrefixMatch(nameFLPM); |
| 179 | BOOST_CHECK_EQUAL(temp, nt.findExactMatch(nameF)); |
| 180 | |
| 181 | Name nameRootLPM("/does_not_exist"); |
| 182 | temp = nt.findLongestPrefixMatch(nameRootLPM); |
| 183 | BOOST_CHECK_EQUAL(temp, nt.findExactMatch(nameRoot)); |
| 184 | |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 185 | bool eraseResult = false; |
| 186 | temp = nt.findExactMatch(nameABC); |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 187 | if (temp != nullptr) |
| 188 | eraseResult = nt.eraseEntryIfEmpty(temp); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 189 | BOOST_CHECK_EQUAL(nt.size(), 6); |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 190 | BOOST_CHECK(nt.findExactMatch(nameABC) == nullptr); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 191 | BOOST_CHECK_EQUAL(eraseResult, true); |
| 192 | |
| 193 | eraseResult = false; |
| 194 | temp = nt.findExactMatch(nameABCLPM); |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 195 | if (temp != nullptr) |
| 196 | eraseResult = nt.eraseEntryIfEmpty(temp); |
| 197 | BOOST_CHECK(temp == nullptr); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 198 | BOOST_CHECK_EQUAL(nt.size(), 6); |
| 199 | BOOST_CHECK_EQUAL(eraseResult, false); |
| 200 | |
| 201 | // nt.dump(std::cout); |
| 202 | |
| 203 | nt.lookup(nameABC); |
| 204 | BOOST_CHECK_EQUAL(nt.size(), 7); |
| 205 | |
| 206 | eraseResult = false; |
| 207 | temp = nt.findExactMatch(nameABC); |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 208 | if (temp != nullptr) |
| 209 | eraseResult = nt.eraseEntryIfEmpty(temp); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 210 | BOOST_CHECK_EQUAL(nt.size(), 6); |
| 211 | BOOST_CHECK_EQUAL(eraseResult, true); |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 212 | BOOST_CHECK(nt.findExactMatch(nameABC) == nullptr); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 213 | |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 214 | BOOST_CHECK_EQUAL(nt.getNBuckets(), 16); |
| 215 | |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 216 | // should resize now |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 217 | Name nameABCD("a/b/c/d"); |
| 218 | nt.lookup(nameABCD); |
| 219 | Name nameABCDE("a/b/c/d/e"); |
| 220 | nt.lookup(nameABCDE); |
| 221 | BOOST_CHECK_EQUAL(nt.size(), 9); |
| 222 | BOOST_CHECK_EQUAL(nt.getNBuckets(), 32); |
| 223 | |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 224 | // try to erase /a/b/c, should return false |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 225 | temp = nt.findExactMatch(nameABC); |
| 226 | BOOST_CHECK_EQUAL(temp->getPrefix(), nameABC); |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 227 | eraseResult = nt.eraseEntryIfEmpty(temp); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 228 | BOOST_CHECK_EQUAL(eraseResult, false); |
| 229 | temp = nt.findExactMatch(nameABC); |
| 230 | BOOST_CHECK_EQUAL(temp->getPrefix(), nameABC); |
| 231 | |
| 232 | temp = nt.findExactMatch(nameABD); |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 233 | if (temp != nullptr) |
| 234 | nt.eraseEntryIfEmpty(temp); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 235 | BOOST_CHECK_EQUAL(nt.size(), 8); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 236 | } |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 237 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 238 | /** \brief verify a NameTree enumeration contains expected entries |
| 239 | * |
| 240 | * Example: |
| 241 | * \code{.cpp} |
| 242 | * auto& enumerable = ...; |
| 243 | * EnumerationVerifier(enumerable) |
| 244 | * .expect("/A") |
| 245 | * .expect("/B") |
| 246 | * .end(); |
| 247 | * // enumerable must have /A /B and nothing else to pass the test. |
| 248 | * \endcode |
| 249 | */ |
| 250 | class EnumerationVerifier : noncopyable |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 251 | { |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 252 | public: |
| 253 | template<typename Enumerable> |
| 254 | EnumerationVerifier(Enumerable&& enumerable) |
| 255 | { |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 256 | for (const Entry& entry : enumerable) { |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 257 | const Name& name = entry.getPrefix(); |
| 258 | BOOST_CHECK_MESSAGE(m_names.insert(name).second, "duplicate Name " << name); |
| 259 | } |
| 260 | } |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 261 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 262 | EnumerationVerifier& |
| 263 | expect(const Name& name) |
| 264 | { |
| 265 | BOOST_CHECK_MESSAGE(m_names.erase(name) == 1, "missing Name " << name); |
| 266 | return *this; |
| 267 | } |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 268 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 269 | void |
| 270 | end() |
| 271 | { |
Alexander Afanasyev | e84044e | 2015-02-26 21:52:18 -0800 | [diff] [blame] | 272 | BOOST_CHECK(m_names.empty()); |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 273 | } |
| 274 | |
| 275 | private: |
| 276 | std::unordered_set<Name> m_names; |
| 277 | }; |
| 278 | |
| 279 | class EnumerationFixture : public BaseFixture |
| 280 | { |
| 281 | protected: |
| 282 | EnumerationFixture() |
| 283 | : nt(N_BUCKETS) |
| 284 | { |
| 285 | BOOST_CHECK_EQUAL(nt.size(), 0); |
| 286 | BOOST_CHECK_EQUAL(nt.getNBuckets(), N_BUCKETS); |
| 287 | } |
| 288 | |
| 289 | void |
| 290 | insertAbAc() |
| 291 | { |
| 292 | nt.lookup("/a/b"); |
| 293 | nt.lookup("/a/c"); |
| 294 | BOOST_CHECK_EQUAL(nt.size(), 4); |
| 295 | // /, /a, /a/b, /a/c |
| 296 | } |
| 297 | |
| 298 | void |
| 299 | insertAb1Ab2Ac1Ac2() |
| 300 | { |
| 301 | nt.lookup("/a/b/1"); |
| 302 | nt.lookup("/a/b/2"); |
| 303 | nt.lookup("/a/c/1"); |
| 304 | nt.lookup("/a/c/2"); |
| 305 | BOOST_CHECK_EQUAL(nt.size(), 8); |
| 306 | // /, /a, /a/b, /a/b/1, /a/b/2, /a/c, /a/c/1, /a/c/2 |
| 307 | } |
| 308 | |
| 309 | protected: |
| 310 | static const size_t N_BUCKETS = 16; |
| 311 | NameTree nt; |
| 312 | }; |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 313 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 314 | const size_t EnumerationFixture::N_BUCKETS; |
| 315 | |
| 316 | BOOST_FIXTURE_TEST_CASE(IteratorFullEnumerate, EnumerationFixture) |
| 317 | { |
| 318 | nt.lookup("/a/b/c"); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 319 | BOOST_CHECK_EQUAL(nt.size(), 4); |
| 320 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 321 | nt.lookup("/a/b/d"); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 322 | BOOST_CHECK_EQUAL(nt.size(), 5); |
| 323 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 324 | nt.lookup("/a/e"); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 325 | BOOST_CHECK_EQUAL(nt.size(), 6); |
| 326 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 327 | nt.lookup("/f"); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 328 | BOOST_CHECK_EQUAL(nt.size(), 7); |
| 329 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 330 | nt.lookup("/"); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 331 | BOOST_CHECK_EQUAL(nt.size(), 7); |
| 332 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 333 | auto&& enumerable = nt.fullEnumerate(); |
| 334 | EnumerationVerifier(enumerable) |
| 335 | .expect("/") |
| 336 | .expect("/a") |
| 337 | .expect("/a/b") |
| 338 | .expect("/a/b/c") |
| 339 | .expect("/a/b/d") |
| 340 | .expect("/a/e") |
| 341 | .expect("/f") |
| 342 | .end(); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 343 | } |
| 344 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 345 | BOOST_FIXTURE_TEST_SUITE(IteratorPartialEnumerate, EnumerationFixture) |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 346 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 347 | BOOST_AUTO_TEST_CASE(Empty) |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 348 | { |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 349 | auto&& enumerable = nt.partialEnumerate("/a"); |
| 350 | |
| 351 | EnumerationVerifier(enumerable) |
| 352 | .end(); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 353 | } |
| 354 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 355 | BOOST_AUTO_TEST_CASE(NotIn) |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 356 | { |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 357 | this->insertAbAc(); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 358 | |
| 359 | // Enumerate on some name that is not in nameTree |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 360 | Name name0("/0"); |
| 361 | auto&& enumerable = nt.partialEnumerate("/0"); |
| 362 | |
| 363 | EnumerationVerifier(enumerable) |
| 364 | .end(); |
| 365 | } |
| 366 | |
| 367 | BOOST_AUTO_TEST_CASE(OnlyA) |
| 368 | { |
| 369 | this->insertAbAc(); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 370 | |
| 371 | // Accept "root" nameA only |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 372 | auto&& enumerable = nt.partialEnumerate("/a", [] (const Entry& entry) { |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 373 | return std::make_pair(entry.getPrefix() == "/a", true); |
| 374 | }); |
| 375 | |
| 376 | EnumerationVerifier(enumerable) |
| 377 | .expect("/a") |
| 378 | .end(); |
| 379 | } |
| 380 | |
| 381 | BOOST_AUTO_TEST_CASE(ExceptA) |
| 382 | { |
| 383 | this->insertAbAc(); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 384 | |
| 385 | // Accept anything except "root" nameA |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 386 | auto&& enumerable = nt.partialEnumerate("/a", [] (const Entry& entry) { |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 387 | return std::make_pair(entry.getPrefix() != "/a", true); |
| 388 | }); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 389 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 390 | EnumerationVerifier(enumerable) |
| 391 | .expect("/a/b") |
| 392 | .expect("/a/c") |
| 393 | .end(); |
| 394 | } |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 395 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 396 | BOOST_AUTO_TEST_CASE(NoNameANoSubTreeAB) |
| 397 | { |
| 398 | this->insertAb1Ab2Ac1Ac2(); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 399 | |
| 400 | // No NameA |
| 401 | // No SubTree from NameAB |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 402 | auto&& enumerable = nt.partialEnumerate("/a", [] (const Entry& entry) { |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 403 | return std::make_pair(entry.getPrefix() != "/a", entry.getPrefix() != "/a/b"); |
| 404 | }); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 405 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 406 | EnumerationVerifier(enumerable) |
| 407 | .expect("/a/b") |
| 408 | .expect("/a/c") |
| 409 | .expect("/a/c/1") |
| 410 | .expect("/a/c/2") |
| 411 | .end(); |
| 412 | } |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 413 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 414 | BOOST_AUTO_TEST_CASE(NoNameANoSubTreeAC) |
| 415 | { |
| 416 | this->insertAb1Ab2Ac1Ac2(); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 417 | |
| 418 | // No NameA |
| 419 | // No SubTree from NameAC |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 420 | auto&& enumerable = nt.partialEnumerate("/a", [] (const Entry& entry) { |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 421 | return std::make_pair(entry.getPrefix() != "/a", entry.getPrefix() != "/a/c"); |
| 422 | }); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 423 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 424 | EnumerationVerifier(enumerable) |
| 425 | .expect("/a/b") |
| 426 | .expect("/a/b/1") |
| 427 | .expect("/a/b/2") |
| 428 | .expect("/a/c") |
| 429 | .end(); |
| 430 | } |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 431 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 432 | BOOST_AUTO_TEST_CASE(NoSubTreeA) |
| 433 | { |
| 434 | this->insertAb1Ab2Ac1Ac2(); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 435 | |
| 436 | // No Subtree from NameA |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 437 | auto&& enumerable = nt.partialEnumerate("/a", [] (const Entry& entry) { |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 438 | return std::make_pair(true, entry.getPrefix() != "/a"); |
| 439 | }); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 440 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 441 | EnumerationVerifier(enumerable) |
| 442 | .expect("/a") |
| 443 | .end(); |
| 444 | } |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 445 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 446 | BOOST_AUTO_TEST_CASE(Example) |
| 447 | { |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 448 | // Example |
| 449 | // / |
| 450 | // /A |
| 451 | // /A/B x |
| 452 | // /A/B/C |
| 453 | // /A/D x |
| 454 | // /E |
| 455 | // /F |
| 456 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 457 | nt.lookup("/A"); |
| 458 | nt.lookup("/A/B"); |
| 459 | nt.lookup("/A/B/C"); |
| 460 | nt.lookup("/A/D"); |
| 461 | nt.lookup("/E"); |
| 462 | nt.lookup("/F"); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 463 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 464 | auto&& enumerable = nt.partialEnumerate("/A", |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 465 | [] (const Entry& entry) -> std::pair<bool, bool> { |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 466 | bool visitEntry = false; |
| 467 | bool visitChildren = false; |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 468 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 469 | Name name = entry.getPrefix(); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 470 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 471 | if (name == "/" || name == "/A/B" || name == "/A/B/C" || name == "/A/D") { |
| 472 | visitEntry = true; |
| 473 | } |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 474 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 475 | if (name == "/" || name == "/A" || name == "/F") { |
| 476 | visitChildren = true; |
| 477 | } |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 478 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 479 | return {visitEntry, visitChildren}; |
| 480 | }); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 481 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 482 | EnumerationVerifier(enumerable) |
| 483 | .expect("/A/B") |
| 484 | .expect("/A/D") |
| 485 | .end(); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 486 | } |
| 487 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 488 | BOOST_AUTO_TEST_SUITE_END() |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 489 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 490 | BOOST_FIXTURE_TEST_CASE(IteratorFindAllMatches, EnumerationFixture) |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 491 | { |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 492 | nt.lookup("/a/b/c/d/e/f"); |
| 493 | nt.lookup("/a/a/c"); |
| 494 | nt.lookup("/a/a/d/1"); |
| 495 | nt.lookup("/a/a/d/2"); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 496 | BOOST_CHECK_EQUAL(nt.size(), 12); |
| 497 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 498 | auto&& allMatches = nt.findAllMatches("/a/b/c/d/e"); |
Haowei Yuan | e1079fc | 2014-03-08 14:41:25 -0600 | [diff] [blame] | 499 | |
Junxiao Shi | 60607c7 | 2014-11-26 22:40:36 -0700 | [diff] [blame] | 500 | EnumerationVerifier(allMatches) |
| 501 | .expect("/") |
| 502 | .expect("/a") |
| 503 | .expect("/a/b") |
| 504 | .expect("/a/b/c") |
| 505 | .expect("/a/b/c/d") |
| 506 | .expect("/a/b/c/d/e") |
| 507 | .end(); |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 508 | } |
| 509 | |
Alexander Afanasyev | b303324 | 2014-08-04 11:09:05 -0700 | [diff] [blame] | 510 | BOOST_AUTO_TEST_CASE(HashTableResizeShrink) |
Haowei Yuan | f52dac7 | 2014-03-24 23:35:03 -0500 | [diff] [blame] | 511 | { |
| 512 | size_t nBuckets = 16; |
| 513 | NameTree nameTree(nBuckets); |
| 514 | |
| 515 | Name prefix("/a/b/c/d/e/f/g/h"); // requires 9 buckets |
| 516 | |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 517 | shared_ptr<Entry> entry = nameTree.lookup(prefix); |
Haowei Yuan | f52dac7 | 2014-03-24 23:35:03 -0500 | [diff] [blame] | 518 | BOOST_CHECK_EQUAL(nameTree.size(), 9); |
| 519 | BOOST_CHECK_EQUAL(nameTree.getNBuckets(), 32); |
| 520 | |
| 521 | nameTree.eraseEntryIfEmpty(entry); |
| 522 | BOOST_CHECK_EQUAL(nameTree.size(), 0); |
| 523 | BOOST_CHECK_EQUAL(nameTree.getNBuckets(), 16); |
| 524 | } |
| 525 | |
Alexander Afanasyev | b303324 | 2014-08-04 11:09:05 -0700 | [diff] [blame] | 526 | // .lookup should not invalidate iterator |
| 527 | BOOST_AUTO_TEST_CASE(SurvivedIteratorAfterLookup) |
| 528 | { |
| 529 | NameTree nt; |
| 530 | nt.lookup("/A/B/C"); |
| 531 | nt.lookup("/E"); |
| 532 | |
| 533 | Name nameB("/A/B"); |
| 534 | std::set<Name> seenNames; |
| 535 | for (NameTree::const_iterator it = nt.begin(); it != nt.end(); ++it) { |
| 536 | BOOST_CHECK(seenNames.insert(it->getPrefix()).second); |
| 537 | if (it->getPrefix() == nameB) { |
| 538 | nt.lookup("/D"); |
| 539 | } |
| 540 | } |
| 541 | |
| 542 | BOOST_CHECK_EQUAL(seenNames.count("/"), 1); |
| 543 | BOOST_CHECK_EQUAL(seenNames.count("/A"), 1); |
| 544 | BOOST_CHECK_EQUAL(seenNames.count("/A/B"), 1); |
| 545 | BOOST_CHECK_EQUAL(seenNames.count("/A/B/C"), 1); |
| 546 | BOOST_CHECK_EQUAL(seenNames.count("/E"), 1); |
| 547 | |
| 548 | seenNames.erase("/D"); // /D may or may not appear |
| 549 | BOOST_CHECK(seenNames.size() == 5); |
| 550 | } |
| 551 | |
| 552 | // .eraseEntryIfEmpty should not invalidate iterator |
| 553 | BOOST_AUTO_TEST_CASE(SurvivedIteratorAfterErase) |
| 554 | { |
| 555 | NameTree nt; |
| 556 | nt.lookup("/A/B/C"); |
| 557 | nt.lookup("/A/D/E"); |
| 558 | nt.lookup("/A/F/G"); |
| 559 | nt.lookup("/H"); |
| 560 | |
| 561 | Name nameD("/A/D"); |
| 562 | std::set<Name> seenNames; |
| 563 | for (NameTree::const_iterator it = nt.begin(); it != nt.end(); ++it) { |
| 564 | BOOST_CHECK(seenNames.insert(it->getPrefix()).second); |
| 565 | if (it->getPrefix() == nameD) { |
| 566 | nt.eraseEntryIfEmpty(nt.findExactMatch("/A/F/G")); // /A/F/G and /A/F are erased |
| 567 | } |
| 568 | } |
| 569 | |
| 570 | BOOST_CHECK_EQUAL(seenNames.count("/"), 1); |
| 571 | BOOST_CHECK_EQUAL(seenNames.count("/A"), 1); |
| 572 | BOOST_CHECK_EQUAL(seenNames.count("/A/B"), 1); |
| 573 | BOOST_CHECK_EQUAL(seenNames.count("/A/B/C"), 1); |
| 574 | BOOST_CHECK_EQUAL(seenNames.count("/A/D"), 1); |
| 575 | BOOST_CHECK_EQUAL(seenNames.count("/A/D/E"), 1); |
| 576 | BOOST_CHECK_EQUAL(seenNames.count("/H"), 1); |
| 577 | |
| 578 | seenNames.erase("/A/F"); // /A/F may or may not appear |
| 579 | seenNames.erase("/A/F/G"); // /A/F/G may or may not appear |
| 580 | BOOST_CHECK(seenNames.size() == 7); |
| 581 | } |
| 582 | |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 583 | BOOST_AUTO_TEST_SUITE_END() // TestNameTree |
| 584 | BOOST_AUTO_TEST_SUITE_END() // Table |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 585 | |
Junxiao Shi | d9ee45c | 2014-02-27 15:38:11 -0700 | [diff] [blame] | 586 | } // namespace tests |
Junxiao Shi | 2570f3e | 2016-07-27 02:48:29 +0000 | [diff] [blame^] | 587 | } // namespace name_tree |
HYuan | a9b8575 | 2014-02-26 02:32:30 -0600 | [diff] [blame] | 588 | } // namespace nfd |