blob: 861ca97b61a1930163189af1608786305722bbcc [file] [log] [blame]
Steve DiBenedetto5b433982014-01-29 17:14:27 -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 "mgmt/internal-face.hpp"
Steve DiBenedetto042bfe92014-01-30 15:05:08 -07008#include "mgmt/fib-manager.hpp"
9#include "table/fib.hpp"
10
Steve DiBenedetto5b433982014-01-29 17:14:27 -070011
12#include <boost/test/unit_test.hpp>
13
14namespace nfd {
15
16BOOST_AUTO_TEST_SUITE(MgmtInternalFace)
17
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070018shared_ptr<Face>
19getFace(FaceId id)
20{
21 return shared_ptr<Face>();
22}
23
Steve DiBenedetto5b433982014-01-29 17:14:27 -070024BOOST_AUTO_TEST_CASE(ValidPrefixRegistration)
25{
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070026 Fib fib;
27 FibManager manager(fib, &getFace);
28 InternalFace internal(manager);
29
30 Name regName(manager.getRequestPrefix());
31 regName.append("hello").append("world");
32 Interest regInterest(regName);
Steve DiBenedetto5b433982014-01-29 17:14:27 -070033 internal.sendInterest(regInterest);
34}
35
36BOOST_AUTO_TEST_CASE(InvalidPrefixRegistration)
37{
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070038 Fib fib;
39 FibManager manager(fib, &getFace);
40 InternalFace internal(manager);
Steve DiBenedetto5b433982014-01-29 17:14:27 -070041 Interest nonRegInterest("/hello/world");
42 internal.sendInterest(nonRegInterest);
43}
44
45BOOST_AUTO_TEST_SUITE_END()
46
47} // namespace nfd