Files
rippled/include/xrpl/beast/unit_test/suite_list.h
Bart 1d42c4f6de refactor: Remove unnecessary copyright notices already covered by LICENSE.md (#5929)
Per XLS-0095, we are taking steps to rename ripple(d) to xrpl(d).

This change specifically removes all copyright notices referencing Ripple, XRPLF, and certain affiliated contributors upon mutual agreement, so the notice in the LICENSE.md file applies throughout. Copyright notices referencing external contributions remain as-is. Duplicate verbiage is also removed.
2025-11-04 08:33:42 +00:00

76 lines
1.7 KiB
C++

// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BEAST_UNIT_TEST_SUITE_LIST_HPP
#define BEAST_UNIT_TEST_SUITE_LIST_HPP
#include <xrpl/beast/unit_test/detail/const_container.h>
#include <xrpl/beast/unit_test/suite_info.h>
#include <boost/assert.hpp>
#include <set>
#include <typeindex>
#include <unordered_set>
namespace beast {
namespace unit_test {
/// A container of test suites.
class suite_list : public detail::const_container<std::set<suite_info>>
{
private:
#ifndef NDEBUG
std::unordered_set<std::string> names_;
std::unordered_set<std::type_index> classes_;
#endif
public:
/** Insert a suite into the set.
The suite must not already exist.
*/
template <class Suite>
void
insert(
char const* name,
char const* module,
char const* library,
bool manual,
int priority);
};
//------------------------------------------------------------------------------
template <class Suite>
void
suite_list::insert(
char const* name,
char const* module,
char const* library,
bool manual,
int priority)
{
#ifndef NDEBUG
{
std::string s;
s = std::string(library) + "." + module + "." + name;
auto const result(names_.insert(s));
BOOST_ASSERT(result.second); // Duplicate name
}
{
auto const result(classes_.insert(std::type_index(typeid(Suite))));
BOOST_ASSERT(result.second); // Duplicate type
}
#endif
cont().emplace(
make_suite_info<Suite>(name, module, library, manual, priority));
}
} // namespace unit_test
} // namespace beast
#endif