File indexing completed on 2025-01-18 09:54:06
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED
0009 #define CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED
0010
0011 #include <catch2/interfaces/catch_interfaces_testcase.hpp>
0012 #include <catch2/interfaces/catch_interfaces_config.hpp>
0013 #include <catch2/internal/catch_unique_ptr.hpp>
0014
0015 #include <vector>
0016
0017 namespace Catch {
0018
0019 class IConfig;
0020 class ITestInvoker;
0021 class TestCaseHandle;
0022 class TestSpec;
0023
0024 std::vector<TestCaseHandle> sortTests( IConfig const& config, std::vector<TestCaseHandle> const& unsortedTestCases );
0025
0026 bool isThrowSafe( TestCaseHandle const& testCase, IConfig const& config );
0027
0028 std::vector<TestCaseHandle> filterTests( std::vector<TestCaseHandle> const& testCases, TestSpec const& testSpec, IConfig const& config );
0029 std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config );
0030
0031 class TestRegistry : public ITestCaseRegistry {
0032 public:
0033 ~TestRegistry() override = default;
0034
0035 void registerTest( Detail::unique_ptr<TestCaseInfo> testInfo, Detail::unique_ptr<ITestInvoker> testInvoker );
0036
0037 std::vector<TestCaseInfo*> const& getAllInfos() const override;
0038 std::vector<TestCaseHandle> const& getAllTests() const override;
0039 std::vector<TestCaseHandle> const& getAllTestsSorted( IConfig const& config ) const override;
0040
0041 private:
0042 std::vector<Detail::unique_ptr<TestCaseInfo>> m_owned_test_infos;
0043
0044
0045 std::vector<TestCaseInfo*> m_viewed_test_infos;
0046
0047 std::vector<Detail::unique_ptr<ITestInvoker>> m_invokers;
0048 std::vector<TestCaseHandle> m_handles;
0049 mutable TestRunOrder m_currentSortOrder = TestRunOrder::Declared;
0050 mutable std::vector<TestCaseHandle> m_sortedFunctions;
0051 };
0052
0053
0054
0055
0056 }
0057
0058
0059 #endif