Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:53:26

0001 
0002 //              Copyright Catch2 Authors
0003 // Distributed under the Boost Software License, Version 1.0.
0004 //   (See accompanying file LICENSE.txt or copy at
0005 //        https://www.boost.org/LICENSE_1_0.txt)
0006 
0007 // SPDX-License-Identifier: BSL-1.0
0008 #ifndef CATCH_INTERFACES_CAPTURE_HPP_INCLUDED
0009 #define CATCH_INTERFACES_CAPTURE_HPP_INCLUDED
0010 
0011 #include <string>
0012 
0013 #include <catch2/internal/catch_stringref.hpp>
0014 #include <catch2/internal/catch_result_type.hpp>
0015 #include <catch2/internal/catch_unique_ptr.hpp>
0016 #include <catch2/benchmark/detail/catch_benchmark_stats_fwd.hpp>
0017 
0018 namespace Catch {
0019 
0020     class AssertionResult;
0021     struct AssertionInfo;
0022     struct SectionInfo;
0023     struct SectionEndInfo;
0024     struct MessageInfo;
0025     struct MessageBuilder;
0026     struct Counts;
0027     struct AssertionReaction;
0028     struct SourceLineInfo;
0029 
0030     class ITransientExpression;
0031     class IGeneratorTracker;
0032 
0033     struct BenchmarkInfo;
0034 
0035     namespace Generators {
0036         class GeneratorUntypedBase;
0037         using GeneratorBasePtr = Catch::Detail::unique_ptr<GeneratorUntypedBase>;
0038     }
0039 
0040 
0041     class IResultCapture {
0042     public:
0043         virtual ~IResultCapture();
0044 
0045         virtual void notifyAssertionStarted( AssertionInfo const& info ) = 0;
0046         virtual bool sectionStarted( StringRef sectionName,
0047                                      SourceLineInfo const& sectionLineInfo,
0048                                      Counts& assertions ) = 0;
0049         virtual void sectionEnded( SectionEndInfo&& endInfo ) = 0;
0050         virtual void sectionEndedEarly( SectionEndInfo&& endInfo ) = 0;
0051 
0052         virtual IGeneratorTracker*
0053         acquireGeneratorTracker( StringRef generatorName,
0054                                  SourceLineInfo const& lineInfo ) = 0;
0055         virtual IGeneratorTracker*
0056         createGeneratorTracker( StringRef generatorName,
0057                                 SourceLineInfo lineInfo,
0058                                 Generators::GeneratorBasePtr&& generator ) = 0;
0059 
0060         virtual void benchmarkPreparing( StringRef name ) = 0;
0061         virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0;
0062         virtual void benchmarkEnded( BenchmarkStats<> const& stats ) = 0;
0063         virtual void benchmarkFailed( StringRef error ) = 0;
0064 
0065         virtual void pushScopedMessage( MessageInfo const& message ) = 0;
0066         virtual void popScopedMessage( MessageInfo const& message ) = 0;
0067 
0068         virtual void emplaceUnscopedMessage( MessageBuilder&& builder ) = 0;
0069 
0070         virtual void handleFatalErrorCondition( StringRef message ) = 0;
0071 
0072         virtual void handleExpr
0073                 (   AssertionInfo const& info,
0074                     ITransientExpression const& expr,
0075                     AssertionReaction& reaction ) = 0;
0076         virtual void handleMessage
0077                 (   AssertionInfo const& info,
0078                     ResultWas::OfType resultType,
0079                     std::string&& message,
0080                     AssertionReaction& reaction ) = 0;
0081         virtual void handleUnexpectedExceptionNotThrown
0082                 (   AssertionInfo const& info,
0083                     AssertionReaction& reaction ) = 0;
0084         virtual void handleUnexpectedInflightException
0085                 (   AssertionInfo const& info,
0086                     std::string&& message,
0087                     AssertionReaction& reaction ) = 0;
0088         virtual void handleIncomplete
0089                 (   AssertionInfo const& info ) = 0;
0090         virtual void handleNonExpr
0091                 (   AssertionInfo const &info,
0092                     ResultWas::OfType resultType,
0093                     AssertionReaction &reaction ) = 0;
0094 
0095 
0096 
0097         virtual bool lastAssertionPassed() = 0;
0098         virtual void assertionPassed() = 0;
0099 
0100         // Deprecated, do not use:
0101         virtual std::string getCurrentTestName() const = 0;
0102         virtual const AssertionResult* getLastResult() const = 0;
0103         virtual void exceptionEarlyReported() = 0;
0104     };
0105 
0106     IResultCapture& getResultCapture();
0107 }
0108 
0109 #endif // CATCH_INTERFACES_CAPTURE_HPP_INCLUDED