table: mock Measurements table
refs #1259, #1197
Change-Id: Ie7cd2ff6fbbb413a77539eb9f1c5354405252cec
diff --git a/tests/table/measurements.cpp b/tests/table/measurements.cpp
new file mode 100644
index 0000000..09874a0
--- /dev/null
+++ b/tests/table/measurements.cpp
@@ -0,0 +1,41 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "table/measurements.hpp"
+
+#include <boost/test/unit_test.hpp>
+
+namespace nfd {
+
+BOOST_AUTO_TEST_SUITE(TableMeasurements)
+
+BOOST_AUTO_TEST_CASE(Get_Parent)
+{
+ Name name0;
+ Name nameA ("ndn:/A");
+ Name nameAB("ndn:/A/B");
+
+ boost::asio::io_service ioService;
+ Measurements measurements(ioService);
+
+ shared_ptr<measurements::Entry> entryAB = measurements.get(nameAB);
+ BOOST_REQUIRE(static_cast<bool>(entryAB));
+ BOOST_CHECK_EQUAL(entryAB->getName(), nameAB);
+
+ shared_ptr<measurements::Entry> entry0 = measurements.get(name0);
+ BOOST_REQUIRE(static_cast<bool>(entry0));
+
+ shared_ptr<measurements::Entry> entryA = measurements.getParent(entryAB);
+ BOOST_REQUIRE(static_cast<bool>(entryA));
+ BOOST_CHECK_EQUAL(entryA->getName(), nameA);
+
+ shared_ptr<measurements::Entry> entry0c = measurements.getParent(entryA);
+ BOOST_CHECK_EQUAL(entry0, entry0c);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace nfd