blob: 69e2506a88dab42061d500c1da25a4c763a01c54 [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
Junxiao Shid9ee45c2014-02-27 15:38:11 -07009#include "tests/test-common.hpp"
Junxiao Shi65d00722014-02-17 10:50:20 -070010
11namespace nfd {
Junxiao Shid9ee45c2014-02-27 15:38:11 -070012namespace tests {
Junxiao Shi65d00722014-02-17 10:50:20 -070013
Junxiao Shid9ee45c2014-02-27 15:38:11 -070014BOOST_FIXTURE_TEST_SUITE(TableMeasurements, BaseFixture)
Junxiao Shi65d00722014-02-17 10:50:20 -070015
16BOOST_AUTO_TEST_CASE(Get_Parent)
17{
Junxiao Shic041ca32014-02-25 20:01:15 -070018 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
Junxiao Shid9ee45c2014-02-27 15:38:11 -070041} // namespace tests
Junxiao Shi65d00722014-02-17 10:50:20 -070042} // namespace nfd