tests: use decorators to label test data generators
Also various minor cleanups
Change-Id: Iaee434991b923abdf464293fec35da22d6cb449a
diff --git a/tests/unit/security/validator-config/checker.t.cpp b/tests/unit/security/validator-config/checker.t.cpp
index d7e2fb9..523f1a2 100644
--- a/tests/unit/security/validator-config/checker.t.cpp
+++ b/tests/unit/security/validator-config/checker.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).
*
@@ -64,14 +64,15 @@
static void
testChecker(C& checker, tlv::SignatureTypeValue sigType, const Name& pktName, const Name& klName, bool expectedOutcome)
{
- BOOST_TEST_CONTEXT("pkt=" << pktName << " kl=" << klName) {
- auto state = PktType::makeState();
- auto result = checker.check(PktType::getType(), sigType, pktName, klName, *state);
- BOOST_CHECK_EQUAL(bool(result), expectedOutcome);
- BOOST_CHECK(boost::logic::indeterminate(state->getOutcome()));
- if (!result) {
- BOOST_CHECK_NE(result.getErrorMessage(), "");
- }
+ BOOST_TEST_INFO_SCOPE("Packet = " << pktName);
+ BOOST_TEST_INFO_SCOPE("KeyLocator = " << klName);
+
+ auto state = PktType::makeState();
+ auto result = checker.check(PktType::getType(), sigType, pktName, klName, *state);
+ BOOST_CHECK_EQUAL(bool(result), expectedOutcome);
+ BOOST_CHECK(boost::logic::indeterminate(state->getOutcome()));
+ if (!result) {
+ BOOST_CHECK_NE(result.getErrorMessage(), "");
}
}
diff --git a/tests/unit/security/validator-config/rule.t.cpp b/tests/unit/security/validator-config/rule.t.cpp
index 434a0c9..49fdde2 100644
--- a/tests/unit/security/validator-config/rule.t.cpp
+++ b/tests/unit/security/validator-config/rule.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).
*
@@ -95,20 +95,21 @@
BOOST_FIXTURE_TEST_CASE_TEMPLATE(Checkers, PktType, PktTypes, RuleFixture<PktType>)
{
auto testChecker = [this] (const Name& klName, bool expectedOutcome) {
- BOOST_TEST_CONTEXT(klName << " expected=" << expectedOutcome) {
- this->state = PktType::makeState(); // reset state
- BOOST_CHECK_EQUAL(this->rule.check(PktType::getType(), tlv::SignatureSha256WithRsa,
- this->pktName, klName, this->state),
- expectedOutcome);
+ BOOST_TEST_INFO_SCOPE("Name = " << klName);
+ BOOST_TEST_INFO_SCOPE("Expected = " << expectedOutcome);
- auto outcome = this->state->getOutcome();
- if (expectedOutcome) {
- BOOST_CHECK(boost::logic::indeterminate(outcome));
- }
- else {
- BOOST_CHECK(!boost::logic::indeterminate(outcome));
- BOOST_CHECK(!bool(outcome));
- }
+ this->state = PktType::makeState(); // reset state
+ BOOST_CHECK_EQUAL(this->rule.check(PktType::getType(), tlv::SignatureSha256WithRsa,
+ this->pktName, klName, this->state),
+ expectedOutcome);
+
+ auto outcome = this->state->getOutcome();
+ if (expectedOutcome) {
+ BOOST_CHECK(boost::logic::indeterminate(outcome));
+ }
+ else {
+ BOOST_CHECK(!boost::logic::indeterminate(outcome));
+ BOOST_CHECK(!bool(outcome));
}
};