tlv: Use the encoding/decoding functions for "double" from ndn-cxx

refs: #4615

Change-Id: I0bde7085876646f272ee6006f4d3cfbd513d4ffd
diff --git a/tests/tlv/test-adjacency-lsa.cpp b/tests/tlv/test-adjacency-lsa.cpp
index 5959535..65fe2b6 100644
--- a/tests/tlv/test-adjacency-lsa.cpp
+++ b/tests/tlv/test-adjacency-lsa.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.
  *
@@ -24,7 +24,7 @@
 #include "../boost-test.hpp"
 
 namespace nlsr {
-namespace tlv  {
+namespace tlv {
 namespace test {
 
 BOOST_AUTO_TEST_SUITE(TlvTestAdjacencyLsa)
@@ -50,7 +50,7 @@
   0x83, 0x13,
   // LsaInfo
   0x80, 0x11, 0x81, 0x08, 0x07, 0x06, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x82, 0x01,
-  0x80, 0x8b, 0x02, 0x27, 0x10,
+  0x80, 0x8b, 0x02, 0x27, 0x10
 };
 
 BOOST_AUTO_TEST_CASE(AdjacencyLsaEncodeWithAdjacencies)
diff --git a/tests/tlv/test-adjacency.cpp b/tests/tlv/test-adjacency.cpp
index 3126073..b271a62 100644
--- a/tests/tlv/test-adjacency.cpp
+++ b/tests/tlv/test-adjacency.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.
  *
@@ -24,7 +24,7 @@
 #include "../boost-test.hpp"
 
 namespace nlsr {
-namespace tlv  {
+namespace tlv {
 namespace test {
 
 BOOST_AUTO_TEST_SUITE(TlvTestAdjacency)
diff --git a/tests/tlv/test-coordinate-lsa.cpp b/tests/tlv/test-coordinate-lsa.cpp
index fa05d95..dc289ca 100644
--- a/tests/tlv/test-coordinate-lsa.cpp
+++ b/tests/tlv/test-coordinate-lsa.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.
  *
@@ -32,14 +32,15 @@
 const uint8_t CoordinateLsaData[] =
 {
   // Header
-  0x85, 0x2b,
+  0x85, 0x27,
   // LsaInfo
   0x80, 0x11, 0x81, 0x08, 0x07, 0x06, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x82, 0x01,
   0x80, 0x8b, 0x02, 0x27, 0x10,
   // HyperbolicRadius
-  0x87, 0x0a, 0x86, 0x08, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfa, 0x3f,
+  0x87, 0x08, 0x3f, 0xfa, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
   // HyperbolicAngle
-  0x88, 0x0a, 0x86, 0x08, 0x7b, 0x14, 0xae, 0x47, 0xe1, 0x7a, 0xfc, 0x3f
+  0x88, 0x08, 0x3f, 0xfc, 0x7a, 0xe1, 0x47, 0xae, 0x14, 0x7b
+
 };
 
 BOOST_AUTO_TEST_CASE(CoordinateLsaEncode)
diff --git a/tests/tlv/test-lsdb-status.cpp b/tests/tlv/test-lsdb-status.cpp
index 12284e8..c058fb1 100644
--- a/tests/tlv/test-lsdb-status.cpp
+++ b/tests/tlv/test-lsdb-status.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.
  *
@@ -34,7 +34,7 @@
 const uint8_t LsdbStatusData1[] =
 {
   // Header
-  0x8a, 0x7f,
+  0x8a, 0x7b,
   // AdjacencyLsa
   0x83, 0x32,
     // LsaInfo
@@ -44,15 +44,15 @@
     0x84, 0x1d, 0x07, 0x0c, 0x08, 0x0a, 0x61, 0x64, 0x6a, 0x61, 0x63, 0x65, 0x6e, 0x63,
     0x79, 0x31, 0x8d, 0x0a, 0x61, 0x64, 0x6a, 0x61, 0x63, 0x65, 0x6e, 0x63, 0x79, 0x31,
     0x8c, 0x01, 0x80,
-  // CoordianteLsa
-  0x85, 0x2b,
+  // CoordinateLsa
+  0x85, 0x27,
     // LsaInfo
     0x80, 0x11, 0x81, 0x08, 0x07, 0x06, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x82, 0x01,
     0x80, 0x8b, 0x02, 0x27, 0x10,
     // HyperbolicRadius
-    0x87, 0x0a, 0x86, 0x08, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfa, 0x3f,
+    0x87, 0x08, 0x3f, 0xfa, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
     // HyperbolicAngle
-    0x88, 0x0a, 0x86, 0x08, 0x7b, 0x14, 0xae, 0x47, 0xe1, 0x7a, 0xfc, 0x3f,
+    0x88, 0x08, 0x3f, 0xfc, 0x7a, 0xe1, 0x47, 0xae, 0x14, 0x7b,
   // NameLsa
   0x89, 0x1c,
     // LsaInfo
@@ -71,16 +71,16 @@
 const uint8_t LsdbStatusData3[] =
 {
   // Header
-  0x8a, 0x7f,
+  0x8a, 0x7b,
   // CoordianteLsa
-  0x85, 0x2b,
+  0x85, 0x27,
     // LsaInfo
     0x80, 0x11, 0x81, 0x08, 0x07, 0x06, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x82, 0x01,
-    0x80, 0x8b, 0x02, 0x27, 0x10,
+    0x80, 0x8B, 0x02, 0x27, 0x10,
     // HyperbolicRadius
-    0x87, 0x0a, 0x86, 0x08, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfa, 0x3f,
+    0x87, 0x08, 0x3F, 0xFA, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
     // HyperbolicAngle
-    0x88, 0x0a, 0x86, 0x08, 0x7b, 0x14, 0xae, 0x47, 0xe1, 0x7a, 0xfc, 0x3f,
+    0x88, 0x08, 0x3F, 0xFC, 0x7A, 0xE1, 0x47, 0xAE, 0x14, 0x7B,
   // NameLsa
   0x89, 0x1c,
     // LsaInfo
@@ -89,14 +89,14 @@
     // Name
     0x07, 0x07, 0x08, 0x05, 0x6e, 0x61, 0x6d, 0x65, 0x31,
   // AdjacencyLsa
-   0x83, 0x32,
-     // LsaInfo
-     0x80, 0x11, 0x81, 0x08, 0x07, 0x06, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x82, 0x01,
-     0x80, 0x8b, 0x02, 0x27, 0x10,
-     // Adjacency
-     0x84, 0x1d, 0x07, 0x0c, 0x08, 0x0a, 0x61, 0x64, 0x6a, 0x61, 0x63, 0x65, 0x6e, 0x63,
-     0x79, 0x31, 0x8d, 0x0a, 0x61, 0x64, 0x6a, 0x61, 0x63, 0x65, 0x6e, 0x63, 0x79, 0x31,
-     0x8c, 0x01, 0x80
+  0x83, 0x32,
+    // LsaInfo
+    0x80, 0x11, 0x81, 0x08, 0x07, 0x06, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x82, 0x01,
+    0x80, 0x8B, 0x02, 0x27, 0x10,
+    // Adjacency
+    0x84, 0x1d, 0x07, 0x0c, 0x08, 0x0a, 0x61, 0x64, 0x6a, 0x61, 0x63, 0x65, 0x6e, 0x63,
+    0x79, 0x31, 0x8d, 0x0a, 0x61, 0x64, 0x6a, 0x61, 0x63, 0x65, 0x6e, 0x63, 0x79, 0x31,
+    0x8c, 0x01, 0x80
 };
 
 BOOST_AUTO_TEST_CASE(LsdbStatusEncode1)
@@ -150,7 +150,6 @@
   LsdbStatus lsdbStatus;
 
   const ndn::Block& wire = lsdbStatus.wireEncode();
-
   BOOST_REQUIRE_EQUAL_COLLECTIONS(LsdbStatusData2,
                                   LsdbStatusData2 + sizeof(LsdbStatusData2),
                                   wire.begin(), wire.end());
diff --git a/tests/tlv/test-name-lsa.cpp b/tests/tlv/test-name-lsa.cpp
index b84b12f..f5ce311 100644
--- a/tests/tlv/test-name-lsa.cpp
+++ b/tests/tlv/test-name-lsa.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.
  *
@@ -24,7 +24,7 @@
 #include "../boost-test.hpp"
 
 namespace nlsr {
-namespace tlv  {
+namespace tlv {
 namespace test {
 
 BOOST_AUTO_TEST_SUITE(TlvTestNameLsa)
diff --git a/tests/tlv/test-nexthops.cpp b/tests/tlv/test-nexthops.cpp
index 9e8158f..1714bbf 100644
--- a/tests/tlv/test-nexthops.cpp
+++ b/tests/tlv/test-nexthops.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.
  *
@@ -32,11 +32,12 @@
 const uint8_t NexthopData[] =
 {
   // Header
-  0x8f, 0x1f,
+  0x8f, 0x1d,
   // Uri
-  0x8d, 0x11, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f, 0x70, 0x2f, 0x74, 0x6c, 0x76,
+  0x8d, 0x11, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f,
+  0x70, 0x2f, 0x74, 0x6c, 0x76,
   // Cost
-  0x86, 0x0a, 0x86, 0x08, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfa, 0x3f
+  0x86, 0x08, 0x3f, 0xfa, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66
 };
 
 BOOST_AUTO_TEST_CASE(NexthopEncode)
@@ -46,7 +47,6 @@
   nexthops1.setCost(1.65);
 
   const ndn::Block& wire = nexthops1.wireEncode();
-
   BOOST_REQUIRE_EQUAL_COLLECTIONS(NexthopData,
                                   NexthopData + sizeof(NexthopData),
                                   wire.begin(), wire.end());
diff --git a/tests/tlv/test-nlsr.cpp b/tests/tlv/test-nlsr.cpp
deleted file mode 100644
index 43d1487..0000000
--- a/tests/tlv/test-nlsr.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2018,  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 "tlv/tlv-nlsr.hpp"
-
-#include "../boost-test.hpp"
-
-#include <ndn-cxx/encoding/estimator.hpp>
-#include <ndn-cxx/encoding/encoding-buffer.hpp>
-#include <ndn-cxx/encoding/block-helpers.hpp>
-
-namespace nlsr {
-namespace tlv {
-namespace test {
-
-BOOST_AUTO_TEST_SUITE(TlvTestNlsr)
-
-BOOST_AUTO_TEST_CASE(TestDouble)
-{
-  ndn::Block block = ndn::encoding::makeNonNegativeIntegerBlock(0x01, 1);
-  BOOST_CHECK_THROW(ndn::tlv::nlsr::readDouble(block), ndn::tlv::Error);
-
-  double value = 1.65;
-  uint32_t type = 0x251;
-
-  ndn::encoding::EncodingEstimator estimator;
-  size_t totalLength = ndn::tlv::nlsr::prependDouble(estimator, type, value);
-
-  ndn::encoding::EncodingBuffer encoder(totalLength, 0);
-  ndn::tlv::nlsr::prependDouble(encoder, type, value);
-
-  BOOST_CHECK_CLOSE(value, ndn::tlv::nlsr::readDouble(encoder.block()), 0.001);
-}
-
-BOOST_AUTO_TEST_SUITE_END()
-
-} // namespace test
-} // namespace tlv
-} // namespace nlsr
diff --git a/tests/tlv/test-routing-table-entry.cpp b/tests/tlv/test-routing-table-entry.cpp
index deaad1c..9415210 100644
--- a/tests/tlv/test-routing-table-entry.cpp
+++ b/tests/tlv/test-routing-table-entry.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.
  *
@@ -32,15 +32,15 @@
 const uint8_t RoutingTableEntryWithNexthopsData[] =
 {
   // Header
-  0x91, 0x3b,
+  0x91, 0x37,
   // Destination
   0x8e, 0x09, 0x07, 0x07, 0x08, 0x05, 0x64, 0x65, 0x73, 0x74, 0x31,
   // Nexthop
-  0x8f, 0x16, 0x8d, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f, 0x70,
-  0x31, 0x86, 0x0a, 0x86, 0x08, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfa, 0x3f,
+  0x8f, 0x14, 0x8d, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f, 0x70, 0x31, 0x86, 0x08,
+  0x3f, 0xfa, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x8f, 0x14,
   // Nexthop
-  0x8f, 0x16, 0x8d, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f, 0x70,
-  0x32, 0x86, 0x0a, 0x86, 0x08, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfa, 0x3f
+  0x8d, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f, 0x70, 0x32, 0x86, 0x08, 0x3f, 0xfa,
+  0x66, 0x66, 0x66, 0x66, 0x66, 0x66
 };
 
 const uint8_t RoutingTableEntryWithoutNexthopsData[] =
diff --git a/tests/tlv/test-routing-table.cpp b/tests/tlv/test-routing-table.cpp
index 85a9850..6e9ce43 100644
--- a/tests/tlv/test-routing-table.cpp
+++ b/tests/tlv/test-routing-table.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.
  *
@@ -32,14 +32,14 @@
 const uint8_t RoutingTableData1[] =
 {
   // Header
-  0x90, 0x24,
+  0x90, 0x22,
   // Routing table entry
-  0x91, 0x22,
-    // Destination
-    0x8e, 0x09, 0x07, 0x07, 0x08, 0x05, 0x64, 0x65, 0x73, 0x74, 0x31,
-    // Nexthop
-    0x8f, 0x15, 0x8d, 0x07, 0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f, 0x70,
-    0x86, 0x0a, 0x86, 0x08, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfa, 0x3f
+  0x91, 0x20,
+  // Destination
+  0x8e, 0x09, 0x07, 0x07, 0x08, 0x05, 0x64, 0x65, 0x73, 0x74, 0x31,
+  // Nexthop
+  0x8f, 0x13, 0x8d, 0x07, 0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f, 0x70, 0x86, 0x08, 0x3f,
+  0xfa, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66
 };
 
 const uint8_t RoutingTableData2[] =