tests: use decorators to label test data generators
Also various minor cleanups
Change-Id: Iaee434991b923abdf464293fec35da22d6cb449a
diff --git a/tests/unit/util/indented-stream.t.cpp b/tests/unit/util/indented-stream.t.cpp
index 4994d0d..63bb483 100644
--- a/tests/unit/util/indented-stream.t.cpp
+++ b/tests/unit/util/indented-stream.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2023 Regents of the University of California.
+ * Copyright (c) 2013-2024 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -53,7 +53,8 @@
));
}
-BOOST_AUTO_TEST_CASE(BasicWithFlushes) // Bug #2723
+BOOST_AUTO_TEST_CASE(BasicWithFlushes,
+ * ut::description("test for bug #2723"))
{
output_test_stream os;
diff --git a/tests/unit/util/io.t.cpp b/tests/unit/util/io.t.cpp
index 3492fa1..2dc303d 100644
--- a/tests/unit/util/io.t.cpp
+++ b/tests/unit/util/io.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2023 Regents of the University of California.
+ * Copyright (c) 2013-2024 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -34,22 +34,22 @@
struct NoEncoding
{
- const io::IoEncoding encoding{io::NO_ENCODING};
- const std::vector<uint8_t> blob{0xd1, 0x0, 0xb0, 0x1a};
+ static constexpr io::IoEncoding encoding = io::NO_ENCODING;
+ static inline const std::vector<uint8_t> blob{0xd1, 0x0, 0xb0, 0x1a};
std::istringstream stream{std::string("\xd1\x00\xb0\x1a", 4), std::ios_base::binary};
};
struct Base64Encoding
{
- const io::IoEncoding encoding = io::BASE64;
- const std::vector<uint8_t> blob{0x42, 0x61, 0x73, 0x65, 0x36, 0x34, 0x45, 0x6e, 0x63};
+ static constexpr io::IoEncoding encoding = io::BASE64;
+ static inline const std::vector<uint8_t> blob{0x42, 0x61, 0x73, 0x65, 0x36, 0x34, 0x45, 0x6e, 0x63};
std::istringstream stream{"QmFzZTY0RW5j\n", std::ios_base::binary};
};
struct HexEncoding
{
- const io::IoEncoding encoding = io::HEX;
- const std::vector<uint8_t> blob{0x48, 0x65, 0x78, 0x45, 0x6e, 0x63};
+ static constexpr io::IoEncoding encoding = io::HEX;
+ static inline const std::vector<uint8_t> blob{0x48, 0x65, 0x78, 0x45, 0x6e, 0x63};
std::istringstream stream{"486578456E63", std::ios_base::binary};
};
@@ -58,15 +58,15 @@
BOOST_AUTO_TEST_CASE_TEMPLATE(LoadBuffer, T, Encodings)
{
T t;
- shared_ptr<Buffer> buf = io::loadBuffer(t.stream, t.encoding);
- BOOST_CHECK_EQUAL_COLLECTIONS(buf->begin(), buf->end(), t.blob.begin(), t.blob.end());
+ shared_ptr<Buffer> buf = io::loadBuffer(t.stream, T::encoding);
+ BOOST_CHECK_EQUAL_COLLECTIONS(buf->begin(), buf->end(), T::blob.begin(), T::blob.end());
}
BOOST_AUTO_TEST_CASE_TEMPLATE(SaveBuffer, T, Encodings)
{
T t;
std::ostringstream os(std::ios_base::binary);
- io::saveBuffer(t.blob, os, t.encoding);
+ io::saveBuffer(T::blob, os, T::encoding);
BOOST_CHECK_EQUAL(os.str(), t.stream.str());
}
diff --git a/tests/unit/util/scheduler.t.cpp b/tests/unit/util/scheduler.t.cpp
index 88c4313..ec59c30 100644
--- a/tests/unit/util/scheduler.t.cpp
+++ b/tests/unit/util/scheduler.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2023 Regents of the University of California.
+ * Copyright (c) 2013-2024 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -201,7 +201,8 @@
BOOST_CHECK_EQUAL(count, 0);
}
-BOOST_AUTO_TEST_CASE(CancelAllWithScopedEventId) // Bug 3691
+BOOST_AUTO_TEST_CASE(CancelAllWithScopedEventId,
+ * ut::description("test for bug #3691"))
{
ScopedEventId eid = scheduler.schedule(10_ms, []{});
scheduler.cancelAllEvents();
diff --git a/tests/unit/util/segment-fetcher.t.cpp b/tests/unit/util/segment-fetcher.t.cpp
index 1166110..567918a 100644
--- a/tests/unit/util/segment-fetcher.t.cpp
+++ b/tests/unit/util/segment-fetcher.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2023 Regents of the University of California.
+ * Copyright (c) 2013-2024 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -824,7 +824,8 @@
BOOST_CHECK_EQUAL(nAfterSegmentTimedOut, 2);
}
-BOOST_AUTO_TEST_CASE(UncanceledPendingInterestBug) // Bug #4770
+BOOST_AUTO_TEST_CASE(UncanceledPendingInterest,
+ * ut::description("test for bug #4770"))
{
DummyValidator acceptValidator;
auto fetcher = SegmentFetcher::start(face, Interest("/hello/world"), acceptValidator);