forked from catchorg/Catch2
/
catch_reporter_helpers.hpp
95 lines (77 loc) · 3.22 KB
/
catch_reporter_helpers.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Copyright Catch2 Authors
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
// SPDX-License-Identifier: BSL-1.0
#ifndef CATCH_REPORTER_HELPERS_HPP_INCLUDED
#define CATCH_REPORTER_HELPERS_HPP_INCLUDED
#include <iosfwd>
#include <string>
#include <vector>
#include <catch2/internal/catch_list.hpp>
#include <catch2/interfaces/catch_interfaces_config.hpp>
#include <catch2/catch_totals.hpp>
namespace Catch {
class IConfig;
class TestCaseHandle;
class ColourImpl;
// Returns double formatted as %.3f (format expected on output)
std::string getFormattedDuration( double duration );
//! Should the reporter show duration of test given current configuration?
bool shouldShowDuration( IConfig const& config, double duration );
std::string serializeFilters( std::vector<std::string> const& filters );
struct lineOfChars {
char c;
constexpr lineOfChars( char c_ ): c( c_ ) {}
friend std::ostream& operator<<( std::ostream& out, lineOfChars value );
};
/**
* Lists reporter descriptions to the provided stream in user-friendly
* format
*
* Used as the default listing implementation by the first party reporter
* bases. The output should be backwards compatible with the output of
* Catch2 v2 binaries.
*/
void
defaultListReporters( std::ostream& out,
std::vector<ReporterDescription> const& descriptions,
Verbosity verbosity );
/**
* Lists listeners descriptions to the provided stream in user-friendly
* format
*/
void defaultListListeners( std::ostream& out,
std::vector<ListenerDescription> const& descriptions );
/**
* Lists tag information to the provided stream in user-friendly format
*
* Used as the default listing implementation by the first party reporter
* bases. The output should be backwards compatible with the output of
* Catch2 v2 binaries.
*/
void defaultListTags( std::ostream& out, std::vector<TagInfo> const& tags, bool isFiltered );
/**
* Lists test case information to the provided stream in user-friendly
* format
*
* Used as the default listing implementation by the first party reporter
* bases. The output is backwards compatible with the output of Catch2
* v2 binaries, and also supports the format specific to the old
* `--list-test-names-only` option, for people who used it in integrations.
*/
void defaultListTests( std::ostream& out,
ColourImpl* streamColour,
std::vector<TestCaseHandle> const& tests,
bool isFiltered,
Verbosity verbosity );
/**
* Prints test run totals to the provided stream in user-friendly format
*
* Used by the console and compact reporters.
*/
void printTestRunTotals( std::ostream& stream,
ColourImpl& streamColour,
Totals const& totals );
} // end namespace Catch
#endif // CATCH_REPORTER_HELPERS_HPP_INCLUDED