2 // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 // Official repository: https://github.com/boostorg/beast
10 #ifndef BOOST_BEAST_UNIT_TEST_SUITE_LIST_HPP
11 #define BOOST_BEAST_UNIT_TEST_SUITE_LIST_HPP
13 #include <boost/beast/_experimental/unit_test/suite_info.hpp>
14 #include <boost/beast/_experimental/unit_test/detail/const_container.hpp>
15 #include <boost/assert.hpp>
16 #include <boost/type_index.hpp>
17 #include <boost/functional/hash.hpp>
20 #include <unordered_set>
26 /// A container of test suites.
28 : public detail::const_container <std::set <suite_info>>
32 std::unordered_set<std::string> names_;
34 using type_index = boost::typeindex::type_index;
35 std::unordered_set<type_index, boost::hash<type_index>> classes_;
39 /** Insert a suite into the set.
41 The suite must not already exist.
52 //------------------------------------------------------------------------------
65 s = std::string(library) + "." + module + "." + name;
66 auto const result(names_.insert(s));
67 BOOST_ASSERT(result.second); // Duplicate name
71 auto const result(classes_.insert(
72 boost::typeindex::type_id<Suite>()));
73 BOOST_ASSERT(result.second); // Duplicate type
76 cont().emplace(make_suite_info<Suite>(
77 name, module, library, manual));