From cb065f1773c42a4d9467d87b7fc2ca5faa6bebad Mon Sep 17 00:00:00 2001 From: Davide Pesavento Date: Fri, 27 Dec 2019 01:03:34 -0500 Subject: [PATCH] tests: sync common test infrastructure with ndn-cxx Change-Id: I6f2ee4b5b644d6fddcebbe1158b1dd9ad2159417 --- tests/boost-test.hpp | 14 +++++--------- tests/communication/test-sync-protocol-adapter.cpp | 9 ++++----- tests/main.cpp | 9 ++++----- tests/publisher/publisher-fixture.hpp | 3 +-- tests/publisher/test-dataset-interest-handler.cpp | 5 +---- tests/route/test-fib-entry.cpp | 5 ++--- tests/route/test-map-entry.cpp | 7 +++---- tests/route/test-map.cpp | 5 ++--- tests/route/test-name-prefix-table-entry.cpp | 5 ++--- tests/route/test-nexthop-list.cpp | 3 +-- tests/route/test-nexthop.cpp | 5 ++--- tests/route/test-routing-table-entry.cpp | 5 ++--- tests/route/test-routing-table-pool-entry.cpp | 5 ++--- tests/route/test-routing-table.cpp | 5 ++--- tests/test-adjacency-list.cpp | 4 ++-- tests/test-adjacent.cpp | 7 +++---- tests/test-common.hpp | 5 +++-- tests/test-conf-file-processor.cpp | 1 - tests/test-conf-parameter.cpp | 6 ++---- tests/test-hyperbolic-calculator.cpp | 2 -- tests/test-lsa-segment-storage.cpp | 2 -- tests/test-lsdb.cpp | 1 - tests/test-name-prefix-list.cpp | 4 ++-- tests/test-sequencing-manager.cpp | 3 +-- tests/tlv/test-adjacency-lsa.cpp | 2 +- tests/tlv/test-adjacency.cpp | 2 +- tests/tlv/test-coordinate-lsa.cpp | 2 +- tests/tlv/test-destination.cpp | 4 ++-- tests/tlv/test-lsa-info.cpp | 5 +++-- tests/tlv/test-lsdb-status.cpp | 3 ++- tests/tlv/test-name-lsa.cpp | 2 +- tests/tlv/test-nexthops.cpp | 2 +- tests/tlv/test-routing-table-entry.cpp | 2 +- tests/tlv/test-routing-table.cpp | 2 +- tests/wscript | 5 ++--- 35 files changed, 62 insertions(+), 89 deletions(-) diff --git a/tests/boost-test.hpp b/tests/boost-test.hpp index 534f427..6592f3b 100644 --- a/tests/boost-test.hpp +++ b/tests/boost-test.hpp @@ -1,7 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2017, The University of Memphis - * Regents of the University of California, +/* + * Copyright (c) 2014-2019, The University of Memphis, + * Regents of the University of California * * This file is part of NLSR (Named-data Link State Routing). * See AUTHORS.md for complete list of NLSR authors and contributors. @@ -16,10 +16,7 @@ * * You should have received a copy of the GNU General Public License along with * NLSR, e.g., in COPYING.md file. If not, see . - * - * \author Yingdi Yu - * - **/ + */ #ifndef NLSR_TESTS_BOOST_TEST_HPP #define NLSR_TESTS_BOOST_TEST_HPP @@ -28,8 +25,7 @@ #pragma GCC system_header #pragma clang system_header +#define BOOST_TEST_DYN_LINK #include -#include -#include #endif // NLSR_TESTS_BOOST_TEST_HPP diff --git a/tests/communication/test-sync-protocol-adapter.cpp b/tests/communication/test-sync-protocol-adapter.cpp index 707732b..5998caf 100644 --- a/tests/communication/test-sync-protocol-adapter.cpp +++ b/tests/communication/test-sync-protocol-adapter.cpp @@ -20,8 +20,7 @@ **/ #include "communication/sync-protocol-adapter.hpp" -#include "../test-common.hpp" -#include "../boost-test.hpp" +#include "tests/test-common.hpp" #include @@ -41,7 +40,7 @@ public: , nameLsaUserPrefix("/localhop/ndn/nlsr/LSA/NAME") , syncInterestLifetime(time::seconds(60)) { - syncPrefix.appendVersion(4); + syncPrefix.appendVersion(4); } template @@ -53,7 +52,7 @@ public: util::DummyClientFace::Options{true, true}); userPrefixes[i] = Name(nameLsaUserPrefix).appendNumber(i); nodes[i] = std::make_shared(*faces[i], T, syncPrefix, - userPrefixes[i], + userPrefixes[i], syncInterestLifetime, [i, this] (const ndn::Name& updateName, uint64_t highSeq) { @@ -114,4 +113,4 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Sync, SyncProtocol, Protocols) BOOST_AUTO_TEST_SUITE_END() } // namespace test -} // namespace nlsr \ No newline at end of file +} // namespace nlsr diff --git a/tests/main.cpp b/tests/main.cpp index 39380c5..58210a2 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2017, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -23,8 +23,7 @@ * NLSR, e.g., in COPYING.md file. If not, see . */ -#define BOOST_TEST_DYN_LINK -#define BOOST_TEST_ALTERNATIVE_INIT_API +#define BOOST_TEST_MODULE NLSR Unit Tests #include @@ -32,9 +31,9 @@ // Boost.Test v3.3 (Boost 1.62) natively supports multi-logger output #include "boost-test.hpp" #else +#define BOOST_TEST_ALTERNATIVE_INIT_API #define BOOST_TEST_NO_MAIN #include "boost-test.hpp" - #include "boost-multi-log-formatter.hpp" #include diff --git a/tests/publisher/publisher-fixture.hpp b/tests/publisher/publisher-fixture.hpp index 840de0b..f5b37fa 100644 --- a/tests/publisher/publisher-fixture.hpp +++ b/tests/publisher/publisher-fixture.hpp @@ -25,8 +25,7 @@ #include "publisher/dataset-interest-handler.hpp" #include "nlsr.hpp" -#include "../boost-test.hpp" -#include "../test-common.hpp" +#include "tests/test-common.hpp" #include #include diff --git a/tests/publisher/test-dataset-interest-handler.cpp b/tests/publisher/test-dataset-interest-handler.cpp index 070c06d..102be58 100644 --- a/tests/publisher/test-dataset-interest-handler.cpp +++ b/tests/publisher/test-dataset-interest-handler.cpp @@ -20,16 +20,13 @@ **/ #include "publisher/dataset-interest-handler.hpp" -#include "tests/test-common.hpp" #include "tlv/tlv-nlsr.hpp" +#include "tests/test-common.hpp" #include "publisher-fixture.hpp" -#include "../boost-test.hpp" #include -#include - namespace nlsr { namespace test { diff --git a/tests/route/test-fib-entry.cpp b/tests/route/test-fib-entry.cpp index e38986a..b323ca5 100644 --- a/tests/route/test-fib-entry.cpp +++ b/tests/route/test-fib-entry.cpp @@ -18,17 +18,16 @@ * NLSR, e.g., in COPYING.md file. If not, see . * * \author Ashlesh Gawande - * **/ #include "route/fib-entry.hpp" #include "route/nexthop-list.hpp" +#include "tests/boost-test.hpp" + #include -#include namespace nlsr { - namespace test { BOOST_AUTO_TEST_SUITE(TestFibEntry) diff --git a/tests/route/test-map-entry.cpp b/tests/route/test-map-entry.cpp index 234e5a6..0429dde 100644 --- a/tests/route/test-map-entry.cpp +++ b/tests/route/test-map-entry.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /** - * Copyright (c) 2014-2019 , The University of Memphis, + * Copyright (c) 2014-2019, The University of Memphis, * Regents of the University of California * * This file is part of NLSR (Named-data Link State Routing). @@ -18,13 +18,12 @@ * NLSR, e.g., in COPYING.md file. If not, see . * * \author Ashlesh Gawande - * **/ + #include "route/map.hpp" -#include +#include "tests/boost-test.hpp" namespace nlsr { - namespace test { BOOST_AUTO_TEST_SUITE(TestMapEntry) diff --git a/tests/route/test-map.cpp b/tests/route/test-map.cpp index a324b6e..0564377 100644 --- a/tests/route/test-map.cpp +++ b/tests/route/test-map.cpp @@ -18,13 +18,12 @@ * NLSR, e.g., in COPYING.md file. If not, see . * * \author Ashlesh Gawande - * **/ + #include "route/map.hpp" -#include +#include "tests/boost-test.hpp" namespace nlsr { - namespace test { BOOST_AUTO_TEST_SUITE(TestMap) diff --git a/tests/route/test-name-prefix-table-entry.cpp b/tests/route/test-name-prefix-table-entry.cpp index 478d4bd..949c380 100644 --- a/tests/route/test-name-prefix-table-entry.cpp +++ b/tests/route/test-name-prefix-table-entry.cpp @@ -18,13 +18,12 @@ * NLSR, e.g., in COPYING.md file. If not, see . * * \author Ashlesh Gawande - * **/ + #include "route/name-prefix-table-entry.hpp" -#include +#include "tests/boost-test.hpp" namespace nlsr { - namespace test { BOOST_AUTO_TEST_SUITE(TestNpte) diff --git a/tests/route/test-nexthop-list.cpp b/tests/route/test-nexthop-list.cpp index ed5bf0d..5bdef4d 100644 --- a/tests/route/test-nexthop-list.cpp +++ b/tests/route/test-nexthop-list.cpp @@ -21,10 +21,9 @@ #include "route/nexthop-list.hpp" #include "route/nexthop.hpp" -#include +#include "tests/boost-test.hpp" namespace nlsr { - namespace test { BOOST_AUTO_TEST_SUITE(TestNhl) diff --git a/tests/route/test-nexthop.cpp b/tests/route/test-nexthop.cpp index 12be825..3a6a5fd 100644 --- a/tests/route/test-nexthop.cpp +++ b/tests/route/test-nexthop.cpp @@ -18,13 +18,12 @@ * NLSR, e.g., in COPYING.md file. If not, see . * * \author Ashlesh Gawande - * **/ + #include "route/nexthop.hpp" -#include +#include "tests/boost-test.hpp" namespace nlsr { - namespace test { BOOST_AUTO_TEST_SUITE(TestNexthop) diff --git a/tests/route/test-routing-table-entry.cpp b/tests/route/test-routing-table-entry.cpp index b2ac244..574abc2 100644 --- a/tests/route/test-routing-table-entry.cpp +++ b/tests/route/test-routing-table-entry.cpp @@ -18,13 +18,12 @@ * NLSR, e.g., in COPYING.md file. If not, see . * * \author Ashlesh Gawande - * **/ + #include "route/routing-table-entry.hpp" -#include +#include "tests/boost-test.hpp" namespace nlsr { - namespace test { BOOST_AUTO_TEST_SUITE(TestRoutingTableEntry) diff --git a/tests/route/test-routing-table-pool-entry.cpp b/tests/route/test-routing-table-pool-entry.cpp index 444fbbd..cf425d2 100644 --- a/tests/route/test-routing-table-pool-entry.cpp +++ b/tests/route/test-routing-table-pool-entry.cpp @@ -18,16 +18,15 @@ * NLSR, e.g., in COPYING.md file. If not, see . * * \author Nicholas Gordon - * **/ + #include "route/routing-table-pool-entry.hpp" #include "route/nexthop.hpp" #include "route/nexthop-list.hpp" -#include +#include "tests/boost-test.hpp" namespace nlsr { - namespace test { BOOST_AUTO_TEST_SUITE(TestRoutingTablePoolEntry) diff --git a/tests/route/test-routing-table.cpp b/tests/route/test-routing-table.cpp index cd600f1..0f630aa 100644 --- a/tests/route/test-routing-table.cpp +++ b/tests/route/test-routing-table.cpp @@ -18,15 +18,14 @@ * NLSR, e.g., in COPYING.md file. If not, see . * * \author Ashlesh Gawande - * **/ #include "route/routing-table.hpp" #include "nlsr.hpp" -#include "../test-common.hpp" #include "route/routing-table-entry.hpp" #include "route/nexthop.hpp" -#include + +#include "tests/test-common.hpp" namespace nlsr { namespace test { diff --git a/tests/test-adjacency-list.cpp b/tests/test-adjacency-list.cpp index 5d37aff..721d8f6 100644 --- a/tests/test-adjacency-list.cpp +++ b/tests/test-adjacency-list.cpp @@ -24,9 +24,9 @@ #include "adjacent.hpp" #include "conf-parameter.hpp" -#include +#include "tests/boost-test.hpp" -#include +#include namespace nlsr { namespace test { diff --git a/tests/test-adjacent.cpp b/tests/test-adjacent.cpp index 512cec1..a65ef97 100644 --- a/tests/test-adjacent.cpp +++ b/tests/test-adjacent.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /** - * Copyright (c) 2014-2017, The University of Memphis, + * Copyright (c) 2014-2019, The University of Memphis, * Regents of the University of California * * This file is part of NLSR (Named-data Link State Routing). @@ -18,13 +18,12 @@ * NLSR, e.g., in COPYING.md file. If not, see . * * \author Ashlesh Gawande - * **/ + #include "adjacent.hpp" -#include +#include "tests/boost-test.hpp" namespace nlsr { - namespace test { using namespace std; diff --git a/tests/test-common.hpp b/tests/test-common.hpp index 878a27d..339fd82 100644 --- a/tests/test-common.hpp +++ b/tests/test-common.hpp @@ -23,11 +23,12 @@ #define NLSR_TEST_COMMON_HPP #include "common.hpp" -#include "identity-management-fixture.hpp" #include "conf-parameter.hpp" +#include "boost-test.hpp" +#include "identity-management-fixture.hpp" + #include -#include #include #include diff --git a/tests/test-conf-file-processor.cpp b/tests/test-conf-file-processor.cpp index e132e11..8ddb6ee 100644 --- a/tests/test-conf-file-processor.cpp +++ b/tests/test-conf-file-processor.cpp @@ -24,7 +24,6 @@ #include -#include #include #include #include diff --git a/tests/test-conf-parameter.cpp b/tests/test-conf-parameter.cpp index 7b3b74e..4bc9c54 100644 --- a/tests/test-conf-parameter.cpp +++ b/tests/test-conf-parameter.cpp @@ -18,16 +18,14 @@ * NLSR, e.g., in COPYING.md file. If not, see . * * \author Ashlesh Gawande - * **/ + #include "conf-parameter.hpp" +#include "tests/boost-test.hpp" #include -#include - namespace nlsr { - namespace test { using namespace std; diff --git a/tests/test-hyperbolic-calculator.cpp b/tests/test-hyperbolic-calculator.cpp index 4a141ea..28f7323 100644 --- a/tests/test-hyperbolic-calculator.cpp +++ b/tests/test-hyperbolic-calculator.cpp @@ -30,8 +30,6 @@ #include "route/map.hpp" #include "route/routing-table.hpp" -#include - #include namespace nlsr { diff --git a/tests/test-lsa-segment-storage.cpp b/tests/test-lsa-segment-storage.cpp index ac2671f..e8f90bf 100644 --- a/tests/test-lsa-segment-storage.cpp +++ b/tests/test-lsa-segment-storage.cpp @@ -28,8 +28,6 @@ #include "name-prefix-list.hpp" #include "lsa.hpp" -#include - namespace nlsr { namespace test { diff --git a/tests/test-lsdb.cpp b/tests/test-lsdb.cpp index 2e6a6ff..9bec39a 100644 --- a/tests/test-lsdb.cpp +++ b/tests/test-lsdb.cpp @@ -25,7 +25,6 @@ #include "nlsr.hpp" #include "lsa.hpp" #include "name-prefix-list.hpp" -#include #include #include diff --git a/tests/test-name-prefix-list.cpp b/tests/test-name-prefix-list.cpp index f8bf855..3bb93b7 100644 --- a/tests/test-name-prefix-list.cpp +++ b/tests/test-name-prefix-list.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /** - * Copyright (c) 2014-2017, The University of Memphis, + * Copyright (c) 2014-2019, The University of Memphis, * Regents of the University of California * * This file is part of NLSR (Named-data Link State Routing). @@ -19,7 +19,7 @@ **/ #include "name-prefix-list.hpp" -#include +#include "tests/boost-test.hpp" namespace nlsr { namespace test { diff --git a/tests/test-sequencing-manager.cpp b/tests/test-sequencing-manager.cpp index d55f18a..d1c928b 100644 --- a/tests/test-sequencing-manager.cpp +++ b/tests/test-sequencing-manager.cpp @@ -21,7 +21,7 @@ #include "sequencing-manager.hpp" #include "test-common.hpp" -#include + #include #include #include @@ -30,7 +30,6 @@ using namespace ndn; namespace nlsr { - namespace test { class SequencingManagerFixture : public BaseFixture diff --git a/tests/tlv/test-adjacency-lsa.cpp b/tests/tlv/test-adjacency-lsa.cpp index 65fe2b6..531e1a4 100644 --- a/tests/tlv/test-adjacency-lsa.cpp +++ b/tests/tlv/test-adjacency-lsa.cpp @@ -21,7 +21,7 @@ #include "tlv/adjacency-lsa.hpp" -#include "../boost-test.hpp" +#include "tests/boost-test.hpp" namespace nlsr { namespace tlv { diff --git a/tests/tlv/test-adjacency.cpp b/tests/tlv/test-adjacency.cpp index b271a62..6e3b754 100644 --- a/tests/tlv/test-adjacency.cpp +++ b/tests/tlv/test-adjacency.cpp @@ -21,7 +21,7 @@ #include "tlv/adjacency.hpp" -#include "../boost-test.hpp" +#include "tests/boost-test.hpp" namespace nlsr { namespace tlv { diff --git a/tests/tlv/test-coordinate-lsa.cpp b/tests/tlv/test-coordinate-lsa.cpp index dc289ca..225c708 100644 --- a/tests/tlv/test-coordinate-lsa.cpp +++ b/tests/tlv/test-coordinate-lsa.cpp @@ -21,7 +21,7 @@ #include "tlv/coordinate-lsa.hpp" -#include "../boost-test.hpp" +#include "tests/boost-test.hpp" namespace nlsr { namespace tlv { diff --git a/tests/tlv/test-destination.cpp b/tests/tlv/test-destination.cpp index b74120d..8e2d177 100644 --- a/tests/tlv/test-destination.cpp +++ b/tests/tlv/test-destination.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /** - * Copyright (c) 2014-2018, The University of Memphis, + * Copyright (c) 2014-2019, The University of Memphis, * Regents of the University of California, * Arizona Board of Regents. * @@ -21,7 +21,7 @@ #include "tlv/destination.hpp" -#include "../boost-test.hpp" +#include "tests/boost-test.hpp" namespace nlsr { namespace tlv { diff --git a/tests/tlv/test-lsa-info.cpp b/tests/tlv/test-lsa-info.cpp index eea9b37..46157a5 100644 --- a/tests/tlv/test-lsa-info.cpp +++ b/tests/tlv/test-lsa-info.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /** - * Copyright (c) 2014-2017, The University of Memphis, + * Copyright (c) 2014-2019, The University of Memphis, * Regents of the University of California, * Arizona Board of Regents. * @@ -20,7 +20,8 @@ **/ #include "tlv/lsa-info.hpp" -#include "../boost-test.hpp" + +#include "tests/boost-test.hpp" #include "tests/mocks/lsa.hpp" namespace nlsr { diff --git a/tests/tlv/test-lsdb-status.cpp b/tests/tlv/test-lsdb-status.cpp index c058fb1..0c87774 100644 --- a/tests/tlv/test-lsdb-status.cpp +++ b/tests/tlv/test-lsdb-status.cpp @@ -21,7 +21,8 @@ #include "tlv/lsdb-status.hpp" -#include "../boost-test.hpp" +#include "tests/boost-test.hpp" + #include #include diff --git a/tests/tlv/test-name-lsa.cpp b/tests/tlv/test-name-lsa.cpp index f5ce311..885d225 100644 --- a/tests/tlv/test-name-lsa.cpp +++ b/tests/tlv/test-name-lsa.cpp @@ -21,7 +21,7 @@ #include "tlv/name-lsa.hpp" -#include "../boost-test.hpp" +#include "tests/boost-test.hpp" namespace nlsr { namespace tlv { diff --git a/tests/tlv/test-nexthops.cpp b/tests/tlv/test-nexthops.cpp index 1714bbf..12a479e 100644 --- a/tests/tlv/test-nexthops.cpp +++ b/tests/tlv/test-nexthops.cpp @@ -21,7 +21,7 @@ #include "tlv/nexthop.hpp" -#include "../boost-test.hpp" +#include "tests/boost-test.hpp" namespace nlsr { namespace tlv { diff --git a/tests/tlv/test-routing-table-entry.cpp b/tests/tlv/test-routing-table-entry.cpp index 9415210..378dfd9 100644 --- a/tests/tlv/test-routing-table-entry.cpp +++ b/tests/tlv/test-routing-table-entry.cpp @@ -21,7 +21,7 @@ #include "tlv/routing-table-entry.hpp" -#include "../boost-test.hpp" +#include "tests/boost-test.hpp" namespace nlsr { namespace tlv { diff --git a/tests/tlv/test-routing-table.cpp b/tests/tlv/test-routing-table.cpp index 6e9ce43..ba8cef6 100644 --- a/tests/tlv/test-routing-table.cpp +++ b/tests/tlv/test-routing-table.cpp @@ -21,7 +21,7 @@ #include "tlv/routing-table-status.hpp" -#include "../boost-test.hpp" +#include "tests/boost-test.hpp" namespace nlsr { namespace tlv { diff --git a/tests/wscript b/tests/wscript index de5a52c..8371275 100644 --- a/tests/wscript +++ b/tests/wscript @@ -1,7 +1,7 @@ # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- """ -Copyright (c) 2014-2018, The University of Memphis +Copyright (c) 2014-2019, The University of Memphis Regents of the University of California This file is part of NLSR (Named-data Link State Routing). @@ -22,7 +22,7 @@ NLSR, e.g., in COPYING.md file. If not, see . top = '..' def build(bld): - if not bld.env['WITH_TESTS']: + if not bld.env.WITH_TESTS: return bld.objects(target='unit-test-objects', @@ -32,6 +32,5 @@ def build(bld): bld.program(target='../unit-tests-nlsr', name='unit-tests-nlsr', source='main.cpp', - defines=['BOOST_TEST_MODULE=NLSR Unit Tests'], use='unit-test-objects', install_path=None)