mirror of
https://github.com/catchorg/Catch2.git
synced 2025-01-29 02:36:32 +00:00
Compare commits
2 Commits
14533f5bb6
...
7efbc83ae0
Author | SHA1 | Date | |
---|---|---|---|
|
7efbc83ae0 | ||
|
9e498278be |
src
CMakeLists.txt
catch2
benchmark
catch_all.hppcatch_assertion_info.hppcatch_assertion_result.hppcatch_config.cppcatch_section_info.hppcatch_tag_alias_autoregistrar.cppcatch_test_case_info.hppgenerators
interfaces
catch_interfaces_capture.cppcatch_interfaces_capture.hppcatch_interfaces_combined_tu.cppcatch_interfaces_config.cppcatch_interfaces_enum_values_registry.hppcatch_interfaces_exception.cppcatch_interfaces_registry_hub.cppcatch_interfaces_reporter.hppcatch_interfaces_runner.cppcatch_interfaces_testcase.cpp
internal
catch_combined_tu.cppcatch_decomposer.cppcatch_decomposer.hppcatch_errno_guard.cppcatch_leak_detector.cppcatch_list.hppcatch_polyfills.cppcatch_startup_exception_registry.cppcatch_stream.cppcatch_string_manip.cppcatch_string_manip.hppcatch_stringref.cppcatch_stringref.hppcatch_test_macro_impl.hppcatch_test_registry.hppcatch_uncaught_exceptions.cpp
matchers
catch_matchers.cppcatch_matchers_container_properties.cppcatch_matchers_exception.cppcatch_matchers_predicate.cppcatch_matchers_templated.hpp
internal
reporters
tests/SelfTest/IntrospectiveTests
@ -24,10 +24,7 @@ set(BENCHMARK_HEADERS
|
||||
${SOURCES_DIR}/benchmark/detail/catch_timing.hpp
|
||||
)
|
||||
set(BENCHMARK_SOURCES
|
||||
${SOURCES_DIR}/benchmark/catch_chronometer.cpp
|
||||
${SOURCES_DIR}/benchmark/detail/catch_benchmark_function.cpp
|
||||
${SOURCES_DIR}/benchmark/detail/catch_complete_invoke.cpp
|
||||
${SOURCES_DIR}/benchmark/detail/catch_run_for_at_least.cpp
|
||||
${SOURCES_DIR}/benchmark/internal/catch_benchmark_combined_tu.cpp
|
||||
${SOURCES_DIR}/benchmark/detail/catch_stats.cpp
|
||||
)
|
||||
|
||||
@ -104,8 +101,8 @@ set(INTERNAL_HEADERS
|
||||
${SOURCES_DIR}/internal/catch_singletons.hpp
|
||||
${SOURCES_DIR}/internal/catch_startup_exception_registry.hpp
|
||||
${SOURCES_DIR}/internal/catch_stream.hpp
|
||||
${SOURCES_DIR}/catch_stringref.hpp
|
||||
${SOURCES_DIR}/internal/catch_string_manip.hpp
|
||||
${SOURCES_DIR}/internal/catch_stringref.hpp
|
||||
${SOURCES_DIR}/catch_tag_alias.hpp
|
||||
${SOURCES_DIR}/catch_tag_alias_autoregistrar.hpp
|
||||
${SOURCES_DIR}/internal/catch_tag_alias_registry.hpp
|
||||
@ -134,7 +131,7 @@ set(IMPL_SOURCES
|
||||
${SOURCES_DIR}/catch_approx.cpp
|
||||
${SOURCES_DIR}/internal/catch_assertionhandler.cpp
|
||||
${SOURCES_DIR}/catch_assertion_result.cpp
|
||||
${SOURCES_DIR}/matchers/internal/catch_matchers_impl.cpp
|
||||
${SOURCES_DIR}/matchers/internal/catch_matchers_combined_tu.cpp
|
||||
${SOURCES_DIR}/internal/catch_commandline.cpp
|
||||
${SOURCES_DIR}/internal/catch_common.cpp
|
||||
${SOURCES_DIR}/catch_config.cpp
|
||||
@ -142,34 +139,21 @@ set(IMPL_SOURCES
|
||||
${SOURCES_DIR}/internal/catch_context.cpp
|
||||
${SOURCES_DIR}/internal/catch_debug_console.cpp
|
||||
${SOURCES_DIR}/internal/catch_debugger.cpp
|
||||
${SOURCES_DIR}/internal/catch_decomposer.cpp
|
||||
${SOURCES_DIR}/internal/catch_enforce.cpp
|
||||
${SOURCES_DIR}/internal/catch_enum_values_registry.cpp
|
||||
${SOURCES_DIR}/internal/catch_errno_guard.cpp
|
||||
${SOURCES_DIR}/internal/catch_exception_translator_registry.cpp
|
||||
${SOURCES_DIR}/internal/catch_fatal_condition_handler.cpp
|
||||
${SOURCES_DIR}/generators/catch_generator_exception.cpp
|
||||
${SOURCES_DIR}/generators/catch_generators.cpp
|
||||
${SOURCES_DIR}/interfaces/catch_interfaces_capture.cpp
|
||||
${SOURCES_DIR}/interfaces/catch_interfaces_config.cpp
|
||||
${SOURCES_DIR}/interfaces/catch_interfaces_exception.cpp
|
||||
${SOURCES_DIR}/interfaces/catch_interfaces_registry_hub.cpp
|
||||
${SOURCES_DIR}/generators/internal/catch_generators_combined_tu.cpp
|
||||
${SOURCES_DIR}/interfaces/catch_interfaces_combined_tu.cpp
|
||||
${SOURCES_DIR}/interfaces/catch_interfaces_reporter.cpp
|
||||
${SOURCES_DIR}/interfaces/catch_interfaces_runner.cpp
|
||||
${SOURCES_DIR}/interfaces/catch_interfaces_testcase.cpp
|
||||
${SOURCES_DIR}/internal/catch_list.cpp
|
||||
${SOURCES_DIR}/internal/catch_leak_detector.cpp
|
||||
${SOURCES_DIR}/matchers/catch_matchers.cpp
|
||||
${SOURCES_DIR}/matchers/catch_matchers_container_properties.cpp
|
||||
${SOURCES_DIR}/matchers/catch_matchers_exception.cpp
|
||||
${SOURCES_DIR}/matchers/catch_matchers_floating.cpp
|
||||
${SOURCES_DIR}/matchers/catch_matchers_predicate.cpp
|
||||
${SOURCES_DIR}/matchers/catch_matchers_string.cpp
|
||||
${SOURCES_DIR}/matchers/catch_matchers_templated.cpp
|
||||
${SOURCES_DIR}/catch_message.cpp
|
||||
${SOURCES_DIR}/internal/catch_output_redirect.cpp
|
||||
${SOURCES_DIR}/catch_registry_hub.cpp
|
||||
${SOURCES_DIR}/internal/catch_polyfills.cpp
|
||||
${SOURCES_DIR}/internal/catch_combined_tu.cpp
|
||||
${SOURCES_DIR}/internal/catch_random_number_generator.cpp
|
||||
${SOURCES_DIR}/internal/catch_reporter_registry.cpp
|
||||
${SOURCES_DIR}/internal/catch_result_type.cpp
|
||||
@ -177,11 +161,9 @@ set(IMPL_SOURCES
|
||||
${SOURCES_DIR}/internal/catch_section.cpp
|
||||
${SOURCES_DIR}/catch_session.cpp
|
||||
${SOURCES_DIR}/internal/catch_singletons.cpp
|
||||
${SOURCES_DIR}/internal/catch_startup_exception_registry.cpp
|
||||
${SOURCES_DIR}/internal/catch_stream.cpp
|
||||
${SOURCES_DIR}/internal/catch_stringref.cpp
|
||||
${SOURCES_DIR}/internal/catch_string_manip.cpp
|
||||
${SOURCES_DIR}/catch_tag_alias_autoregistrar.cpp
|
||||
${SOURCES_DIR}/internal/catch_tag_alias_registry.cpp
|
||||
${SOURCES_DIR}/catch_test_case_info.cpp
|
||||
${SOURCES_DIR}/internal/catch_test_case_registry_impl.cpp
|
||||
@ -192,7 +174,6 @@ set(IMPL_SOURCES
|
||||
${SOURCES_DIR}/catch_timer.cpp
|
||||
${SOURCES_DIR}/catch_tostring.cpp
|
||||
${SOURCES_DIR}/catch_totals.cpp
|
||||
${SOURCES_DIR}/internal/catch_uncaught_exceptions.cpp
|
||||
${SOURCES_DIR}/catch_version.cpp
|
||||
${SOURCES_DIR}/internal/catch_wildcard_pattern.cpp
|
||||
${SOURCES_DIR}/internal/catch_xmlwriter.cpp
|
||||
|
@ -1,14 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
#include <catch2/benchmark/catch_chronometer.hpp>
|
||||
|
||||
namespace Catch {
|
||||
namespace Benchmark {
|
||||
namespace Detail {
|
||||
ChronometerConcept::~ChronometerConcept() = default;
|
||||
} // namespace Detail
|
||||
} // namespace Benchmark
|
||||
} // namespace Catch
|
@ -1,14 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
#include <catch2/benchmark/detail/catch_benchmark_function.hpp>
|
||||
|
||||
namespace Catch {
|
||||
namespace Benchmark {
|
||||
namespace Detail {
|
||||
BenchmarkFunction::callable::~callable() = default;
|
||||
} // namespace Detail
|
||||
} // namespace Benchmark
|
||||
} // namespace Catch
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
#include <catch2/benchmark/detail/catch_complete_invoke.hpp>
|
||||
|
||||
namespace Catch {
|
||||
namespace Benchmark {
|
||||
namespace Detail {
|
||||
CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
|
||||
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
|
||||
const std::string benchmarkErrorMsg = "a benchmark failed to run successfully";
|
||||
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
|
||||
} // namespace Detail
|
||||
} // namespace Benchmark
|
||||
} // namespace Catch
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
// Run a function for a minimum amount of time
|
||||
#include <catch2/benchmark/detail/catch_run_for_at_least.hpp>
|
||||
|
||||
#include <exception>
|
||||
#include <catch2/internal/catch_enforce.hpp>
|
||||
|
||||
namespace Catch {
|
||||
namespace Benchmark {
|
||||
namespace Detail {
|
||||
struct optimized_away_error : std::exception {
|
||||
const char* what() const noexcept override;
|
||||
};
|
||||
|
||||
const char* optimized_away_error::what() const noexcept {
|
||||
return "could not measure benchmark, maybe it was optimized away";
|
||||
}
|
||||
|
||||
void throw_optimized_away_error() {
|
||||
Catch::throw_exception(optimized_away_error{});
|
||||
}
|
||||
|
||||
} // namespace Detail
|
||||
} // namespace Benchmark
|
||||
} // namespace Catch
|
@ -0,0 +1,88 @@
|
||||
/** \file
|
||||
* This is a special TU that combines what would otherwise be a very
|
||||
* small benchmarking-related TUs into one bigger TU.
|
||||
*
|
||||
* The reason for this is compilation performance improvements by
|
||||
* avoiding reparsing headers for many small TUs, instead having this
|
||||
* one TU include bit more, but having it all parsed only once.
|
||||
*
|
||||
* To avoid heavy-tail problem with compilation times, each "subpart"
|
||||
* of Catch2 has its own combined TU like this.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////
|
||||
// vvv formerly catch_chronometer.cpp vvv //
|
||||
////////////////////////////////////////////
|
||||
|
||||
#include <catch2/benchmark/catch_chronometer.hpp>
|
||||
|
||||
namespace Catch {
|
||||
namespace Benchmark {
|
||||
namespace Detail {
|
||||
ChronometerConcept::~ChronometerConcept() = default;
|
||||
} // namespace Detail
|
||||
} // namespace Benchmark
|
||||
} // namespace Catch
|
||||
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
// vvv formerly catch_benchmark_function.cpp vvv //
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
#include <catch2/benchmark/detail/catch_benchmark_function.hpp>
|
||||
|
||||
namespace Catch {
|
||||
namespace Benchmark {
|
||||
namespace Detail {
|
||||
BenchmarkFunction::callable::~callable() = default;
|
||||
} // namespace Detail
|
||||
} // namespace Benchmark
|
||||
} // namespace Catch
|
||||
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// vvv formerly catch_complete_invoke.cpp vvv //
|
||||
////////////////////////////////////////////////
|
||||
|
||||
#include <catch2/benchmark/detail/catch_complete_invoke.hpp>
|
||||
|
||||
namespace Catch {
|
||||
namespace Benchmark {
|
||||
namespace Detail {
|
||||
CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
|
||||
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
|
||||
const std::string benchmarkErrorMsg = "a benchmark failed to run successfully";
|
||||
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
|
||||
} // namespace Detail
|
||||
} // namespace Benchmark
|
||||
} // namespace Catch
|
||||
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// vvv formerly catch_run_for_at_least.cpp vvv //
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
#include <catch2/benchmark/detail/catch_run_for_at_least.hpp>
|
||||
#include <exception>
|
||||
#include <catch2/internal/catch_enforce.hpp>
|
||||
|
||||
namespace Catch {
|
||||
namespace Benchmark {
|
||||
namespace Detail {
|
||||
struct optimized_away_error : std::exception {
|
||||
const char* what() const noexcept override;
|
||||
};
|
||||
|
||||
const char* optimized_away_error::what() const noexcept {
|
||||
return "could not measure benchmark, maybe it was optimized away";
|
||||
}
|
||||
|
||||
void throw_optimized_away_error() {
|
||||
Catch::throw_exception(optimized_away_error{});
|
||||
}
|
||||
|
||||
} // namespace Detail
|
||||
} // namespace Benchmark
|
||||
} // namespace Catch
|
@ -24,7 +24,6 @@
|
||||
#include <catch2/catch_reporter_registrars.hpp>
|
||||
#include <catch2/catch_section_info.hpp>
|
||||
#include <catch2/catch_session.hpp>
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/catch_tag_alias.hpp>
|
||||
#include <catch2/catch_tag_alias_autoregistrar.hpp>
|
||||
#include <catch2/catch_template_test_macros.hpp>
|
||||
@ -72,6 +71,7 @@
|
||||
#include <catch2/internal/catch_startup_exception_registry.hpp>
|
||||
#include <catch2/internal/catch_stream.hpp>
|
||||
#include <catch2/internal/catch_string_manip.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_tag_alias_registry.hpp>
|
||||
#include <catch2/internal/catch_template_test_registry.hpp>
|
||||
#include <catch2/internal/catch_test_case_registry_impl.hpp>
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include <catch2/internal/catch_result_type.hpp>
|
||||
#include <catch2/internal/catch_common.hpp>
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <catch2/catch_assertion_info.hpp>
|
||||
#include <catch2/internal/catch_result_type.hpp>
|
||||
#include <catch2/internal/catch_common.hpp>
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_assertionhandler.hpp>
|
||||
|
||||
namespace Catch {
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <catch2/catch_config.hpp>
|
||||
#include <catch2/internal/catch_enforce.hpp>
|
||||
#include <catch2/internal/catch_stream.hpp>
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_string_manip.hpp>
|
||||
#include <catch2/internal/catch_test_spec_parser.hpp>
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define TWOBLUECUBES_CATCH_SECTION_INFO_H_INCLUDED
|
||||
|
||||
#include <catch2/internal/catch_common.hpp>
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/catch_totals.hpp>
|
||||
|
||||
#include <string>
|
||||
|
@ -1,16 +0,0 @@
|
||||
#include <catch2/catch_tag_alias_autoregistrar.hpp>
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) {
|
||||
CATCH_TRY {
|
||||
getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo);
|
||||
} CATCH_CATCH_ALL {
|
||||
// Do not throw when constructing global objects, instead register the exception to be processed later
|
||||
getMutableRegistryHub().registerStartupException();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
#define TWOBLUECUBES_CATCH_TEST_CASE_INFO_H_INCLUDED
|
||||
|
||||
#include <catch2/internal/catch_common.hpp>
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_test_registry.hpp>
|
||||
|
||||
#include <string>
|
||||
|
@ -1,14 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
#include <catch2/generators/catch_generator_exception.hpp>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
const char* GeneratorException::what() const noexcept {
|
||||
return m_msg;
|
||||
}
|
||||
|
||||
} // end namespace Catch
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Created by Phil Nash on 15/6/2018.
|
||||
*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
#include <catch2/generators/catch_generators.hpp>
|
||||
#include <catch2/internal/catch_enforce.hpp>
|
||||
#include <catch2/generators/catch_generator_exception.hpp>
|
||||
#include <catch2/interfaces/catch_interfaces_capture.hpp>
|
||||
|
||||
#include <limits>
|
||||
#include <set>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
IGeneratorTracker::~IGeneratorTracker() {}
|
||||
|
||||
namespace Generators {
|
||||
|
||||
namespace Detail {
|
||||
|
||||
[[noreturn]]
|
||||
void throw_generator_exception(char const* msg) {
|
||||
Catch::throw_exception(GeneratorException{ msg });
|
||||
}
|
||||
} // end namespace Detail
|
||||
|
||||
GeneratorUntypedBase::~GeneratorUntypedBase() {}
|
||||
|
||||
auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
|
||||
return getResultCapture().acquireGeneratorTracker( lineInfo );
|
||||
}
|
||||
|
||||
} // namespace Generators
|
||||
} // namespace Catch
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
|
@ -0,0 +1,58 @@
|
||||
/** \file
|
||||
* This is a special TU that combines what would otherwise be a very
|
||||
* small generator-related TUs into one bigger TU.
|
||||
*
|
||||
* The reason for this is compilation performance improvements by
|
||||
* avoiding reparsing headers for many small TUs, instead having this
|
||||
* one TU include bit more, but having it all parsed only once.
|
||||
*
|
||||
* To avoid heavy-tail problem with compilation times, each "subpart"
|
||||
* of Catch2 has its own combined TU like this.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// vvv formerly catch_generator_exception.cpp vvv //
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
#include <catch2/generators/catch_generator_exception.hpp>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
const char* GeneratorException::what() const noexcept {
|
||||
return m_msg;
|
||||
}
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
|
||||
///////////////////////////////////////////
|
||||
// vvv formerly catch_generators.cpp vvv //
|
||||
///////////////////////////////////////////
|
||||
|
||||
#include <catch2/generators/catch_generators.hpp>
|
||||
#include <catch2/internal/catch_enforce.hpp>
|
||||
#include <catch2/generators/catch_generator_exception.hpp>
|
||||
#include <catch2/interfaces/catch_interfaces_capture.hpp>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
IGeneratorTracker::~IGeneratorTracker() {}
|
||||
|
||||
namespace Generators {
|
||||
|
||||
namespace Detail {
|
||||
|
||||
[[noreturn]]
|
||||
void throw_generator_exception(char const* msg) {
|
||||
Catch::throw_exception(GeneratorException{ msg });
|
||||
}
|
||||
} // end namespace Detail
|
||||
|
||||
GeneratorUntypedBase::~GeneratorUntypedBase() {}
|
||||
|
||||
auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
|
||||
return getResultCapture().acquireGeneratorTracker( lineInfo );
|
||||
}
|
||||
|
||||
} // namespace Generators
|
||||
} // namespace Catch
|
@ -1,5 +0,0 @@
|
||||
#include <catch2/interfaces/catch_interfaces_capture.hpp>
|
||||
|
||||
namespace Catch {
|
||||
IResultCapture::~IResultCapture() = default;
|
||||
}
|
@ -11,7 +11,7 @@
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_result_type.hpp>
|
||||
|
||||
namespace Catch {
|
||||
|
79
src/catch2/interfaces/catch_interfaces_combined_tu.cpp
Normal file
79
src/catch2/interfaces/catch_interfaces_combined_tu.cpp
Normal file
@ -0,0 +1,79 @@
|
||||
/** \file
|
||||
* This is a special TU that combines what would otherwise be a very
|
||||
* small interfaces-related TUs into one bigger TU.
|
||||
*
|
||||
* The reason for this is compilation performance improvements by
|
||||
* avoiding reparsing headers for many small TUs, instead having this
|
||||
* one TU include bit more, but having it all parsed only once.
|
||||
*
|
||||
* To avoid heavy-tail problem with compilation times, each "subpart"
|
||||
* of Catch2 has its own combined TU like this.
|
||||
*/
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
// vvv formerly catch_interfaces_capture.cpp vvv //
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
#include <catch2/interfaces/catch_interfaces_capture.hpp>
|
||||
|
||||
namespace Catch {
|
||||
IResultCapture::~IResultCapture() = default;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// vvv formerly catch_interfaces_config.cpp vvv //
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
#include <catch2/interfaces/catch_interfaces_config.hpp>
|
||||
|
||||
namespace Catch {
|
||||
IConfig::~IConfig() = default;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
// vvv formerly catch_interfaces_exception.cpp vvv //
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
#include <catch2/interfaces/catch_interfaces_exception.hpp>
|
||||
|
||||
namespace Catch {
|
||||
IExceptionTranslator::~IExceptionTranslator() = default;
|
||||
IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// vvv formerly catch_interfaces_registry_hub.cpp vvv //
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
|
||||
|
||||
namespace Catch {
|
||||
IRegistryHub::~IRegistryHub() = default;
|
||||
IMutableRegistryHub::~IMutableRegistryHub() = default;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// vvv formerly catch_interfaces_runner.cpp vvv //
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
#include <catch2/interfaces/catch_interfaces_runner.hpp>
|
||||
|
||||
namespace Catch {
|
||||
IRunner::~IRunner() = default;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// vvv formerly catch_interfaces_testcase.cpp vvv //
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
#include <catch2/interfaces/catch_interfaces_testcase.hpp>
|
||||
|
||||
namespace Catch {
|
||||
ITestInvoker::~ITestInvoker() = default;
|
||||
ITestCaseRegistry::~ITestCaseRegistry() = default;
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
#include <catch2/interfaces/catch_interfaces_config.hpp>
|
||||
|
||||
namespace Catch {
|
||||
IConfig::~IConfig() = default;
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
#ifndef TWOBLUECUBES_CATCH_INTERFACESENUMVALUESREGISTRY_H_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_INTERFACESENUMVALUESREGISTRY_H_INCLUDED
|
||||
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -1,6 +0,0 @@
|
||||
#include <catch2/interfaces/catch_interfaces_exception.hpp>
|
||||
|
||||
namespace Catch {
|
||||
IExceptionTranslator::~IExceptionTranslator() = default;
|
||||
IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default;
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
|
||||
|
||||
namespace Catch {
|
||||
IRegistryHub::~IRegistryHub() = default;
|
||||
IMutableRegistryHub::~IMutableRegistryHub() = default;
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
#include <catch2/catch_assertion_result.hpp>
|
||||
#include <catch2/catch_message.hpp>
|
||||
#include <catch2/internal/catch_option.hpp>
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <catch2/benchmark/catch_estimate.hpp>
|
||||
#include <catch2/benchmark/catch_outlier_classification.hpp>
|
||||
|
@ -1,5 +0,0 @@
|
||||
#include <catch2/interfaces/catch_interfaces_runner.hpp>
|
||||
|
||||
namespace Catch {
|
||||
IRunner::~IRunner() = default;
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
#include <catch2/interfaces/catch_interfaces_testcase.hpp>
|
||||
|
||||
namespace Catch {
|
||||
ITestInvoker::~ITestInvoker() = default;
|
||||
ITestCaseRegistry::~ITestCaseRegistry() = default;
|
||||
}
|
173
src/catch2/internal/catch_combined_tu.cpp
Normal file
173
src/catch2/internal/catch_combined_tu.cpp
Normal file
@ -0,0 +1,173 @@
|
||||
/** \file
|
||||
* This is a special TU that combines what would otherwise be a very
|
||||
* small top-level TUs into one bigger TU.
|
||||
*
|
||||
* The reason for this is compilation performance improvements by
|
||||
* avoiding reparsing headers for many small TUs, instead having this
|
||||
* one TU include bit more, but having it all parsed only once.
|
||||
*
|
||||
* To avoid heavy-tail problem with compilation times, each "subpart"
|
||||
* of Catch2 has its own combined TU like this.
|
||||
*/
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// vvv formerly catch_tag_alias_autoregistrar.cpp vvv //
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
#include <catch2/catch_tag_alias_autoregistrar.hpp>
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) {
|
||||
CATCH_TRY {
|
||||
getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo);
|
||||
} CATCH_CATCH_ALL {
|
||||
// Do not throw when constructing global objects, instead register the exception to be processed later
|
||||
getMutableRegistryHub().registerStartupException();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
// vvv formerly catch_polyfills.cpp vvv //
|
||||
//////////////////////////////////////////
|
||||
|
||||
#include <catch2/internal/catch_polyfills.hpp>
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
#include <cmath>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
#if !defined(CATCH_CONFIG_POLYFILL_ISNAN)
|
||||
bool isnan(float f) {
|
||||
return std::isnan(f);
|
||||
}
|
||||
bool isnan(double d) {
|
||||
return std::isnan(d);
|
||||
}
|
||||
#else
|
||||
// For now we only use this for embarcadero
|
||||
bool isnan(float f) {
|
||||
return std::_isnan(f);
|
||||
}
|
||||
bool isnan(double d) {
|
||||
return std::_isnan(d);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// vvv formerly catch_uncaught_exceptions.cpp vvv //
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
#include <catch2/internal/catch_uncaught_exceptions.hpp>
|
||||
#include <exception>
|
||||
|
||||
namespace Catch {
|
||||
bool uncaught_exceptions() {
|
||||
#if defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) || (defined(__cpp_lib_uncaught_exceptions) && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS))
|
||||
return std::uncaught_exceptions() > 0;
|
||||
#else
|
||||
return std::uncaught_exception();
|
||||
#endif
|
||||
}
|
||||
} // end namespace Catch
|
||||
|
||||
|
||||
////////////////////////////////////////////
|
||||
// vvv formerly catch_errno_guard.cpp vvv //
|
||||
////////////////////////////////////////////
|
||||
#include <catch2/internal/catch_errno_guard.hpp>
|
||||
|
||||
#include <cerrno>
|
||||
|
||||
namespace Catch {
|
||||
ErrnoGuard::ErrnoGuard():m_oldErrno(errno){}
|
||||
ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; }
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////
|
||||
// vvv formerly catch_decomposer.cpp vvv //
|
||||
///////////////////////////////////////////
|
||||
#include <catch2/internal/catch_decomposer.hpp>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
ITransientExpression::~ITransientExpression() = default;
|
||||
|
||||
void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) {
|
||||
if( lhs.size() + rhs.size() < 40 &&
|
||||
lhs.find('\n') == std::string::npos &&
|
||||
rhs.find('\n') == std::string::npos )
|
||||
os << lhs << ' ' << op << ' ' << rhs;
|
||||
else
|
||||
os << lhs << '\n' << op << '\n' << rhs;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// vvv formerly catch_startup_exception_registry.cpp vvv //
|
||||
///////////////////////////////////////////////////////////
|
||||
#include <catch2/internal/catch_startup_exception_registry.hpp>
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
|
||||
namespace Catch {
|
||||
void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept {
|
||||
CATCH_TRY {
|
||||
m_exceptions.push_back(exception);
|
||||
} CATCH_CATCH_ALL {
|
||||
// If we run out of memory during start-up there's really not a lot more we can do about it
|
||||
std::terminate();
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::exception_ptr> const& StartupExceptionRegistry::getExceptions() const noexcept {
|
||||
return m_exceptions;
|
||||
}
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// vvv formerly catch_leak_detector.cpp vvv //
|
||||
//////////////////////////////////////////////
|
||||
#include <catch2/internal/catch_leak_detector.hpp>
|
||||
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
|
||||
|
||||
|
||||
#ifdef CATCH_CONFIG_WINDOWS_CRTDBG
|
||||
#include <crtdbg.h>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
LeakDetector::LeakDetector() {
|
||||
int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
||||
flag |= _CRTDBG_LEAK_CHECK_DF;
|
||||
flag |= _CRTDBG_ALLOC_MEM_DF;
|
||||
_CrtSetDbgFlag(flag);
|
||||
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
|
||||
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
|
||||
// Change this to leaking allocation's number to break there
|
||||
_CrtSetBreakAlloc(-1);
|
||||
}
|
||||
}
|
||||
|
||||
#else // ^^ Windows crt debug heap enabled // Windows crt debug heap disabled vv
|
||||
|
||||
Catch::LeakDetector::LeakDetector() {}
|
||||
|
||||
#endif // CATCH_CONFIG_WINDOWS_CRTDBG
|
||||
|
||||
Catch::LeakDetector::~LeakDetector() {
|
||||
Catch::cleanUp();
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Created by Phil Nash on 8/8/2017.
|
||||
* Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
|
||||
*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
#include <catch2/internal/catch_decomposer.hpp>
|
||||
#include <catch2/catch_config.hpp>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
ITransientExpression::~ITransientExpression() = default;
|
||||
|
||||
void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) {
|
||||
if( lhs.size() + rhs.size() < 40 &&
|
||||
lhs.find('\n') == std::string::npos &&
|
||||
rhs.find('\n') == std::string::npos )
|
||||
os << lhs << ' ' << op << ' ' << rhs;
|
||||
else
|
||||
os << lhs << '\n' << op << '\n' << rhs;
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
#define TWOBLUECUBES_CATCH_DECOMPOSER_H_INCLUDED
|
||||
|
||||
#include <catch2/catch_tostring.hpp>
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_meta.hpp>
|
||||
|
||||
#include <iosfwd>
|
||||
|
@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Created by Martin on 06/03/2017.
|
||||
*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
#include <catch2/internal/catch_errno_guard.hpp>
|
||||
|
||||
#include <cerrno>
|
||||
|
||||
namespace Catch {
|
||||
ErrnoGuard::ErrnoGuard():m_oldErrno(errno){}
|
||||
ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; }
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Created by Martin on 12/07/2017.
|
||||
*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
#include <catch2/internal/catch_leak_detector.hpp>
|
||||
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
|
||||
|
||||
|
||||
#ifdef CATCH_CONFIG_WINDOWS_CRTDBG
|
||||
#include <crtdbg.h>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
LeakDetector::LeakDetector() {
|
||||
int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
||||
flag |= _CRTDBG_LEAK_CHECK_DF;
|
||||
flag |= _CRTDBG_ALLOC_MEM_DF;
|
||||
_CrtSetDbgFlag(flag);
|
||||
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
|
||||
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
|
||||
// Change this to leaking allocation's number to break there
|
||||
_CrtSetBreakAlloc(-1);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
Catch::LeakDetector::LeakDetector() {}
|
||||
|
||||
#endif
|
||||
|
||||
Catch::LeakDetector::~LeakDetector() {
|
||||
Catch::cleanUp();
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
#define TWOBLUECUBES_CATCH_LIST_H_INCLUDED
|
||||
|
||||
#include <catch2/catch_config.hpp>
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Created by Martin on 17/11/2017.
|
||||
*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
#include <catch2/internal/catch_polyfills.hpp>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
#if !defined(CATCH_CONFIG_POLYFILL_ISNAN)
|
||||
bool isnan(float f) {
|
||||
return std::isnan(f);
|
||||
}
|
||||
bool isnan(double d) {
|
||||
return std::isnan(d);
|
||||
}
|
||||
#else
|
||||
// For now we only use this for embarcadero
|
||||
bool isnan(float f) {
|
||||
return std::_isnan(f);
|
||||
}
|
||||
bool isnan(double d) {
|
||||
return std::_isnan(d);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // end namespace Catch
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Created by Martin on 04/06/2017.
|
||||
* Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
|
||||
*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
#include <catch2/internal/catch_startup_exception_registry.hpp>
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
|
||||
namespace Catch {
|
||||
void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept {
|
||||
CATCH_TRY {
|
||||
m_exceptions.push_back(exception);
|
||||
} CATCH_CATCH_ALL {
|
||||
// If we run out of memory during start-up there's really not a lot more we can do about it
|
||||
std::terminate();
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::exception_ptr> const& StartupExceptionRegistry::getExceptions() const noexcept {
|
||||
return m_exceptions;
|
||||
}
|
||||
|
||||
} // end namespace Catch
|
@ -11,7 +11,7 @@
|
||||
#include <catch2/internal/catch_enforce.hpp>
|
||||
#include <catch2/internal/catch_stream.hpp>
|
||||
#include <catch2/internal/catch_debug_console.hpp>
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_singletons.hpp>
|
||||
|
||||
#include <cstdio>
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <catch2/internal/catch_string_manip.hpp>
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <ostream>
|
||||
|
@ -7,7 +7,7 @@
|
||||
#ifndef TWOBLUECUBES_CATCH_STRING_MANIP_H_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_STRING_MANIP_H_INCLUDED
|
||||
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <iosfwd>
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <catch2/internal/catch_enforce.hpp>
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <ostream>
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include <catch2/internal/catch_assertionhandler.hpp>
|
||||
#include <catch2/interfaces/catch_interfaces_capture.hpp>
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
// We need this suppression to leak, because it took until GCC 9
|
||||
// for the front end to handle local suppression via _Pragma properly
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <catch2/internal/catch_common.hpp>
|
||||
#include <catch2/interfaces/catch_interfaces_testcase.hpp>
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Created by Josh on 1/2/2018.
|
||||
* Copyright 2018 Two Blue Cubes Ltd. All rights reserved.
|
||||
*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
#include <catch2/internal/catch_uncaught_exceptions.hpp>
|
||||
#include <exception>
|
||||
|
||||
namespace Catch {
|
||||
bool uncaught_exceptions() {
|
||||
#if defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) || (defined(__cpp_lib_uncaught_exceptions) && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS))
|
||||
return std::uncaught_exceptions() > 0;
|
||||
#else
|
||||
return std::uncaught_exception();
|
||||
#endif
|
||||
}
|
||||
} // end namespace Catch
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
#include <catch2/matchers/catch_matchers.hpp>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
namespace Matchers {
|
||||
|
||||
std::string MatcherUntypedBase::toString() const {
|
||||
if (m_cachedToString.empty())
|
||||
m_cachedToString = describe();
|
||||
return m_cachedToString;
|
||||
}
|
||||
|
||||
MatcherUntypedBase::~MatcherUntypedBase() = default;
|
||||
|
||||
} // namespace Matchers
|
||||
|
||||
} // namespace Catch
|
@ -1,30 +0,0 @@
|
||||
// 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)
|
||||
|
||||
#include <catch2/matchers/catch_matchers_container_properties.hpp>
|
||||
|
||||
#include <catch2/internal/catch_stream.hpp>
|
||||
|
||||
namespace Catch {
|
||||
namespace Matchers {
|
||||
|
||||
std::string IsEmptyMatcher::describe() const {
|
||||
return "is empty";
|
||||
}
|
||||
|
||||
std::string HasSizeMatcher::describe() const {
|
||||
ReusableStringStream sstr;
|
||||
sstr << "has size == " << m_target_size;
|
||||
return sstr.str();
|
||||
}
|
||||
|
||||
IsEmptyMatcher IsEmpty() {
|
||||
return {};
|
||||
}
|
||||
|
||||
HasSizeMatcher SizeIs(std::size_t sz) {
|
||||
return HasSizeMatcher{ sz };
|
||||
}
|
||||
|
||||
} // end namespace Matchers
|
||||
} // end namespace Catch
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Created by Martin Hořeňovský on 13/10/2019.
|
||||
*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
#include <catch2/matchers/catch_matchers_exception.hpp>
|
||||
|
||||
|
||||
namespace Catch {
|
||||
namespace Matchers {
|
||||
|
||||
bool ExceptionMessageMatcher::match(std::exception const& ex) const {
|
||||
return ex.what() == m_message;
|
||||
}
|
||||
|
||||
std::string ExceptionMessageMatcher::describe() const {
|
||||
return "exception message matches \"" + m_message + "\"";
|
||||
}
|
||||
|
||||
ExceptionMessageMatcher Message(std::string const& message) {
|
||||
return ExceptionMessageMatcher(message);
|
||||
}
|
||||
|
||||
} // namespace Matchers
|
||||
} // namespace Catch
|
@ -1,9 +0,0 @@
|
||||
#include <catch2/matchers/catch_matchers_predicate.hpp>
|
||||
|
||||
std::string Catch::Matchers::Detail::finalizeDescription(const std::string& desc) {
|
||||
if (desc.empty()) {
|
||||
return "matches undescribed predicate";
|
||||
} else {
|
||||
return "matches predicate: \"" + desc + '"';
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <catch2/internal/catch_common.hpp>
|
||||
#include <catch2/matchers/catch_matchers.hpp>
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <algorithm>
|
||||
|
127
src/catch2/matchers/internal/catch_matchers_combined_tu.cpp
Normal file
127
src/catch2/matchers/internal/catch_matchers_combined_tu.cpp
Normal file
@ -0,0 +1,127 @@
|
||||
/** \file
|
||||
* This is a special TU that combines what would otherwise be a very
|
||||
* small matcher-related TUs into one bigger TU.
|
||||
*
|
||||
* The reason for this is compilation performance improvements by
|
||||
* avoiding reparsing headers for many small TUs, instead having this
|
||||
* one TU include bit more, but having it all parsed only once.
|
||||
*
|
||||
* To avoid heavy-tail problem with compilation times, each "subpart"
|
||||
* of Catch2 has its own combined TU like this.
|
||||
*/
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// vvv formerly catch_matchers_impl.cpp vvv //
|
||||
//////////////////////////////////////////////
|
||||
#include <catch2/matchers/internal/catch_matchers_impl.hpp>
|
||||
#include <catch2/matchers/catch_matchers.hpp>
|
||||
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
// This is the general overload that takes a any string matcher
|
||||
// There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers
|
||||
// the Equals matcher (so the header does not mention matchers)
|
||||
void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString ) {
|
||||
std::string exceptionMessage = Catch::translateActiveException();
|
||||
MatchExpr<std::string, StringMatcher const&> expr( std::move(exceptionMessage), matcher, matcherString );
|
||||
handler.handleExpr( expr );
|
||||
}
|
||||
|
||||
} // namespace Catch
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// vvv formerly catch_matchers_container_properties.cpp vvv //
|
||||
//////////////////////////////////////////////////////////////
|
||||
#include <catch2/matchers/catch_matchers_container_properties.hpp>
|
||||
#include <catch2/internal/catch_stream.hpp>
|
||||
|
||||
namespace Catch {
|
||||
namespace Matchers {
|
||||
|
||||
std::string IsEmptyMatcher::describe() const {
|
||||
return "is empty";
|
||||
}
|
||||
|
||||
std::string HasSizeMatcher::describe() const {
|
||||
ReusableStringStream sstr;
|
||||
sstr << "has size == " << m_target_size;
|
||||
return sstr.str();
|
||||
}
|
||||
|
||||
IsEmptyMatcher IsEmpty() {
|
||||
return {};
|
||||
}
|
||||
|
||||
HasSizeMatcher SizeIs(std::size_t sz) {
|
||||
return HasSizeMatcher{ sz };
|
||||
}
|
||||
|
||||
} // end namespace Matchers
|
||||
} // end namespace Catch
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////
|
||||
// vvv formerly catch_matchers.cpp vvv //
|
||||
/////////////////////////////////////////
|
||||
|
||||
#include <catch2/matchers/catch_matchers.hpp>
|
||||
|
||||
namespace Catch {
|
||||
namespace Matchers {
|
||||
|
||||
std::string MatcherUntypedBase::toString() const {
|
||||
if (m_cachedToString.empty()) {
|
||||
m_cachedToString = describe();
|
||||
}
|
||||
return m_cachedToString;
|
||||
}
|
||||
|
||||
MatcherUntypedBase::~MatcherUntypedBase() = default;
|
||||
|
||||
} // namespace Matchers
|
||||
} // namespace Catch
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
// vvv formerly catch_matchers_predicate.cpp vvv //
|
||||
///////////////////////////////////////////////////
|
||||
#include <catch2/matchers/catch_matchers_predicate.hpp>
|
||||
|
||||
std::string Catch::Matchers::Detail::finalizeDescription(const std::string& desc) {
|
||||
if (desc.empty()) {
|
||||
return "matches undescribed predicate";
|
||||
} else {
|
||||
return "matches predicate: \"" + desc + '"';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
// vvv formerly catch_matchers_exception.cpp vvv //
|
||||
///////////////////////////////////////////////////
|
||||
#include <catch2/matchers/catch_matchers_exception.hpp>
|
||||
|
||||
namespace Catch {
|
||||
namespace Matchers {
|
||||
|
||||
bool ExceptionMessageMatcher::match(std::exception const& ex) const {
|
||||
return ex.what() == m_message;
|
||||
}
|
||||
|
||||
std::string ExceptionMessageMatcher::describe() const {
|
||||
return "exception message matches \"" + m_message + "\"";
|
||||
}
|
||||
|
||||
ExceptionMessageMatcher Message(std::string const& message) {
|
||||
return ExceptionMessageMatcher(message);
|
||||
}
|
||||
|
||||
} // namespace Matchers
|
||||
} // namespace Catch
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
*/
|
||||
#include <catch2/matchers/internal/catch_matchers_impl.hpp>
|
||||
#include <catch2/matchers/catch_matchers.hpp>
|
||||
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
// This is the general overload that takes a any string matcher
|
||||
// There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers
|
||||
// the Equals matcher (so the header does not mention matchers)
|
||||
void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString ) {
|
||||
std::string exceptionMessage = Catch::translateActiveException();
|
||||
MatchExpr<std::string, StringMatcher const&> expr( std::move(exceptionMessage), matcher, matcherString );
|
||||
handler.handleExpr( expr );
|
||||
}
|
||||
|
||||
} // namespace Catch
|
@ -6,7 +6,7 @@
|
||||
#define TWOBLUECUBES_CATCH_CAPTURE_MATCHERS_HPP_INCLUDED
|
||||
|
||||
#include <catch2/internal/catch_test_macro_impl.hpp>
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <catch2/internal/catch_string_manip.hpp>
|
||||
#include <catch2/catch_version.hpp>
|
||||
#include <catch2/internal/catch_text.hpp>
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <cfloat>
|
||||
#include <cstdio>
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user