table: advisory limit of NameTree depth
refs #4262
Change-Id: I691f9615e2b8a3b146a683919c6d5833f53f6122
diff --git a/tests/daemon/table/name-tree.t.cpp b/tests/daemon/table/name-tree.t.cpp
index 127056d..8b7307a 100644
--- a/tests/daemon/table/name-tree.t.cpp
+++ b/tests/daemon/table/name-tree.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -47,6 +47,9 @@
prefix.wireEncode();
HashSequence hashes = computeHashes(prefix);
BOOST_CHECK_EQUAL(hashes.size(), prefix.size() + 1);
+
+ hashes = computeHashes(prefix, 2);
+ BOOST_CHECK_EQUAL(hashes.size(), 3);
}
BOOST_AUTO_TEST_SUITE(Hashtable)
@@ -298,7 +301,7 @@
// lookup
- Name nameABC("ndn:/a/b/c");
+ Name nameABC("/a/b/c");
Entry& npeABC = nt.lookup(nameABC);
BOOST_CHECK_EQUAL(nt.size(), 4);
@@ -414,6 +417,20 @@
BOOST_CHECK_EQUAL(nt.size(), 8);
}
+BOOST_AUTO_TEST_CASE(LongName)
+{
+ Name name;
+ for (int i = 0; i < 2000; ++i) {
+ name.append("X");
+ }
+
+ NameTree nt;
+
+ Entry& entry1 = nt.lookup(name, true);
+ BOOST_CHECK_EQUAL(entry1.getName().size(), NameTree::getMaxDepth());
+ BOOST_CHECK_EQUAL(nt.size(), NameTree::getMaxDepth() + 1);
+}
+
/** \brief verify a NameTree enumeration contains expected entries
*
* Example: