Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:02:48

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