Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/interfaces
diff options
context:
space:
mode:
authorMartin Hořeňovský2023-03-31 10:44:29 +0200
committerMartin Hořeňovský2023-03-31 19:31:51 +0200
commit9f08097f55eb29a61efcdb4af41952a67e155215 (patch)
tree04a4e437ee8384da04758380abe3d925ecbf79b1 /src/catch2/interfaces
parent1f881ab4641b866304b818a063164dae976dba5f (diff)
downloadcatch3-9f08097f55eb29a61efcdb4af41952a67e155215.tar.gz
Cleanup internal includes by splitting out some event structs
* Split out BenchmarkInfo and BenchmarkStats to their own header * Outline BenchmarkStats<> declaration to separate header * Split out TestRunInfo into its own header These changes let us remove the large `interfaces_reporter.hpp` include from `benchmark.hpp`, and replace it with `interfaces_capture.hpp` in `run_context.hpp`. I also cleaned out `interfaces_repoter.hpp` from reporter headers that depend on `reporter_common_base.hpp`. This will not change anything in the actual inclusion set, but makes it logically more consistent.
Diffstat (limited to 'src/catch2/interfaces')
-rw-r--r--src/catch2/interfaces/catch_interfaces_capture.hpp3
-rw-r--r--src/catch2/interfaces/catch_interfaces_reporter.hpp49
2 files changed, 3 insertions, 49 deletions
diff --git a/src/catch2/interfaces/catch_interfaces_capture.hpp b/src/catch2/interfaces/catch_interfaces_capture.hpp
index c3c80d75..e605f998 100644
--- a/src/catch2/interfaces/catch_interfaces_capture.hpp
+++ b/src/catch2/interfaces/catch_interfaces_capture.hpp
@@ -14,6 +14,7 @@
#include <catch2/internal/catch_stringref.hpp>
#include <catch2/internal/catch_result_type.hpp>
#include <catch2/internal/catch_unique_ptr.hpp>
+#include <catch2/benchmark/detail/catch_benchmark_stats_fwd.hpp>
namespace Catch {
@@ -31,8 +32,6 @@ namespace Catch {
class IGeneratorTracker;
struct BenchmarkInfo;
- template <typename Duration = std::chrono::duration<double, std::nano>>
- struct BenchmarkStats;
namespace Generators {
class GeneratorUntypedBase;
diff --git a/src/catch2/interfaces/catch_interfaces_reporter.hpp b/src/catch2/interfaces/catch_interfaces_reporter.hpp
index 8ebc7a73..0ce62e86 100644
--- a/src/catch2/interfaces/catch_interfaces_reporter.hpp
+++ b/src/catch2/interfaces/catch_interfaces_reporter.hpp
@@ -13,11 +13,10 @@
#include <catch2/catch_assertion_result.hpp>
#include <catch2/internal/catch_message_info.hpp>
#include <catch2/internal/catch_stringref.hpp>
+#include <catch2/internal/catch_test_run_info.hpp>
#include <catch2/internal/catch_unique_ptr.hpp>
#include <catch2/internal/catch_move_and_forward.hpp>
-#include <catch2/benchmark/catch_estimate.hpp>
-#include <catch2/benchmark/catch_outlier_classification.hpp>
-#include <catch2/interfaces/catch_interfaces_capture.hpp>
+#include <catch2/benchmark/detail/catch_benchmark_stats.hpp>
#include <map>
#include <string>
@@ -57,11 +56,6 @@ namespace Catch {
std::map<std::string, std::string> m_customOptions;
};
- struct TestRunInfo {
- constexpr TestRunInfo(StringRef _name) : name(_name) {}
- StringRef name;
- };
-
struct AssertionStats {
AssertionStats( AssertionResult const& _assertionResult,
std::vector<MessageInfo> const& _infoMessages,
@@ -113,45 +107,6 @@ namespace Catch {
bool aborting;
};
-
- struct BenchmarkInfo {
- std::string name;
- double estimatedDuration;
- int iterations;
- unsigned int samples;
- unsigned int resamples;
- double clockResolution;
- double clockCost;
- };
-
- template <class Duration>
- struct BenchmarkStats {
- BenchmarkInfo info;
-
- std::vector<Duration> samples;
- Benchmark::Estimate<Duration> mean;
- Benchmark::Estimate<Duration> standardDeviation;
- Benchmark::OutlierClassification outliers;
- double outlierVariance;
-
- template <typename Duration2>
- operator BenchmarkStats<Duration2>() const {
- std::vector<Duration2> samples2;
- samples2.reserve(samples.size());
- for (auto const& sample : samples) {
- samples2.push_back(Duration2(sample));
- }
- return {
- info,
- CATCH_MOVE(samples2),
- mean,
- standardDeviation,
- outliers,
- outlierVariance,
- };
- }
- };
-
//! By setting up its preferences, a reporter can modify Catch2's behaviour
//! in some regards, e.g. it can request Catch2 to capture writes to
//! stdout/stderr during test execution, and pass them to the reporter.