diff --git a/tests/route/test-hyperbolic-calculator.cpp b/tests/route/test-hyperbolic-calculator.cpp
new file mode 100644
index 0000000..a697e2e
--- /dev/null
+++ b/tests/route/test-hyperbolic-calculator.cpp
@@ -0,0 +1,199 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2020,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NLSR 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "../test-common.hpp"
+
+#include "route/routing-table-calculator.hpp"
+
+#include "adjacency-list.hpp"
+#include "lsdb.hpp"
+#include "nlsr.hpp"
+#include "route/map.hpp"
+#include "route/routing-table.hpp"
+
+#include <ndn-cxx/util/dummy-client-face.hpp>
+
+namespace nlsr {
+namespace test {
+
+using std::shared_ptr;
+using ndn::time::system_clock;
+static const system_clock::TimePoint MAX_TIME = system_clock::TimePoint::max();
+
+class HyperbolicCalculatorFixture : public BaseFixture
+{
+public:
+  HyperbolicCalculatorFixture()
+    : face(m_ioService, m_keyChain)
+    , conf(face, m_keyChain)
+    , nlsr(face, m_keyChain, conf)
+    , routingTable(nlsr.m_routingTable)
+    , adjacencies(conf.getAdjacencyList())
+    , lsdb(nlsr.m_lsdb)
+  {
+  }
+
+  // Triangle topology with routers A, B, C connected
+  void setUpTopology(std::vector<double> anglesA, std::vector<double> anglesB,
+                     std::vector<double> anglesC)
+  {
+    Adjacent a(ROUTER_A_NAME, ndn::FaceUri(ROUTER_A_FACE), 0, Adjacent::STATUS_ACTIVE, 0, 0);
+    Adjacent b(ROUTER_B_NAME, ndn::FaceUri(ROUTER_B_FACE), 0, Adjacent::STATUS_ACTIVE, 0, 0);
+    Adjacent c(ROUTER_C_NAME, ndn::FaceUri(ROUTER_C_FACE), 0, Adjacent::STATUS_ACTIVE, 0, 0);
+
+    // Router A
+    adjacencies.insert(b);
+    adjacencies.insert(c);
+
+    AdjLsa adjA(a.getName(), 1, MAX_TIME, 2, adjacencies);
+    lsdb.installAdjLsa(adjA);
+
+
+    CoordinateLsa coordA(adjA.getOriginRouter(), 1, MAX_TIME, 16.23, anglesA);
+    lsdb.installCoordinateLsa(coordA);
+
+    // Router B
+    a.setFaceId(1);
+    c.setFaceId(2);
+
+    AdjacencyList adjacencyListB;
+    adjacencyListB.insert(a);
+    adjacencyListB.insert(c);
+
+    AdjLsa adjB(b.getName(), 1, MAX_TIME, 2, adjacencyListB);
+    lsdb.installAdjLsa(adjB);
+
+    CoordinateLsa coordB(adjB.getOriginRouter(), 1, MAX_TIME, 16.59, anglesB);
+    lsdb.installCoordinateLsa(coordB);
+
+    // Router C
+    a.setFaceId(1);
+    b.setFaceId(2);
+
+    AdjacencyList adjacencyListC;
+    adjacencyListC.insert(a);
+    adjacencyListC.insert(b);
+
+    AdjLsa adjC(c.getName(), 1, MAX_TIME, 2, adjacencyListC);
+    lsdb.installAdjLsa(adjC);
+
+    CoordinateLsa coordC(adjC.getOriginRouter(), 1, MAX_TIME, 14.11, anglesC);
+    lsdb.installCoordinateLsa(coordC);
+
+    map.createFromAdjLsdb(lsdb.getAdjLsdb().begin(), lsdb.getAdjLsdb().end());
+  }
+
+  void runTest(const double& expectedCost)
+  {
+    HyperbolicRoutingCalculator calculator(map.getMapSize(), false, ROUTER_A_NAME);
+    calculator.calculatePath(map, routingTable, lsdb, adjacencies);
+
+    RoutingTableEntry* entryB = routingTable.findRoutingTableEntry(ROUTER_B_NAME);
+
+    // Router A should be able to get to B through B with cost 0 and to B through C
+    NexthopList& bHopList = entryB->getNexthopList();
+    BOOST_REQUIRE_EQUAL(bHopList.getNextHops().size(), 2);
+
+    for (std::set<NextHop, NextHopComparator>::iterator it = bHopList.begin(); it != bHopList.end(); ++it) {
+      std::string faceUri = it->getConnectingFaceUri();
+      uint64_t cost = it->getRouteCostAsAdjustedInteger();
+
+      BOOST_CHECK((faceUri == ROUTER_B_FACE && cost == 0) ||
+                  (faceUri == ROUTER_C_FACE && cost == applyHyperbolicFactorAndRound(expectedCost)));
+    }
+
+    RoutingTableEntry* entryC = routingTable.findRoutingTableEntry(ROUTER_C_NAME);
+
+    // Router A should be able to get to C through C with cost 0 and to C through B
+    NexthopList& cHopList = entryC->getNexthopList();
+    BOOST_REQUIRE_EQUAL(cHopList.getNextHops().size(), 2);
+
+    for (std::set<NextHop, NextHopComparator>::iterator it = cHopList.begin(); it != cHopList.end(); ++it) {
+      std::string faceUri = it->getConnectingFaceUri();
+      uint64_t cost = it->getRouteCostAsAdjustedInteger();
+
+      BOOST_CHECK((faceUri == ROUTER_B_FACE && cost == applyHyperbolicFactorAndRound(expectedCost)) ||
+                  (faceUri == ROUTER_C_FACE && cost == 0));
+    }
+  }
+
+  uint64_t
+  applyHyperbolicFactorAndRound(double d)
+  {
+    // Hyperbolic costs in the tests were calculated with 1*10^-9 precision.
+    // A factor larger than 1*10^9 will cause the tests to fail.
+    BOOST_REQUIRE(NextHop::HYPERBOLIC_COST_ADJUSTMENT_FACTOR <= 1000000000);
+    return round(NextHop::HYPERBOLIC_COST_ADJUSTMENT_FACTOR*d);
+  }
+
+public:
+  ndn::util::DummyClientFace face;
+  ConfParameter conf;
+  Nlsr nlsr;
+  Map map;
+
+  RoutingTable& routingTable;
+  AdjacencyList& adjacencies;
+  Lsdb& lsdb;
+
+  static const ndn::Name ROUTER_A_NAME;
+  static const ndn::Name ROUTER_B_NAME;
+  static const ndn::Name ROUTER_C_NAME;
+
+  static const std::string ROUTER_A_FACE;
+  static const std::string ROUTER_B_FACE;
+  static const std::string ROUTER_C_FACE;
+};
+
+const ndn::Name HyperbolicCalculatorFixture::ROUTER_A_NAME = "/ndn/router/a";
+const ndn::Name HyperbolicCalculatorFixture::ROUTER_B_NAME = "/ndn/router/b";
+const ndn::Name HyperbolicCalculatorFixture::ROUTER_C_NAME = "/ndn/router/c";
+
+const std::string HyperbolicCalculatorFixture::ROUTER_A_FACE = "udp4://10.0.0.1";
+const std::string HyperbolicCalculatorFixture::ROUTER_B_FACE = "udp4://10.0.0.2";
+const std::string HyperbolicCalculatorFixture::ROUTER_C_FACE = "udp4://10.0.0.3";
+
+BOOST_FIXTURE_TEST_SUITE(TestHyperbolicRoutingCalculator, HyperbolicCalculatorFixture)
+
+BOOST_AUTO_TEST_CASE(Basic)
+{
+  std::vector<double> anglesA = {2.97},
+                      anglesB = {3.0},
+                      anglesC = {2.99};
+  setUpTopology(anglesA, anglesB, anglesC);
+
+  runTest(20.103356956);
+}
+
+BOOST_AUTO_TEST_CASE(BasicMultipleAngles)
+{
+  std::vector<double> anglesA = {2.97,1.22},
+                      anglesB = {3.0, 0.09},
+                      anglesC = {321, 2.99};
+  setUpTopology(anglesA, anglesB, anglesC);
+
+  runTest(30.655296361);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace test
+} // namespace nlsr
diff --git a/tests/route/test-link-state-calculator.cpp b/tests/route/test-link-state-calculator.cpp
new file mode 100644
index 0000000..a0d04df
--- /dev/null
+++ b/tests/route/test-link-state-calculator.cpp
@@ -0,0 +1,323 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2020,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NLSR 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "route/routing-table-calculator.hpp"
+
+#include "adjacency-list.hpp"
+#include "lsdb.hpp"
+#include "nlsr.hpp"
+#include "../test-common.hpp"
+#include "route/map.hpp"
+#include "route/routing-table.hpp"
+#include "adjacent.hpp"
+
+#include <ndn-cxx/util/dummy-client-face.hpp>
+
+namespace nlsr {
+namespace test {
+
+static const ndn::time::system_clock::TimePoint MAX_TIME =
+  ndn::time::system_clock::TimePoint::max();
+
+class LinkStateCalculatorFixture : public BaseFixture
+{
+public:
+  LinkStateCalculatorFixture()
+    : face(m_ioService, m_keyChain)
+    , conf(face, m_keyChain)
+    , confProcessor(conf)
+    , nlsr(face, m_keyChain, conf)
+    , routingTable(nlsr.m_routingTable)
+    , lsdb(nlsr.m_lsdb)
+  {
+    setUpTopology();
+  }
+
+  // Triangle topology with routers A, B, C connected
+  void setUpTopology()
+  {
+    Adjacent a(ROUTER_A_NAME, ndn::FaceUri(ROUTER_A_FACE), 0, Adjacent::STATUS_ACTIVE, 0, 0);
+    Adjacent b(ROUTER_B_NAME, ndn::FaceUri(ROUTER_B_FACE), 0, Adjacent::STATUS_ACTIVE, 0, 0);
+    Adjacent c(ROUTER_C_NAME, ndn::FaceUri(ROUTER_C_FACE), 0, Adjacent::STATUS_ACTIVE, 0, 0);
+
+    // Router A
+    b.setLinkCost(LINK_AB_COST);
+    c.setLinkCost(LINK_AC_COST);
+
+    AdjacencyList& adjacencyListA = conf.getAdjacencyList();
+    adjacencyListA.insert(b);
+    adjacencyListA.insert(c);
+
+    AdjLsa adjA(a.getName(), 1, MAX_TIME, 2, adjacencyListA);
+    lsdb.installAdjLsa(adjA);
+
+    // Router B
+    a.setLinkCost(LINK_AB_COST);
+    c.setLinkCost(LINK_BC_COST);
+
+    AdjacencyList adjacencyListB;
+    adjacencyListB.insert(a);
+    adjacencyListB.insert(c);
+
+    AdjLsa adjB(b.getName(), 1, MAX_TIME, 2, adjacencyListB);
+    lsdb.installAdjLsa(adjB);
+
+    // Router C
+    a.setLinkCost(LINK_AC_COST);
+    b.setLinkCost(LINK_BC_COST);
+
+    AdjacencyList adjacencyListC;
+    adjacencyListC.insert(a);
+    adjacencyListC.insert(b);
+
+    AdjLsa adjC(c.getName(), 1, MAX_TIME, 2, adjacencyListC);
+    lsdb.installAdjLsa(adjC);
+
+    map.createFromAdjLsdb(lsdb.getAdjLsdb().begin(), lsdb.getAdjLsdb().end());
+  }
+
+public:
+  ndn::util::DummyClientFace face;
+  ConfParameter conf;
+  DummyConfFileProcessor confProcessor;
+  Nlsr nlsr;
+  Map map;
+
+  RoutingTable& routingTable;
+  Lsdb& lsdb;
+
+  static const ndn::Name ROUTER_A_NAME;
+  static const ndn::Name ROUTER_B_NAME;
+  static const ndn::Name ROUTER_C_NAME;
+
+  static const std::string ROUTER_A_FACE;
+  static const std::string ROUTER_B_FACE;
+  static const std::string ROUTER_C_FACE;
+
+  static const double LINK_AB_COST;
+  static const double LINK_AC_COST;
+  static const double LINK_BC_COST;
+};
+
+const ndn::Name LinkStateCalculatorFixture::ROUTER_A_NAME = "/ndn/site/%C1.Router/this-router";
+const ndn::Name LinkStateCalculatorFixture::ROUTER_B_NAME = "/ndn/site/%C1.Router/b";
+const ndn::Name LinkStateCalculatorFixture::ROUTER_C_NAME = "/ndn/site/%C1.Router/c";
+
+const std::string LinkStateCalculatorFixture::ROUTER_A_FACE = "udp4://10.0.0.1";
+const std::string LinkStateCalculatorFixture::ROUTER_B_FACE = "udp4://10.0.0.2";
+const std::string LinkStateCalculatorFixture::ROUTER_C_FACE = "udp4://10.0.0.3";
+
+const double LinkStateCalculatorFixture::LINK_AB_COST = 5;
+const double LinkStateCalculatorFixture::LINK_AC_COST = 10;
+const double LinkStateCalculatorFixture::LINK_BC_COST = 17;
+
+BOOST_FIXTURE_TEST_SUITE(TestLinkStateRoutingCalculator, LinkStateCalculatorFixture)
+
+BOOST_AUTO_TEST_CASE(Basic)
+{
+  LinkStateRoutingTableCalculator calculator(map.getMapSize());
+  calculator.calculatePath(map, routingTable, conf, lsdb.getAdjLsdb());
+
+  RoutingTableEntry* entryB = routingTable.findRoutingTableEntry(ROUTER_B_NAME);
+  BOOST_REQUIRE(entryB != nullptr);
+
+  // Router A should be able to get to B through B and to B through C
+  NexthopList& bHopList = entryB->getNexthopList();
+  BOOST_REQUIRE_EQUAL(bHopList.getNextHops().size(), 2);
+
+  for (const NextHop& hop : bHopList) {
+    std::string faceUri = hop.getConnectingFaceUri();
+    uint64_t cost = hop.getRouteCostAsAdjustedInteger();
+
+    BOOST_CHECK((faceUri == ROUTER_B_FACE && cost == LINK_AB_COST) ||
+                (faceUri == ROUTER_C_FACE && cost == LINK_AC_COST + LINK_BC_COST));
+
+  }
+
+  RoutingTableEntry* entryC = routingTable.findRoutingTableEntry(ROUTER_C_NAME);
+  BOOST_REQUIRE(entryC != nullptr);
+
+  // Router A should be able to get to C through C and to C through B
+  NexthopList& cHopList = entryC->getNexthopList();
+  BOOST_REQUIRE_EQUAL(cHopList.getNextHops().size(), 2);
+
+  for (const NextHop& hop : cHopList) {
+    std::string faceUri = hop.getConnectingFaceUri();
+    uint64_t cost = hop.getRouteCostAsAdjustedInteger();
+
+    BOOST_CHECK((faceUri == ROUTER_C_FACE && cost == LINK_AC_COST) ||
+                (faceUri == ROUTER_B_FACE && cost == LINK_AB_COST + LINK_BC_COST));
+  }
+}
+
+BOOST_AUTO_TEST_CASE(Asymmetric)
+{
+  // Asymmetric link cost between B and C
+  ndn::Name key = ndn::Name(ROUTER_B_NAME).append(boost::lexical_cast<std::string>(Lsa::Type::ADJACENCY));
+  AdjLsa* lsa = nlsr.m_lsdb.findAdjLsa(key);
+  BOOST_REQUIRE(lsa != nullptr);
+
+  auto c = lsa->m_adl.findAdjacent(ROUTER_C_NAME);
+  BOOST_REQUIRE(c != conf.getAdjacencyList().end());
+
+  double higherLinkCost = LINK_BC_COST + 1;
+  c->setLinkCost(higherLinkCost);
+
+  // Calculation should consider the link between B and C as having cost = higherLinkCost
+  LinkStateRoutingTableCalculator calculator(map.getMapSize());
+  calculator.calculatePath(map, routingTable, conf, lsdb.getAdjLsdb());
+
+  RoutingTableEntry* entryB = routingTable.findRoutingTableEntry(ROUTER_B_NAME);
+  BOOST_REQUIRE(entryB != nullptr);
+
+  // Router A should be able to get to B through B and to B through C
+  NexthopList& bHopList = entryB->getNexthopList();
+  BOOST_REQUIRE_EQUAL(bHopList.getNextHops().size(), 2);
+
+  for (const NextHop& hop : bHopList) {
+    std::string faceUri = hop.getConnectingFaceUri();
+    uint64_t cost = hop.getRouteCostAsAdjustedInteger();
+
+    BOOST_CHECK((faceUri == ROUTER_B_FACE && cost == LINK_AB_COST) ||
+                (faceUri == ROUTER_C_FACE && cost == LINK_AC_COST + higherLinkCost));
+
+  }
+
+  RoutingTableEntry* entryC = routingTable.findRoutingTableEntry(ROUTER_C_NAME);
+  BOOST_REQUIRE(entryC != nullptr);
+
+  // Router A should be able to get to C through C and to C through B
+  NexthopList& cHopList = entryC->getNexthopList();
+  BOOST_REQUIRE_EQUAL(cHopList.getNextHops().size(), 2);
+
+  for (const NextHop& hop : cHopList) {
+    std::string faceUri = hop.getConnectingFaceUri();
+    uint64_t cost = hop.getRouteCostAsAdjustedInteger();
+
+    BOOST_CHECK((faceUri == ROUTER_C_FACE && cost == LINK_AC_COST) ||
+                (faceUri == ROUTER_B_FACE && cost == LINK_AB_COST + higherLinkCost));
+  }
+}
+
+BOOST_AUTO_TEST_CASE(NonAdjacentCost)
+{
+  // Asymmetric link cost between B and C
+  ndn::Name key = ndn::Name(ROUTER_B_NAME).append(boost::lexical_cast<std::string>(Lsa::Type::ADJACENCY));
+  auto lsa = nlsr.m_lsdb.findAdjLsa(key);
+  BOOST_REQUIRE(lsa != nullptr);
+
+  auto c = lsa->m_adl.findAdjacent(ROUTER_C_NAME);
+  BOOST_REQUIRE(c != conf.getAdjacencyList().end());
+
+  // Break the link between B - C by setting it to a NON_ADJACENT_COST.
+  c->setLinkCost(Adjacent::NON_ADJACENT_COST);
+
+  // Calculation should consider the link between B and C as down
+  LinkStateRoutingTableCalculator calculator(map.getMapSize());
+  calculator.calculatePath(map, routingTable, conf, lsdb.getAdjLsdb());
+
+  // Router A should be able to get to B through B but not through C
+  RoutingTableEntry* entryB = routingTable.findRoutingTableEntry(ROUTER_B_NAME);
+  BOOST_REQUIRE(entryB != nullptr);
+
+  auto bHopList = entryB->getNexthopList();
+  BOOST_REQUIRE_EQUAL(bHopList.getNextHops().size(), 1);
+
+  const auto nextHopForB = bHopList.getNextHops().begin();
+
+  BOOST_CHECK(nextHopForB->getConnectingFaceUri() == ROUTER_B_FACE &&
+              nextHopForB->getRouteCostAsAdjustedInteger() == LINK_AB_COST);
+
+  // Router A should be able to get to C through C but not through B
+  auto entryC = routingTable.findRoutingTableEntry(ROUTER_C_NAME);
+  BOOST_REQUIRE(entryC != nullptr);
+
+  NexthopList& cHopList = entryC->getNexthopList();
+  BOOST_REQUIRE_EQUAL(cHopList.getNextHops().size(), 1);
+
+  const auto nextHopForC = cHopList.getNextHops().begin();
+
+  BOOST_CHECK(nextHopForC->getConnectingFaceUri() == ROUTER_C_FACE &&
+              nextHopForC->getRouteCostAsAdjustedInteger() == LINK_AC_COST);
+}
+
+BOOST_AUTO_TEST_CASE(AsymmetricZeroCostLink)
+{
+  // Asymmetric and zero link cost between B - C, and B - A.
+  ndn::Name keyB = ndn::Name(ROUTER_B_NAME).append(boost::lexical_cast<std::string>(Lsa::Type::ADJACENCY));
+  auto lsaB = nlsr.m_lsdb.findAdjLsa(keyB);
+  BOOST_REQUIRE(lsaB != nullptr);
+
+  auto c = lsaB->m_adl.findAdjacent(ROUTER_C_NAME);
+  BOOST_REQUIRE(c != conf.getAdjacencyList().end());
+  // Re-adjust link cost to 0 from B-C. However, this should not set B-C cost 0 because C-B
+  // cost is greater that 0 i.e. 17
+  c->setLinkCost(0);
+
+  auto a = lsaB->m_adl.findAdjacent(ROUTER_A_NAME);
+  BOOST_REQUIRE(a != conf.getAdjacencyList().end());
+
+  ndn::Name keyA = ndn::Name(ROUTER_A_NAME).append(boost::lexical_cast<std::string>(Lsa::Type::ADJACENCY));
+  auto lsaA = nlsr.m_lsdb.findAdjLsa(keyA);
+  BOOST_REQUIRE(lsaA != nullptr);
+
+  auto b = lsaA->m_adl.findAdjacent(ROUTER_B_NAME);
+  BOOST_REQUIRE(b != conf.getAdjacencyList().end());
+
+  // Re-adjust link cost to 0 from both the direction i.e B-A and A-B
+  a->setLinkCost(0);
+  b->setLinkCost(0);
+
+  // Calculation should consider 0 link-cost between B and C
+  LinkStateRoutingTableCalculator calculator(map.getMapSize());
+  calculator.calculatePath(map, routingTable, conf, lsdb.getAdjLsdb());
+
+  // Router A should be able to get to B through B and C
+  RoutingTableEntry* entryB = routingTable.findRoutingTableEntry(ROUTER_B_NAME);
+  BOOST_REQUIRE(entryB != nullptr);
+
+  // Node can have neighbors with zero cost, so the nexthop count should be 2
+  NexthopList& bHopList = entryB->getNexthopList();
+  BOOST_REQUIRE_EQUAL(bHopList.getNextHops().size(), 2);
+
+  const auto nextHopForB = bHopList.getNextHops().begin();
+  // Check if the next hop via B is through A or not after the cost adjustment
+  BOOST_CHECK(nextHopForB->getConnectingFaceUri() == ROUTER_B_FACE &&
+              nextHopForB->getRouteCostAsAdjustedInteger() == 0);
+
+  // Router A should be able to get to C through C and B
+  auto entryC = routingTable.findRoutingTableEntry(ROUTER_C_NAME);
+  BOOST_REQUIRE(entryC != nullptr);
+
+  NexthopList& cHopList = entryC->getNexthopList();
+  BOOST_REQUIRE_EQUAL(cHopList.getNextHops().size(), 2);
+
+  const auto nextHopForC = cHopList.getNextHops().begin();
+  // Check if the nextHop from C is via A or not
+  BOOST_CHECK(nextHopForC->getConnectingFaceUri() == ROUTER_C_FACE &&
+              nextHopForC->getRouteCostAsAdjustedInteger() == LINK_AC_COST);
+
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace test
+} // namespace nlsr
diff --git a/tests/route/test-map-entry.cpp b/tests/route/test-map-entry.cpp
deleted file mode 100644
index 0429dde..0000000
--- a/tests/route/test-map-entry.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * 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.
- *
- * NLSR is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NLSR 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- *
- * \author Ashlesh Gawande <agawande@memphis.edu>
- **/
-
-#include "route/map.hpp"
-#include "tests/boost-test.hpp"
-
-namespace nlsr {
-namespace test {
-
-BOOST_AUTO_TEST_SUITE(TestMapEntry)
-
-BOOST_AUTO_TEST_CASE(MapEntryConstructorAndGetters)
-{
-  std::string rtr = "r0";
-
-  MapEntry me1(rtr, 1);
-
-  BOOST_CHECK_EQUAL(me1.getRouter(), "r0");
-
-  BOOST_CHECK_EQUAL(me1.getMappingNumber(), 1);
-}
-
-BOOST_AUTO_TEST_SUITE_END()
-
-} // namespace test
-} // namespace nlsr
diff --git a/tests/route/test-nexthop-list.cpp b/tests/route/test-nexthop-list.cpp
index 5bdef4d..9ab8572 100644
--- a/tests/route/test-nexthop-list.cpp
+++ b/tests/route/test-nexthop-list.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-2020,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -17,7 +17,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 <http://www.gnu.org/licenses/>.
- **/
+ */
 
 #include "route/nexthop-list.hpp"
 #include "route/nexthop.hpp"
@@ -101,7 +101,7 @@
   NexthopList::iterator it = list.begin();
   BOOST_CHECK_EQUAL(it->getConnectingFaceUri(), hopA.getConnectingFaceUri());
 
-  list.reset();
+  list.clear();
   list.addNextHop(hopZ);
   list.addNextHop(hopA);
 
@@ -118,7 +118,7 @@
   shortUriHop.setRouteCost(25);
   shortUriHop.setConnectingFaceUri("AAA");
 
-  list.reset();
+  list.clear();
   list.addNextHop(longUriHop);
   list.addNextHop(shortUriHop);
 
diff --git a/tests/route/test-nexthop.cpp b/tests/route/test-nexthop.cpp
index 3a6a5fd..a11c221 100644
--- a/tests/route/test-nexthop.cpp
+++ b/tests/route/test-nexthop.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-2020,  The University of Memphis,
  *                           Regents of the University of California
  *
  * This file is part of NLSR (Named-data Link State Routing).
@@ -16,9 +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 <http://www.gnu.org/licenses/>.
- *
- * \author Ashlesh Gawande <agawande@memphis.edu>
- **/
+ */
 
 #include "route/nexthop.hpp"
 #include "tests/boost-test.hpp"
@@ -102,6 +100,50 @@
   BOOST_CHECK(hop1.getRouteCostAsAdjustedInteger() > hop2.getRouteCostAsAdjustedInteger());
 }
 
+const uint8_t NexthopData[] =
+{
+  // Header
+  0x8f, 0x1d,
+  // Uri
+  0x8d, 0x11, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f,
+  0x70, 0x2f, 0x74, 0x6c, 0x76,
+  // Cost
+  0x86, 0x08, 0x3f, 0xfa, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66
+};
+
+BOOST_AUTO_TEST_CASE(NexthopEncode)
+{
+  NextHop nexthops1;
+  nexthops1.setConnectingFaceUri("/test/nexthop/tlv");
+  nexthops1.setRouteCost(1.65);
+
+  const ndn::Block& wire = nexthops1.wireEncode();
+  BOOST_REQUIRE_EQUAL_COLLECTIONS(NexthopData,
+                                  NexthopData + sizeof(NexthopData),
+                                  wire.begin(), wire.end());
+}
+
+BOOST_AUTO_TEST_CASE(NexthopDecode)
+{
+  NextHop nexthops1;
+
+  nexthops1.wireDecode(ndn::Block(NexthopData, sizeof(NexthopData)));
+
+  BOOST_REQUIRE_EQUAL(nexthops1.getConnectingFaceUri(), "/test/nexthop/tlv");
+  BOOST_REQUIRE_EQUAL(nexthops1.getRouteCost(), 1.65);
+}
+
+BOOST_AUTO_TEST_CASE(AdjacencyOutputStream)
+{
+  NextHop nexthops1;
+  nexthops1.setConnectingFaceUri("/test/nexthop/tlv");
+  nexthops1.setRouteCost(99);
+
+  std::ostringstream os;
+  os << nexthops1;
+  BOOST_CHECK_EQUAL(os.str(), "NextHop(Uri: /test/nexthop/tlv, Cost: 99)");
+}
+
 BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace test
diff --git a/tests/route/test-routing-table-entry.cpp b/tests/route/test-routing-table-entry.cpp
index 574abc2..c17b981 100644
--- a/tests/route/test-routing-table-entry.cpp
+++ b/tests/route/test-routing-table-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-2020,  The University of Memphis,
  *                           Regents of the University of California
  *
  * This file is part of NLSR (Named-data Link State Routing).
@@ -16,9 +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 <http://www.gnu.org/licenses/>.
- *
- * \author Ashlesh Gawande <agawande@memphis.edu>
- **/
+ */
 
 #include "route/routing-table-entry.hpp"
 #include "tests/boost-test.hpp"
@@ -35,6 +33,134 @@
   BOOST_CHECK_EQUAL(rte1.getDestination(), "router1");
 }
 
+const uint8_t RoutingTableEntryWithNexthopsData[] =
+{
+  // Header
+  0x91, 0x35,
+  // Destination Name
+  0x07, 0x07, 0x08, 0x05, 0x64, 0x65, 0x73, 0x74, 0x31, 0x8f, 0x14,
+  // Nexthop
+  0x8d, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f, 0x70, 0x31, 0x86, 0x08, 0x3f, 0xfa,
+  0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x8f, 0x14, 0x8d, 0x08,
+  // Nexthop
+  0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f, 0x70, 0x32, 0x86, 0x08, 0x3f, 0xfa, 0x66, 0x66,
+  0x66, 0x66, 0x66, 0x66
+};
+
+const uint8_t RoutingTableEntryWithoutNexthopsData[] =
+{
+  // Header
+  0x91, 0x09,
+  // Destination Name
+  0x07, 0x07, 0x08, 0x05, 0x64, 0x65, 0x73, 0x74, 0x31
+};
+
+BOOST_AUTO_TEST_CASE(RoutingTableEntryEncodeWithNexthops)
+{
+  RoutingTableEntry rte(ndn::Name("dest1"));
+
+  NextHop nexthops1;
+  nexthops1.setConnectingFaceUri("nexthop1");
+  nexthops1.setRouteCost(1.65);
+  rte.getNexthopList().addNextHop(nexthops1);
+
+  NextHop nexthops2;
+  nexthops2.setConnectingFaceUri("nexthop2");
+  nexthops2.setRouteCost(1.65);
+  rte.getNexthopList().addNextHop(nexthops2);
+
+  const ndn::Block& wire = rte.wireEncode();
+
+  BOOST_REQUIRE_EQUAL_COLLECTIONS(RoutingTableEntryWithNexthopsData,
+                                  RoutingTableEntryWithNexthopsData +
+                                    sizeof(RoutingTableEntryWithNexthopsData),
+                                  wire.begin(), wire.end());
+}
+
+BOOST_AUTO_TEST_CASE(RoutingTableEntryDecodeWithNexthops)
+{
+  RoutingTableEntry rte(ndn::Block(RoutingTableEntryWithNexthopsData,
+                                   sizeof(RoutingTableEntryWithNexthopsData)));
+  BOOST_CHECK_EQUAL(rte.getDestination(), "dest1");
+
+  BOOST_CHECK(rte.getNexthopList().size() != 0);
+  auto it = rte.getNexthopList().begin();
+  BOOST_CHECK_EQUAL(it->getConnectingFaceUri(), "nexthop1");
+  BOOST_CHECK_EQUAL(it->getRouteCost(), 1.65);
+
+  it++;
+  BOOST_CHECK_EQUAL(it->getConnectingFaceUri(), "nexthop2");
+  BOOST_CHECK_EQUAL(it->getRouteCost(), 1.65);
+}
+
+BOOST_AUTO_TEST_CASE(RoutingTableEntryEncodeWithoutNexthops)
+{
+  RoutingTableEntry rte(ndn::Name("dest1"));
+
+  auto wire = rte.wireEncode();
+
+  BOOST_REQUIRE_EQUAL_COLLECTIONS(RoutingTableEntryWithoutNexthopsData,
+                                  RoutingTableEntryWithoutNexthopsData +
+                                    sizeof(RoutingTableEntryWithoutNexthopsData),
+                                  wire.begin(), wire.end());
+}
+
+BOOST_AUTO_TEST_CASE(RoutingTableEntryDecodeWithoutNexthops)
+{
+  RoutingTableEntry rte(ndn::Block(RoutingTableEntryWithoutNexthopsData,
+                                   sizeof(RoutingTableEntryWithoutNexthopsData)));
+
+  BOOST_CHECK_EQUAL(rte.getDestination(), "dest1");
+  BOOST_CHECK(rte.getNexthopList().size() == 0);
+}
+
+
+BOOST_AUTO_TEST_CASE(RoutingTableEntryClear)
+{
+  RoutingTableEntry rte(ndn::Name("dest1"));
+
+  NextHop nexthops1;
+  nexthops1.setConnectingFaceUri("nexthop1");
+  nexthops1.setRouteCost(99);
+  rte.getNexthopList().addNextHop(nexthops1);
+
+  BOOST_CHECK_EQUAL(rte.getNexthopList().size(), 1);
+
+  auto it = rte.getNexthopList().begin();
+  BOOST_CHECK_EQUAL(it->getConnectingFaceUri(), "nexthop1");
+  BOOST_CHECK_EQUAL(it->getRouteCost(), 99);
+
+  rte.getNexthopList().clear();
+  BOOST_CHECK_EQUAL(rte.getNexthopList().size(), 0);
+
+  NextHop nexthops2;
+  nexthops2.setConnectingFaceUri("nexthop2");
+  nexthops2.setRouteCost(99);
+  rte.getNexthopList().addNextHop(nexthops2);
+
+  BOOST_CHECK_EQUAL(rte.getNexthopList().size(), 1);
+  it =  rte.getNexthopList().begin();
+  BOOST_CHECK_EQUAL(it->getConnectingFaceUri(), "nexthop2");
+  BOOST_CHECK_EQUAL(it->getRouteCost(), 99);
+}
+
+BOOST_AUTO_TEST_CASE(RoutingTableEntryOutputStream)
+{
+  RoutingTableEntry rte(ndn::Name("dest1"));
+
+  NextHop nexthops1;
+  nexthops1.setConnectingFaceUri("nexthop1");
+  nexthops1.setRouteCost(99);
+  rte.getNexthopList().addNextHop(nexthops1);
+
+  std::ostringstream os;
+  os << rte;
+
+  BOOST_CHECK_EQUAL(os.str(),
+                    "  Destination: /dest1\n"
+                    "    NextHop(Uri: nexthop1, Cost: 99)\n");
+}
+
 BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace test
diff --git a/tests/route/test-routing-table.cpp b/tests/route/test-routing-table.cpp
index f8a7df5..0bce153 100644
--- a/tests/route/test-routing-table.cpp
+++ b/tests/route/test-routing-table.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2020,  The University of Memphis,
  *                           Regents of the University of California
  *
@@ -16,9 +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 <http://www.gnu.org/licenses/>.
- *
- * \author Ashlesh Gawande <agawande@memphis.edu>
- **/
+ */
 
 #include "route/routing-table.hpp"
 #include "nlsr.hpp"
@@ -30,23 +28,106 @@
 namespace nlsr {
 namespace test {
 
-BOOST_FIXTURE_TEST_SUITE(TestRoutingTable, BaseFixture)
-
-BOOST_AUTO_TEST_CASE(RoutingTableAddNextHop)
+class RoutingTableFixture
 {
+public:
+  RoutingTableFixture()
+    : conf(face, keyChain)
+    , nlsr(face, keyChain, conf)
+    , rt(nlsr.m_routingTable)
+  {
+  }
+
+public:
   ndn::util::DummyClientFace face;
   ndn::KeyChain keyChain;
-  ConfParameter conf(face, keyChain);
-  Nlsr nlsr(face, keyChain, conf);
+  ConfParameter conf;
+  Nlsr nlsr;
 
-  RoutingTable rt1(m_scheduler, nlsr.m_fib, nlsr.m_lsdb,
-                   nlsr.m_namePrefixTable, conf);
+  RoutingTable& rt;
+};
 
+BOOST_AUTO_TEST_SUITE(TestRoutingTable)
+
+BOOST_FIXTURE_TEST_CASE(RoutingTableAddNextHop, RoutingTableFixture)
+{
   NextHop nh1;
   const std::string DEST_ROUTER = "destRouter";
-  rt1.addNextHop(DEST_ROUTER, nh1);
+  rt.addNextHop(DEST_ROUTER, nh1);
 
-  BOOST_CHECK_EQUAL(rt1.findRoutingTableEntry(DEST_ROUTER)->getDestination(), DEST_ROUTER);
+  BOOST_CHECK_EQUAL(rt.findRoutingTableEntry(DEST_ROUTER)->getDestination(), DEST_ROUTER);
+}
+
+const uint8_t RoutingTableData1[] =
+{
+  // Header
+  0x90, 0x20,
+  // Routing table entry
+  0x91, 0x1e,
+  // Destination
+  0x07, 0x07, 0x08, 0x05, 0x64, 0x65, 0x73, 0x74, 0x31, 0x8f, 0x13,
+  // Nexthop
+  0x8d, 0x07, 0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f, 0x70, 0x86, 0x08, 0x3f, 0xfa, 0x66,
+  0x66, 0x66, 0x66, 0x66, 0x66
+};
+
+const uint8_t RoutingTableData2[] =
+{
+  // Header
+  0x90, 0x00
+};
+
+BOOST_FIXTURE_TEST_CASE(RoutingTableEncode1, RoutingTableFixture)
+{
+  NextHop nexthops;
+  nexthops.setConnectingFaceUri("nexthop");
+  nexthops.setRouteCost(1.65);
+  rt.addNextHop("dest1", nexthops);
+
+  auto wire = rt.wireEncode();
+  BOOST_REQUIRE_EQUAL_COLLECTIONS(RoutingTableData1,
+                                  RoutingTableData1 + sizeof(RoutingTableData1),
+                                  wire.begin(), wire.end());
+}
+
+BOOST_FIXTURE_TEST_CASE(RoutingTableEncode2, RoutingTableFixture)
+{
+  auto wire = rt.wireEncode();
+  BOOST_REQUIRE_EQUAL_COLLECTIONS(RoutingTableData2,
+                                  RoutingTableData2 + sizeof(RoutingTableData2),
+                                  wire.begin(), wire.end());
+}
+
+BOOST_FIXTURE_TEST_CASE(RoutingTableDecode1, RoutingTableFixture)
+{
+  RoutingTableStatus rtStatus(ndn::Block(RoutingTableData1, sizeof(RoutingTableData1)));
+
+  auto it1 = rtStatus.m_rTable.begin();
+
+  ndn::Name des1 = it1->getDestination();
+  BOOST_CHECK_EQUAL(des1, "dest1");
+
+  auto it2 = it1->getNexthopList().begin();
+  BOOST_CHECK_EQUAL(it2->getConnectingFaceUri(), "nexthop");
+  BOOST_CHECK_EQUAL(it2->getRouteCost(), 1.65);
+
+  BOOST_CHECK_EQUAL(rtStatus.m_rTable.size(), 1);
+}
+
+BOOST_FIXTURE_TEST_CASE(RoutingTableOutputStream, RoutingTableFixture)
+{
+  NextHop nexthops;
+  nexthops.setConnectingFaceUri("nexthop");
+  nexthops.setRouteCost(99);
+  rt.addNextHop("dest1", nexthops);
+
+  std::ostringstream os;
+  os << rt;
+
+  BOOST_CHECK_EQUAL(os.str(),
+                    "Routing Table:\n"
+                    "  Destination: /dest1\n"
+                    "    NextHop(Uri: nexthop, Cost: 99)\n");
 }
 
 BOOST_AUTO_TEST_SUITE_END()
