Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:07

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_REPORTER_HELPERS_HPP_INCLUDED
0009 #define CATCH_REPORTER_HELPERS_HPP_INCLUDED
0010 
0011 #include <iosfwd>
0012 #include <string>
0013 #include <vector>
0014 
0015 #include <catch2/internal/catch_list.hpp>
0016 #include <catch2/interfaces/catch_interfaces_config.hpp>
0017 #include <catch2/catch_totals.hpp>
0018 
0019 namespace Catch {
0020 
0021     class IConfig;
0022     class TestCaseHandle;
0023     class ColourImpl;
0024 
0025     // Returns double formatted as %.3f (format expected on output)
0026     std::string getFormattedDuration( double duration );
0027 
0028     //! Should the reporter show duration of test given current configuration?
0029     bool shouldShowDuration( IConfig const& config, double duration );
0030 
0031     std::string serializeFilters( std::vector<std::string> const& filters );
0032 
0033     struct lineOfChars {
0034         char c;
0035         constexpr lineOfChars( char c_ ): c( c_ ) {}
0036 
0037         friend std::ostream& operator<<( std::ostream& out, lineOfChars value );
0038     };
0039 
0040     /**
0041      * Lists reporter descriptions to the provided stream in user-friendly
0042      * format
0043      *
0044      * Used as the default listing implementation by the first party reporter
0045      * bases. The output should be backwards compatible with the output of
0046      * Catch2 v2 binaries.
0047      */
0048     void
0049     defaultListReporters( std::ostream& out,
0050                           std::vector<ReporterDescription> const& descriptions,
0051                           Verbosity verbosity );
0052 
0053     /**
0054      * Lists listeners descriptions to the provided stream in user-friendly
0055      * format
0056      */
0057     void defaultListListeners( std::ostream& out,
0058                                std::vector<ListenerDescription> const& descriptions );
0059 
0060     /**
0061      * Lists tag information to the provided stream in user-friendly format
0062      *
0063      * Used as the default listing implementation by the first party reporter
0064      * bases. The output should be backwards compatible with the output of
0065      * Catch2 v2 binaries.
0066      */
0067     void defaultListTags( std::ostream& out, std::vector<TagInfo> const& tags, bool isFiltered );
0068 
0069     /**
0070      * Lists test case information to the provided stream in user-friendly
0071      * format
0072      *
0073      * Used as the default listing implementation by the first party reporter
0074      * bases. The output is backwards compatible with the output of Catch2
0075      * v2 binaries, and also supports the format specific to the old
0076      * `--list-test-names-only` option, for people who used it in integrations.
0077      */
0078     void defaultListTests( std::ostream& out,
0079                            ColourImpl* streamColour,
0080                            std::vector<TestCaseHandle> const& tests,
0081                            bool isFiltered,
0082                            Verbosity verbosity );
0083 
0084     /**
0085      * Prints test run totals to the provided stream in user-friendly format
0086      *
0087      * Used by the console and compact reporters.
0088      */
0089     void printTestRunTotals( std::ostream& stream,
0090                       ColourImpl& streamColour,
0091                       Totals const& totals );
0092 
0093 } // end namespace Catch
0094 
0095 #endif // CATCH_REPORTER_HELPERS_HPP_INCLUDED