Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 1 | /* -*- 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 DiBenedetto | 042bfe9 | 2014-01-30 15:05:08 -0700 | [diff] [blame^] | 8 | #include "mgmt/fib-manager.hpp" |
| 9 | #include "table/fib.hpp" |
| 10 | |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 11 | |
| 12 | #include <boost/test/unit_test.hpp> |
| 13 | |
| 14 | namespace nfd { |
| 15 | |
| 16 | BOOST_AUTO_TEST_SUITE(MgmtInternalFace) |
| 17 | |
Steve DiBenedetto | 042bfe9 | 2014-01-30 15:05:08 -0700 | [diff] [blame^] | 18 | shared_ptr<Face> |
| 19 | getFace(FaceId id) |
| 20 | { |
| 21 | return shared_ptr<Face>(); |
| 22 | } |
| 23 | |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 24 | BOOST_AUTO_TEST_CASE(ValidPrefixRegistration) |
| 25 | { |
Steve DiBenedetto | 042bfe9 | 2014-01-30 15:05:08 -0700 | [diff] [blame^] | 26 | 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 DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 33 | internal.sendInterest(regInterest); |
| 34 | } |
| 35 | |
| 36 | BOOST_AUTO_TEST_CASE(InvalidPrefixRegistration) |
| 37 | { |
Steve DiBenedetto | 042bfe9 | 2014-01-30 15:05:08 -0700 | [diff] [blame^] | 38 | Fib fib; |
| 39 | FibManager manager(fib, &getFace); |
| 40 | InternalFace internal(manager); |
Steve DiBenedetto | 5b43398 | 2014-01-29 17:14:27 -0700 | [diff] [blame] | 41 | Interest nonRegInterest("/hello/world"); |
| 42 | internal.sendInterest(nonRegInterest); |
| 43 | } |
| 44 | |
| 45 | BOOST_AUTO_TEST_SUITE_END() |
| 46 | |
| 47 | } // namespace nfd |