tests: respect naming conventions and improve nesting of some test suites

Change-Id: I255c27b552b32570871a9d5f8bda814ba8723c80
Refs: #2497
diff --git a/tests/unit-tests/encoding/block-helpers.t.cpp b/tests/unit-tests/encoding/block-helpers.t.cpp
index 01f0ddb..c4afa40 100644
--- a/tests/unit-tests/encoding/block-helpers.t.cpp
+++ b/tests/unit-tests/encoding/block-helpers.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -20,15 +20,16 @@
  */
 
 #include "encoding/block-helpers.hpp"
+#include "name.hpp"
 
 #include "boost-test.hpp"
-#include "name.hpp"
 
 namespace ndn {
 namespace encoding {
 namespace tests {
 
-BOOST_AUTO_TEST_SUITE(EncodingBlockHelpers)
+BOOST_AUTO_TEST_SUITE(Encoding)
+BOOST_AUTO_TEST_SUITE(TestBlockHelpers)
 
 BOOST_AUTO_TEST_CASE(NonNegativeInteger)
 {
@@ -86,7 +87,8 @@
   BOOST_CHECK(*b1.elements().begin() == name.wireEncode());
 }
 
-BOOST_AUTO_TEST_SUITE_END() // EncodingBlockHelpers
+BOOST_AUTO_TEST_SUITE_END() // TestBlockHelpers
+BOOST_AUTO_TEST_SUITE_END() // Encoding
 
 } // namespace tests
 } // namespace encoding
diff --git a/tests/unit-tests/encoding/block.t.cpp b/tests/unit-tests/encoding/block.t.cpp
index 7fcf0fd..599f37c 100644
--- a/tests/unit-tests/encoding/block.t.cpp
+++ b/tests/unit-tests/encoding/block.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -19,16 +19,20 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#include "encoding/encoding-buffer.hpp"
-#include "encoding/buffer-stream.hpp"
+#include "encoding/block.hpp"
 #include "encoding/block-helpers.hpp"
+#include "encoding/encoding-buffer.hpp"
 
 #include "boost-test.hpp"
 
+#include <boost/iostreams/device/array.hpp>
+#include <boost/iostreams/stream.hpp>
+
 namespace ndn {
 namespace tests {
 
-BOOST_AUTO_TEST_SUITE(EncodingBlock)
+BOOST_AUTO_TEST_SUITE(Encoding)
+BOOST_AUTO_TEST_SUITE(TestBlock)
 
 class BasicBlockFixture
 {
@@ -167,7 +171,9 @@
 
 BOOST_AUTO_TEST_SUITE_END() // Basic
 
-BOOST_AUTO_TEST_CASE(BlockFromBlock)
+BOOST_AUTO_TEST_SUITE(Construction)
+
+BOOST_AUTO_TEST_CASE(FromBlock)
 {
   static uint8_t buffer[] = {0x80, 0x06, 0x81, 0x01, 0x01, 0x82, 0x01, 0x01};
   Block block(buffer, sizeof(buffer));
@@ -186,7 +192,7 @@
   BOOST_CHECK_THROW(Block(block, otherBuffer.begin(), otherBuffer.end()), Block::Error);
 }
 
-BOOST_AUTO_TEST_CASE(BlockFromBlockCopyOnWriteModifyOrig)
+BOOST_AUTO_TEST_CASE(FromBlockCopyOnWriteModifyOriginal)
 {
   static uint8_t buffer[] = {
     0x05, 0x0b, 0x07, 0x03, 0x01, 0x02, 0x03, 0x0a, 0x04, 0x04, 0x05, 0x06, 0x07,
@@ -207,7 +213,7 @@
   BOOST_CHECK_EQUAL(buf2, block2.getBuffer());
 }
 
-BOOST_AUTO_TEST_CASE(BlockFromBlockCopyOnWriteModifyCopy)
+BOOST_AUTO_TEST_CASE(FromBlockCopyOnWriteModifyCopy)
 {
   static uint8_t buffer[] = {
     0x05, 0x0b, 0x07, 0x03, 0x01, 0x02, 0x03, 0x0a, 0x04, 0x04, 0x05, 0x06, 0x07,
@@ -228,7 +234,7 @@
   BOOST_CHECK_EQUAL(buf1, block1.getBuffer());
 }
 
-BOOST_AUTO_TEST_CASE(EncodingBufferToBlock)
+BOOST_AUTO_TEST_CASE(FromEncodingBuffer)
 {
   uint8_t value[4];
 
@@ -247,10 +253,11 @@
   BOOST_CHECK_EQUAL(block.value_size(), sizeof(value));
 }
 
-BOOST_AUTO_TEST_CASE(BlockToBuffer)
+BOOST_AUTO_TEST_CASE(ToEncodingBuffer)
 {
   shared_ptr<Buffer> buf = make_shared<Buffer>(10);
-  for (int i = 0; i < 10; i++) (*buf)[i] = i;
+  for (int i = 0; i < 10; i++)
+    (*buf)[i] = i;
 
   Block block(0xab, buf);
   block.encode();
@@ -343,7 +350,6 @@
   typedef boost::iostreams::stream<boost::iostreams::array_source> ArrayStream;
   ArrayStream stream(reinterpret_cast<const char*>(TEST_BUFFER), sizeof(TEST_BUFFER));
 
-
   Block testBlock;
   BOOST_REQUIRE_NO_THROW(testBlock = Block::fromStream(stream));
   BOOST_CHECK_EQUAL(testBlock.type(), 0);
@@ -401,6 +407,8 @@
   BOOST_CHECK_EQUAL(block.value_size(), 0);
 }
 
+BOOST_AUTO_TEST_SUITE_END() // Construction
+
 BOOST_AUTO_TEST_CASE(Equality)
 {
   BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Block>));
@@ -559,7 +567,8 @@
   BOOST_CHECK(readString(elements[1]).compare("ndn:/test-prefix") == 0);
 }
 
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestBlock
+BOOST_AUTO_TEST_SUITE_END() // Encoding
 
 } // namespace tests
 } // namespace ndn
diff --git a/tests/unit-tests/encoding/buffer-stream.t.cpp b/tests/unit-tests/encoding/buffer-stream.t.cpp
index 2e37e25..9c712ea 100644
--- a/tests/unit-tests/encoding/buffer-stream.t.cpp
+++ b/tests/unit-tests/encoding/buffer-stream.t.cpp
@@ -65,6 +65,9 @@
   auto os = make_unique<OBufferStream>();
   *os << 'x';
   os.reset(); // should not cause use-after-free
+
+  // avoid "test case [...] did not check any assertions" message from Boost.Test
+  BOOST_CHECK(true);
 }
 
 BOOST_AUTO_TEST_SUITE_END() // TestBufferStream
diff --git a/tests/unit-tests/encoding/encoder.t.cpp b/tests/unit-tests/encoding/encoder.t.cpp
index b48569d..2534419 100644
--- a/tests/unit-tests/encoding/encoder.t.cpp
+++ b/tests/unit-tests/encoding/encoder.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -27,7 +27,8 @@
 namespace encoding {
 namespace tests {
 
-BOOST_AUTO_TEST_SUITE(EncodingEncoder)
+BOOST_AUTO_TEST_SUITE(Encoding)
+BOOST_AUTO_TEST_SUITE(TestEncoder)
 
 BOOST_AUTO_TEST_CASE(Basic)
 {
@@ -164,7 +165,8 @@
   BOOST_CHECK_GT(e.capacity(), 2000);
 }
 
-BOOST_AUTO_TEST_SUITE_END() // EncodingEncoder
+BOOST_AUTO_TEST_SUITE_END() // TestEncoder
+BOOST_AUTO_TEST_SUITE_END() // Encoding
 
 } // namespace tests
 } // namespace encoding
diff --git a/tests/unit-tests/encoding/estimator.t.cpp b/tests/unit-tests/encoding/estimator.t.cpp
index b759489..700ea95 100644
--- a/tests/unit-tests/encoding/estimator.t.cpp
+++ b/tests/unit-tests/encoding/estimator.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -27,7 +27,8 @@
 namespace encoding {
 namespace tests {
 
-BOOST_AUTO_TEST_SUITE(EncodingEstimator)
+BOOST_AUTO_TEST_SUITE(Encoding)
+BOOST_AUTO_TEST_SUITE(TestEstimator)
 
 BOOST_AUTO_TEST_CASE(Basic)
 {
@@ -113,7 +114,8 @@
   BOOST_CHECK_EQUAL(e.appendBlock(block2), 7);
 }
 
-BOOST_AUTO_TEST_SUITE_END() // EncodingEstimator
+BOOST_AUTO_TEST_SUITE_END() // TestEstimator
+BOOST_AUTO_TEST_SUITE_END() // Encoding
 
 } // namespace tests
 } // namespace encoding
diff --git a/tests/unit-tests/encoding/nfd-constants.t.cpp b/tests/unit-tests/encoding/nfd-constants.t.cpp
index 889f94a..6146307 100644
--- a/tests/unit-tests/encoding/nfd-constants.t.cpp
+++ b/tests/unit-tests/encoding/nfd-constants.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -18,6 +18,7 @@
  *
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
+
 #include "encoding/nfd-constants.hpp"
 
 #include "boost-test.hpp"
diff --git a/tests/unit-tests/encoding/tlv.t.cpp b/tests/unit-tests/encoding/tlv.t.cpp
index 763d628..635aecf 100644
--- a/tests/unit-tests/encoding/tlv.t.cpp
+++ b/tests/unit-tests/encoding/tlv.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -22,20 +22,19 @@
 #include "encoding/tlv.hpp"
 
 #include "boost-test.hpp"
+
 #include <boost/iostreams/stream.hpp>
+#include <boost/iostreams/device/array.hpp>
 
 namespace ndn {
 namespace tlv {
 namespace tests {
 
-using std::ostringstream;
+BOOST_AUTO_TEST_SUITE(Encoding)
+BOOST_AUTO_TEST_SUITE(TestTlv)
 
-BOOST_AUTO_TEST_SUITE(EncodingTlv)
-
-BOOST_AUTO_TEST_CASE(Exception)
-{
-  BOOST_CHECK_THROW(throw Error("Test"), Error);
-}
+using ArrayStream = boost::iostreams::stream<boost::iostreams::array_source>;
+using Iterator = std::istream_iterator<uint8_t>;
 
 BOOST_AUTO_TEST_SUITE(VarNumber)
 
@@ -58,7 +57,7 @@
 
 BOOST_AUTO_TEST_CASE(Write)
 {
-  ostringstream os;
+  std::ostringstream os;
 
   writeVarNumber(os, 1);
   writeVarNumber(os, 252);
@@ -143,9 +142,6 @@
 
 BOOST_AUTO_TEST_CASE(ReadFromStream)
 {
-  typedef boost::iostreams::stream<boost::iostreams::array_source> ArrayStream;
-  typedef std::istream_iterator<uint8_t> Iterator;
-
   Iterator end; // end of stream
   uint64_t value;
   {
@@ -300,7 +296,7 @@
 
 BOOST_AUTO_TEST_CASE(Write)
 {
-  ostringstream os;
+  std::ostringstream os;
 
   writeNonNegativeInteger(os, 1);
   writeNonNegativeInteger(os, 257);
@@ -315,7 +311,6 @@
                                 actual, actual + sizeof(BUFFER));
 }
 
-
 BOOST_AUTO_TEST_CASE(ReadFromBuffer)
 {
   const uint8_t* begin;
@@ -347,9 +342,6 @@
 
 BOOST_AUTO_TEST_CASE(ReadFromStream)
 {
-  typedef boost::iostreams::stream<boost::iostreams::array_source> ArrayStream;
-  typedef std::istream_iterator<uint8_t> Iterator;
-
   Iterator end; // end of stream
   uint64_t value;
   {
@@ -409,7 +401,8 @@
 
 BOOST_AUTO_TEST_SUITE_END() // NonNegativeInteger
 
-BOOST_AUTO_TEST_SUITE_END() // EncodingTlv
+BOOST_AUTO_TEST_SUITE_END() // TestTlv
+BOOST_AUTO_TEST_SUITE_END() // Encoding
 
 } // namespace tests
 } // namespace tlv