File indexing completed on 2025-01-19 09:25:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_BEAST_UNIT_TEST_SUITE_LIST_HPP
0011 #define BOOST_BEAST_UNIT_TEST_SUITE_LIST_HPP
0012
0013 #include <boost/beast/_experimental/unit_test/suite_info.hpp>
0014 #include <boost/beast/_experimental/unit_test/detail/const_container.hpp>
0015 #include <boost/assert.hpp>
0016 #include <boost/type_index.hpp>
0017 #include <boost/functional/hash.hpp>
0018 #include <typeindex>
0019 #include <set>
0020 #include <unordered_set>
0021
0022 namespace boost {
0023 namespace beast {
0024 namespace unit_test {
0025
0026
0027 class suite_list
0028 : public detail::const_container <std::set <suite_info>>
0029 {
0030 private:
0031 #ifndef NDEBUG
0032 std::unordered_set<std::string> names_;
0033
0034 using type_index = boost::typeindex::type_index;
0035 std::unordered_set<type_index, boost::hash<type_index>> classes_;
0036 #endif
0037
0038 public:
0039
0040
0041
0042
0043 template<class Suite>
0044 void
0045 insert(
0046 char const* name,
0047 char const* module,
0048 char const* library,
0049 bool manual);
0050 };
0051
0052
0053
0054 template<class Suite>
0055 void
0056 suite_list::insert(
0057 char const* name,
0058 char const* module,
0059 char const* library,
0060 bool manual)
0061 {
0062 #ifndef NDEBUG
0063 {
0064 std::string s;
0065 s = std::string(library) + "." + module + "." + name;
0066 auto const result(names_.insert(s));
0067 BOOST_ASSERT(result.second);
0068 }
0069
0070 {
0071 auto const result(classes_.insert(
0072 boost::typeindex::type_id<Suite>()));
0073 BOOST_ASSERT(result.second);
0074 }
0075 #endif
0076 cont().emplace(make_suite_info<Suite>(
0077 name, module, library, manual));
0078 }
0079
0080 }
0081 }
0082 }
0083
0084 #endif
0085