tests: respect naming conventions and improve nesting of some test suites
Change-Id: I255c27b552b32570871a9d5f8bda814ba8723c80
Refs: #2497
diff --git a/src/util/in-memory-storage.cpp b/src/util/in-memory-storage.cpp
index 7d3584c..69f2b5a 100644
--- a/src/util/in-memory-storage.cpp
+++ b/src/util/in-memory-storage.cpp
@@ -21,7 +21,6 @@
#include "in-memory-storage.hpp"
#include "in-memory-storage-entry.hpp"
-#include "util/backports.hpp"
#include "crypto.hpp"
diff --git a/tests/integrated/scheduler-benchmark.cpp b/tests/integrated/scheduler-benchmark.cpp
index 6166899..16a6bdc 100644
--- a/tests/integrated/scheduler-benchmark.cpp
+++ b/tests/integrated/scheduler-benchmark.cpp
@@ -21,7 +21,7 @@
#define BOOST_TEST_MAIN 1
#define BOOST_TEST_DYN_LINK 1
-#define BOOST_TEST_MODULE Scheduler Benchmark
+#define BOOST_TEST_MODULE ndn-cxx Scheduler Benchmark
#include "util/scheduler.hpp"
diff --git a/tests/main.cpp b/tests/main.cpp
index aa2f330..cf03e21 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#define BOOST_TEST_MODULE ndn-cxx Unit Tests
+#define BOOST_TEST_MODULE ndn-cxx Tests
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_ALTERNATIVE_INIT_API
diff --git a/tests/unit-tests/data.t.cpp b/tests/unit-tests/data.t.cpp
index aa1a6c8..2940c77 100644
--- a/tests/unit-tests/data.t.cpp
+++ b/tests/unit-tests/data.t.cpp
@@ -358,7 +358,7 @@
"sha256digest=28bad4b5275bd392dbb670c75cf0b66f13f7942b21e80f55c0e86b374753a548");
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestData
} // namespace tests
} // namespace ndn
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
diff --git a/tests/unit-tests/exclude.t.cpp b/tests/unit-tests/exclude.t.cpp
index 46cefa0..1e074d5 100644
--- a/tests/unit-tests/exclude.t.cpp
+++ b/tests/unit-tests/exclude.t.cpp
@@ -21,10 +21,11 @@
#include "exclude.hpp"
#include "util/crypto.hpp"
-#include <boost/lexical_cast.hpp>
#include "boost-test.hpp"
+#include <boost/lexical_cast.hpp>
+
namespace ndn {
namespace tests {
@@ -234,7 +235,6 @@
BOOST_AUTO_TEST_SUITE_END() // GenericComponent
-
BOOST_AUTO_TEST_SUITE(ImplicitDigest) // exclude ImplicitSha256DigestComponent
/** \brief make a name::Component with an octet repeated crypto::SHA256_DIGEST_SIZE times
@@ -434,7 +434,6 @@
BOOST_AUTO_TEST_SUITE_END() // ImplicitDigest
-
BOOST_AUTO_TEST_SUITE(WireCompare) // wireEncode, wireDecode, operator==, operator!=
BOOST_AUTO_TEST_CASE(EqualityComparable)
@@ -563,8 +562,7 @@
BOOST_AUTO_TEST_SUITE_END() // WireCompare
-
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestExclude
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/face.t.cpp b/tests/unit-tests/face.t.cpp
index c25681b..d547e33 100644
--- a/tests/unit-tests/face.t.cpp
+++ b/tests/unit-tests/face.t.cpp
@@ -262,6 +262,9 @@
face.receive(*makeData("/Hello/World/%21"));
advanceClocks(time::milliseconds(200), 5);
+
+ // avoid "test case [...] did not check any assertions" message from Boost.Test
+ BOOST_CHECK(true);
}
BOOST_AUTO_TEST_CASE(RemoveAllPendingInterests)
@@ -297,8 +300,10 @@
advanceClocks(time::milliseconds(50), 2);
}
- advanceClocks(time::milliseconds(50), 2);
- // should not segfault
+ advanceClocks(time::milliseconds(50), 2); // should not crash
+
+ // avoid "test case [...] did not check any assertions" message from Boost.Test
+ BOOST_CHECK(true);
}
BOOST_AUTO_TEST_SUITE_END() // Consumer
@@ -634,6 +639,9 @@
face2.reset();
io.poll(); // should not crash
+
+ // avoid "test case [...] did not check any assertions" message from Boost.Test
+ BOOST_CHECK(true);
}
BOOST_AUTO_TEST_SUITE_END() // IoRoutines
diff --git a/tests/unit-tests/identity-management-time-fixture.cpp b/tests/unit-tests/identity-management-time-fixture.cpp
deleted file mode 100644
index f029fc4..0000000
--- a/tests/unit-tests/identity-management-time-fixture.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 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 "identity-management-time-fixture.hpp"
-
-namespace ndn {
-namespace tests {
-
-IdentityManagementTimeFixture::IdentityManagementTimeFixture()
-{
-}
-
-IdentityManagementTimeFixture::~IdentityManagementTimeFixture()
-{
-}
-
-} // namespace tests
-} // namespace ndn
diff --git a/tests/unit-tests/identity-management-time-fixture.hpp b/tests/unit-tests/identity-management-time-fixture.hpp
index 727da49..3451b30 100644
--- a/tests/unit-tests/identity-management-time-fixture.hpp
+++ b/tests/unit-tests/identity-management-time-fixture.hpp
@@ -22,11 +22,8 @@
#ifndef NDN_TESTS_UNIT_TESTS_IDENTITY_MANAGEMENT_TIME_FIXTURE_HPP
#define NDN_TESTS_UNIT_TESTS_IDENTITY_MANAGEMENT_TIME_FIXTURE_HPP
-#include "security/key-chain.hpp"
-
#include "identity-management-fixture.hpp"
#include "unit-test-time-fixture.hpp"
-#include "boost-test.hpp"
namespace ndn {
namespace tests {
@@ -37,13 +34,9 @@
* Identities added via addIdentity method are automatically deleted
* during test teardown.
*/
-class IdentityManagementTimeFixture : public tests::UnitTestTimeFixture
+class IdentityManagementTimeFixture : public UnitTestTimeFixture
, public IdentityManagementFixture
{
-public:
- IdentityManagementTimeFixture();
-
- ~IdentityManagementTimeFixture();
};
} // namespace tests
diff --git a/tests/unit-tests/interest.t.cpp b/tests/unit-tests/interest.t.cpp
index 7a8fbbe..240cc80 100644
--- a/tests/unit-tests/interest.t.cpp
+++ b/tests/unit-tests/interest.t.cpp
@@ -1117,7 +1117,7 @@
BOOST_CHECK_EQUAL(InterestFilter("/a", "<b><>+").doesMatch("/a/b/c"), true);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestInterest
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/key-locator.t.cpp b/tests/unit-tests/key-locator.t.cpp
index 94eb5a2..72e4d66 100644
--- a/tests/unit-tests/key-locator.t.cpp
+++ b/tests/unit-tests/key-locator.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).
*
@@ -172,7 +172,7 @@
BOOST_CHECK_EQUAL(a != b, true);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestKeyLocator
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/link.t.cpp b/tests/unit-tests/link.t.cpp
index 1627b3c..3858036 100644
--- a/tests/unit-tests/link.t.cpp
+++ b/tests/unit-tests/link.t.cpp
@@ -30,6 +30,8 @@
namespace ndn {
namespace tests {
+BOOST_AUTO_TEST_SUITE(TestLink)
+
const uint8_t LinkTest[] = {
0x06, 0xda, // Data
0x07, 0x14, // Name
@@ -229,8 +231,6 @@
0xfc, 0x90, 0x7a, 0xb8, 0x66, 0x9c, 0x0e, 0xf6, 0xb7, 0x64, 0xd1
};
-BOOST_AUTO_TEST_SUITE(TestLink)
-
BOOST_AUTO_TEST_CASE(PairParsingCheck)
{
Link link("test", {{10, "/test1"}, {20, "/test2"}, {100, "/test3"}});
@@ -400,7 +400,7 @@
BOOST_REQUIRE_THROW(link.wireDecode(linkBlock), Link::Error);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestLink
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/lp/cache-policy.t.cpp b/tests/unit-tests/lp/cache-policy.t.cpp
index 8d249dc..106d685 100644
--- a/tests/unit-tests/lp/cache-policy.t.cpp
+++ b/tests/unit-tests/lp/cache-policy.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).
*
@@ -29,7 +29,8 @@
namespace lp {
namespace tests {
-BOOST_AUTO_TEST_SUITE(LpCachePoicy)
+BOOST_AUTO_TEST_SUITE(Lp)
+BOOST_AUTO_TEST_SUITE(TestCachePolicy)
BOOST_AUTO_TEST_CASE(Encode)
{
@@ -97,8 +98,9 @@
BOOST_CHECK_EQUAL(policy.getPolicy(), CachePolicyType::NO_CACHE);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestCachePolicy
+BOOST_AUTO_TEST_SUITE_END() // Lp
} // namespace tests
} // namespace lp
-} // namespace ndn
\ No newline at end of file
+} // namespace ndn
diff --git a/tests/unit-tests/lp/nack-header.t.cpp b/tests/unit-tests/lp/nack-header.t.cpp
index 515926a..83c9f9d 100644
--- a/tests/unit-tests/lp/nack-header.t.cpp
+++ b/tests/unit-tests/lp/nack-header.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).
*
@@ -29,7 +29,8 @@
namespace lp {
namespace tests {
-BOOST_AUTO_TEST_SUITE(LpNackHeader)
+BOOST_AUTO_TEST_SUITE(Lp)
+BOOST_AUTO_TEST_SUITE(TestNackHeader)
BOOST_AUTO_TEST_CASE(Encode)
{
@@ -96,8 +97,9 @@
BOOST_CHECK_EQUAL(header.getReason(), NackReason::DUPLICATE);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestNackHeader
+BOOST_AUTO_TEST_SUITE_END() // Lp
} // namespace tests
} // namespace lp
-} // namespace ndn
\ No newline at end of file
+} // namespace ndn
diff --git a/tests/unit-tests/lp/nack.t.cpp b/tests/unit-tests/lp/nack.t.cpp
index ad09455..8ca609d 100644
--- a/tests/unit-tests/lp/nack.t.cpp
+++ b/tests/unit-tests/lp/nack.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).
*
@@ -29,7 +29,8 @@
namespace lp {
namespace tests {
-BOOST_AUTO_TEST_SUITE(LpNack)
+BOOST_AUTO_TEST_SUITE(Lp)
+BOOST_AUTO_TEST_SUITE(TestNack)
BOOST_AUTO_TEST_CASE(Members)
{
@@ -56,8 +57,9 @@
BOOST_CHECK_EQUAL(nack2.getReason(), NackReason::NONE);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestNack
+BOOST_AUTO_TEST_SUITE_END() // Lp
} // namespace tests
} // namespace lp
-} // namespace ndn
\ No newline at end of file
+} // namespace ndn
diff --git a/tests/unit-tests/lp/packet.t.cpp b/tests/unit-tests/lp/packet.t.cpp
index 29ec091..0a7f1d5 100644
--- a/tests/unit-tests/lp/packet.t.cpp
+++ b/tests/unit-tests/lp/packet.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 lp {
namespace tests {
-BOOST_AUTO_TEST_SUITE(LpPacket)
+BOOST_AUTO_TEST_SUITE(Lp)
+BOOST_AUTO_TEST_SUITE(TestPacket)
BOOST_AUTO_TEST_CASE(FieldAccess)
{
@@ -332,8 +333,9 @@
BOOST_CHECK_THROW(packet.wireDecode(wire), Packet::Error);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestPacket
+BOOST_AUTO_TEST_SUITE_END() // Lp
} // namespace tests
} // namespace lp
-} // namespace ndn
\ No newline at end of file
+} // namespace ndn
diff --git a/tests/unit-tests/meta-info.t.cpp b/tests/unit-tests/meta-info.t.cpp
index d07acaf..3fd8b3c 100644
--- a/tests/unit-tests/meta-info.t.cpp
+++ b/tests/unit-tests/meta-info.t.cpp
@@ -194,7 +194,7 @@
BOOST_CHECK_THROW(info.addAppMetaInfo(makeNonNegativeIntegerBlock(253, 1000)), MetaInfo::Error);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestMetaInfo
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/mgmt/dispatcher.t.cpp b/tests/unit-tests/mgmt/dispatcher.t.cpp
index 877ec02..76e5c6c 100644
--- a/tests/unit-tests/mgmt/dispatcher.t.cpp
+++ b/tests/unit-tests/mgmt/dispatcher.t.cpp
@@ -98,7 +98,7 @@
};
}
-BOOST_FIXTURE_TEST_CASE(BasicUsageSemantics, DispatcherFixture)
+BOOST_FIXTURE_TEST_CASE(Basic, DispatcherFixture)
{
BOOST_CHECK_NO_THROW(dispatcher
.addControlCommand<VoidParameters>("test/1", makeAcceptAllAuthorization(),
diff --git a/tests/unit-tests/mgmt/status-dataset-context.t.cpp b/tests/unit-tests/mgmt/status-dataset-context.t.cpp
index b1876db..cff721b 100644
--- a/tests/unit-tests/mgmt/status-dataset-context.t.cpp
+++ b/tests/unit-tests/mgmt/status-dataset-context.t.cpp
@@ -20,6 +20,7 @@
*/
#include "mgmt/status-dataset-context.hpp"
+
#include "boost-test.hpp"
#include "unit-tests/make-interest-data.hpp"
@@ -31,7 +32,7 @@
class StatusDatasetContextFixture
{
-public:
+private:
struct SendDataArgs
{
Name dataName;
@@ -40,6 +41,7 @@
bool isFinalBlock;
};
+protected:
StatusDatasetContextFixture()
: interest(makeInterest("/test/context/interest"))
, contentBlock(makeStringBlock(tlv::Content, "/test/data/content"))
@@ -57,18 +59,18 @@
}
Name
- makeSegmentName(size_t segmentNo)
+ makeSegmentName(size_t segmentNo) const
{
auto name = context.getPrefix();
return name.appendSegment(segmentNo);
}
Block
- concatenateDataContent()
+ concatenateDataContent() const
{
EncodingBuffer encoder;
size_t valueLength = 0;
- for (auto args : sendDataHistory) {
+ for (const auto& args : sendDataHistory) {
const auto& content = args.content;
valueLength += encoder.appendByteArray(content.value(), content.value_size());
}
@@ -77,7 +79,7 @@
return encoder.block();
}
-public:
+protected:
std::vector<SendDataArgs> sendDataHistory;
std::vector<ControlResponse> sendNackHistory;
shared_ptr<Interest> interest;
@@ -89,16 +91,16 @@
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_FIXTURE_TEST_SUITE(TestStatusDatasetContext, StatusDatasetContextFixture)
-BOOST_AUTO_TEST_CASE(GetPrefix)
+BOOST_AUTO_TEST_SUITE(Prefix)
+
+BOOST_AUTO_TEST_CASE(Get)
{
Name dataName = context.getPrefix();
BOOST_CHECK(dataName[-1].isVersion());
BOOST_CHECK(dataName.getPrefix(-1) == interest->getName());
}
-BOOST_AUTO_TEST_SUITE(SetPrefix)
-
-BOOST_AUTO_TEST_CASE(Valid)
+BOOST_AUTO_TEST_CASE(SetValid)
{
Name validPrefix = Name(interest->getName()).append("/valid");
BOOST_CHECK_NO_THROW(context.setPrefix(validPrefix));
@@ -106,44 +108,49 @@
BOOST_CHECK(context.getPrefix().getPrefix(-1) == validPrefix);
}
-BOOST_AUTO_TEST_CASE(Invalid)
+BOOST_AUTO_TEST_CASE(SetInvalid)
{
Name invalidPrefix = Name(interest->getName()).getPrefix(-1).append("/invalid");
BOOST_CHECK_THROW(context.setPrefix(invalidPrefix), std::invalid_argument);
}
-BOOST_AUTO_TEST_CASE(ValidWithAppendCalled)
+BOOST_AUTO_TEST_CASE(SetValidWithAppendCalled)
{
Name validPrefix = Name(interest->getName()).append("/valid");
context.append(contentBlock);
BOOST_CHECK_THROW(context.setPrefix(validPrefix), std::domain_error);
}
-BOOST_AUTO_TEST_CASE(ValidWithEndCalled)
+BOOST_AUTO_TEST_CASE(SetValidWithEndCalled)
{
Name validPrefix = Name(interest->getName()).append("/valid");
context.end();
BOOST_CHECK_THROW(context.setPrefix(validPrefix), std::domain_error);
}
-BOOST_AUTO_TEST_CASE(ValidWithRejectCalled)
+BOOST_AUTO_TEST_CASE(SetValidWithRejectCalled)
{
Name validPrefix = Name(interest->getName()).append("/valid");
context.reject();
BOOST_CHECK_THROW(context.setPrefix(validPrefix), std::domain_error);
}
-BOOST_AUTO_TEST_SUITE_END() // SetPrefix
+BOOST_AUTO_TEST_SUITE_END() // Prefix
-BOOST_AUTO_TEST_CASE(Expiry)
+BOOST_AUTO_TEST_SUITE(Expiry)
+
+BOOST_AUTO_TEST_CASE(GetAndSet)
{
- // getExpiry & setExpiry
auto period = time::milliseconds(9527);
BOOST_CHECK_EQUAL(context.getExpiry(), time::milliseconds(1000));
BOOST_CHECK_EQUAL(context.setExpiry(period).getExpiry(), period);
}
-BOOST_AUTO_TEST_CASE(Respond)
+BOOST_AUTO_TEST_SUITE_END() // Expiry
+
+BOOST_AUTO_TEST_SUITE(Respond)
+
+BOOST_AUTO_TEST_CASE(Basic)
{
BOOST_CHECK_NO_THROW(context.append(contentBlock));
BOOST_CHECK(sendDataHistory.empty()); // does not call end yet
@@ -159,7 +166,7 @@
BOOST_CHECK_EQUAL(args.isFinalBlock, true);
}
-BOOST_AUTO_TEST_CASE(RespondLarge)
+BOOST_AUTO_TEST_CASE(Large)
{
static Block largeBlock = [] () -> Block {
EncodingBuffer encoder;
@@ -195,7 +202,7 @@
BOOST_CHECK(contentLargeBlock.elements()[0] == largeBlock);
}
-BOOST_AUTO_TEST_CASE(ResponseMultipleSmall)
+BOOST_AUTO_TEST_CASE(MultipleSmall)
{
size_t nBlocks = 100;
for (size_t i = 0 ; i < nBlocks ; i ++) {
@@ -217,22 +224,28 @@
}
}
-BOOST_AUTO_TEST_CASE(Reject)
+BOOST_AUTO_TEST_SUITE_END() // Respond
+
+BOOST_AUTO_TEST_SUITE(Reject)
+
+BOOST_AUTO_TEST_CASE(Basic)
{
BOOST_CHECK_NO_THROW(context.reject());
BOOST_REQUIRE_EQUAL(sendNackHistory.size(), 1);
BOOST_CHECK_EQUAL(sendNackHistory[0].getCode(), 400);
}
+BOOST_AUTO_TEST_SUITE_END() // Reject
+
class AbnormalStateTestFixture
{
-public:
+protected:
AbnormalStateTestFixture()
: context(Interest("/abnormal-state"), bind([]{}), bind([]{}))
{
}
-public:
+protected:
mgmt::StatusDatasetContext context;
};
@@ -283,6 +296,7 @@
}
BOOST_AUTO_TEST_SUITE_END() // AbnormalState
+
BOOST_AUTO_TEST_SUITE_END() // TestStatusDatasetContext
BOOST_AUTO_TEST_SUITE_END() // Mgmt
diff --git a/tests/unit-tests/name.t.cpp b/tests/unit-tests/name.t.cpp
index 64691c4..a49a9c4 100644
--- a/tests/unit-tests/name.t.cpp
+++ b/tests/unit-tests/name.t.cpp
@@ -503,7 +503,7 @@
BOOST_CHECK_EQUAL(n3.wireEncode().getBuffer()->size(), n3.wireEncode().size());
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestName
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/ndebug.cpp b/tests/unit-tests/ndebug.t.cpp
similarity index 86%
rename from tests/unit-tests/ndebug.cpp
rename to tests/unit-tests/ndebug.t.cpp
index 9063e64..05f510e 100644
--- a/tests/unit-tests/ndebug.cpp
+++ b/tests/unit-tests/ndebug.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).
*
@@ -34,6 +34,8 @@
// in release builds, assertion shouldn't execute
BOOST_ASSERT(false);
#endif
+ // Trivial check to avoid "test case did not check any assertions" message from Boost.Test
+ BOOST_CHECK(true);
}
BOOST_AUTO_TEST_CASE(SideEffect)
@@ -47,7 +49,7 @@
#endif
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestNdebug
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/network-configuration-detector.hpp b/tests/unit-tests/network-configuration-detector.hpp
index 5619b58..95d2aa8 100644
--- a/tests/unit-tests/network-configuration-detector.hpp
+++ b/tests/unit-tests/network-configuration-detector.hpp
@@ -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,6 +22,22 @@
#ifndef NDN_TESTS_NETWORK_CONFIGURATION_DETECTOR_HPP
#define NDN_TESTS_NETWORK_CONFIGURATION_DETECTOR_HPP
+#define SKIP_IF_IPV4_UNAVAILABLE() \
+ do { \
+ if (!NetworkConfigurationDetector::hasIpv4()) { \
+ BOOST_WARN_MESSAGE(false, "skipping assertions that require IPv4 support"); \
+ return; \
+ } \
+ } while (false)
+
+#define SKIP_IF_IPV6_UNAVAILABLE() \
+ do { \
+ if (!NetworkConfigurationDetector::hasIpv6()) { \
+ BOOST_WARN_MESSAGE(false, "skipping assertions that require IPv6 support"); \
+ return; \
+ } \
+ } while (false)
+
namespace ndn {
namespace tests {
diff --git a/tests/unit-tests/security/certificate-container.t.cpp b/tests/unit-tests/security/certificate-container.t.cpp
index 52a6070..6ff8499 100644
--- a/tests/unit-tests/security/certificate-container.t.cpp
+++ b/tests/unit-tests/security/certificate-container.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,15 +22,16 @@
#include "security/certificate-container.hpp"
#include "security/pib.hpp"
#include "security/pib-memory.hpp"
-#include "pib-data-fixture.hpp"
#include "boost-test.hpp"
+#include "pib-data-fixture.hpp"
namespace ndn {
namespace security {
namespace tests {
-BOOST_AUTO_TEST_SUITE(SecurityCertificateContainer)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_AUTO_TEST_SUITE(TestCertificateContainer)
BOOST_FIXTURE_TEST_CASE(TestCertificateContainer, PibDataFixture)
{
@@ -71,7 +72,8 @@
BOOST_CHECK_EQUAL(count, 2);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestCertificateContainer
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace security
diff --git a/tests/unit-tests/security/command-interest-validator.t.cpp b/tests/unit-tests/security/command-interest-validator.t.cpp
index 9a9d1e8..f31f3a3 100644
--- a/tests/unit-tests/security/command-interest-validator.t.cpp
+++ b/tests/unit-tests/security/command-interest-validator.t.cpp
@@ -21,13 +21,14 @@
#include "security/command-interest-validator.hpp"
#include "security/signing-helpers.hpp"
-#include <boost/lexical_cast.hpp>
#include "boost-test.hpp"
-#include "../../dummy-validator.hpp"
+#include "dummy-validator.hpp"
#include "../identity-management-time-fixture.hpp"
#include "../make-interest-data.hpp"
+#include <boost/lexical_cast.hpp>
+
namespace ndn {
namespace security {
namespace tests {
@@ -51,7 +52,7 @@
}
Name
- makeIdentity(int identity)
+ makeIdentity(uint64_t identity)
{
Name name("/localhost/CommandInterestValidatorIdentity");
name.appendSequenceNumber(identity);
@@ -60,7 +61,7 @@
}
shared_ptr<Interest>
- makeCommandInterest(int identity = 0)
+ makeCommandInterest(uint64_t identity = 0)
{
auto interest = makeInterest("/CommandInterestPrefix");
m_keyChain.sign(*interest, signingByIdentity(makeIdentity(identity)));
@@ -115,7 +116,9 @@
BOOST_AUTO_TEST_SUITE(Security)
BOOST_FIXTURE_TEST_SUITE(TestCommandInterestValidator, CommandInterestValidatorFixture)
-BOOST_AUTO_TEST_CASE(Normal)
+BOOST_AUTO_TEST_SUITE(Accepts)
+
+BOOST_AUTO_TEST_CASE(Basic)
{
auto i1 = makeCommandInterest();
assertAccept(*i1);
@@ -136,11 +139,13 @@
validator->validate(*d1,
[&nAccepts] (const shared_ptr<const Data>&) { ++nAccepts; },
[] (const shared_ptr<const Data>&, const std::string& msg) {
- BOOST_ERROR("validation request should succeed but fails with " << msg);
+ BOOST_ERROR("validation request should succeed but fails with: " << msg);
});
BOOST_CHECK_EQUAL(nAccepts, 1);
}
+BOOST_AUTO_TEST_SUITE_END() // Accepts
+
BOOST_AUTO_TEST_SUITE(Rejects)
BOOST_AUTO_TEST_CASE(NameTooShort)
diff --git a/tests/unit-tests/security/conf/checker.t.cpp b/tests/unit-tests/security/conf/checker.t.cpp
index fddfb83..5ba5ad8 100644
--- a/tests/unit-tests/security/conf/checker.t.cpp
+++ b/tests/unit-tests/security/conf/checker.t.cpp
@@ -21,8 +21,9 @@
#include "security/conf/checker.hpp"
#include "security/key-chain.hpp"
-#include "identity-management-fixture.hpp"
+
#include "boost-test.hpp"
+#include "identity-management-fixture.hpp"
namespace ndn {
namespace security {
@@ -31,7 +32,9 @@
using namespace ndn::tests;
-BOOST_FIXTURE_TEST_SUITE(SecurityConfChecker, IdentityManagementFixture)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_AUTO_TEST_SUITE(Conf)
+BOOST_FIXTURE_TEST_SUITE(TestChecker, IdentityManagementFixture)
BOOST_AUTO_TEST_CASE(CustomizedCheckerTest1)
{
@@ -427,7 +430,9 @@
BOOST_CHECK_EQUAL(result, 1);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestChecker
+BOOST_AUTO_TEST_SUITE_END() // Conf
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace conf
diff --git a/tests/unit-tests/security/digest-sha256.t.cpp b/tests/unit-tests/security/digest-sha256.t.cpp
index 67b6730..cbac8e2 100644
--- a/tests/unit-tests/security/digest-sha256.t.cpp
+++ b/tests/unit-tests/security/digest-sha256.t.cpp
@@ -30,24 +30,20 @@
namespace ndn {
namespace tests {
-BOOST_FIXTURE_TEST_SUITE(SecurityDigestSha256, IdentityManagementFixture)
-
-std::string SHA256_RESULT("a883dafc480d466ee04e0d6da986bd78eb1fdd2178d04693723da3a8f95d42f4");
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_FIXTURE_TEST_SUITE(TestDigestSha256, IdentityManagementFixture)
BOOST_AUTO_TEST_CASE(Sha256)
{
- using namespace CryptoPP;
-
char content[6] = "1234\n";
ConstBufferPtr buf = crypto::computeSha256Digest(reinterpret_cast<uint8_t*>(content), 5);
- BOOST_CHECK_EQUAL(SHA256_RESULT, toHex(buf->buf(), buf->size(), false));
+ BOOST_CHECK_EQUAL(toHex(buf->buf(), buf->size(), false),
+ "a883dafc480d466ee04e0d6da986bd78eb1fdd2178d04693723da3a8f95d42f4");
}
BOOST_AUTO_TEST_CASE(DataSignature)
{
- using namespace CryptoPP;
-
Name name("/TestSignatureSha/Basic");
Data testData(name);
char content[5] = "1234";
@@ -79,7 +75,8 @@
BOOST_CHECK(Validator::verifySignature(testInterest, sig));
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestDigestSha256
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/security/identity-container.t.cpp b/tests/unit-tests/security/identity-container.t.cpp
index 91c4fe2..c2c1c0e 100644
--- a/tests/unit-tests/security/identity-container.t.cpp
+++ b/tests/unit-tests/security/identity-container.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,17 +22,18 @@
#include "security/identity-container.hpp"
#include "security/pib.hpp"
#include "security/pib-memory.hpp"
-#include "pib-data-fixture.hpp"
#include "boost-test.hpp"
+#include "pib-data-fixture.hpp"
namespace ndn {
namespace security {
namespace tests {
-BOOST_AUTO_TEST_SUITE(SecurityIdentityContainer)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_AUTO_TEST_SUITE(TestIdentityContainer)
-BOOST_FIXTURE_TEST_CASE(TestIdentityContainer, PibDataFixture)
+BOOST_FIXTURE_TEST_CASE(Basic, PibDataFixture)
{
auto pibImpl = make_shared<PibMemory>();
Pib pib("pib-memory", "", pibImpl);
@@ -69,7 +70,8 @@
BOOST_CHECK_EQUAL(count, 2);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestIdentityContainer
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace security
diff --git a/tests/unit-tests/security/identity-management-fixture.t.cpp b/tests/unit-tests/security/identity-management-fixture.t.cpp
index 5c02328..81dcfe5 100644
--- a/tests/unit-tests/security/identity-management-fixture.t.cpp
+++ b/tests/unit-tests/security/identity-management-fixture.t.cpp
@@ -20,12 +20,14 @@
*/
#include "identity-management-fixture.hpp"
+
#include "boost-test.hpp"
namespace ndn {
namespace tests {
-BOOST_FIXTURE_TEST_SUITE(SecurityIdentityManagementFixture, IdentityManagementFixture)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_FIXTURE_TEST_SUITE(TestIdentityManagementFixture, IdentityManagementFixture)
BOOST_AUTO_TEST_CASE(Tmp)
{
@@ -36,7 +38,8 @@
BOOST_REQUIRE_NO_THROW(m_keyChain.getCertificate(certName));
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestIdentityManagementFixture
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/security/identity.t.cpp b/tests/unit-tests/security/identity.t.cpp
index d77d680..5e04d4c 100644
--- a/tests/unit-tests/security/identity.t.cpp
+++ b/tests/unit-tests/security/identity.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,17 +22,18 @@
#include "security/identity.hpp"
#include "security/pib.hpp"
#include "security/pib-memory.hpp"
-#include "pib-data-fixture.hpp"
#include "boost-test.hpp"
+#include "pib-data-fixture.hpp"
namespace ndn {
namespace security {
namespace tests {
-BOOST_AUTO_TEST_SUITE(SecurityIdentity)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_FIXTURE_TEST_SUITE(TestIdentity, PibDataFixture)
-BOOST_FIXTURE_TEST_CASE(ValidityChecking, PibDataFixture)
+BOOST_AUTO_TEST_CASE(ValidityChecking)
{
// identity
Identity id;
@@ -57,7 +58,7 @@
BOOST_CHECK(false);
}
-BOOST_FIXTURE_TEST_CASE(TestKeyOperation, PibDataFixture)
+BOOST_AUTO_TEST_CASE(KeyOperations)
{
auto pibImpl = make_shared<PibMemory>();
@@ -79,7 +80,8 @@
BOOST_CHECK_THROW(identity1.getDefaultKey(), Pib::Error);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestIdentity
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace security
diff --git a/tests/unit-tests/security/key-chain.t.cpp b/tests/unit-tests/security/key-chain.t.cpp
index eff1ab3..8009daa 100644
--- a/tests/unit-tests/security/key-chain.t.cpp
+++ b/tests/unit-tests/security/key-chain.t.cpp
@@ -25,13 +25,13 @@
#include "boost-test.hpp"
#include "dummy-keychain.hpp"
-#include "../util/test-home-environment-fixture.hpp"
+#include "../test-home-env-saver.hpp"
#include "key-chain-fixture.hpp"
#include "identity-management-fixture.hpp"
-#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
-#include <fstream>
+#include <boost/filesystem.hpp>
+#include <cstdlib>
namespace ndn {
namespace security {
@@ -39,7 +39,8 @@
using namespace ndn::tests;
-BOOST_FIXTURE_TEST_SUITE(SecurityKeyChain, util::TestHomeEnvironmentFixture)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_FIXTURE_TEST_SUITE(TestKeyChain, TestHomeEnvSaver)
template<class Path>
class TestHomeAndPibFixture : public TestHomeFixture<Path>
@@ -417,7 +418,8 @@
BOOST_CHECK(ecdsaIdentity.isPrefixOf(data.getSignature().getKeyLocator().getName()));
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestKeyChain
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace security
diff --git a/tests/unit-tests/security/key-container.t.cpp b/tests/unit-tests/security/key-container.t.cpp
index 016ad90..817a84f 100644
--- a/tests/unit-tests/security/key-container.t.cpp
+++ b/tests/unit-tests/security/key-container.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,17 +22,18 @@
#include "security/key-container.hpp"
#include "security/pib.hpp"
#include "security/pib-memory.hpp"
-#include "pib-data-fixture.hpp"
#include "boost-test.hpp"
+#include "pib-data-fixture.hpp"
namespace ndn {
namespace security {
namespace tests {
-BOOST_AUTO_TEST_SUITE(SecurityKeyContainer)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_AUTO_TEST_SUITE(TestKeyContainer)
-BOOST_FIXTURE_TEST_CASE(TestKeyContainer, PibDataFixture)
+BOOST_FIXTURE_TEST_CASE(Basic, PibDataFixture)
{
auto pibImpl = make_shared<PibMemory>();
Pib pib("pib-memory", "", pibImpl);
@@ -72,7 +73,8 @@
BOOST_CHECK_EQUAL(count, 2);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestKeyContainer
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace security
diff --git a/tests/unit-tests/security/key-params.t.cpp b/tests/unit-tests/security/key-params.t.cpp
index 66e30fe..a1fefa4 100644
--- a/tests/unit-tests/security/key-params.t.cpp
+++ b/tests/unit-tests/security/key-params.t.cpp
@@ -23,13 +23,13 @@
#include "boost-test.hpp"
-
namespace ndn {
namespace tests {
-BOOST_AUTO_TEST_SUITE(SecurityKeyParams)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_AUTO_TEST_SUITE(TestKeyParams)
-BOOST_AUTO_TEST_CASE(RsaParameter)
+BOOST_AUTO_TEST_CASE(Rsa)
{
RsaKeyParams params;
BOOST_CHECK_EQUAL(params.getKeyType(), KeyType::RSA);
@@ -44,7 +44,7 @@
BOOST_CHECK_EQUAL(params3.getKeySize(), 2048);
}
-BOOST_AUTO_TEST_CASE(EcdsaParameter)
+BOOST_AUTO_TEST_CASE(Ecdsa)
{
EcdsaKeyParams params;
BOOST_CHECK_EQUAL(params.getKeyType(), KeyType::EC);
@@ -59,7 +59,7 @@
BOOST_CHECK_EQUAL(params3.getKeySize(), 256);
}
-BOOST_AUTO_TEST_CASE(AesParameter)
+BOOST_AUTO_TEST_CASE(Aes)
{
AesKeyParams params;
BOOST_CHECK_EQUAL(params.getKeyType(), KeyType::AES);
@@ -87,7 +87,8 @@
BOOST_REQUIRE_THROW((RsaKeyParams(params2)), KeyParams::Error);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestKeyParams
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/security/key.t.cpp b/tests/unit-tests/security/key.t.cpp
index 681c43c..7d9ddc1 100644
--- a/tests/unit-tests/security/key.t.cpp
+++ b/tests/unit-tests/security/key.t.cpp
@@ -22,17 +22,18 @@
#include "security/key.hpp"
#include "security/pib.hpp"
#include "security/pib-memory.hpp"
-#include "pib-data-fixture.hpp"
#include "boost-test.hpp"
+#include "pib-data-fixture.hpp"
namespace ndn {
namespace security {
namespace tests {
-BOOST_AUTO_TEST_SUITE(SecurityKey)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_FIXTURE_TEST_SUITE(TestKey, PibDataFixture)
-BOOST_FIXTURE_TEST_CASE(ValidityChecking, PibDataFixture)
+BOOST_AUTO_TEST_CASE(ValidityChecking)
{
// key
Key key;
@@ -57,7 +58,7 @@
BOOST_CHECK(false);
}
-BOOST_FIXTURE_TEST_CASE(TestCertificateOperation, PibDataFixture)
+BOOST_AUTO_TEST_CASE(CertificateOperations)
{
auto pibImpl = make_shared<PibMemory>();
@@ -85,8 +86,8 @@
BOOST_CHECK_THROW(key11.getDefaultCertificate(), Pib::Error);
}
-
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestKey
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace security
diff --git a/tests/unit-tests/security/pib-data-fixture.cpp b/tests/unit-tests/security/pib-data-fixture.cpp
index dfb5304..18b2cfb 100644
--- a/tests/unit-tests/security/pib-data-fixture.cpp
+++ b/tests/unit-tests/security/pib-data-fixture.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,7 +20,6 @@
*/
#include "pib-data-fixture.hpp"
-#include "../identity-management-time-fixture.hpp"
/**
* The test data can be generated with a TestCertDataGenerator defined as below:
@@ -96,7 +95,7 @@
* };
*/
-uint8_t ID1_KEY1[] = {
+const uint8_t ID1_KEY1[] = {
0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D,
0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xFF, 0xF9, 0x1E, 0x85, 0x6C, 0x29, 0x5F, 0x98, 0xB1, 0x2E, 0xD5, 0x3D, 0xCA,
0xE2, 0x00, 0x52, 0x7A, 0x55, 0x93, 0x96, 0xD1, 0x7F, 0x03, 0x20, 0x25, 0xA7, 0xE5, 0xB8, 0xF8, 0x5D, 0xF0, 0x2E, 0x3E,
@@ -104,7 +103,7 @@
0x4B, 0xD4, 0xBB, 0x1E, 0x15, 0x29, 0x3E, 0x40, 0x22, 0x4E, 0xE7
};
-uint8_t ID1_KEY1_CERT1[] = {
+const uint8_t ID1_KEY1_CERT1[] = {
0x06, 0xFD, 0x01, 0x88, 0x07, 0x43, 0x08, 0x03, 0x70, 0x69, 0x62, 0x08, 0x09, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61,
0x63, 0x65, 0x08, 0x02, 0x69, 0x64, 0x08, 0x01, 0x31, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x11, 0x6B, 0x73, 0x6B, 0x2D,
0x31, 0x34, 0x31, 0x35, 0x36, 0x38, 0x34, 0x31, 0x33, 0x32, 0x30, 0x30, 0x30, 0x08, 0x07, 0x49, 0x44, 0x2D, 0x43, 0x45,
@@ -127,7 +126,7 @@
0x27, 0x13, 0x65, 0x4D, 0x5D, 0x1A, 0x23, 0x5F, 0xA9, 0xFC, 0x53, 0x22, 0x86, 0xBD, 0x92, 0x01
};
-uint8_t ID1_KEY1_CERT2[] = {
+const uint8_t ID1_KEY1_CERT2[] = {
0x06, 0xFD, 0x01, 0x88, 0x07, 0x43, 0x08, 0x03, 0x70, 0x69, 0x62, 0x08, 0x09, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61,
0x63, 0x65, 0x08, 0x02, 0x69, 0x64, 0x08, 0x01, 0x31, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x11, 0x6B, 0x73, 0x6B, 0x2D,
0x31, 0x34, 0x31, 0x35, 0x36, 0x38, 0x34, 0x31, 0x33, 0x32, 0x30, 0x30, 0x30, 0x08, 0x07, 0x49, 0x44, 0x2D, 0x43, 0x45,
@@ -150,7 +149,7 @@
0x09, 0x74, 0xF1, 0xB1, 0x7C, 0x9B, 0xFA, 0x67, 0x22, 0x55, 0x18, 0xA5, 0x05, 0x48, 0x7D, 0x65
};
-uint8_t ID1_KEY2[] = {
+const uint8_t ID1_KEY2[] = {
0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D,
0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xC2, 0xE0, 0xEC, 0xC7, 0xED, 0x65, 0xDE, 0x0A, 0x46, 0xCE, 0x38, 0xC2, 0x68,
0x77, 0x4F, 0xE3, 0xE1, 0xDF, 0x37, 0x7D, 0xA3, 0x56, 0x0D, 0xF9, 0x66, 0x43, 0x37, 0x60, 0x42, 0x7E, 0x96, 0x93, 0x7E,
@@ -158,7 +157,7 @@
0x67, 0x6B, 0xDB, 0x83, 0x26, 0x1F, 0x75, 0x7A, 0x93, 0xA2, 0xAE
};
-uint8_t ID1_KEY2_CERT1[] = {
+const uint8_t ID1_KEY2_CERT1[] = {
0x06, 0xFD, 0x01, 0x88, 0x07, 0x43, 0x08, 0x03, 0x70, 0x69, 0x62, 0x08, 0x09, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61,
0x63, 0x65, 0x08, 0x02, 0x69, 0x64, 0x08, 0x01, 0x31, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x11, 0x6B, 0x73, 0x6B, 0x2D,
0x31, 0x34, 0x31, 0x35, 0x36, 0x38, 0x34, 0x31, 0x35, 0x32, 0x30, 0x30, 0x30, 0x08, 0x07, 0x49, 0x44, 0x2D, 0x43, 0x45,
@@ -181,7 +180,7 @@
0x1A, 0x0F, 0x4B, 0x94, 0xBE, 0x28, 0xCE, 0xE7, 0x0A, 0x8A, 0xB4, 0xD5, 0xEA, 0x8D, 0x20, 0x95
};
-uint8_t ID1_KEY2_CERT2[] = {
+const uint8_t ID1_KEY2_CERT2[] = {
0x06, 0xFD, 0x01, 0x88, 0x07, 0x43, 0x08, 0x03, 0x70, 0x69, 0x62, 0x08, 0x09, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61,
0x63, 0x65, 0x08, 0x02, 0x69, 0x64, 0x08, 0x01, 0x31, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x11, 0x6B, 0x73, 0x6B, 0x2D,
0x31, 0x34, 0x31, 0x35, 0x36, 0x38, 0x34, 0x31, 0x35, 0x32, 0x30, 0x30, 0x30, 0x08, 0x07, 0x49, 0x44, 0x2D, 0x43, 0x45,
@@ -204,7 +203,7 @@
0x31, 0x48, 0xB0, 0x96, 0x41, 0x40, 0x98, 0x68, 0xF9, 0x7C, 0x01, 0x94, 0xD0, 0xA3, 0xF3, 0xC7
};
-uint8_t ID2_KEY1[] = {
+const uint8_t ID2_KEY1[] = {
0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D,
0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xA4, 0x25, 0xDB, 0xB0, 0xD7, 0xC6, 0x0D, 0xC6, 0x95, 0x97, 0x79, 0xFA, 0xE3,
0xC7, 0x90, 0xFB, 0x97, 0xAF, 0xCE, 0xDB, 0xC3, 0x50, 0x99, 0x1E, 0x39, 0xF5, 0x9A, 0xB6, 0xC9, 0x37, 0x1A, 0xE5, 0x0A,
@@ -212,7 +211,7 @@
0x3C, 0xA7, 0x99, 0x09, 0x05, 0x9F, 0x65, 0x9A, 0xA5, 0x9C, 0xD5
};
-uint8_t ID2_KEY1_CERT1[] = {
+const uint8_t ID2_KEY1_CERT1[] = {
0x06, 0xFD, 0x01, 0x89, 0x07, 0x43, 0x08, 0x03, 0x70, 0x69, 0x62, 0x08, 0x09, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61,
0x63, 0x65, 0x08, 0x02, 0x69, 0x64, 0x08, 0x01, 0x32, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x11, 0x6B, 0x73, 0x6B, 0x2D,
0x31, 0x34, 0x31, 0x35, 0x36, 0x38, 0x34, 0x31, 0x33, 0x32, 0x30, 0x30, 0x30, 0x08, 0x07, 0x49, 0x44, 0x2D, 0x43, 0x45,
@@ -235,7 +234,7 @@
0x23, 0x37, 0x6E, 0x3C, 0xC0, 0xC4, 0x2F, 0xED, 0xBB, 0x9B, 0xB2, 0xEC, 0x2A, 0x96, 0xE6, 0xD2, 0x98
};
-uint8_t ID2_KEY1_CERT2[] = {
+const uint8_t ID2_KEY1_CERT2[] = {
0x06, 0xFD, 0x01, 0x88, 0x07, 0x43, 0x08, 0x03, 0x70, 0x69, 0x62, 0x08, 0x09, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61,
0x63, 0x65, 0x08, 0x02, 0x69, 0x64, 0x08, 0x01, 0x32, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x11, 0x6B, 0x73, 0x6B, 0x2D,
0x31, 0x34, 0x31, 0x35, 0x36, 0x38, 0x34, 0x31, 0x33, 0x32, 0x30, 0x30, 0x30, 0x08, 0x07, 0x49, 0x44, 0x2D, 0x43, 0x45,
@@ -258,7 +257,7 @@
0xB3, 0x88, 0x9D, 0x99, 0x7E, 0x49, 0xD5, 0x72, 0x7F, 0x6F, 0x92, 0xCF, 0x0A, 0x56, 0xA6, 0xF9
};
-uint8_t ID2_KEY2[] = {
+const uint8_t ID2_KEY2[] = {
0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D,
0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x6C, 0x49, 0x20, 0x7E, 0x59, 0xAF, 0x48, 0x1C, 0x9B, 0xCB, 0x67, 0xD4, 0x6F,
0x43, 0x9D, 0xD8, 0xB5, 0x36, 0xDB, 0x72, 0xDA, 0x37, 0x55, 0x4B, 0x8C, 0x69, 0x17, 0x87, 0xF6, 0x06, 0xAB, 0x06, 0x70,
@@ -266,7 +265,7 @@
0x62, 0x3B, 0x30, 0xFE, 0xCF, 0x05, 0xBE, 0x04, 0xC9, 0x78, 0x5C
};
-uint8_t ID2_KEY2_CERT1[] = {
+const uint8_t ID2_KEY2_CERT1[] = {
0x06, 0xFD, 0x01, 0x89, 0x07, 0x43, 0x08, 0x03, 0x70, 0x69, 0x62, 0x08, 0x09, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61,
0x63, 0x65, 0x08, 0x02, 0x69, 0x64, 0x08, 0x01, 0x32, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x11, 0x6B, 0x73, 0x6B, 0x2D,
0x31, 0x34, 0x31, 0x35, 0x36, 0x38, 0x34, 0x31, 0x35, 0x32, 0x30, 0x30, 0x30, 0x08, 0x07, 0x49, 0x44, 0x2D, 0x43, 0x45,
@@ -289,7 +288,7 @@
0xB8, 0x3A, 0xEE, 0xBF, 0x1F, 0x51, 0x14, 0x6A, 0x8F, 0x2E, 0x5A, 0x60, 0xD8, 0x45, 0x87, 0x62, 0x51
};
-uint8_t ID2_KEY2_CERT2[] = {
+const uint8_t ID2_KEY2_CERT2[] = {
0x06, 0xFD, 0x01, 0x89, 0x07, 0x43, 0x08, 0x03, 0x70, 0x69, 0x62, 0x08, 0x09, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61,
0x63, 0x65, 0x08, 0x02, 0x69, 0x64, 0x08, 0x01, 0x32, 0x08, 0x03, 0x4B, 0x45, 0x59, 0x08, 0x11, 0x6B, 0x73, 0x6B, 0x2D,
0x31, 0x34, 0x31, 0x35, 0x36, 0x38, 0x34, 0x31, 0x35, 0x32, 0x30, 0x30, 0x30, 0x08, 0x07, 0x49, 0x44, 0x2D, 0x43, 0x45,
diff --git a/tests/unit-tests/security/pib-data-fixture.hpp b/tests/unit-tests/security/pib-data-fixture.hpp
index 04db21d..5e92dd1 100644
--- a/tests/unit-tests/security/pib-data-fixture.hpp
+++ b/tests/unit-tests/security/pib-data-fixture.hpp
@@ -19,8 +19,8 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_TESTS_PIB_DATA_FIXTURE_HPP
-#define NDN_TESTS_PIB_DATA_FIXTURE_HPP
+#ifndef NDN_TESTS_SECURITY_PIB_DATA_FIXTURE_HPP
+#define NDN_TESTS_SECURITY_PIB_DATA_FIXTURE_HPP
#include "security/v1/identity-certificate.hpp"
@@ -61,4 +61,4 @@
} // namespace security
} // namespace ndn
-#endif // NDN_TESTS_PIB_DATA_FIXTURE_HPP
+#endif // NDN_TESTS_SECURITY_PIB_DATA_FIXTURE_HPP
diff --git a/tests/unit-tests/security/pib-impl.t.cpp b/tests/unit-tests/security/pib-impl.t.cpp
index 40de0f2..d86a95d 100644
--- a/tests/unit-tests/security/pib-impl.t.cpp
+++ b/tests/unit-tests/security/pib-impl.t.cpp
@@ -22,17 +22,19 @@
#include "security/pib-memory.hpp"
#include "security/pib-sqlite3.hpp"
#include "security/pib.hpp"
+
+#include "boost-test.hpp"
#include "pib-data-fixture.hpp"
#include <boost/filesystem.hpp>
#include <boost/mpl/list.hpp>
-#include "boost-test.hpp"
namespace ndn {
namespace security {
namespace tests {
-BOOST_AUTO_TEST_SUITE(SecurityPibImpl)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_AUTO_TEST_SUITE(TestPibImpl)
class PibMemoryWrapper
{
@@ -54,6 +56,7 @@
boost::filesystem::remove_all(tmpPath);
}
+public:
boost::filesystem::path tmpPath;
PibSqlite3 impl;
};
@@ -223,7 +226,8 @@
BOOST_CHECK_EQUAL(certNames.size(), 0);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestPibImpl
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace security
diff --git a/tests/unit-tests/security/pib-memory.t.cpp b/tests/unit-tests/security/pib-memory.t.cpp
index e0a7e59..74dde3f 100644
--- a/tests/unit-tests/security/pib-memory.t.cpp
+++ b/tests/unit-tests/security/pib-memory.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,8 +27,10 @@
namespace security {
namespace tests {
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_AUTO_TEST_SUITE(TestPibMemory)
+
// most functionalities are tested in pib-impl.t.cpp
-BOOST_AUTO_TEST_SUITE(SecurityPibMemory)
BOOST_AUTO_TEST_CASE(TpmLocatorManagement)
{
@@ -38,7 +40,8 @@
BOOST_CHECK_THROW(pibImpl.setTpmLocator(""), PibImpl::Error);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestPibMemory
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace security
diff --git a/tests/unit-tests/security/pib-sqlite3.t.cpp b/tests/unit-tests/security/pib-sqlite3.t.cpp
index 3ae16cb..656900e 100644
--- a/tests/unit-tests/security/pib-sqlite3.t.cpp
+++ b/tests/unit-tests/security/pib-sqlite3.t.cpp
@@ -22,9 +22,10 @@
#include "security/pib-sqlite3.hpp"
#include "security/pib.hpp"
-#include <boost/filesystem.hpp>
#include "boost-test.hpp"
+#include <boost/filesystem.hpp>
+
namespace ndn {
namespace security {
namespace tests {
@@ -50,8 +51,8 @@
PibSqlite3 impl;
};
-
-BOOST_FIXTURE_TEST_SUITE(SecurityPibSqlite3, PibSqlite3TestFixture)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_FIXTURE_TEST_SUITE(TestPibSqlite3, PibSqlite3TestFixture)
// most functionalities are tested in pib-impl.t.cpp
@@ -117,7 +118,8 @@
BOOST_CHECK_EQUAL(impl.getCertificatesOfKey(identity, keyId).size(), 0);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestPibSqlite3
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace security
diff --git a/tests/unit-tests/security/pib.t.cpp b/tests/unit-tests/security/pib.t.cpp
index bc05ca9..be617ac 100644
--- a/tests/unit-tests/security/pib.t.cpp
+++ b/tests/unit-tests/security/pib.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).
*
@@ -21,17 +21,18 @@
#include "security/pib.hpp"
#include "security/pib-memory.hpp"
-#include "pib-data-fixture.hpp"
#include "boost-test.hpp"
+#include "pib-data-fixture.hpp"
namespace ndn {
namespace security {
namespace tests {
-BOOST_AUTO_TEST_SUITE(SecurityPib)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_FIXTURE_TEST_SUITE(TestPib, PibDataFixture)
-BOOST_FIXTURE_TEST_CASE(ValidityChecking, PibDataFixture)
+BOOST_AUTO_TEST_CASE(ValidityChecking)
{
auto pibImpl = make_shared<PibMemory>();
Pib pib("pib-memory", "", pibImpl);
@@ -58,7 +59,7 @@
BOOST_CHECK(false);
}
-BOOST_FIXTURE_TEST_CASE(TestIdentityOperation, PibDataFixture)
+BOOST_AUTO_TEST_CASE(IdentityOperations)
{
auto pibImpl = make_shared<PibMemory>();
Pib pib("pib-memory", "", pibImpl);
@@ -78,7 +79,8 @@
BOOST_CHECK_THROW(pib.getDefaultIdentity(), Pib::Error);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestPib
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace security
diff --git a/tests/unit-tests/security/safe-bag.t.cpp b/tests/unit-tests/security/safe-bag.t.cpp
index cdfe27d..3c93e58 100644
--- a/tests/unit-tests/security/safe-bag.t.cpp
+++ b/tests/unit-tests/security/safe-bag.t.cpp
@@ -20,6 +20,7 @@
*
* @author Zhiyi Zhang <dreamerbarrychang@gmail.com>
*/
+
#include "security/safe-bag.hpp"
#include "boost-test.hpp"
diff --git a/tests/unit-tests/security/sec-public-info-sqlite3.t.cpp b/tests/unit-tests/security/sec-public-info-sqlite3.t.cpp
index aa2a748..245babc 100644
--- a/tests/unit-tests/security/sec-public-info-sqlite3.t.cpp
+++ b/tests/unit-tests/security/sec-public-info-sqlite3.t.cpp
@@ -25,9 +25,10 @@
#include "encoding/buffer-stream.hpp"
#include "util/time.hpp"
+#include "boost-test.hpp"
+
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
-#include "boost-test.hpp"
namespace ndn {
namespace security {
@@ -53,7 +54,8 @@
boost::filesystem::path tmpPath;
};
-BOOST_AUTO_TEST_SUITE(SecuritySecPublicInfoSqlite3)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_AUTO_TEST_SUITE(TestSecPublicInfoSqlite3)
const std::string RSA_DER("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuFoDcNtffwbfFix64fw0\
hI2tKMkFrc6Ex7yw0YLMK9vGE8lXOyBl/qXabow6RCz+GldmFN6E2Qhm1+AX3Zm5\
@@ -134,16 +136,16 @@
pib.deleteIdentityInfo(Name("/TestSecPublicInfoSqlite3/KeyType/ECDSA"));
}
-BOOST_AUTO_TEST_CASE(KeyTypeNonExist)
+BOOST_AUTO_TEST_CASE(KeyTypeNonExistent)
{
Name nullKeyName("/TestSecPublicInfoSqlite3/KeyType/Null");
SecPublicInfoSqlite3 pib;
BOOST_CHECK_EQUAL(KeyType::NONE, pib.getPublicKeyType(nullKeyName));
-
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestSecPublicInfoSqlite3
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace security
diff --git a/tests/unit-tests/security/sec-rule-relative.t.cpp b/tests/unit-tests/security/sec-rule-relative.t.cpp
index a94e6c1..21f805e 100644
--- a/tests/unit-tests/security/sec-rule-relative.t.cpp
+++ b/tests/unit-tests/security/sec-rule-relative.t.cpp
@@ -28,9 +28,10 @@
using namespace ndn::tests;
-BOOST_FIXTURE_TEST_SUITE(SecuritySecRuleRelative, IdentityManagementFixture)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_FIXTURE_TEST_SUITE(TestSecRuleRelative, IdentityManagementFixture)
-BOOST_AUTO_TEST_CASE(SecRuleRelativeTest)
+BOOST_AUTO_TEST_CASE(Basic)
{
Name rsaIdentity("/SecurityTestSecRule/Basic/Rsa");
BOOST_REQUIRE(addIdentity(rsaIdentity, RsaKeyParams()));
@@ -61,7 +62,8 @@
BOOST_CHECK_EQUAL(rule.matchSignerName(sha256Data), false);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestSecRuleRelative
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace security
diff --git a/tests/unit-tests/security/sec-rule-specific.t.cpp b/tests/unit-tests/security/sec-rule-specific.t.cpp
index c1748fb..e69d0ee 100644
--- a/tests/unit-tests/security/sec-rule-specific.t.cpp
+++ b/tests/unit-tests/security/sec-rule-specific.t.cpp
@@ -31,9 +31,10 @@
using namespace ndn::tests;
-BOOST_FIXTURE_TEST_SUITE(SecuritySecRuleSpecific, IdentityManagementFixture)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_FIXTURE_TEST_SUITE(TestSecRuleSpecific, IdentityManagementFixture)
-BOOST_AUTO_TEST_CASE(SecRuleSpecificTest)
+BOOST_AUTO_TEST_CASE(Basic)
{
Name rsaIdentity("/SecurityTestSecRule/Basic/Rsa");
BOOST_REQUIRE(addIdentity(rsaIdentity, RsaKeyParams()));
@@ -67,7 +68,8 @@
BOOST_CHECK_EQUAL(rule.matchSignerName(sha256Data), false);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestSecRuleSpecific
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace security
diff --git a/tests/unit-tests/security/sec-tpm-file.t.cpp b/tests/unit-tests/security/sec-tpm-file.t.cpp
index 56f8ba7..68671e8 100644
--- a/tests/unit-tests/security/sec-tpm-file.t.cpp
+++ b/tests/unit-tests/security/sec-tpm-file.t.cpp
@@ -22,18 +22,19 @@
#include "security/sec-tpm-file.hpp"
#include "security/key-chain.hpp"
#include "security/v1/cryptopp.hpp"
-
#include "util/time.hpp"
+#include "boost-test.hpp"
+
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
-#include "boost-test.hpp"
namespace ndn {
namespace security {
namespace tests {
-BOOST_AUTO_TEST_SUITE(SecuritySecTpmFile)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_AUTO_TEST_SUITE(TestSecTpmFile)
BOOST_AUTO_TEST_CASE(Delete)
{
@@ -404,7 +405,8 @@
BOOST_REQUIRE_EQUAL(tpm.doesKeyExistInTpm(keyName, KeyClass::PUBLIC), false);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestSecTpmFile
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace security
diff --git a/tests/unit-tests/security/sec-tpm-osx.t.cpp b/tests/unit-tests/security/sec-tpm-osx.t.cpp
index 6bb283a..65ea5c3 100644
--- a/tests/unit-tests/security/sec-tpm-osx.t.cpp
+++ b/tests/unit-tests/security/sec-tpm-osx.t.cpp
@@ -21,14 +21,13 @@
#include "security/sec-tpm-osx.hpp"
#include "security/v1/cryptopp.hpp"
-
#include "util/time.hpp"
+#include "boost-test.hpp"
+
#include <boost/lexical_cast.hpp>
#include <Availability.h>
-#include "boost-test.hpp"
-
namespace ndn {
namespace security {
namespace tests {
@@ -63,7 +62,8 @@
std::string m_HOME;
};
-BOOST_FIXTURE_TEST_SUITE(SecuritySecTpmOsx, OsxKeyChainTestFixture)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_FIXTURE_TEST_SUITE(TestSecTpmOsx, OsxKeyChainTestFixture)
BOOST_AUTO_TEST_CASE(Delete)
{
@@ -360,7 +360,8 @@
#endif
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestSecTpmOsx
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace security
diff --git a/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp b/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp
index e6bd97f..448734b 100644
--- a/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp
+++ b/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp
@@ -23,15 +23,14 @@
#include "security/key-chain.hpp"
#include "security/validator.hpp"
#include "util/scheduler.hpp"
-#include "identity-management-fixture.hpp"
-#include "../unit-test-time-fixture.hpp"
+
#include "boost-test.hpp"
+#include "../identity-management-time-fixture.hpp"
namespace ndn {
namespace tests {
-class SignatureSha256EcdsaTimeFixture : public UnitTestTimeFixture
- , public IdentityManagementFixture
+class SignatureSha256EcdsaTimeFixture : public IdentityManagementTimeFixture
{
public:
SignatureSha256EcdsaTimeFixture()
@@ -43,7 +42,8 @@
Scheduler scheduler;
};
-BOOST_FIXTURE_TEST_SUITE(SecuritySignatureSha256WithEcdsa, SignatureSha256EcdsaTimeFixture)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_FIXTURE_TEST_SUITE(TestSignatureSha256WithEcdsa, SignatureSha256EcdsaTimeFixture)
const uint8_t sigInfo[] = {
0x16, 0x1b, // SignatureInfo
@@ -124,7 +124,6 @@
BOOST_CHECK(Validator::verifySignature(testData2, *publicKey));
}
-
BOOST_AUTO_TEST_CASE(InterestSignature)
{
Name identityName("/SecurityTestSignatureSha256WithEcdsa/InterestSignature");
@@ -173,7 +172,8 @@
BOOST_CHECK(Validator::verifySignature(interest2, *publicKey));
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestSignatureSha256WithEcdsa
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp b/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp
index ec9e936..75fc6be 100644
--- a/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp
+++ b/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp
@@ -23,15 +23,14 @@
#include "security/key-chain.hpp"
#include "security/validator.hpp"
#include "util/scheduler.hpp"
-#include "identity-management-fixture.hpp"
-#include "../unit-test-time-fixture.hpp"
+
#include "boost-test.hpp"
+#include "../identity-management-time-fixture.hpp"
namespace ndn {
namespace tests {
-class SignatureSha256RsaTimeFixture : public UnitTestTimeFixture
- , public IdentityManagementFixture
+class SignatureSha256RsaTimeFixture : public IdentityManagementTimeFixture
{
public:
SignatureSha256RsaTimeFixture()
@@ -43,7 +42,8 @@
Scheduler scheduler;
};
-BOOST_FIXTURE_TEST_SUITE(SecuritySignatureSha256WithRsa, SignatureSha256RsaTimeFixture)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_FIXTURE_TEST_SUITE(TestSignatureSha256WithRsa, SignatureSha256RsaTimeFixture)
const uint8_t sigInfo[] = {
0x16, 0x1b, // SignatureInfo
@@ -176,7 +176,8 @@
BOOST_CHECK(Validator::verifySignature(interest2, *publicKey));
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestSignatureSha256WithRsa
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/security/signing-helpers.t.cpp b/tests/unit-tests/security/signing-helpers.t.cpp
index 6665704..b29954c 100644
--- a/tests/unit-tests/security/signing-helpers.t.cpp
+++ b/tests/unit-tests/security/signing-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).
*
@@ -27,7 +27,8 @@
namespace security {
namespace tests {
-BOOST_AUTO_TEST_SUITE(SecuritySigningHelpers)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_AUTO_TEST_SUITE(TestSigningHelpers)
BOOST_AUTO_TEST_CASE(Identity)
{
@@ -60,8 +61,9 @@
BOOST_CHECK_EQUAL(info.getSignerName(), SigningInfo::EMPTY_NAME);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestSigningHelpers
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace security
-} // namespace ndn
\ No newline at end of file
+} // namespace ndn
diff --git a/tests/unit-tests/security/signing-info.t.cpp b/tests/unit-tests/security/signing-info.t.cpp
index 994cb2a..e7e1447 100644
--- a/tests/unit-tests/security/signing-info.t.cpp
+++ b/tests/unit-tests/security/signing-info.t.cpp
@@ -22,16 +22,17 @@
#include "security/signing-info.hpp"
#include "security/key-chain.hpp"
-#include <sstream>
-#include <boost/lexical_cast.hpp>
-
#include "boost-test.hpp"
+#include <boost/lexical_cast.hpp>
+#include <sstream>
+
namespace ndn {
namespace security {
namespace tests {
-BOOST_AUTO_TEST_SUITE(SecuritySigningInfo)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_AUTO_TEST_SUITE(TestSigningInfo)
BOOST_AUTO_TEST_CASE(Basic)
{
@@ -151,7 +152,8 @@
"id:/localhost/identity/digest-sha256");
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestSigningInfo
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace security
diff --git a/tests/unit-tests/security/v2/additional-info.t.cpp b/tests/unit-tests/security/v2/additional-description.t.cpp
similarity index 92%
rename from tests/unit-tests/security/v2/additional-info.t.cpp
rename to tests/unit-tests/security/v2/additional-description.t.cpp
index b82d56d..98431b6 100644
--- a/tests/unit-tests/security/v2/additional-info.t.cpp
+++ b/tests/unit-tests/security/v2/additional-description.t.cpp
@@ -27,9 +27,10 @@
namespace security {
namespace tests {
-BOOST_AUTO_TEST_SUITE(SecurityAdditionalDescription)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_AUTO_TEST_SUITE(TestAdditionalDescription)
-static const uint8_t description[] = {
+const uint8_t description[] = {
0xfd, 0x01, 0x02, 0x28,
0xfd, 0x02, 0x00, 0x10, // DescriptionEntry
0xfd, 0x02, 0x01, 0x04, // DescriptionKey
@@ -43,7 +44,7 @@
0x76, 0x61, 0x6c, 0x32, // "val2"
};
-static const std::string text = "((key1:val1), (key2:val2))";
+const std::string text = "((key1:val1), (key2:val2))";
BOOST_AUTO_TEST_CASE(Basic)
{
@@ -94,7 +95,8 @@
BOOST_CHECK_EQUAL(os.str(), text);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestAdditionalDescription
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace tests
} // namespace security
diff --git a/tests/unit-tests/security/validity-period.t.cpp b/tests/unit-tests/security/validity-period.t.cpp
index be5b2e4..db22b9e 100644
--- a/tests/unit-tests/security/validity-period.t.cpp
+++ b/tests/unit-tests/security/validity-period.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).
*
@@ -28,7 +28,8 @@
namespace security {
namespace test {
-BOOST_AUTO_TEST_SUITE(SecurityValidityPeriod)
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_AUTO_TEST_SUITE(TestValidityPeriod)
BOOST_AUTO_TEST_CASE(ConstructorSetter)
{
@@ -184,7 +185,8 @@
BOOST_CHECK(validity1 != validity3);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestValidityPeriod
+BOOST_AUTO_TEST_SUITE_END() // Security
} // namespace test
} // namespace security
diff --git a/tests/unit-tests/signature-info.t.cpp b/tests/unit-tests/signature-info.t.cpp
index 9e7f600..1eaa665 100644
--- a/tests/unit-tests/signature-info.t.cpp
+++ b/tests/unit-tests/signature-info.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).
*
@@ -224,7 +224,7 @@
BOOST_REQUIRE_NO_THROW(info.getTypeSpecificTlv(0x81));
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestSignatureInfo
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/tag-host.t.cpp b/tests/unit-tests/tag-host.t.cpp
index ffdf7e0..ae99a8c 100644
--- a/tests/unit-tests/tag-host.t.cpp
+++ b/tests/unit-tests/tag-host.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).
*
@@ -80,7 +80,7 @@
BOOST_CHECK(this->template getTag<TestTag2>() == nullptr);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestTagHost
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/util/test-home-environment-fixture.hpp b/tests/unit-tests/test-home-env-saver.hpp
similarity index 74%
rename from tests/unit-tests/util/test-home-environment-fixture.hpp
rename to tests/unit-tests/test-home-env-saver.hpp
index 4fd5dca..9976b96 100644
--- a/tests/unit-tests/util/test-home-environment-fixture.hpp
+++ b/tests/unit-tests/test-home-env-saver.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2014 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,23 +19,26 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_TESTS_UNIT_TESTS_UTIL_HOME_ENVIRONMENT_FIXTURE_HPP
-#define NDN_TESTS_UNIT_TESTS_UTIL_HOME_ENVIRONMENT_FIXTURE_HPP
+#ifndef NDN_TESTS_UNIT_TESTS_TEST_HOME_ENV_SAVER_HPP
+#define NDN_TESTS_UNIT_TESTS_TEST_HOME_ENV_SAVER_HPP
+
+#include <string>
+#include <cstdlib>
namespace ndn {
-namespace util {
+namespace tests {
-class TestHomeEnvironmentFixture
+class TestHomeEnvSaver
{
public:
- TestHomeEnvironmentFixture()
+ TestHomeEnvSaver()
{
- if (std::getenv("TEST_HOME"))
+ if (std::getenv("TEST_HOME") != nullptr)
m_HOME = std::getenv("TEST_HOME");
}
virtual
- ~TestHomeEnvironmentFixture()
+ ~TestHomeEnvSaver()
{
if (!m_HOME.empty())
setenv("TEST_HOME", m_HOME.c_str(), 1);
@@ -43,11 +46,11 @@
unsetenv("TEST_HOME");
}
-protected:
+private:
std::string m_HOME;
};
} // namespace tests
} // namespace ndn
-#endif // NDN_TESTS_UNIT_TESTS_UTIL_HOME_ENVIRONMENT_FIXTURE_HPP
+#endif // NDN_TESTS_UNIT_TESTS_TEST_HOME_ENV_SAVER_HPP
diff --git a/tests/unit-tests/transport/tcp-transport.t.cpp b/tests/unit-tests/transport/tcp-transport.t.cpp
index 3e9a99b..2386553 100644
--- a/tests/unit-tests/transport/tcp-transport.t.cpp
+++ b/tests/unit-tests/transport/tcp-transport.t.cpp
@@ -27,7 +27,10 @@
namespace ndn {
namespace tests {
-BOOST_FIXTURE_TEST_SUITE(TransportTcpTransport, TransportFixture)
+BOOST_AUTO_TEST_SUITE(Transport)
+BOOST_FIXTURE_TEST_SUITE(TestTcpTransport, TransportFixture)
+
+using ndn::Transport;
BOOST_AUTO_TEST_CASE(GetDefaultSocketNameOk)
{
@@ -81,7 +84,8 @@
});
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestTcpTransport
+BOOST_AUTO_TEST_SUITE_END() // Transport
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/transport/transport-fixture.hpp b/tests/unit-tests/transport/transport-fixture.hpp
index 71970c5..602ba5f 100644
--- a/tests/unit-tests/transport/transport-fixture.hpp
+++ b/tests/unit-tests/transport/transport-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2014 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,29 +20,29 @@
*/
#include "util/config-file.hpp"
-#include "../util/test-home-environment-fixture.hpp"
+#include "../test-home-env-saver.hpp"
#ifndef NDN_TESTS_UNIT_TESTS_TRANSPORT_FIXTURE_HPP
#define NDN_TESTS_UNIT_TESTS_TRANSPORT_FIXTURE_HPP
namespace ndn {
+namespace tests {
-class TransportFixture : public util::TestHomeEnvironmentFixture
+class TransportFixture : public TestHomeEnvSaver
{
public:
-
void
initializeConfig(const char* path)
{
setenv("TEST_HOME", path, 1);
- m_config.reset(new ConfigFile);
+ m_config = make_unique<ConfigFile>();
}
protected:
- std::string m_HOME;
unique_ptr<ConfigFile> m_config;
};
+} // namespace tests
} // namespace ndn
#endif // NDN_TESTS_UNIT_TESTS_TRANSPORT_FIXTURE_HPP
diff --git a/tests/unit-tests/transport/unix-transport.t.cpp b/tests/unit-tests/transport/unix-transport.t.cpp
index 86bd7f3..f3d4cac 100644
--- a/tests/unit-tests/transport/unix-transport.t.cpp
+++ b/tests/unit-tests/transport/unix-transport.t.cpp
@@ -27,7 +27,10 @@
namespace ndn {
namespace tests {
-BOOST_FIXTURE_TEST_SUITE(TransportUnixTransport, TransportFixture)
+BOOST_AUTO_TEST_SUITE(Transport)
+BOOST_FIXTURE_TEST_SUITE(TestUnixTransport, TransportFixture)
+
+using ndn::Transport;
BOOST_AUTO_TEST_CASE(GetDefaultSocketNameOk)
{
@@ -58,7 +61,8 @@
});
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestUnixTransport
+BOOST_AUTO_TEST_SUITE_END() // Transport
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/util/config-file.t.cpp b/tests/unit-tests/util/config-file.t.cpp
index af03156..e72d0f2 100644
--- a/tests/unit-tests/util/config-file.t.cpp
+++ b/tests/unit-tests/util/config-file.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,79 +20,51 @@
*/
#include "util/config-file.hpp"
-#include "../util/test-home-environment-fixture.hpp"
-
-#include <cstdlib>
+#include "../test-home-env-saver.hpp"
#include "boost-test.hpp"
+#include <cstdlib>
+
namespace ndn {
namespace tests {
-BOOST_FIXTURE_TEST_SUITE(UtilConfigFile, util::TestHomeEnvironmentFixture)
+BOOST_AUTO_TEST_SUITE(Util)
+BOOST_FIXTURE_TEST_SUITE(TestConfigFile, TestHomeEnvSaver)
-BOOST_AUTO_TEST_CASE(TestParse)
+BOOST_AUTO_TEST_CASE(Parse)
{
- using namespace boost::filesystem;
- // std::cerr << "current home = " << std::getenv("TEST_HOME") << std::endl;
+ namespace fs = boost::filesystem;
setenv("TEST_HOME", "tests/unit-tests/util/config-file-home", 1);
- path homePath(absolute(std::getenv("TEST_HOME")));
+ fs::path homePath(fs::absolute(std::getenv("TEST_HOME")));
homePath /= ".ndn/client.conf";
- try
- {
- ConfigFile config;
+ ConfigFile config;
+ BOOST_REQUIRE_EQUAL(config.getPath(), homePath);
- BOOST_REQUIRE_EQUAL(config.getPath(), homePath);
-
- const ConfigFile::Parsed& parsed = config.getParsedConfiguration();
- BOOST_CHECK_EQUAL(parsed.get<std::string>("a"), "/path/to/nowhere");
- BOOST_CHECK_EQUAL(parsed.get<std::string>("b"), "some-othervalue.01");
- }
- catch (const std::runtime_error& error)
- {
- BOOST_FAIL("Unexpected exception: " << error.what());
- }
+ const ConfigFile::Parsed& parsed = config.getParsedConfiguration();
+ BOOST_CHECK_EQUAL(parsed.get<std::string>("a"), "/path/to/nowhere");
+ BOOST_CHECK_EQUAL(parsed.get<std::string>("b"), "some-othervalue.01");
}
-BOOST_AUTO_TEST_CASE(EmptyPathParse)
+BOOST_AUTO_TEST_CASE(ParseEmptyPath)
{
- // std::cerr << "current home = " << std::getenv("TEST_HOME") << std::endl;
-
setenv("TEST_HOME", "tests/unit-tests/util/does/not/exist", 1);
- try
- {
- ConfigFile config;
- }
- catch (const std::runtime_error& error)
- {
- BOOST_FAIL("Unexpected exception: " << error.what());
- }
+
+ BOOST_CHECK_NO_THROW(ConfigFile config);
}
-BOOST_AUTO_TEST_CASE(MalformedParse)
+BOOST_AUTO_TEST_CASE(ParseMalformed)
{
- using namespace boost::filesystem;
- // std::cerr << "current home = " << std::getenv("TEST_HOME") << std::endl;
-
setenv("TEST_HOME", "tests/unit-tests/util/config-file-malformed-home", 1);
- bool fileWasMalformed = false;
- try
- {
- ConfigFile config;
- }
- catch (const ConfigFile::Error& error)
- {
- fileWasMalformed = true;
- }
-
- BOOST_REQUIRE(fileWasMalformed);
+ BOOST_CHECK_THROW(ConfigFile config, ConfigFile::Error);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestConfigFile
+BOOST_AUTO_TEST_SUITE_END() // Util
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/util/digest.t.cpp b/tests/unit-tests/util/digest.t.cpp
index 62be5d4..25f75dd 100644
--- a/tests/unit-tests/util/digest.t.cpp
+++ b/tests/unit-tests/util/digest.t.cpp
@@ -29,7 +29,8 @@
namespace util {
namespace test {
-BOOST_AUTO_TEST_SUITE(UtilDigest)
+BOOST_AUTO_TEST_SUITE(Util)
+BOOST_AUTO_TEST_SUITE(TestDigest)
BOOST_AUTO_TEST_CASE(Sha256Digest)
{
@@ -185,7 +186,6 @@
digest2->buf() + digest2->size());
}
-
BOOST_AUTO_TEST_CASE(Error)
{
uint64_t origin = 256;
@@ -234,7 +234,8 @@
BOOST_CHECK_EQUAL(digest.toString(), hexString);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestDigest
+BOOST_AUTO_TEST_SUITE_END() // Util
} // namespace test
} // namespace util
diff --git a/tests/unit-tests/util/dns.t.cpp b/tests/unit-tests/util/dns.t.cpp
index be94ba9..e76d593 100644
--- a/tests/unit-tests/util/dns.t.cpp
+++ b/tests/unit-tests/util/dns.t.cpp
@@ -24,8 +24,7 @@
#include "boost-test.hpp"
#include "../network-configuration-detector.hpp"
-#include <boost/asio.hpp>
-#include <boost/lexical_cast.hpp>
+#include <boost/asio/io_service.hpp>
namespace ndn {
namespace util {
@@ -51,24 +50,19 @@
bool isValid,
bool shouldCheckAddress = false)
{
- BOOST_TEST_MESSAGE("Resolved to: " << resolvedAddress);
-
++m_nSuccesses;
- if (!isValid)
- {
- BOOST_FAIL("Resolved to " + boost::lexical_cast<std::string>(resolvedAddress)
- + ", but should have failed");
- }
+ if (!isValid) {
+ BOOST_FAIL("Resolved to " + resolvedAddress.to_string() + ", but should have failed");
+ }
BOOST_CHECK_EQUAL(resolvedAddress.is_v4(), expectedAddress.is_v4());
// checking address is not deterministic and should be enabled only
// if only one IP address will be returned by resolution
- if (shouldCheckAddress)
- {
- BOOST_CHECK_EQUAL(resolvedAddress, expectedAddress);
- }
+ if (shouldCheckAddress) {
+ BOOST_CHECK_EQUAL(resolvedAddress, expectedAddress);
+ }
}
void
@@ -76,27 +70,26 @@
{
++m_nFailures;
- if (!isValid)
- {
- BOOST_FAIL("Resolution should not have failed");
- }
+ if (!isValid) {
+ BOOST_FAIL("Resolution should not have failed");
+ }
BOOST_CHECK_MESSAGE(true, "Resolution failed as expected");
}
-public:
+protected:
uint32_t m_nFailures;
uint32_t m_nSuccesses;
-
boost::asio::io_service m_ioService;
};
-BOOST_FIXTURE_TEST_SUITE(UtilDns, DnsFixture)
+BOOST_AUTO_TEST_SUITE(Util)
+BOOST_FIXTURE_TEST_SUITE(TestDns, DnsFixture)
BOOST_AUTO_TEST_CASE(Asynchronous)
{
if (!NetworkConfigurationDetector::hasIpv4() && !NetworkConfigurationDetector::hasIpv6()) {
- BOOST_TEST_MESSAGE("Platform does not support both IPv4 and IPv6, skipping test case");
+ BOOST_WARN_MESSAGE(false, "skipping assertions that require either IPv4 or IPv6 support");
return;
}
@@ -113,10 +106,7 @@
BOOST_AUTO_TEST_CASE(AsynchronousV4)
{
- if (!NetworkConfigurationDetector::hasIpv4()) {
- BOOST_TEST_MESSAGE("Platform does not support IPv4, skipping the test case");
- return;
- }
+ SKIP_IF_IPV4_UNAVAILABLE();
dns::asyncResolve("192.0.2.1",
bind(&DnsFixture::onSuccess, this, _1,
@@ -132,10 +122,7 @@
BOOST_AUTO_TEST_CASE(AsynchronousV6)
{
- if (!NetworkConfigurationDetector::hasIpv6()) {
- BOOST_TEST_MESSAGE("Platform does not support IPv6, skipping the test case");
- return;
- }
+ SKIP_IF_IPV6_UNAVAILABLE();
dns::asyncResolve("ipv6.google.com", // only IPv6 address should be available
bind(&DnsFixture::onSuccess, this, _1,
@@ -158,10 +145,8 @@
BOOST_AUTO_TEST_CASE(AsynchronousV4AndV6)
{
- if (!NetworkConfigurationDetector::hasIpv4() || !NetworkConfigurationDetector::hasIpv6()) {
- BOOST_TEST_MESSAGE("Platform does not support either IPv4 or IPv6, skipping test case");
- return;
- }
+ SKIP_IF_IPV4_UNAVAILABLE();
+ SKIP_IF_IPV6_UNAVAILABLE();
dns::asyncResolve("www.named-data.net",
bind(&DnsFixture::onSuccess, this, _1,
@@ -206,7 +191,7 @@
BOOST_AUTO_TEST_CASE(Synchronous)
{
if (!NetworkConfigurationDetector::hasIpv4() && !NetworkConfigurationDetector::hasIpv6()) {
- BOOST_TEST_MESSAGE("Platform does not support both IPv4 and IPv6, skipping test case");
+ BOOST_WARN_MESSAGE(false, "skipping assertions that require either IPv4 or IPv6 support");
return;
}
dns::IpAddress address;
@@ -215,7 +200,8 @@
BOOST_CHECK(address.is_v4() || address.is_v6());
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestDns
+BOOST_AUTO_TEST_SUITE_END() // Util
} // namespace tests
} // namespace util
diff --git a/tests/unit-tests/util/ethernet.t.cpp b/tests/unit-tests/util/ethernet.t.cpp
index 9b7aa35..e8e59e5 100644
--- a/tests/unit-tests/util/ethernet.t.cpp
+++ b/tests/unit-tests/util/ethernet.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,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -33,9 +33,10 @@
namespace util {
namespace tests {
-BOOST_AUTO_TEST_SUITE(UtilEthernet)
+BOOST_AUTO_TEST_SUITE(Util)
+BOOST_AUTO_TEST_SUITE(TestEthernet)
-BOOST_AUTO_TEST_CASE(BasicChecks)
+BOOST_AUTO_TEST_CASE(Basic)
{
ethernet::Address a;
BOOST_CHECK(a.isNull());
@@ -110,7 +111,8 @@
BOOST_CHECK_NO_THROW(h(ethernet::getDefaultMulticastAddress()));
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestEthernet
+BOOST_AUTO_TEST_SUITE_END() // Util
} // namespace tests
} // namespace util
diff --git a/tests/unit-tests/util/face-uri.t.cpp b/tests/unit-tests/util/face-uri.t.cpp
index b860e2f..6cf52d9 100644
--- a/tests/unit-tests/util/face-uri.t.cpp
+++ b/tests/unit-tests/util/face-uri.t.cpp
@@ -36,7 +36,8 @@
using ndn::tests::NetworkConfigurationDetector;
-BOOST_AUTO_TEST_SUITE(UtilFaceUri)
+BOOST_AUTO_TEST_SUITE(Util)
+BOOST_AUTO_TEST_SUITE(TestFaceUri)
class CanonizeFixture : noncopyable
{
@@ -196,10 +197,7 @@
BOOST_FIXTURE_TEST_CASE(CanonizeUdpV4, CanonizeFixture)
{
- if (!NetworkConfigurationDetector::hasIpv4()) {
- BOOST_TEST_MESSAGE("Platform does not support IPv4, skipping the test case");
- return;
- }
+ SKIP_IF_IPV4_UNAVAILABLE();
// IPv4 unicast
addTest("udp4://192.0.2.1:6363", true, "udp4://192.0.2.1:6363");
@@ -221,10 +219,7 @@
BOOST_FIXTURE_TEST_CASE(CanonizeUdpV6, CanonizeFixture)
{
- if (!NetworkConfigurationDetector::hasIpv6()) {
- BOOST_TEST_MESSAGE("Platform does not support IPv6, skipping the test case");
- return;
- }
+ SKIP_IF_IPV6_UNAVAILABLE();
// IPv6 unicast
addTest("udp6://[2001:db8::1]:6363", true, "udp6://[2001:db8::1]:6363");
@@ -287,10 +282,7 @@
BOOST_FIXTURE_TEST_CASE(CanonizeTcpV4, CanonizeFixture)
{
- if (!NetworkConfigurationDetector::hasIpv4()) {
- BOOST_TEST_MESSAGE("Platform does not support IPv4, skipping the test case");
- return;
- }
+ SKIP_IF_IPV4_UNAVAILABLE();
// IPv4 unicast
addTest("tcp4://192.0.2.1:6363", true, "tcp4://192.0.2.1:6363");
@@ -312,10 +304,7 @@
BOOST_FIXTURE_TEST_CASE(CanonizeTcpV6, CanonizeFixture)
{
- if (!NetworkConfigurationDetector::hasIpv6()) {
- BOOST_TEST_MESSAGE("Platform does not support IPv6, skipping the test case");
- return;
- }
+ SKIP_IF_IPV6_UNAVAILABLE();
// IPv6 unicast
addTest("tcp6://[2001:db8::1]:6363", true, "tcp6://[2001:db8::1]:6363");
@@ -486,6 +475,9 @@
io, time::milliseconds(1));
io.run(); // should not crash
+
+ // avoid "test case [...] did not check any assertions" message from Boost.Test
+ BOOST_CHECK(true);
}
BOOST_FIXTURE_TEST_CASE(CanonizeUnsupported, CanonizeFixture)
@@ -523,7 +515,8 @@
BOOST_CHECK_EQUAL(uri.toString(), "wsclient://76.90.11.239:56366");
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestFaceUri
+BOOST_AUTO_TEST_SUITE_END() // Util
} // namespace tests
} // namespace util
diff --git a/tests/unit-tests/util/in-memory-storage-common.t.cpp b/tests/unit-tests/util/in-memory-storage-common.t.cpp
index da87929..e6a3ab7 100644
--- a/tests/unit-tests/util/in-memory-storage-common.t.cpp
+++ b/tests/unit-tests/util/in-memory-storage-common.t.cpp
@@ -41,20 +41,15 @@
BOOST_AUTO_TEST_SUITE(TestInMemoryStorage)
BOOST_AUTO_TEST_SUITE(Common)
-typedef boost::mpl::list<InMemoryStoragePersistent, InMemoryStorageFifo, InMemoryStorageLfu,
- InMemoryStorageLru> InMemoryStorages;
+using InMemoryStorages = boost::mpl::list<InMemoryStoragePersistent,
+ InMemoryStorageFifo,
+ InMemoryStorageLfu,
+ InMemoryStorageLru>;
BOOST_AUTO_TEST_CASE_TEMPLATE(Insertion, T, InMemoryStorages)
{
T ims;
- ims.insert(*makeData("/insertion"));
-}
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(Insertion2, T, InMemoryStorages)
-{
- T ims;
-
ims.insert(*makeData("/a"));
ims.insert(*makeData("/b"));
ims.insert(*makeData("/c"));
@@ -63,7 +58,7 @@
BOOST_CHECK_EQUAL(ims.size(), 4);
}
-BOOST_AUTO_TEST_CASE_TEMPLATE(Insertion3, T, InMemoryStorages)
+BOOST_AUTO_TEST_CASE_TEMPLATE(Insertion2, T, InMemoryStorages)
{
T ims;
@@ -347,6 +342,9 @@
shared_ptr<Data> data7 = makeData("/c/c/1");
ims.insert(*data7);
+
+ // avoid "test case [...] did not check any assertions" message from Boost.Test
+ BOOST_CHECK(true);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(EraseCanonical, T, InMemoryStorages)
@@ -627,8 +625,9 @@
BOOST_CHECK_EQUAL(found3->getName(), "/c/a");
}
-typedef boost::mpl::list<InMemoryStorageFifo, InMemoryStorageLfu, InMemoryStorageLru>
- InMemoryStoragesLimited;
+using InMemoryStoragesLimited = boost::mpl::list<InMemoryStorageFifo,
+ InMemoryStorageLfu,
+ InMemoryStorageLru>;
BOOST_AUTO_TEST_CASE_TEMPLATE(SetCapacity, T, InMemoryStoragesLimited)
{
diff --git a/tests/unit-tests/util/indented-stream.t.cpp b/tests/unit-tests/util/indented-stream.t.cpp
index 91dff26..bc033ff 100644
--- a/tests/unit-tests/util/indented-stream.t.cpp
+++ b/tests/unit-tests/util/indented-stream.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).
*
@@ -24,13 +24,14 @@
#include "boost-test.hpp"
#include <boost/test/output_test_stream.hpp>
-using boost::test_tools::output_test_stream;
-
namespace ndn {
namespace util {
namespace tests {
-BOOST_AUTO_TEST_SUITE(UtilIndentedStream)
+using boost::test_tools::output_test_stream;
+
+BOOST_AUTO_TEST_SUITE(Util)
+BOOST_AUTO_TEST_SUITE(TestIndentedStream)
BOOST_AUTO_TEST_CASE(Basic)
{
@@ -72,7 +73,8 @@
));
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestIndentedStream
+BOOST_AUTO_TEST_SUITE_END() // Util
} // namespace tests
} // namespace util
diff --git a/tests/unit-tests/util/notification-stream.t.cpp b/tests/unit-tests/util/notification-stream.t.cpp
index 8ac084a..8ec6c6f 100644
--- a/tests/unit-tests/util/notification-stream.t.cpp
+++ b/tests/unit-tests/util/notification-stream.t.cpp
@@ -36,7 +36,8 @@
namespace util {
namespace tests {
-BOOST_FIXTURE_TEST_SUITE(UtilNotificationStream, ndn::tests::IdentityManagementTimeFixture)
+BOOST_AUTO_TEST_SUITE(Util)
+BOOST_FIXTURE_TEST_SUITE(TestNotificationStream, ndn::tests::IdentityManagementTimeFixture)
BOOST_AUTO_TEST_CASE(Post)
{
@@ -69,7 +70,8 @@
BOOST_CHECK_EQUAL(decoded2.getMessage(), "msg2");
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestNotificationStream
+BOOST_AUTO_TEST_SUITE_END() // Util
} // namespace tests
} // namespace util
diff --git a/tests/unit-tests/util/regex.t.cpp b/tests/unit-tests/util/regex.t.cpp
index e7cdea5..fc46c23 100644
--- a/tests/unit-tests/util/regex.t.cpp
+++ b/tests/unit-tests/util/regex.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).
*
@@ -37,11 +37,11 @@
using std::string;
-BOOST_AUTO_TEST_SUITE(UtilRegex)
+BOOST_AUTO_TEST_SUITE(Util)
+BOOST_AUTO_TEST_SUITE(TestRegex)
BOOST_AUTO_TEST_CASE(ComponentMatcher)
{
-
shared_ptr<RegexBackrefManager> backRef = make_shared<RegexBackrefManager>();
shared_ptr<RegexComponentMatcher> cm = make_shared<RegexComponentMatcher>("a", backRef);
bool res = cm->match(Name("/a/b/"), 0, 1);
@@ -69,7 +69,6 @@
BOOST_AUTO_TEST_CASE(ComponentSetMatcher)
{
-
shared_ptr<RegexBackrefManager> backRef = make_shared<RegexBackrefManager>();
shared_ptr<RegexComponentSetMatcher> cm = make_shared<RegexComponentSetMatcher>("<a>", backRef);
bool res = cm->match(Name("/a/b/"), 0, 1);
@@ -102,12 +101,10 @@
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 1);
BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("d"));
-
}
BOOST_AUTO_TEST_CASE(RepeatMatcher)
{
-
shared_ptr<RegexBackrefManager> backRef = make_shared<RegexBackrefManager>();
shared_ptr<RegexRepeatMatcher> cm = make_shared<RegexRepeatMatcher>("[<a><b>]*", backRef, 8);
bool res = cm->match(Name("/a/b/c"), 0, 0);
@@ -120,8 +117,6 @@
BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
-
-
backRef = make_shared<RegexBackrefManager>();
cm = make_shared<RegexRepeatMatcher>("[<a><b>]+", backRef, 8);
res = cm->match(Name("/a/b/c"), 0, 0);
@@ -134,8 +129,6 @@
BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
-
-
backRef = make_shared<RegexBackrefManager>();
cm = make_shared<RegexRepeatMatcher>("<.*>*", backRef, 4);
res = cm->match(Name("/a/b/c/d/e/f/"), 0, 6);
@@ -148,8 +141,6 @@
BOOST_CHECK_EQUAL(cm->getMatchResult()[4].toUri(), string("e"));
BOOST_CHECK_EQUAL(cm->getMatchResult()[5].toUri(), string("f"));
-
-
backRef = make_shared<RegexBackrefManager>();
cm = make_shared<RegexRepeatMatcher>("<>*", backRef, 2);
res = cm->match(Name("/a/b/c/d/e/f/"), 0, 6);
@@ -162,8 +153,6 @@
BOOST_CHECK_EQUAL(cm->getMatchResult()[4].toUri(), string("e"));
BOOST_CHECK_EQUAL(cm->getMatchResult()[5].toUri(), string("f"));
-
-
backRef = make_shared<RegexBackrefManager>();
cm = make_shared<RegexRepeatMatcher>("<a>?", backRef, 3);
res = cm->match(Name("/a/b/c"), 0, 0);
@@ -181,8 +170,6 @@
BOOST_CHECK_EQUAL(res, false);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
-
-
backRef = make_shared<RegexBackrefManager>();
cm = make_shared<RegexRepeatMatcher>("[<a><b>]{3}", backRef, 8);
res = cm->match(Name("/a/b/a/d/"), 0, 2);
@@ -200,8 +187,6 @@
BOOST_CHECK_EQUAL(res, false);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
-
-
backRef = make_shared<RegexBackrefManager>();
cm = make_shared<RegexRepeatMatcher>("[<a><b>]{2,3}", backRef, 8);
res = cm->match(Name("/a/b/a/d/e/"), 0, 2);
@@ -225,7 +210,6 @@
BOOST_CHECK_EQUAL(res, false);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
-
backRef = make_shared<RegexBackrefManager>();
cm = make_shared<RegexRepeatMatcher>("[<a><b>]{2,}", backRef, 8);
res = cm->match(Name("/a/b/a/d/e/"), 0, 2);
@@ -246,8 +230,6 @@
BOOST_CHECK_EQUAL(res, false);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
-
-
backRef = make_shared<RegexBackrefManager>();
cm = make_shared<RegexRepeatMatcher>("[<a><b>]{,2}", backRef, 8);
res = cm->match(Name("/a/b/a/b/e/"), 0, 3);
@@ -272,7 +254,6 @@
BOOST_AUTO_TEST_CASE(BackRefMatcher)
{
-
shared_ptr<RegexBackrefManager> backRef = make_shared<RegexBackrefManager>();
shared_ptr<RegexBackrefMatcher> cm = make_shared<RegexBackrefMatcher>("(<a><b>)", backRef);
backRef->pushRef(static_pointer_cast<RegexMatcher>(cm));
@@ -301,7 +282,6 @@
BOOST_AUTO_TEST_CASE(BackRefMatcherAdvanced)
{
-
shared_ptr<RegexBackrefManager> backRef = make_shared<RegexBackrefManager>();
shared_ptr<RegexRepeatMatcher> cm = make_shared<RegexRepeatMatcher>("([<a><b>])+", backRef, 10);
bool res = cm->match(Name("/a/b/c"), 0, 2);
@@ -315,7 +295,6 @@
BOOST_AUTO_TEST_CASE(BackRefMatcherAdvanced2)
{
-
shared_ptr<RegexBackrefManager> backRef = make_shared<RegexBackrefManager>();
shared_ptr<RegexPatternListMatcher> cm = make_shared<RegexPatternListMatcher>("(<a>(<b>))<c>", backRef);
bool res = cm->match(Name("/a/b/c"), 0, 3);
@@ -332,7 +311,6 @@
BOOST_AUTO_TEST_CASE(PatternListMatcher)
{
-
shared_ptr<RegexBackrefManager> backRef = make_shared<RegexBackrefManager>();
shared_ptr<RegexPatternListMatcher> cm = make_shared<RegexPatternListMatcher>("<a>[<a><b>]", backRef);
bool res = cm->match(Name("/a/b/c"), 0, 2);
@@ -362,12 +340,10 @@
BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toUri(), string("c"));
-
}
BOOST_AUTO_TEST_CASE(TopMatcher)
{
-
shared_ptr<RegexTopMatcher> cm = make_shared<RegexTopMatcher>("^<a><b><c>");
bool res = cm->match(Name("/a/b/c/d"));
BOOST_CHECK_EQUAL(res, true);
@@ -408,7 +384,6 @@
BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toUri(), string("c"));
BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toUri(), string("d"));
-
cm = make_shared<RegexTopMatcher>("<b><c>");
res = cm->match(Name("/a/b/c/d"));
BOOST_CHECK_EQUAL(res, true);
@@ -464,7 +439,8 @@
BOOST_CHECK_EQUAL(cm->expand(), Name("/ndn/edu/ucla/yingdi/mac/"));
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestRegex
+BOOST_AUTO_TEST_SUITE_END() // Util
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/util/scheduler.t.cpp b/tests/unit-tests/util/scheduler.t.cpp
index 72db284..8189f01 100644
--- a/tests/unit-tests/util/scheduler.t.cpp
+++ b/tests/unit-tests/util/scheduler.t.cpp
@@ -48,6 +48,8 @@
BOOST_AUTO_TEST_SUITE(Util)
BOOST_FIXTURE_TEST_SUITE(TestScheduler, SchedulerFixture)
+BOOST_AUTO_TEST_SUITE(General)
+
BOOST_AUTO_TEST_CASE(Events)
{
size_t count1 = 0;
@@ -97,6 +99,9 @@
{
EventId i;
scheduler.cancelEvent(i);
+
+ // avoid "test case [...] did not check any assertions" message from Boost.Test
+ BOOST_CHECK(true);
}
BOOST_AUTO_TEST_CASE(SelfCancel)
@@ -233,8 +238,13 @@
eid = sched.scheduleEvent(time::milliseconds(10), []{});
sched.cancelAllEvents();
eid.cancel(); // should not crash
+
+ // avoid "test case [...] did not check any assertions" message from Boost.Test
+ BOOST_CHECK(true);
}
+BOOST_AUTO_TEST_SUITE_END() // General
+
BOOST_AUTO_TEST_SUITE(EventId)
using scheduler::EventId;
@@ -243,6 +253,9 @@
{
EventId eid;
eid = nullptr;
+
+ // avoid "test case [...] did not check any assertions" message from Boost.Test
+ BOOST_CHECK(true);
}
BOOST_AUTO_TEST_CASE(Compare)
diff --git a/tests/unit-tests/util/signal.t.cpp b/tests/unit-tests/util/signal.t.cpp
index c06c4ac..eb02324 100644
--- a/tests/unit-tests/util/signal.t.cpp
+++ b/tests/unit-tests/util/signal.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).
*
@@ -28,7 +28,8 @@
namespace signal {
namespace tests {
-BOOST_AUTO_TEST_SUITE(UtilSignal)
+BOOST_AUTO_TEST_SUITE(Util)
+BOOST_AUTO_TEST_SUITE(TestSignal)
class SignalOwner0
{
@@ -420,7 +421,8 @@
BOOST_CHECK_EQUAL(hit, 2); // handler called
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestSignal
+BOOST_AUTO_TEST_SUITE_END() // Util
} // namespace tests
} // namespace signal
diff --git a/tests/unit-tests/util/simple-notification.hpp b/tests/unit-tests/util/simple-notification.hpp
index 66e4641..ce6ec90 100644
--- a/tests/unit-tests/util/simple-notification.hpp
+++ b/tests/unit-tests/util/simple-notification.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -25,8 +25,8 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_UNIT_TESTS_UTIL_SIMPLE_NOTIFICATION_HPP
-#define NDN_UNIT_TESTS_UTIL_SIMPLE_NOTIFICATION_HPP
+#ifndef NDN_TESTS_UNIT_TESTS_UTIL_SIMPLE_NOTIFICATION_HPP
+#define NDN_TESTS_UNIT_TESTS_UTIL_SIMPLE_NOTIFICATION_HPP
#include "common.hpp"
@@ -40,9 +40,7 @@
class SimpleNotification
{
public:
- SimpleNotification()
- {
- }
+ SimpleNotification() = default;
explicit
SimpleNotification(const Block& block)
@@ -55,10 +53,6 @@
{
}
- ~SimpleNotification()
- {
- }
-
Block
wireEncode() const
{
@@ -80,7 +74,6 @@
BOOST_THROW_EXCEPTION(tlv::Error("0x07 error"));
}
-public:
const std::string&
getMessage() const
{
@@ -101,4 +94,4 @@
} // namespace util
} // namespace ndn
-#endif // NDN_UNIT_TESTS_UTIL_CORE_SIMPLE_NOTIFICATION_HPP
+#endif // NDN_TESTS_UNIT_TESTS_UTIL_SIMPLE_NOTIFICATION_HPP
diff --git a/tests/unit-tests/util/sqlite3-statement.t.cpp b/tests/unit-tests/util/sqlite3-statement.t.cpp
index a7fa29a..b440f7a 100644
--- a/tests/unit-tests/util/sqlite3-statement.t.cpp
+++ b/tests/unit-tests/util/sqlite3-statement.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).
*
@@ -21,9 +21,9 @@
#include "util/sqlite3-statement.hpp"
-#include <boost/filesystem.hpp>
#include "boost-test.hpp"
+#include <boost/filesystem.hpp>
#include <sqlite3.h>
namespace ndn {
@@ -64,7 +64,8 @@
sqlite3* db;
};
-BOOST_FIXTURE_TEST_SUITE(UtilSqlite3Statement, Sqlite3StatementTestFixture)
+BOOST_AUTO_TEST_SUITE(Util)
+BOOST_FIXTURE_TEST_SUITE(TestSqlite3Statement, Sqlite3StatementTestFixture)
BOOST_AUTO_TEST_CASE(Basic)
{
@@ -149,7 +150,8 @@
}
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestSqlite3Statement
+BOOST_AUTO_TEST_SUITE_END() // Util
} // namespace tests
} // namespace util
diff --git a/tests/unit-tests/util/string-helper.t.cpp b/tests/unit-tests/util/string-helper.t.cpp
index 82c30d7..22e8659 100644
--- a/tests/unit-tests/util/string-helper.t.cpp
+++ b/tests/unit-tests/util/string-helper.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,13 +22,13 @@
#include "util/string-helper.hpp"
#include "boost-test.hpp"
-#include <iostream>
namespace ndn {
namespace util {
namespace test {
-BOOST_AUTO_TEST_SUITE(UtilStringHelper)
+BOOST_AUTO_TEST_SUITE(Util)
+BOOST_AUTO_TEST_SUITE(TestStringHelper)
BOOST_AUTO_TEST_CASE(ToHex)
{
@@ -170,7 +170,8 @@
"\x01\x2a\x3b\xc4\xde\xfa\xb5\xcd\xef");
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestStringHelper
+BOOST_AUTO_TEST_SUITE_END() // Util
} // namespace test
} // namespace util
diff --git a/tests/unit-tests/util/time-unit-test-clock.t.cpp b/tests/unit-tests/util/time-unit-test-clock.t.cpp
index 658f043..17ceb39 100644
--- a/tests/unit-tests/util/time-unit-test-clock.t.cpp
+++ b/tests/unit-tests/util/time-unit-test-clock.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).
*
@@ -23,35 +23,18 @@
#include "util/scheduler.hpp"
#include "boost-test.hpp"
+#include "../unit-test-time-fixture.hpp"
+
#include <boost/lexical_cast.hpp>
#include <thread>
namespace ndn {
namespace tests {
-BOOST_AUTO_TEST_SUITE(UtilTimeUnitTestClock)
+BOOST_AUTO_TEST_SUITE(Util)
+BOOST_FIXTURE_TEST_SUITE(TestTimeUnitTestClock, UnitTestTimeFixture)
-class UnitTestTimeFixture
-{
-public:
- UnitTestTimeFixture()
- : steadyClock(make_shared<time::UnitTestSteadyClock>())
- , systemClock(make_shared<time::UnitTestSystemClock>())
- {
- time::setCustomClocks(steadyClock, systemClock);
- }
-
- ~UnitTestTimeFixture()
- {
- time::setCustomClocks(nullptr, nullptr);
- }
-
-public:
- shared_ptr<time::UnitTestSteadyClock> steadyClock;
- shared_ptr<time::UnitTestSystemClock> systemClock;
-};
-
-BOOST_FIXTURE_TEST_CASE(SystemClock, UnitTestTimeFixture)
+BOOST_AUTO_TEST_CASE(SystemClock)
{
BOOST_CHECK_EQUAL(time::system_clock::now().time_since_epoch(),
time::UnitTestClockTraits<time::system_clock>::getDefaultStartTime());
@@ -106,7 +89,7 @@
time::fromUnixTimestamp(time::seconds(1390953600)));
}
-BOOST_FIXTURE_TEST_CASE(SteadyClock, UnitTestTimeFixture)
+BOOST_AUTO_TEST_CASE(SteadyClock)
{
BOOST_CHECK_EQUAL(time::steady_clock::now().time_since_epoch(),
time::steady_clock::duration::zero());
@@ -132,9 +115,8 @@
"100 nanoseconds since unit test clock advancements");
}
-BOOST_FIXTURE_TEST_CASE(Scheduler, UnitTestTimeFixture)
+BOOST_AUTO_TEST_CASE(Scheduler)
{
- boost::asio::io_service io;
ndn::Scheduler scheduler(io);
bool hasFired = false;
@@ -149,7 +131,8 @@
BOOST_CHECK_EQUAL(hasFired, true);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestTimeUnitTestClock
+BOOST_AUTO_TEST_SUITE_END() // Util
} // namespace tests
} // namespace ndn
diff --git a/tests/unit-tests/version.t.cpp b/tests/unit-tests/version.t.cpp
index 9dbcc6d..5cb6622 100644
--- a/tests/unit-tests/version.t.cpp
+++ b/tests/unit-tests/version.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,8 +20,10 @@
*/
#include "version.hpp"
+#include "common.hpp"
#include "boost-test.hpp"
+
#include <stdio.h>
namespace ndn {
@@ -29,8 +31,10 @@
BOOST_AUTO_TEST_SUITE(TestVersion)
-BOOST_AUTO_TEST_CASE(Version)
+BOOST_AUTO_TEST_CASE(VersionNumber)
{
+ BOOST_TEST_MESSAGE("NDN_CXX_VERSION = " + to_string(NDN_CXX_VERSION));
+
BOOST_CHECK_EQUAL(NDN_CXX_VERSION, NDN_CXX_VERSION_MAJOR * 1000000 +
NDN_CXX_VERSION_MINOR * 1000 +
NDN_CXX_VERSION_PATCH);
@@ -38,15 +42,19 @@
BOOST_AUTO_TEST_CASE(VersionString)
{
- BOOST_STATIC_ASSERT(NDN_CXX_VERSION_MAJOR < 1000);
- char buf[20];
- snprintf(buf, sizeof(buf), "%d.%d.%d",
- NDN_CXX_VERSION_MAJOR, NDN_CXX_VERSION_MINOR, NDN_CXX_VERSION_PATCH);
+ BOOST_TEST_MESSAGE("NDN_CXX_VERSION_STRING = " NDN_CXX_VERSION_STRING);
- BOOST_CHECK_EQUAL(std::string(NDN_CXX_VERSION_STRING), std::string(buf));
+ BOOST_STATIC_ASSERT(NDN_CXX_VERSION_MAJOR < 1000);
+ BOOST_STATIC_ASSERT(NDN_CXX_VERSION_MINOR < 1000);
+ BOOST_STATIC_ASSERT(NDN_CXX_VERSION_PATCH < 1000);
+ char buf[12];
+ ::snprintf(buf, sizeof(buf), "%d.%d.%d",
+ NDN_CXX_VERSION_MAJOR, NDN_CXX_VERSION_MINOR, NDN_CXX_VERSION_PATCH);
+
+ BOOST_CHECK_EQUAL(NDN_CXX_VERSION_STRING, buf);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestVersion
} // namespace tests
} // namespace ndn