tests: refactor common test infrastructure and fixtures
Change-Id: I597c11130eefa2cc2846ee6655c85dc04f2f22ef
diff --git a/tests/unit/security/validator-config/checker.t.cpp b/tests/unit/security/validator-config/checker.t.cpp
index 55e48a1..029996c 100644
--- a/tests/unit/security/validator-config/checker.t.cpp
+++ b/tests/unit/security/validator-config/checker.t.cpp
@@ -39,7 +39,7 @@
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(ValidatorConfig)
-class CheckerFixture : public IdentityManagementFixture
+class CheckerFixture : public KeyChainFixture
{
public:
CheckerFixture()
diff --git a/tests/unit/security/validator-config/common.hpp b/tests/unit/security/validator-config/common.hpp
index de72e3f..c4a4fe3 100644
--- a/tests/unit/security/validator-config/common.hpp
+++ b/tests/unit/security/validator-config/common.hpp
@@ -19,8 +19,8 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_TESTS_SECURITY_V2_VALIDATOR_CONFIG_COMMON_HPP
-#define NDN_TESTS_SECURITY_V2_VALIDATOR_CONFIG_COMMON_HPP
+#ifndef NDN_CXX_TESTS_UNIT_SECURITY_VALIDATOR_CONFIG_COMMON_HPP
+#define NDN_CXX_TESTS_UNIT_SECURITY_VALIDATOR_CONFIG_COMMON_HPP
#include "ndn-cxx/security/validator-config/common.hpp"
@@ -47,4 +47,4 @@
} // namespace security
} // namespace ndn
-#endif // NDN_TESTS_SECURITY_V2_VALIDATOR_CONFIG_COMMON_HPP
+#endif // NDN_CXX_TESTS_UNIT_SECURITY_VALIDATOR_CONFIG_COMMON_HPP
diff --git a/tests/unit/security/validator-config/filter.t.cpp b/tests/unit/security/validator-config/filter.t.cpp
index 9f6029e..5b77a12 100644
--- a/tests/unit/security/validator-config/filter.t.cpp
+++ b/tests/unit/security/validator-config/filter.t.cpp
@@ -22,7 +22,6 @@
#include "ndn-cxx/security/validator-config/filter.hpp"
#include "tests/boost-test.hpp"
-#include "tests/identity-management-fixture.hpp"
#include "tests/unit/security/validator-config/common.hpp"
#include "tests/unit/security/validator-fixture.hpp"
@@ -38,33 +37,35 @@
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(ValidatorConfig)
-BOOST_FIXTURE_TEST_SUITE(TestFilter, IdentityManagementFixture)
+BOOST_FIXTURE_TEST_SUITE(TestFilter, KeyChainFixture)
#define CHECK_FOR_MATCHES(filter, same, longer, shorter, different) \
- BOOST_CHECK_EQUAL(filter.match(tlv::Interest, InterestV02Pkt::makeName("/foo/bar", m_keyChain), \
- InterestV02Pkt::makeState()), same); \
- BOOST_CHECK_EQUAL(filter.match(tlv::Interest, InterestV03Pkt::makeName("/foo/bar", m_keyChain), \
- InterestV03Pkt::makeState()), same); \
- BOOST_CHECK_EQUAL(filter.match(tlv::Data, DataPkt::makeName("/foo/bar", m_keyChain), \
- DataPkt::makeState()), same); \
- BOOST_CHECK_EQUAL(filter.match(tlv::Interest, InterestV02Pkt::makeName("/foo/bar/bar", m_keyChain), \
- InterestV02Pkt::makeState()), longer); \
- BOOST_CHECK_EQUAL(filter.match(tlv::Interest, InterestV03Pkt::makeName("/foo/bar/bar", m_keyChain), \
- InterestV03Pkt::makeState()), longer); \
- BOOST_CHECK_EQUAL(filter.match(tlv::Data, DataPkt::makeName("/foo/bar/bar", m_keyChain), \
- DataPkt::makeState()), longer); \
- BOOST_CHECK_EQUAL(filter.match(tlv::Interest, InterestV02Pkt::makeName("/foo", m_keyChain), \
- InterestV02Pkt::makeState()), shorter); \
- BOOST_CHECK_EQUAL(filter.match(tlv::Interest, InterestV03Pkt::makeName("/foo", m_keyChain), \
- InterestV03Pkt::makeState()), shorter); \
- BOOST_CHECK_EQUAL(filter.match(tlv::Data, DataPkt::makeName("/foo", m_keyChain), \
- DataPkt::makeState()), shorter); \
- BOOST_CHECK_EQUAL(filter.match(tlv::Interest, InterestV02Pkt::makeName("/other/prefix", m_keyChain), \
- InterestV02Pkt::makeState()), different); \
- BOOST_CHECK_EQUAL(filter.match(tlv::Interest, InterestV03Pkt::makeName("/other/prefix", m_keyChain), \
- InterestV03Pkt::makeState()), different); \
- BOOST_CHECK_EQUAL(filter.match(tlv::Data, DataPkt::makeName("/other/prefix", m_keyChain), \
- DataPkt::makeState()), different);
+ do { \
+ BOOST_CHECK_EQUAL(filter.match(tlv::Interest, InterestV02Pkt::makeName("/foo/bar", m_keyChain), \
+ InterestV02Pkt::makeState()), same); \
+ BOOST_CHECK_EQUAL(filter.match(tlv::Interest, InterestV03Pkt::makeName("/foo/bar", m_keyChain), \
+ InterestV03Pkt::makeState()), same); \
+ BOOST_CHECK_EQUAL(filter.match(tlv::Data, DataPkt::makeName("/foo/bar", m_keyChain), \
+ DataPkt::makeState()), same); \
+ BOOST_CHECK_EQUAL(filter.match(tlv::Interest, InterestV02Pkt::makeName("/foo/bar/bar", m_keyChain), \
+ InterestV02Pkt::makeState()), longer); \
+ BOOST_CHECK_EQUAL(filter.match(tlv::Interest, InterestV03Pkt::makeName("/foo/bar/bar", m_keyChain), \
+ InterestV03Pkt::makeState()), longer); \
+ BOOST_CHECK_EQUAL(filter.match(tlv::Data, DataPkt::makeName("/foo/bar/bar", m_keyChain), \
+ DataPkt::makeState()), longer); \
+ BOOST_CHECK_EQUAL(filter.match(tlv::Interest, InterestV02Pkt::makeName("/foo", m_keyChain), \
+ InterestV02Pkt::makeState()), shorter); \
+ BOOST_CHECK_EQUAL(filter.match(tlv::Interest, InterestV03Pkt::makeName("/foo", m_keyChain), \
+ InterestV03Pkt::makeState()), shorter); \
+ BOOST_CHECK_EQUAL(filter.match(tlv::Data, DataPkt::makeName("/foo", m_keyChain), \
+ DataPkt::makeState()), shorter); \
+ BOOST_CHECK_EQUAL(filter.match(tlv::Interest, InterestV02Pkt::makeName("/other/prefix", m_keyChain), \
+ InterestV02Pkt::makeState()), different); \
+ BOOST_CHECK_EQUAL(filter.match(tlv::Interest, InterestV03Pkt::makeName("/other/prefix", m_keyChain), \
+ InterestV03Pkt::makeState()), different); \
+ BOOST_CHECK_EQUAL(filter.match(tlv::Data, DataPkt::makeName("/other/prefix", m_keyChain), \
+ DataPkt::makeState()), different); \
+ } while (false)
BOOST_AUTO_TEST_CASE(RelationName)
{
@@ -90,7 +91,7 @@
CHECK_FOR_MATCHES(f3, false, true, false, false);
}
-BOOST_FIXTURE_TEST_SUITE(Create, IdentityManagementFixture)
+BOOST_FIXTURE_TEST_SUITE(Create, KeyChainFixture)
BOOST_AUTO_TEST_CASE(Errors)
{
diff --git a/tests/unit/security/validator-config/rule.t.cpp b/tests/unit/security/validator-config/rule.t.cpp
index 75eb6dc..04c6e8d 100644
--- a/tests/unit/security/validator-config/rule.t.cpp
+++ b/tests/unit/security/validator-config/rule.t.cpp
@@ -40,7 +40,7 @@
BOOST_AUTO_TEST_SUITE(ValidatorConfig)
template<class Packet>
-class RuleFixture : public IdentityManagementFixture
+class RuleFixture : public KeyChainFixture
{
public:
RuleFixture()