tests: revamp Face integrated tests

* Categorize tests into consumer, producer, IO routines.
* Split expressInterest tests.
* Add route toward null face when Interest timeout is expected.
* Merge similar setInterestFilter tests.
* Add test for oversized Data.
* Move InterestFilter-convert-to-Name test into unit tests.

refs #4031

Change-Id: I3356ae7fc9eec942ec7f2fb8b2277fa039464750
diff --git a/tests/unit-tests/ims/in-memory-storage-fifo.t.cpp b/tests/unit-tests/ims/in-memory-storage-fifo.t.cpp
index 7455ec0..a873de1 100644
--- a/tests/unit-tests/ims/in-memory-storage-fifo.t.cpp
+++ b/tests/unit-tests/ims/in-memory-storage-fifo.t.cpp
@@ -22,7 +22,7 @@
 #include "ims/in-memory-storage-fifo.hpp"
 
 #include "boost-test.hpp"
-#include "../make-interest-data.hpp"
+#include "make-interest-data.hpp"
 
 namespace ndn {
 namespace tests {
diff --git a/tests/unit-tests/ims/in-memory-storage-lfu.t.cpp b/tests/unit-tests/ims/in-memory-storage-lfu.t.cpp
index b3462de..1fa8b83 100644
--- a/tests/unit-tests/ims/in-memory-storage-lfu.t.cpp
+++ b/tests/unit-tests/ims/in-memory-storage-lfu.t.cpp
@@ -22,7 +22,7 @@
 #include "ims/in-memory-storage-lfu.hpp"
 
 #include "boost-test.hpp"
-#include "../make-interest-data.hpp"
+#include "make-interest-data.hpp"
 
 namespace ndn {
 namespace tests {
diff --git a/tests/unit-tests/ims/in-memory-storage-lru.t.cpp b/tests/unit-tests/ims/in-memory-storage-lru.t.cpp
index f371f9b..80c59d5 100644
--- a/tests/unit-tests/ims/in-memory-storage-lru.t.cpp
+++ b/tests/unit-tests/ims/in-memory-storage-lru.t.cpp
@@ -22,7 +22,7 @@
 #include "ims/in-memory-storage-lru.hpp"
 
 #include "boost-test.hpp"
-#include "../make-interest-data.hpp"
+#include "make-interest-data.hpp"
 
 namespace ndn {
 namespace tests {
diff --git a/tests/unit-tests/ims/in-memory-storage-persistent.t.cpp b/tests/unit-tests/ims/in-memory-storage-persistent.t.cpp
index 69c0d7e..9be6430 100644
--- a/tests/unit-tests/ims/in-memory-storage-persistent.t.cpp
+++ b/tests/unit-tests/ims/in-memory-storage-persistent.t.cpp
@@ -22,7 +22,7 @@
 #include "ims/in-memory-storage-persistent.hpp"
 
 #include "boost-test.hpp"
-#include "../make-interest-data.hpp"
+#include "make-interest-data.hpp"
 
 namespace ndn {
 namespace tests {
diff --git a/tests/unit-tests/ims/in-memory-storage.t.cpp b/tests/unit-tests/ims/in-memory-storage.t.cpp
index 3689c53..67d87f2 100644
--- a/tests/unit-tests/ims/in-memory-storage.t.cpp
+++ b/tests/unit-tests/ims/in-memory-storage.t.cpp
@@ -28,7 +28,7 @@
 #include "util/sha256.hpp"
 
 #include "boost-test.hpp"
-#include "../make-interest-data.hpp"
+#include "make-interest-data.hpp"
 #include "../unit-test-time-fixture.hpp"
 
 #include <boost/mpl/list.hpp>
diff --git a/tests/unit-tests/interest-filter.t.cpp b/tests/unit-tests/interest-filter.t.cpp
index e39f8dd..26be797 100644
--- a/tests/unit-tests/interest-filter.t.cpp
+++ b/tests/unit-tests/interest-filter.t.cpp
@@ -21,12 +21,12 @@
 
 #include "interest-filter.hpp"
 #include "data.hpp"
+#include "encoding/buffer-stream.hpp"
 #include "security/signature-sha256-with-rsa.hpp"
 #include "security/digest-sha256.hpp"
-#include "encoding/buffer-stream.hpp"
+#include "util/dummy-client-face.hpp"
 
 #include "boost-test.hpp"
-#include "identity-management-fixture.hpp"
 
 namespace ndn {
 namespace tests {
@@ -52,6 +52,15 @@
   BOOST_CHECK_EQUAL(InterestFilter("/a", "<b><>+").doesMatch("/a/b/c"), true);
 }
 
+BOOST_AUTO_TEST_CASE(RegexConvertToName)
+{
+  util::DummyClientFace face;
+  face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
+    [] (const Name&, const Interest&) { BOOST_ERROR("unexpected Interest"); });
+  face.processEvents(time::milliseconds(1));
+  BOOST_CHECK_THROW(face.receive(Interest("/Hello/World/a/b/c")), InterestFilter::Error);
+}
+
 BOOST_AUTO_TEST_SUITE_END() // TestInterestFilter
 
 } // namespace tests
diff --git a/tests/unit-tests/make-interest-data.cpp b/tests/unit-tests/make-interest-data.cpp
deleted file mode 100644
index a497da2..0000000
--- a/tests/unit-tests/make-interest-data.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2013-2017 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#include "make-interest-data.hpp"
-#include "security/signature-sha256-with-rsa.hpp"
-
-namespace ndn {
-namespace tests {
-
-shared_ptr<Interest>
-makeInterest(const Name& name, uint32_t nonce)
-{
-  auto interest = make_shared<Interest>(name);
-  if (nonce != 0) {
-    interest->setNonce(nonce);
-  }
-  return interest;
-}
-
-shared_ptr<Data>
-makeData(const Name& name)
-{
-  auto data = make_shared<Data>(name);
-  return signData(data);
-}
-
-Data&
-signData(Data& data)
-{
-  ndn::SignatureSha256WithRsa fakeSignature;
-  fakeSignature.setValue(ndn::encoding::makeEmptyBlock(tlv::SignatureValue));
-  data.setSignature(fakeSignature);
-  data.wireEncode();
-  return data;
-}
-
-lp::Nack
-makeNack(const Interest& interest, lp::NackReason reason)
-{
-  lp::Nack nack(interest);
-  nack.setReason(reason);
-  return nack;
-}
-
-lp::Nack
-makeNack(const Name& name, uint32_t nonce, lp::NackReason reason)
-{
-  Interest interest(name);
-  interest.setNonce(nonce);
-  return makeNack(interest, reason);
-}
-
-} // namespace tests
-} // namespace ndn
diff --git a/tests/unit-tests/make-interest-data.hpp b/tests/unit-tests/make-interest-data.hpp
deleted file mode 100644
index eb208d1..0000000
--- a/tests/unit-tests/make-interest-data.hpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2013-2017 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#ifndef NDN_TESTS_UNIT_TESTS_MAKE_INTEREST_DATA_HPP
-#define NDN_TESTS_UNIT_TESTS_MAKE_INTEREST_DATA_HPP
-
-#include "interest.hpp"
-#include "data.hpp"
-#include "link.hpp"
-#include "lp/nack.hpp"
-
-namespace ndn {
-namespace tests {
-
-/** \brief create an Interest
- *  \param name Interest name
- *  \param nonce if non-zero, set Nonce to this value
- *               (useful for creating Nack with same Nonce)
- */
-shared_ptr<Interest>
-makeInterest(const Name& name, uint32_t nonce = 0);
-
-/** \brief create a Data with fake signature
- *  \note Data may be modified afterwards without losing the fake signature.
- *        If a real signature is desired, sign again with KeyChain.
- */
-shared_ptr<Data>
-makeData(const Name& name);
-
-/** \brief add a fake signature to Data
- */
-Data&
-signData(Data& data);
-
-/** \brief add a fake signature to Data
- */
-inline shared_ptr<Data>
-signData(shared_ptr<Data> data)
-{
-  signData(*data);
-  return data;
-}
-
-/** \brief create a Nack
- *  \param interest Interest
- *  \param reason Nack reason
- */
-lp::Nack
-makeNack(const Interest& interest, lp::NackReason reason);
-
-/** \brief create a Nack
- *  \param name Interest name
- *  \param nonce Interest nonce
- *  \param reason Nack reason
- */
-lp::Nack
-makeNack(const Name& name, uint32_t nonce, lp::NackReason reason);
-
-/** \brief replace a name component
- *  \param[inout] name name
- *  \param index name component index
- *  \param a arguments to name::Component constructor
- */
-template<typename...A>
-void
-setNameComponent(Name& name, ssize_t index, const A& ...a)
-{
-  Name name2 = name.getPrefix(index);
-  name2.append(name::Component(a...));
-  name2.append(name.getSubName(name2.size()));
-  name = name2;
-}
-
-template<typename PKT, typename...A>
-void
-setNameComponent(PKT& pkt, ssize_t index, const A& ...a)
-{
-  Name name = pkt.getName();
-  setNameComponent(name, index, a...);
-  pkt.setName(name);
-}
-
-} // namespace tests
-} // namespace ndn
-
-#endif // NDN_TESTS_UNIT_TESTS_MAKE_INTEREST_DATA_HPP
diff --git a/tests/unit-tests/mgmt/dispatcher.t.cpp b/tests/unit-tests/mgmt/dispatcher.t.cpp
index 536616c..b9577cb 100644
--- a/tests/unit-tests/mgmt/dispatcher.t.cpp
+++ b/tests/unit-tests/mgmt/dispatcher.t.cpp
@@ -24,9 +24,8 @@
 #include "util/dummy-client-face.hpp"
 
 #include "boost-test.hpp"
-#include "identity-management-fixture.hpp"
+#include "make-interest-data.hpp"
 #include "../identity-management-time-fixture.hpp"
-#include "../make-interest-data.hpp"
 
 namespace ndn {
 namespace mgmt {
diff --git a/tests/unit-tests/mgmt/nfd/controller.t.cpp b/tests/unit-tests/mgmt/nfd/controller.t.cpp
index 423499a..92fcedd 100644
--- a/tests/unit-tests/mgmt/nfd/controller.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/controller.t.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
@@ -22,10 +22,8 @@
 #include "mgmt/nfd/controller.hpp"
 #include "mgmt/nfd/control-response.hpp"
 
-#include <boost/tuple/tuple.hpp>
-
 #include "controller-fixture.hpp"
-#include "../../make-interest-data.hpp"
+#include "make-interest-data.hpp"
 
 namespace ndn {
 namespace nfd {
diff --git a/tests/unit-tests/mgmt/nfd/status-dataset.t.cpp b/tests/unit-tests/mgmt/nfd/status-dataset.t.cpp
index aadb2c4..13cd203 100644
--- a/tests/unit-tests/mgmt/nfd/status-dataset.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/status-dataset.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -23,7 +23,7 @@
 #include "mgmt/nfd/controller.hpp"
 
 #include "controller-fixture.hpp"
-#include "../../make-interest-data.hpp"
+#include "make-interest-data.hpp"
 
 namespace ndn {
 namespace nfd {
diff --git a/tests/unit-tests/mgmt/status-dataset-context.t.cpp b/tests/unit-tests/mgmt/status-dataset-context.t.cpp
index cff721b..be7b198 100644
--- a/tests/unit-tests/mgmt/status-dataset-context.t.cpp
+++ b/tests/unit-tests/mgmt/status-dataset-context.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -22,7 +22,7 @@
 #include "mgmt/status-dataset-context.hpp"
 
 #include "boost-test.hpp"
-#include "unit-tests/make-interest-data.hpp"
+#include "make-interest-data.hpp"
 
 namespace ndn {
 namespace mgmt {
diff --git a/tests/unit-tests/security/v2/validation-policy-command-interest.t.cpp b/tests/unit-tests/security/v2/validation-policy-command-interest.t.cpp
index 293bf26..887214a 100644
--- a/tests/unit-tests/security/v2/validation-policy-command-interest.t.cpp
+++ b/tests/unit-tests/security/v2/validation-policy-command-interest.t.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
@@ -27,7 +27,7 @@
 
 #include "boost-test.hpp"
 #include "validator-fixture.hpp"
-#include "unit-tests/make-interest-data.hpp"
+#include "make-interest-data.hpp"
 
 #include <boost/lexical_cast.hpp>
 #include <boost/mpl/vector.hpp>
diff --git a/tests/unit-tests/security/validator-config.t.cpp b/tests/unit-tests/security/validator-config.t.cpp
index 74c29ae..e2fbda1 100644
--- a/tests/unit-tests/security/validator-config.t.cpp
+++ b/tests/unit-tests/security/validator-config.t.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
@@ -20,21 +20,18 @@
  */
 
 #include "security/validator-config.hpp"
-
 #include "security/signing-helpers.hpp"
+#include "util/dummy-client-face.hpp"
 #include "util/io.hpp"
 #include "util/scheduler.hpp"
-#include "util/dummy-client-face.hpp"
-#include "lp/tags.hpp"
 #include "lp/nack.hpp"
+#include "lp/tags.hpp"
 
-#include <boost/asio.hpp>
-#include <boost/logic/tribool.hpp>
-
-#include "identity-management-fixture.hpp"
-#include "../identity-management-time-fixture.hpp"
-#include "../make-interest-data.hpp"
 #include "boost-test.hpp"
+#include "make-interest-data.hpp"
+#include "../identity-management-time-fixture.hpp"
+
+#include <boost/logic/tribool.hpp>
 
 namespace ndn {
 namespace security {
diff --git a/tests/unit-tests/security/validator-null.t.cpp b/tests/unit-tests/security/validator-null.t.cpp
index b4f4102..07c317f 100644
--- a/tests/unit-tests/security/validator-null.t.cpp
+++ b/tests/unit-tests/security/validator-null.t.cpp
@@ -23,7 +23,7 @@
 
 #include "boost-test.hpp"
 #include "identity-management-fixture.hpp"
-#include "../make-interest-data.hpp"
+#include "make-interest-data.hpp"
 
 namespace ndn {
 namespace security {
diff --git a/tests/unit-tests/security/validator.t.cpp b/tests/unit-tests/security/validator.t.cpp
index 6f22c5a..7550eb3 100644
--- a/tests/unit-tests/security/validator.t.cpp
+++ b/tests/unit-tests/security/validator.t.cpp
@@ -23,7 +23,7 @@
 
 #include "boost-test.hpp"
 #include "identity-management-fixture.hpp"
-#include "../make-interest-data.hpp"
+#include "make-interest-data.hpp"
 
 namespace ndn {
 namespace security {
diff --git a/tests/unit-tests/security/verification-helpers.t.cpp b/tests/unit-tests/security/verification-helpers.t.cpp
index 0f0809e..d1654d7 100644
--- a/tests/unit-tests/security/verification-helpers.t.cpp
+++ b/tests/unit-tests/security/verification-helpers.t.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
@@ -25,7 +25,7 @@
 
 #include "boost-test.hpp"
 #include "identity-management-fixture.hpp"
-#include "../make-interest-data.hpp"
+#include "make-interest-data.hpp"
 
 #include <boost/mpl/list.hpp>
 
diff --git a/tests/unit-tests/util/notification-subscriber.t.cpp b/tests/unit-tests/util/notification-subscriber.t.cpp
index 30924f3..aef46a3 100644
--- a/tests/unit-tests/util/notification-subscriber.t.cpp
+++ b/tests/unit-tests/util/notification-subscriber.t.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2017 Regents of the University of California,
  *                         Arizona Board of Regents,
  *                         Colorado State University,
@@ -26,12 +26,12 @@
  */
 
 #include "util/notification-subscriber.hpp"
-#include "simple-notification.hpp"
 #include "util/dummy-client-face.hpp"
 
-#include "../identity-management-time-fixture.hpp"
-#include "../make-interest-data.hpp"
 #include "boost-test.hpp"
+#include "make-interest-data.hpp"
+#include "simple-notification.hpp"
+#include "../identity-management-time-fixture.hpp"
 
 namespace ndn {
 namespace util {
diff --git a/tests/unit-tests/util/segment-fetcher.t.cpp b/tests/unit-tests/util/segment-fetcher.t.cpp
index 09eb212..d80f1ae 100644
--- a/tests/unit-tests/util/segment-fetcher.t.cpp
+++ b/tests/unit-tests/util/segment-fetcher.t.cpp
@@ -20,15 +20,15 @@
  */
 
 #include "util/segment-fetcher.hpp"
-#include "lp/nack-header.hpp"
 #include "data.hpp"
 #include "encoding/block.hpp"
+#include "lp/nack-header.hpp"
+#include "util/dummy-client-face.hpp"
 
 #include "boost-test.hpp"
-#include "util/dummy-client-face.hpp"
+#include "dummy-validator.hpp"
+#include "make-interest-data.hpp"
 #include "../identity-management-time-fixture.hpp"
-#include "../make-interest-data.hpp"
-#include "../../dummy-validator.hpp"
 
 namespace ndn {
 namespace util {