blob: 4643fb820d641339f5caddaccfc3d97f30bf3b8a [file] [log] [blame]
Junxiao Shi65d00722014-02-17 10:50:20 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (C) 2014 Named Data Networking Project
4 * See COPYING for copyright and distribution information.
5 */
6
7#include "table/measurements.hpp"
8
9#include <boost/test/unit_test.hpp>
10
11namespace nfd {
12
13BOOST_AUTO_TEST_SUITE(TableMeasurements)
14
15BOOST_AUTO_TEST_CASE(Get_Parent)
16{
Junxiao Shic041ca32014-02-25 20:01:15 -070017 resetGlobalIoService();
18 Measurements measurements;
19
Junxiao Shi65d00722014-02-17 10:50:20 -070020 Name name0;
21 Name nameA ("ndn:/A");
22 Name nameAB("ndn:/A/B");
23
Junxiao Shi65d00722014-02-17 10:50:20 -070024 shared_ptr<measurements::Entry> entryAB = measurements.get(nameAB);
25 BOOST_REQUIRE(static_cast<bool>(entryAB));
26 BOOST_CHECK_EQUAL(entryAB->getName(), nameAB);
27
28 shared_ptr<measurements::Entry> entry0 = measurements.get(name0);
29 BOOST_REQUIRE(static_cast<bool>(entry0));
30
31 shared_ptr<measurements::Entry> entryA = measurements.getParent(entryAB);
32 BOOST_REQUIRE(static_cast<bool>(entryA));
33 BOOST_CHECK_EQUAL(entryA->getName(), nameA);
34
35 shared_ptr<measurements::Entry> entry0c = measurements.getParent(entryA);
36 BOOST_CHECK_EQUAL(entry0, entry0c);
37}
38
39BOOST_AUTO_TEST_SUITE_END()
40
41} // namespace nfd