Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
Catch Namespace Reference

Namespaces

namespace  clara
 
namespace  Detail
 
namespace  detail
 
namespace  Generators
 
namespace  literals
 
namespace  Matchers
 
namespace  TestCaseTracking
 

Classes

struct  always_false
 
struct  append
 
struct  append< L1< E1... >, L2< E2... > >
 
struct  append< L1< E1... >, L2< E2... >, Rest... >
 
class  AssertionHandler
 
struct  AssertionInfo
 
struct  AssertionReaction
 
class  AssertionResult
 
struct  AssertionResultData
 
struct  AssertionStats
 
struct  AutomakeReporter
 
struct  AutoReg
 
struct  BenchmarkInfo
 
class  BenchmarkLooper
 
struct  BenchmarkStats
 
class  BinaryExpr
 
class  Capturer
 
struct  CaseSensitive
 
struct  Colour
 
struct  combine
 
struct  CompactReporter
 
class  Config
 
struct  ConfigData
 
struct  ConsoleReporter
 
class  Context
 
struct  Counts
 
struct  CumulativeReporterBase
 
struct  Decomposer
 
class  ErrnoGuard
 
class  ExceptionTranslatorRegistrar
 
class  ExceptionTranslatorRegistry
 
class  ExprLhs
 
struct  FatalConditionHandler
 
class  GeneratorException
 
struct  GroupInfo
 
struct  IConfig
 
struct  IContext
 
struct  IExceptionTranslator
 
struct  IExceptionTranslatorRegistry
 
struct  IGeneratorTracker
 
struct  IMutableContext
 
struct  IMutableEnumValuesRegistry
 
struct  IMutableRegistryHub
 
struct  IRegistryHub
 
struct  IReporterFactory
 
struct  IReporterRegistry
 
struct  IResultCapture
 
struct  IRunner
 
struct  is_range
 
struct  is_range< disabled_range >
 
struct  is_unique
 
struct  is_unique< T0, T1, Rest... >
 
struct  ISingleton
 
struct  IStream
 
struct  IStreamingReporter
 
struct  ITagAliasRegistry
 
struct  ITestCaseRegistry
 
struct  ITestInvoker
 
struct  ITransientExpression
 
class  JunitReporter
 
class  LazyExpression
 
struct  LazyStat
 
struct  LeakDetector
 
class  ListenerRegistrar
 
class  ListeningReporter
 
class  MatchExpr
 
struct  MessageBuilder
 
struct  MessageInfo
 
struct  MessageStream
 
struct  NameAndTags
 
class  NonCopyable
 
struct  not_this_one
 
class  OcMethod
 
class  Option
 
struct  pluralise
 
class  RedirectedStdErr
 
class  RedirectedStdOut
 
class  RedirectedStream
 
class  RedirectedStreams
 
struct  RegistrarForTagAliases
 
struct  ReporterConfig
 
struct  ReporterPreferences
 
class  ReporterRegistrar
 
class  ReporterRegistry
 
struct  ResultDisposition
 
struct  ResultWas
 
class  ReusableStringStream
 
struct  rewrap
 
struct  rewrap< Container, List< elems... > >
 
struct  rewrap< Container, List< Elems... >, Elements... >
 
class  RunContext
 
struct  RunTests
 
class  ScopedMessage
 
class  Section
 
struct  SectionEndInfo
 
struct  SectionInfo
 
struct  SectionStats
 
class  Session
 
struct  ShowDurations
 
struct  SignalDefs
 
class  Singleton
 
struct  SourceLineInfo
 
class  StartupExceptionRegistry
 
struct  StreamEndStop
 
struct  StreamingReporterBase
 
struct  StringMaker
 
struct  StringMaker< bool >
 
struct  StringMaker< Catch::Detail::Approx >
 
struct  StringMaker< char * >
 
struct  StringMaker< char >
 
struct  StringMaker< char const * >
 
struct  StringMaker< char[SZ]>
 
struct  StringMaker< double >
 
struct  StringMaker< float >
 
struct  StringMaker< has_maker >
 
struct  StringMaker< has_maker_and_operator >
 
struct  StringMaker< int >
 
struct  StringMaker< long >
 
struct  StringMaker< long long >
 
struct  StringMaker< R C::* >
 
struct  StringMaker< R, typename std::enable_if< is_range< R >::value &&!::Catch::Detail::IsStreamInsertable< R >::value >::type >
 
struct  StringMaker< signed char >
 
struct  StringMaker< signed char[SZ]>
 
struct  StringMaker< std::nullptr_t >
 
struct  StringMaker< std::string >
 
struct  StringMaker< std::wstring >
 
struct  StringMaker< stringmaker_range >
 
struct  StringMaker< StringMakerException >
 
struct  StringMaker< T * >
 
struct  StringMaker< T[SZ]>
 
struct  StringMaker< unsigned char >
 
struct  StringMaker< unsigned char[SZ]>
 
struct  StringMaker< unsigned int >
 
struct  StringMaker< unsigned long >
 
struct  StringMaker< unsigned long long >
 
struct  StringMaker< wchar_t * >
 
struct  StringMaker< wchar_t const * >
 
class  StringRef
 
struct  StringRefTestAccess
 
struct  StringStreams
 
struct  SummaryColumn
 
class  TablePrinter
 
struct  TagAlias
 
class  TagAliasRegistry
 
struct  TagInfo
 
struct  TAPReporter
 
struct  TeamCityReporter
 
class  TestCase
 
struct  TestCaseInfo
 
struct  TestCaseStats
 
struct  TestEventListenerBase
 
struct  TestFailureException
 
struct  TestGroupStats
 
class  TestInvokerAsFunction
 
class  TestInvokerAsMethod
 
class  TestRegistry
 
struct  TestRunInfo
 
struct  TestRunStats
 
class  TestSpec
 
class  TestSpecParser
 
class  Timer
 
struct  Totals
 
struct  TypeList
 
class  UnaryExpr
 
struct  UseColour
 
struct  Version
 
struct  WaitForKeypress
 
struct  WarnAbout
 
class  WildcardPattern
 
class  XmlEncode
 
class  XmlReporter
 
class  XmlWriter
 

Typedefs

using StringMatcher = Matchers::Impl::MatcherBase<std::string>
 
using IConfigPtr = std::shared_ptr<IConfig const>
 
using exceptionTranslateFunction = std::string(*)()
 
using ExceptionTranslators = std::vector<std::unique_ptr<IExceptionTranslator const>>
 
using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>
 
using IStreamingReporterPtr = std::unique_ptr<IStreamingReporter>
 
using RegistryHubSingleton = Singleton<RegistryHub, IRegistryHub, IMutableRegistryHub>
 

Enumerations

enum class  Verbosity {
  Quiet = 0 , Normal , High , Quiet = 0 ,
  Normal , High
}
 
enum class  Verbosity {
  Quiet = 0 , Normal , High , Quiet = 0 ,
  Normal , High
}
 

Functions

std::ostream & cout ()
 
std::ostream & clog ()
 
std::ostream & cerr ()
 
auto operator<< (std::ostream &os, LazyExpression const &lazyExpr) -> std::ostream &
 
void handleExceptionMatchExpr (AssertionHandler &handler, std::string const &str, StringRef const &matcherString)
 
void handleExceptionMatchExpr (AssertionHandler &handler, StringMatcher const &matcher, StringRef const &matcherString)
 
template<typename ArgT , typename MatcherT >
auto makeMatchExpr (ArgT const &arg, MatcherT const &matcher, StringRef const &matcherString) -> MatchExpr< ArgT, MatcherT >
 
clara::Parser makeCommandLineParser (ConfigData &config)
 
std::ostream & operator<< (std::ostream &os, SourceLineInfo const &info)
 
template<typename T >
T const & operator+ (T const &value, StreamEndStop)
 
std::ostream & operator<< (std::ostream &os, Colour const &)
 
void cleanUpContext ()
 
IMutableContextgetCurrentMutableContext ()
 
IContextgetCurrentContext ()
 
void writeToDebugConsole (std::string const &text)
 
bool isDebuggerActive ()
 
void formatReconstructedExpression (std::ostream &os, std::string const &lhs, StringRef op, std::string const &rhs)
 
template<typename LhsT , typename RhsT >
auto compareEqual (LhsT const &lhs, RhsT const &rhs) -> bool
 
template<typename T >
auto compareEqual (T *const &lhs, int rhs) -> bool
 
template<typename T >
auto compareEqual (T *const &lhs, long rhs) -> bool
 
template<typename T >
auto compareEqual (int lhs, T *const &rhs) -> bool
 
template<typename T >
auto compareEqual (long lhs, T *const &rhs) -> bool
 
template<typename LhsT , typename RhsT >
auto compareNotEqual (LhsT const &lhs, RhsT &&rhs) -> bool
 
template<typename T >
auto compareNotEqual (T *const &lhs, int rhs) -> bool
 
template<typename T >
auto compareNotEqual (T *const &lhs, long rhs) -> bool
 
template<typename T >
auto compareNotEqual (int lhs, T *const &rhs) -> bool
 
template<typename T >
auto compareNotEqual (long lhs, T *const &rhs) -> bool
 
void handleExpression (ITransientExpression const &expr)
 
template<typename T >
void handleExpression (ExprLhs< T > const &expr)
 
void throw_exception (std::exception const &e)
 
IResultCapturegetResultCapture ()
 
IRegistryHub const & getRegistryHub ()
 
IMutableRegistryHubgetMutableRegistryHub ()
 
void cleanUp ()
 
std::string translateActiveException ()
 
bool matchTest (TestCase const &testCase, TestSpec const &testSpec, IConfig const &config)
 
std::vector< TestCasefilterTests (std::vector< TestCase > const &testCases, TestSpec const &testSpec, IConfig const &config)
 
std::vector< TestCase > const & getAllTestCasesSorted (IConfig const &config)
 
std::size_t listTests (Config const &config)
 
std::size_t listTestsNamesOnly (Config const &config)
 
std::size_t listTags (Config const &config)
 
std::size_t listReporters ()
 
Option< std::size_t > list (std::shared_ptr< Config > const &config)
 
std::size_t registerTestMethods ()
 
bool isnan (float f)
 
bool isnan (double d)
 
std::mt19937 & rng ()
 
void seedRng (IConfig const &config)
 
unsigned int rngSeed ()
 
bool isOk (ResultWas::OfType resultType)
 
bool isJustInfo (int flags)
 
ResultDisposition::Flags operator| (ResultDisposition::Flags lhs, ResultDisposition::Flags rhs)
 
bool shouldContinueOnFailure (int flags)
 
bool shouldSuppressFailure (int flags)
 
bool isFalseTest (int flags)
 
void addSingleton (ISingleton *singleton)
 
void cleanupSingletons ()
 
auto makeStream (StringRef const &filename) -> IStream const *
 
bool startsWith (std::string const &s, std::string const &prefix)
 
bool startsWith (std::string const &s, char prefix)
 
bool endsWith (std::string const &s, std::string const &suffix)
 
bool endsWith (std::string const &s, char suffix)
 
bool contains (std::string const &s, std::string const &infix)
 
void toLowerInPlace (std::string &s)
 
std::string toLower (std::string const &s)
 
std::string trim (std::string const &str)
 
bool replaceInPlace (std::string &str, std::string const &replaceThis, std::string const &withThis)
 
std::vector< StringRefsplitStringRef (StringRef str, char delimiter)
 
std::ostream & operator<< (std::ostream &os, pluralise const &pluraliser)
 
auto operator+ (StringRef const &lhs, StringRef const &rhs) -> std::string
 
auto operator+ (StringRef const &lhs, const char *rhs) -> std::string
 
auto operator+ (char const *lhs, StringRef const &rhs) -> std::string
 
auto operator<< (std::ostream &os, StringRef const &str) -> std::ostream &
 
auto operator+= (std::string &lhs, StringRef const &rhs) -> std::string &
 
auto operator""_sr (char const *rawChars, std::size_t size) noexcept -> StringRef
 
TestCase makeTestCase (ITestInvoker *_testCase, std::string const &_className, NameAndTags const &nameAndTags, SourceLineInfo const &_lineInfo)
 
void setTags (TestCaseInfo &testCaseInfo, std::vector< std::string > tags)
 
std::vector< TestCasesortTests (IConfig const &config, std::vector< TestCase > const &unsortedTestCases)
 
void enforceNoDuplicateTestCases (std::vector< TestCase > const &functions)
 
std::string extractClassName (StringRef const &classOrQualifiedMethodName)
 
auto makeTestInvoker (void(*testAsFunction)()) noexcept -> ITestInvoker *
 
template<typename C >
auto makeTestInvoker (void(C::*testAsMethod)()) noexcept -> ITestInvoker *
 
TestSpec parseTestSpec (std::string const &arg)
 
auto getCurrentNanosecondsSinceEpoch () -> uint64_t
 
auto getEstimatedClockResolution () -> uint64_t
 
template<typename T >
std::string to_string (T const &t)
 
template<typename T >
std::string fpToString (T value, int precision)
 
template<typename Range >
std::string rangeToString (Range const &range)
 
template<typename Allocator >
std::string rangeToString (std::vector< bool, Allocator > const &v)
 
bool uncaught_exceptions ()
 
std::ostream & operator<< (std::ostream &os, Version const &version)
 
Version const & libraryVersion ()
 
std::ostream & operator<< (std::ostream &os, XmlEncode const &xmlEncode)
 
void prepareExpandedExpression (AssertionResult &result)
 
std::string getFormattedDuration (double duration)
 
std::string serializeFilters (std::vector< std::string > const &container)
 
template<char C>
char const * getLineOfChars ()
 

Variables

LeakDetector leakDetector
 
not_this_one begin (...)
 
not_this_one end (...)
 

Typedef Documentation

◆ exceptionTranslateFunction

typedef std::string(* Catch::exceptionTranslateFunction)() = std::string(*)()

Definition at line 23 of file catch_interfaces_exception.h.

◆ ExceptionTranslators

using Catch::ExceptionTranslators = std::vector<std::unique_ptr<IExceptionTranslator const>>

Definition at line 26 of file catch_interfaces_exception.h.

◆ IConfigPtr

typedef std::shared_ptr< IConfig const > Catch::IConfigPtr = std::shared_ptr<IConfig const>

Definition at line 20 of file catch_context.h.

◆ IReporterFactoryPtr

typedef std::shared_ptr< IReporterFactory > Catch::IReporterFactoryPtr = std::shared_ptr<IReporterFactory>

Definition at line 29 of file catch_interfaces_registry_hub.h.

◆ IStreamingReporterPtr

Definition at line 211 of file catch_interfaces_reporter.h.

◆ RegistryHubSingleton

◆ StringMatcher

Definition at line 13 of file catch_capture_matchers.cpp.

Enumeration Type Documentation

◆ Verbosity [1/2]

enum class Catch::Verbosity
strong
Enumerator
Quiet 
Normal 
High 
Quiet 
Normal 
High 

Definition at line 20 of file catch_interfaces_config.h.

◆ Verbosity [2/2]

enum class Catch::Verbosity
strong
Enumerator
Quiet 
Normal 
High 
Quiet 
Normal 
High 

Definition at line 3987 of file catch.hpp.

3987 {
3988 Quiet = 0,
3989 Normal,
3990 High
3991 };

Function Documentation

◆ addSingleton()

void Catch::addSingleton ( ISingleton * singleton)

Definition at line 25 of file catch_singletons.cpp.

25 {
26 getSingletons()->push_back( singleton );
27 }

◆ cerr()

std::ostream & Catch::cerr ( )

Definition at line 41 of file 231-Cfg-OutputStreams.cpp.

41 {
42 return clog();
43 }
std::ostream & clog()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanUp()

void Catch::cleanUp ( )

Definition at line 86 of file catch_registry_hub.cpp.

86 {
89 }
void cleanupSingletons()
void cleanUpContext()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanUpContext()

void Catch::cleanUpContext ( )

Definition at line 55 of file catch_context.cpp.

55 {
56 delete IMutableContext::currentContext;
57 IMutableContext::currentContext = nullptr;
58 }
Here is the caller graph for this function:

◆ cleanupSingletons()

void Catch::cleanupSingletons ( )

Definition at line 28 of file catch_singletons.cpp.

28 {
29 auto& singletons = getSingletons();
30 for( auto singleton : *singletons )
31 delete singleton;
32 delete singletons;
33 singletons = nullptr;
34 }
Here is the caller graph for this function:

◆ clog()

std::ostream & Catch::clog ( )

Definition at line 37 of file 231-Cfg-OutputStreams.cpp.

37 {
38 static std::ostream ret(new out_buff(stderr));
39 return ret;
40 }
CK_RV ret
Here is the caller graph for this function:

◆ compareEqual() [1/5]

template<typename T >
auto Catch::compareEqual ( int lhs,
T *const & rhs ) -> bool

Definition at line 149 of file catch_decomposer.h.

149{ return reinterpret_cast<void const*>( lhs ) == rhs; }

◆ compareEqual() [2/5]

template<typename LhsT , typename RhsT >
auto Catch::compareEqual ( LhsT const & lhs,
RhsT const & rhs ) -> bool

Definition at line 143 of file catch_decomposer.h.

143{ return static_cast<bool>(lhs == rhs); }
Here is the caller graph for this function:

◆ compareEqual() [3/5]

template<typename T >
auto Catch::compareEqual ( long lhs,
T *const & rhs ) -> bool

Definition at line 151 of file catch_decomposer.h.

151{ return reinterpret_cast<void const*>( lhs ) == rhs; }

◆ compareEqual() [4/5]

template<typename T >
auto Catch::compareEqual ( T *const & lhs,
int rhs ) -> bool

Definition at line 145 of file catch_decomposer.h.

145{ return lhs == reinterpret_cast<void const*>( rhs ); }

◆ compareEqual() [5/5]

template<typename T >
auto Catch::compareEqual ( T *const & lhs,
long rhs ) -> bool

Definition at line 147 of file catch_decomposer.h.

147{ return lhs == reinterpret_cast<void const*>( rhs ); }

◆ compareNotEqual() [1/5]

template<typename T >
auto Catch::compareNotEqual ( int lhs,
T *const & rhs ) -> bool

Definition at line 160 of file catch_decomposer.h.

160{ return reinterpret_cast<void const*>( lhs ) != rhs; }

◆ compareNotEqual() [2/5]

template<typename LhsT , typename RhsT >
auto Catch::compareNotEqual ( LhsT const & lhs,
RhsT && rhs ) -> bool

Definition at line 154 of file catch_decomposer.h.

154{ return static_cast<bool>(lhs != rhs); }
Here is the caller graph for this function:

◆ compareNotEqual() [3/5]

template<typename T >
auto Catch::compareNotEqual ( long lhs,
T *const & rhs ) -> bool

Definition at line 162 of file catch_decomposer.h.

162{ return reinterpret_cast<void const*>( lhs ) != rhs; }

◆ compareNotEqual() [4/5]

template<typename T >
auto Catch::compareNotEqual ( T *const & lhs,
int rhs ) -> bool

Definition at line 156 of file catch_decomposer.h.

156{ return lhs != reinterpret_cast<void const*>( rhs ); }

◆ compareNotEqual() [5/5]

template<typename T >
auto Catch::compareNotEqual ( T *const & lhs,
long rhs ) -> bool

Definition at line 158 of file catch_decomposer.h.

158{ return lhs != reinterpret_cast<void const*>( rhs ); }

◆ contains()

bool Catch::contains ( std::string const & s,
std::string const & infix )

Definition at line 37 of file catch_string_manip.cpp.

37 {
38 return s.find( infix ) != std::string::npos;
39 }
char * s
Here is the caller graph for this function:

◆ cout()

std::ostream & Catch::cout ( )

Definition at line 33 of file 231-Cfg-OutputStreams.cpp.

33 {
34 static std::ostream ret(new out_buff(stdout));
35 return ret;
36 }
Here is the caller graph for this function:

◆ endsWith() [1/2]

bool Catch::endsWith ( std::string const & s,
char suffix )

Definition at line 34 of file catch_string_manip.cpp.

34 {
35 return !s.empty() && s[s.size()-1] == suffix;
36 }

◆ endsWith() [2/2]

bool Catch::endsWith ( std::string const & s,
std::string const & suffix )

Definition at line 31 of file catch_string_manip.cpp.

31 {
32 return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin());
33 }
Here is the caller graph for this function:

◆ enforceNoDuplicateTestCases()

void Catch::enforceNoDuplicateTestCases ( std::vector< TestCase > const & functions)

Definition at line 43 of file catch_test_case_registry_impl.cpp.

43 {
44 std::set<TestCase> seenFunctions;
45 for( auto const& function : functions ) {
46 auto prev = seenFunctions.insert( function );
47 CATCH_ENFORCE( prev.second,
48 "error: TEST_CASE( \"" << function.name << "\" ) already defined.\n"
49 << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n"
50 << "\tRedefined at " << function.getTestCaseInfo().lineInfo );
51 }
52 }
#define CATCH_ENFORCE(condition, msg)
Here is the caller graph for this function:

◆ extractClassName()

std::string Catch::extractClassName ( StringRef const & classOrQualifiedMethodName)

Definition at line 102 of file catch_test_case_registry_impl.cpp.

102 {
103 std::string className = classOrQualifiedMethodName;
104 if( startsWith( className, '&' ) )
105 {
106 std::size_t lastColons = className.rfind( "::" );
107 std::size_t penultimateColons = className.rfind( "::", lastColons-1 );
108 if( penultimateColons == std::string::npos )
109 penultimateColons = 1;
110 className = className.substr( penultimateColons, lastColons-penultimateColons );
111 }
112 return className;
113 }
bool startsWith(std::string const &s, std::string const &prefix)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ filterTests()

std::vector< TestCase > Catch::filterTests ( std::vector< TestCase > const & testCases,
TestSpec const & testSpec,
IConfig const & config )

Definition at line 54 of file catch_test_case_registry_impl.cpp.

54 {
55 std::vector<TestCase> filtered;
56 filtered.reserve( testCases.size() );
57 for (auto const& testCase : testCases) {
58 if ((!testSpec.hasFilters() && !testCase.isHidden()) ||
59 (testSpec.hasFilters() && matchTest(testCase, testSpec, config))) {
60 filtered.push_back(testCase);
61 }
62 }
63 return filtered;
64 }
bool matchTest(TestCase const &testCase, TestSpec const &testSpec, IConfig const &config)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatReconstructedExpression()

void Catch::formatReconstructedExpression ( std::ostream & os,
std::string const & lhs,
StringRef op,
std::string const & rhs )

Definition at line 16 of file catch_decomposer.cpp.

16 {
17 if( lhs.size() + rhs.size() < 40 &&
18 lhs.find('\n') == std::string::npos &&
19 rhs.find('\n') == std::string::npos )
20 os << lhs << " " << op << " " << rhs;
21 else
22 os << lhs << "\n" << op << "\n" << rhs;
23 }
os_t os

◆ fpToString()

template<typename T >
std::string Catch::fpToString ( T value,
int precision )

Definition at line 71 of file catch_tostring.cpp.

71 {
72 if (Catch::isnan(value)) {
73 return "nan";
74 }
75
76 ReusableStringStream rss;
77 rss << std::setprecision( precision )
78 << std::fixed
79 << value;
80 std::string d = rss.str();
81 std::size_t i = d.find_last_not_of( '0' );
82 if( i != std::string::npos && i != d.size()-1 ) {
83 if( d[i] == '.' )
84 i++;
85 d = d.substr( 0, i+1 );
86 }
87 return d;
88}
bool isnan(float f)
#define value
Definition pkcs11.h:157
CK_ULONG d
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAllTestCasesSorted()

std::vector< TestCase > const & Catch::getAllTestCasesSorted ( IConfig const & config)

Definition at line 65 of file catch_test_case_registry_impl.cpp.

65 {
67 }
IRegistryHub const & getRegistryHub()
virtual ITestCaseRegistry const & getTestCaseRegistry() const =0
virtual std::vector< TestCase > const & getAllTestsSorted(IConfig const &config) const =0
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCurrentContext()

IContext & Catch::getCurrentContext ( )
inline

Definition at line 52 of file catch_context.h.

53 {
55 }
IMutableContext & getCurrentMutableContext()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCurrentMutableContext()

IMutableContext & Catch::getCurrentMutableContext ( )
inline

Definition at line 45 of file catch_context.h.

46 {
47 if( !IMutableContext::currentContext )
48 IMutableContext::createContext();
49 return *IMutableContext::currentContext;
50 }
Here is the caller graph for this function:

◆ getCurrentNanosecondsSinceEpoch()

auto Catch::getCurrentNanosecondsSinceEpoch ( ) -> uint64_t

Definition at line 17 of file catch_timer.cpp.

17 {
18 return std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count();
19 }
Here is the caller graph for this function:

◆ getEstimatedClockResolution()

auto Catch::getEstimatedClockResolution ( ) -> uint64_t

Definition at line 52 of file catch_timer.cpp.

52 {
53 static auto s_resolution = estimateClockResolution();
54 return s_resolution;
55 }

◆ getFormattedDuration()

std::string Catch::getFormattedDuration ( double duration)

Definition at line 26 of file catch_reporter_bases.cpp.

26 {
27 // Max exponent + 1 is required to represent the whole part
28 // + 1 for decimal point
29 // + 3 for the 3 decimal places
30 // + 1 for null terminator
31 const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1;
32 char buffer[maxDoubleSize];
33
34 // Save previous errno, to prevent sprintf from overwriting it
35 ErrnoGuard guard;
36#ifdef _MSC_VER
37 sprintf_s(buffer, "%.3f", duration);
38#else
39 std::sprintf(buffer, "%.3f", duration);
40#endif
41 return std::string(buffer);
42 }
Here is the caller graph for this function:

◆ getLineOfChars()

template<char C>
char const * Catch::getLineOfChars ( )

Definition at line 259 of file catch_reporter_bases.hpp.

259 {
260 static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0};
261 if( !*line ) {
262 std::memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 );
263 line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0;
264 }
265 return line;
266 }
#define CATCH_CONFIG_CONSOLE_WIDTH
Here is the caller graph for this function:

◆ getMutableRegistryHub()

IMutableRegistryHub & Catch::getMutableRegistryHub ( )

Definition at line 83 of file catch_registry_hub.cpp.

83 {
84 return RegistryHubSingleton::getMutable();
85 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRegistryHub()

IRegistryHub const & Catch::getRegistryHub ( )

Definition at line 80 of file catch_registry_hub.cpp.

80 {
81 return RegistryHubSingleton::get();
82 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getResultCapture()

IResultCapture & Catch::getResultCapture ( )

Definition at line 494 of file catch_run_context.cpp.

494 {
495 if (auto* capture = getCurrentContext().getResultCapture())
496 return *capture;
497 else
498 CATCH_INTERNAL_ERROR("No result capture instance");
499 }
#define CATCH_INTERNAL_ERROR(msg)
IContext & getCurrentContext()
IResultCapture & getResultCapture()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleExceptionMatchExpr() [1/2]

void Catch::handleExceptionMatchExpr ( AssertionHandler & handler,
std::string const & str,
StringRef const & matcherString )

Definition at line 117 of file catch_assertionhandler.cpp.

117 {
118 handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString );
119 }
void handleExceptionMatchExpr(AssertionHandler &handler, std::string const &str, StringRef const &matcherString)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleExceptionMatchExpr() [2/2]

void Catch::handleExceptionMatchExpr ( AssertionHandler & handler,
StringMatcher const & matcher,
StringRef const & matcherString )

Definition at line 18 of file catch_capture_matchers.cpp.

18 {
19 std::string exceptionMessage = Catch::translateActiveException();
20 MatchExpr<std::string, StringMatcher const&> expr( exceptionMessage, matcher, matcherString );
21 handler.handleExpr( expr );
22 }
void handleExpr(ExprLhs< T > const &expr)
std::string translateActiveException()
Here is the call graph for this function:

◆ handleExpression() [1/2]

template<typename T >
void Catch::handleExpression ( ExprLhs< T > const & expr)

Definition at line 226 of file catch_decomposer.h.

226 {
228 }
auto makeUnaryExpr() const -> UnaryExpr< LhsT >
void handleExpression(ITransientExpression const &expr)
Here is the call graph for this function:

◆ handleExpression() [2/2]

void Catch::handleExpression ( ITransientExpression const & expr)
Here is the caller graph for this function:

◆ isDebuggerActive()

bool Catch::isDebuggerActive ( )

Definition at line 121 of file catch_debugger.cpp.

121{ return false; }

◆ isFalseTest()

bool Catch::isFalseTest ( int flags)
inline

Definition at line 50 of file catch_result_type.h.

50{ return ( flags & ResultDisposition::FalseTest ) != 0; }
pInfo flags
Here is the caller graph for this function:

◆ isJustInfo()

bool Catch::isJustInfo ( int flags)

Definition at line 16 of file catch_result_type.cpp.

16 {
17 return flags == ResultWas::Info;
18 }

◆ isnan() [1/2]

bool Catch::isnan ( double d)

Definition at line 18 of file catch_polyfills.cpp.

18 {
19 return std::isnan(d);
20 }

◆ isnan() [2/2]

bool Catch::isnan ( float f)

Definition at line 15 of file catch_polyfills.cpp.

15 {
16 return std::isnan(f);
17 }
Here is the caller graph for this function:

◆ isOk()

bool Catch::isOk ( ResultWas::OfType resultType)

Definition at line 13 of file catch_result_type.cpp.

13 {
14 return ( resultType & ResultWas::FailureBit ) == 0;
15 }
Here is the caller graph for this function:

◆ libraryVersion()

Version const & Catch::libraryVersion ( )

Definition at line 39 of file catch_version.cpp.

39 {
40 static Version version( 2, 7, 2, "", 0 );
41 return version;
42 }
Here is the caller graph for this function:

◆ list()

Option< std::size_t > Catch::list ( std::shared_ptr< Config > const & config)

Definition at line 150 of file catch_list.cpp.

150 {
151 Option<std::size_t> listedCount;
153 if( config->listTests() )
154 listedCount = listedCount.valueOr(0) + listTests( *config );
155 if( config->listTestNamesOnly() )
156 listedCount = listedCount.valueOr(0) + listTestsNamesOnly( *config );
157 if( config->listTags() )
158 listedCount = listedCount.valueOr(0) + listTags( *config );
159 if( config->listReporters() )
160 listedCount = listedCount.valueOr(0) + listReporters();
161 return listedCount;
162 }
T valueOr(T const &defaultValue) const
std::size_t listTags(Config const &config)
std::size_t listReporters()
std::size_t listTestsNamesOnly(Config const &config)
std::size_t listTests(Config const &config)
virtual void setConfig(IConfigPtr const &config)=0
Here is the call graph for this function:

◆ listReporters()

std::size_t Catch::listReporters ( )

Definition at line 128 of file catch_list.cpp.

128 {
129 Catch::cout() << "Available reporters:\n";
131 std::size_t maxNameLen = 0;
132 for( auto const& factoryKvp : factories )
133 maxNameLen = (std::max)( maxNameLen, factoryKvp.first.size() );
134
135 for( auto const& factoryKvp : factories ) {
137 << Column( factoryKvp.first + ":" )
138 .indent(2)
139 .width( 5+maxNameLen )
140 + Column( factoryKvp.second->getDescription() )
141 .initialIndent(0)
142 .indent(2)
143 .width( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen-8 )
144 << "\n";
145 }
146 Catch::cout() << std::endl;
147 return factories.size();
148 }
auto indent(size_t newIndent) -> Column &
Definition clara.hpp:209
auto initialIndent(size_t newIndent) -> Column &
Definition clara.hpp:213
std::ostream & cout()
virtual IReporterRegistry const & getReporterRegistry() const =0
std::map< std::string, IReporterFactoryPtr > FactoryMap
virtual FactoryMap const & getFactories() const =0
Here is the call graph for this function:
Here is the caller graph for this function:

◆ listTags()

std::size_t Catch::listTags ( Config const & config)

Definition at line 93 of file catch_list.cpp.

93 {
94 TestSpec testSpec = config.testSpec();
95 if( config.hasTestFilters() )
96 Catch::cout() << "Tags for matching test cases:\n";
97 else {
98 Catch::cout() << "All available tags:\n";
99 }
100
101 std::map<std::string, TagInfo> tagCounts;
102
103 std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );
104 for( auto const& testCase : matchedTestCases ) {
105 for( auto const& tagName : testCase.getTestCaseInfo().tags ) {
106 std::string lcaseTagName = toLower( tagName );
107 auto countIt = tagCounts.find( lcaseTagName );
108 if( countIt == tagCounts.end() )
109 countIt = tagCounts.insert( std::make_pair( lcaseTagName, TagInfo() ) ).first;
110 countIt->second.add( tagName );
111 }
112 }
113
114 for( auto const& tagCount : tagCounts ) {
115 ReusableStringStream rss;
116 rss << " " << std::setw(2) << tagCount.second.count << " ";
117 auto str = rss.str();
118 auto wrapper = Column( tagCount.second.all() )
119 .initialIndent( 0 )
120 .indent( str.size() )
121 .width( CATCH_CONFIG_CONSOLE_WIDTH-10 );
122 Catch::cout() << str << wrapper << '\n';
123 }
124 Catch::cout() << pluralise( tagCounts.size(), "tag" ) << '\n' << std::endl;
125 return tagCounts.size();
126 }
return str
Definition CLI11.hpp:1359
Here is the call graph for this function:
Here is the caller graph for this function:

◆ listTests()

std::size_t Catch::listTests ( Config const & config)

Definition at line 30 of file catch_list.cpp.

30 {
31 TestSpec testSpec = config.testSpec();
32 if( config.hasTestFilters() )
33 Catch::cout() << "Matching test cases:\n";
34 else {
35 Catch::cout() << "All available test cases:\n";
36 }
37
38 auto matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );
39 for( auto const& testCaseInfo : matchedTestCases ) {
40 Colour::Code colour = testCaseInfo.isHidden()
41 ? Colour::SecondaryText
42 : Colour::None;
43 Colour colourGuard( colour );
44
45 Catch::cout() << Column( testCaseInfo.name ).initialIndent( 2 ).indent( 4 ) << "\n";
46 if( config.verbosity() >= Verbosity::High ) {
47 Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl;
48 std::string description = testCaseInfo.description;
49 if( description.empty() )
50 description = "(NO DESCRIPTION)";
51 Catch::cout() << Column( description ).indent(4) << std::endl;
52 }
53 if( !testCaseInfo.tags.empty() )
54 Catch::cout() << Column( testCaseInfo.tagsAsString() ).indent( 6 ) << "\n";
55 }
56
57 if( !config.hasTestFilters() )
58 Catch::cout() << pluralise( matchedTestCases.size(), "test case" ) << '\n' << std::endl;
59 else
60 Catch::cout() << pluralise( matchedTestCases.size(), "matching test case" ) << '\n' << std::endl;
61 return matchedTestCases.size();
62 }
std::string stringify(const T &e)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ listTestsNamesOnly()

std::size_t Catch::listTestsNamesOnly ( Config const & config)

Definition at line 64 of file catch_list.cpp.

64 {
65 TestSpec testSpec = config.testSpec();
66 std::size_t matchedTests = 0;
67 std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );
68 for( auto const& testCaseInfo : matchedTestCases ) {
69 matchedTests++;
70 if( startsWith( testCaseInfo.name, '#' ) )
71 Catch::cout() << '"' << testCaseInfo.name << '"';
72 else
73 Catch::cout() << testCaseInfo.name;
74 if ( config.verbosity() >= Verbosity::High )
75 Catch::cout() << "\t@" << testCaseInfo.lineInfo;
76 Catch::cout() << std::endl;
77 }
78 return matchedTests;
79 }
std::vector< TestCase > filterTests(std::vector< TestCase > const &testCases, TestSpec const &testSpec, IConfig const &config)
std::vector< TestCase > const & getAllTestCasesSorted(IConfig const &config)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeCommandLineParser()

clara::Parser Catch::makeCommandLineParser ( ConfigData & config)

Definition at line 21 of file catch_commandline.cpp.

21 {
22
23 using namespace clara;
24
25 auto const setWarning = [&]( std::string const& warning ) {
26 auto warningSet = [&]() {
27 if( warning == "NoAssertions" )
28 return WarnAbout::NoAssertions;
29
30 if ( warning == "NoTests" )
31 return WarnAbout::NoTests;
32
33 return WarnAbout::Nothing;
34 }();
35
36 if (warningSet == WarnAbout::Nothing)
37 return ParserResult::runtimeError( "Unrecognised warning: '" + warning + "'" );
38 config.warnings = static_cast<WarnAbout::What>( config.warnings | warningSet );
39 return ParserResult::ok( ParseResultType::Matched );
40 };
41 auto const loadTestNamesFromFile = [&]( std::string const& filename ) {
42 std::ifstream f( filename.c_str() );
43 if( !f.is_open() )
44 return ParserResult::runtimeError( "Unable to load input file: '" + filename + "'" );
45
46 std::string line;
47 while( std::getline( f, line ) ) {
48 line = trim(line);
49 if( !line.empty() && !startsWith( line, '#' ) ) {
50 if( !startsWith( line, '"' ) )
51 line = '"' + line + '"';
52 config.testsOrTags.push_back( line + ',' );
53 }
54 }
55 return ParserResult::ok( ParseResultType::Matched );
56 };
57 auto const setTestOrder = [&]( std::string const& order ) {
58 if( startsWith( "declared", order ) )
59 config.runOrder = RunTests::InDeclarationOrder;
60 else if( startsWith( "lexical", order ) )
61 config.runOrder = RunTests::InLexicographicalOrder;
62 else if( startsWith( "random", order ) )
63 config.runOrder = RunTests::InRandomOrder;
64 else
65 return clara::ParserResult::runtimeError( "Unrecognised ordering: '" + order + "'" );
66 return ParserResult::ok( ParseResultType::Matched );
67 };
68 auto const setRngSeed = [&]( std::string const& seed ) {
69 if( seed != "time" )
70 return clara::detail::convertInto( seed, config.rngSeed );
71 config.rngSeed = static_cast<unsigned int>( std::time(nullptr) );
72 return ParserResult::ok( ParseResultType::Matched );
73 };
74 auto const setColourUsage = [&]( std::string const& useColour ) {
75 auto mode = toLower( useColour );
76
77 if( mode == "yes" )
78 config.useColour = UseColour::Yes;
79 else if( mode == "no" )
80 config.useColour = UseColour::No;
81 else if( mode == "auto" )
82 config.useColour = UseColour::Auto;
83 else
84 return ParserResult::runtimeError( "colour mode must be one of: auto, yes or no. '" + useColour + "' not recognised" );
85 return ParserResult::ok( ParseResultType::Matched );
86 };
87 auto const setWaitForKeypress = [&]( std::string const& keypress ) {
88 auto keypressLc = toLower( keypress );
89 if( keypressLc == "start" )
90 config.waitForKeypress = WaitForKeypress::BeforeStart;
91 else if( keypressLc == "exit" )
92 config.waitForKeypress = WaitForKeypress::BeforeExit;
93 else if( keypressLc == "both" )
94 config.waitForKeypress = WaitForKeypress::BeforeStartAndExit;
95 else
96 return ParserResult::runtimeError( "keypress argument must be one of: start, exit or both. '" + keypress + "' not recognised" );
97 return ParserResult::ok( ParseResultType::Matched );
98 };
99 auto const setVerbosity = [&]( std::string const& verbosity ) {
100 auto lcVerbosity = toLower( verbosity );
101 if( lcVerbosity == "quiet" )
102 config.verbosity = Verbosity::Quiet;
103 else if( lcVerbosity == "normal" )
104 config.verbosity = Verbosity::Normal;
105 else if( lcVerbosity == "high" )
106 config.verbosity = Verbosity::High;
107 else
108 return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + "'" );
109 return ParserResult::ok( ParseResultType::Matched );
110 };
111 auto const setReporter = [&]( std::string const& reporter ) {
112 IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
113
114 auto lcReporter = toLower( reporter );
115 auto result = factories.find( lcReporter );
116
117 if( factories.end() != result )
118 config.reporterName = lcReporter;
119 else
120 return ParserResult::runtimeError( "Unrecognized reporter, '" + reporter + "'. Check available with --list-reporters" );
121 return ParserResult::ok( ParseResultType::Matched );
122 };
123
124 auto cli
125 = ExeName( config.processName )
126 | Help( config.showHelp )
127 | Opt( config.listTests )
128 ["-l"]["--list-tests"]
129 ( "list all/matching test cases" )
130 | Opt( config.listTags )
131 ["-t"]["--list-tags"]
132 ( "list all/matching tags" )
133 | Opt( config.showSuccessfulTests )
134 ["-s"]["--success"]
135 ( "include successful tests in output" )
136 | Opt( config.shouldDebugBreak )
137 ["-b"]["--break"]
138 ( "break into debugger on failure" )
139 | Opt( config.noThrow )
140 ["-e"]["--nothrow"]
141 ( "skip exception tests" )
142 | Opt( config.showInvisibles )
143 ["-i"]["--invisibles"]
144 ( "show invisibles (tabs, newlines)" )
145 | Opt( config.outputFilename, "filename" )
146 ["-o"]["--out"]
147 ( "output filename" )
148 | Opt( setReporter, "name" )
149 ["-r"]["--reporter"]
150 ( "reporter to use (defaults to console)" )
151 | Opt( config.name, "name" )
152 ["-n"]["--name"]
153 ( "suite name" )
154 | Opt( [&]( bool ){ config.abortAfter = 1; } )
155 ["-a"]["--abort"]
156 ( "abort at first failure" )
157 | Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" )
158 ["-x"]["--abortx"]
159 ( "abort after x failures" )
160 | Opt( setWarning, "warning name" )
161 ["-w"]["--warn"]
162 ( "enable warnings" )
163 | Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )
164 ["-d"]["--durations"]
165 ( "show test durations" )
166 | Opt( loadTestNamesFromFile, "filename" )
167 ["-f"]["--input-file"]
168 ( "load test names to run from a file" )
169 | Opt( config.filenamesAsTags )
170 ["-#"]["--filenames-as-tags"]
171 ( "adds a tag for the filename" )
172 | Opt( config.sectionsToRun, "section name" )
173 ["-c"]["--section"]
174 ( "specify section to run" )
175 | Opt( setVerbosity, "quiet|normal|high" )
176 ["-v"]["--verbosity"]
177 ( "set output verbosity" )
178 | Opt( config.listTestNamesOnly )
179 ["--list-test-names-only"]
180 ( "list all/matching test cases names only" )
181 | Opt( config.listReporters )
182 ["--list-reporters"]
183 ( "list all reporters" )
184 | Opt( setTestOrder, "decl|lex|rand" )
185 ["--order"]
186 ( "test case order (defaults to decl)" )
187 | Opt( setRngSeed, "'time'|number" )
188 ["--rng-seed"]
189 ( "set a specific seed for random numbers" )
190 | Opt( setColourUsage, "yes|no" )
191 ["--use-colour"]
192 ( "should output be colourised" )
193 | Opt( config.libIdentify )
194 ["--libidentify"]
195 ( "report name and version according to libidentify standard" )
196 | Opt( setWaitForKeypress, "start|exit|both" )
197 ["--wait-for-keypress"]
198 ( "waits for a keypress before exiting" )
199 | Opt( config.benchmarkResolutionMultiple, "multiplier" )
200 ["--benchmark-resolution-multiple"]
201 ( "multiple of clock resolution to run benchmarks" )
202
203 | Arg( config.testsOrTags, "test name|pattern|tags" )
204 ( "which test or tests to use" );
205
206 return cli;
207 }
static auto runtimeError(std::string const &message) -> BasicResult
Definition clara.hpp:595
std::string toLower(std::string const &s)
auto convertInto(std::string const &source, T &target) -> ParserResult
Definition clara.hpp:655
fc::string trim(const fc::string &)
Definition string.cpp:152
void cli()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeMatchExpr()

template<typename ArgT , typename MatcherT >
auto Catch::makeMatchExpr ( ArgT const & arg,
MatcherT const & matcher,
StringRef const & matcherString ) -> MatchExpr<ArgT, MatcherT>

Definition at line 49 of file catch_capture_matchers.h.

49 {
50 return MatchExpr<ArgT, MatcherT>( arg, matcher, matcherString );
51 }

◆ makeStream()

auto Catch::makeStream ( StringRef const & filename) -> IStream const *

Definition at line 125 of file catch_stream.cpp.

125 {
126 if( filename.empty() )
127 return new detail::CoutStream();
128 else if( filename[0] == '%' ) {
129 if( filename == "%debug" )
130 return new detail::DebugOutStream();
131 else
132 CATCH_ERROR( "Unrecognised stream: '" << filename << "'" );
133 }
134 else
135 return new detail::FileStream( filename );
136 }
#define CATCH_ERROR(msg)

◆ makeTestCase()

TestCase Catch::makeTestCase ( ITestInvoker * _testCase,
std::string const & _className,
NameAndTags const & nameAndTags,
SourceLineInfo const & _lineInfo )

Definition at line 51 of file catch_test_case_info.cpp.

55 {
56 bool isHidden = false;
57
58 // Parse out tags
59 std::vector<std::string> tags;
60 std::string desc, tag;
61 bool inTag = false;
62 std::string _descOrTags = nameAndTags.tags;
63 for (char c : _descOrTags) {
64 if( !inTag ) {
65 if( c == '[' )
66 inTag = true;
67 else
68 desc += c;
69 }
70 else {
71 if( c == ']' ) {
72 TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag );
73 if( ( prop & TestCaseInfo::IsHidden ) != 0 )
74 isHidden = true;
75 else if( prop == TestCaseInfo::None )
76 enforceNotReservedTag( tag, _lineInfo );
77
78 // Merged hide tags like `[.approvals]` should be added as
79 // `[.][approvals]`. The `[.]` is added at later point, so
80 // we only strip the prefix
81 if (startsWith(tag, '.') && tag.size() > 1) {
82 tag.erase(0, 1);
83 }
84 tags.push_back( tag );
85 tag.clear();
86 inTag = false;
87 }
88 else
89 tag += c;
90 }
91 }
92 if( isHidden ) {
93 tags.push_back( "." );
94 }
95
96 TestCaseInfo info( nameAndTags.name, _className, desc, tags, _lineInfo );
97 return TestCase( _testCase, std::move(info) );
98 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeTestInvoker() [1/2]

auto Catch::makeTestInvoker ( void(* testAsFunction )()) -> ITestInvoker *
noexcept

Definition at line 15 of file catch_test_registry.cpp.

15 {
16 return new(std::nothrow) TestInvokerAsFunction( testAsFunction );
17 }

◆ makeTestInvoker() [2/2]

template<typename C >
auto Catch::makeTestInvoker ( void(C::* testAsMethod )()) -> ITestInvoker*
noexcept

Definition at line 36 of file catch_test_registry.h.

36 {
37 return new(std::nothrow) TestInvokerAsMethod<C>( testAsMethod );
38}

◆ matchTest()

bool Catch::matchTest ( TestCase const & testCase,
TestSpec const & testSpec,
IConfig const & config )

Definition at line 39 of file catch_test_case_registry_impl.cpp.

39 {
40 return testSpec.matches( testCase ) && ( config.allowThrows() || !testCase.throws() );
41 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator""_sr()

auto Catch::operator""_sr ( char const * rawChars,
std::size_t size ) -> StringRef
inlinenoexcept

Definition at line 122 of file catch_stringref.h.

122 {
123 return StringRef( rawChars, size );
124 }
GenericStringRef< CharType > StringRef(const CharType *str)
Mark a character pointer as constant string.
Definition document.h:364
Here is the call graph for this function:

◆ operator+() [1/4]

auto Catch::operator+ ( char const * lhs,
StringRef const & rhs ) -> std::string

Definition at line 110 of file catch_stringref.cpp.

110 {
111 return std::string( lhs ) + std::string( rhs );
112 }

◆ operator+() [2/4]

auto Catch::operator+ ( StringRef const & lhs,
const char * rhs ) -> std::string

Definition at line 107 of file catch_stringref.cpp.

107 {
108 return std::string( lhs ) + std::string( rhs );
109 }

◆ operator+() [3/4]

auto Catch::operator+ ( StringRef const & lhs,
StringRef const & rhs ) -> std::string

Definition at line 100 of file catch_stringref.cpp.

100 {
101 std::string str;
102 str.reserve( lhs.size() + rhs.size() );
103 str += lhs;
104 str += rhs;
105 return str;
106 }

◆ operator+() [4/4]

template<typename T >
T const & Catch::operator+ ( T const & value,
StreamEndStop  )

Definition at line 83 of file catch_common.h.

83 {
84 return value;
85 }

◆ operator+=()

auto Catch::operator+= ( std::string & lhs,
StringRef const & rhs ) -> std::string &

Definition at line 118 of file catch_stringref.cpp.

118 {
119 lhs.append(rhs.currentData(), rhs.size());
120 return lhs;
121 }

◆ operator<<() [1/7]

std::ostream & Catch::operator<< ( std::ostream & os,
Colour const &  )

Definition at line 228 of file catch_console_colour.cpp.

228 {
229 return os;
230 }

◆ operator<<() [2/7]

auto Catch::operator<< ( std::ostream & os,
LazyExpression const & lazyExpr ) -> std::ostream&

Definition at line 38 of file catch_assertionhandler.cpp.

38 {
39 if( lazyExpr.m_isNegated )
40 os << "!";
41
42 if( lazyExpr ) {
43 if( lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression() )
44 os << "(" << *lazyExpr.m_transientExpression << ")";
45 else
46 os << *lazyExpr.m_transientExpression;
47 }
48 else {
49 os << "{** error - unchecked empty expression requested **}";
50 }
51 return os;
52 }

◆ operator<<() [3/7]

std::ostream & Catch::operator<< ( std::ostream & os,
pluralise const & pluraliser )

Definition at line 90 of file catch_string_manip.cpp.

90 {
91 os << pluraliser.m_count << ' ' << pluraliser.m_label;
92 if( pluraliser.m_count != 1 )
93 os << 's';
94 return os;
95 }

◆ operator<<() [4/7]

std::ostream & Catch::operator<< ( std::ostream & os,
SourceLineInfo const & info )

Definition at line 30 of file catch_common.cpp.

30 {
31#ifndef __GNUG__
32 os << info.file << '(' << info.line << ')';
33#else
34 os << info.file << ':' << info.line;
35#endif
36 return os;
37 }

◆ operator<<() [5/7]

auto Catch::operator<< ( std::ostream & os,
StringRef const & str ) -> std::ostream &

Definition at line 114 of file catch_stringref.cpp.

114 {
115 return os.write(str.currentData(), str.size());
116 }

◆ operator<<() [6/7]

std::ostream & Catch::operator<< ( std::ostream & os,
Version const & version )

Definition at line 27 of file catch_version.cpp.

27 {
28 os << version.majorVersion << '.'
29 << version.minorVersion << '.'
30 << version.patchNumber;
31 // branchName is never null -> 0th char is \0 if it is empty
32 if (version.branchName[0]) {
33 os << '-' << version.branchName
34 << '.' << version.buildNumber;
35 }
36 return os;
37 }

◆ operator<<() [7/7]

std::ostream & Catch::operator<< ( std::ostream & os,
XmlEncode const & xmlEncode )

Definition at line 155 of file catch_xmlwriter.cpp.

155 {
156 xmlEncode.encodeTo( os );
157 return os;
158 }

◆ operator|()

Definition at line 20 of file catch_result_type.cpp.

20 {
21 return static_cast<ResultDisposition::Flags>( static_cast<int>( lhs ) | static_cast<int>( rhs ) );
22 }

◆ parseTestSpec()

TestSpec Catch::parseTestSpec ( std::string const & arg)

Definition at line 83 of file catch_test_spec_parser.cpp.

83 {
84 return TestSpecParser( ITagAliasRegistry::get() ).parse( arg ).testSpec();
85 }
TestSpecParser & parse(std::string const &arg)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prepareExpandedExpression()

void Catch::prepareExpandedExpression ( AssertionResult & result)

Definition at line 20 of file catch_reporter_bases.cpp.

20 {
21 result.getExpandedExpression();
22 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rangeToString() [1/2]

template<typename Range >
std::string Catch::rangeToString ( Range const & range)

Definition at line 487 of file catch_tostring.h.

487 {
488 return ::Catch::Detail::rangeToString( begin( range ), end( range ) );
489 }
Here is the caller graph for this function:

◆ rangeToString() [2/2]

template<typename Allocator >
std::string Catch::rangeToString ( std::vector< bool, Allocator > const & v)

Definition at line 493 of file catch_tostring.h.

493 {
495 rss << "{ ";
496 bool first = true;
497 for( bool b : v ) {
498 if( first )
499 first = false;
500 else
501 rss << ", ";
502 rss << ::Catch::Detail::stringify( b );
503 }
504 rss << " }";
505 return rss.str();
506 }
auto str() const -> std::string
Here is the call graph for this function:

◆ registerTestMethods()

std::size_t Catch::registerTestMethods ( )
inline

Definition at line 75 of file catch_objc.hpp.

75 {
76 std::size_t noTestMethods = 0;
77 int noClasses = objc_getClassList( nullptr, 0 );
78
79 Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses);
80 objc_getClassList( classes, noClasses );
81
82 for( int c = 0; c < noClasses; c++ ) {
83 Class cls = classes[c];
84 {
85 u_int count;
86 Method* methods = class_copyMethodList( cls, &count );
87 for( u_int m = 0; m < count ; m++ ) {
88 SEL selector = method_getName(methods[m]);
89 std::string methodName = sel_getName(selector);
90 if( startsWith( methodName, "Catch_TestCase_" ) ) {
91 std::string testCaseName = methodName.substr( 15 );
92 std::string name = Detail::getAnnotation( cls, "Name", testCaseName );
93 std::string desc = Detail::getAnnotation( cls, "Description", testCaseName );
94 const char* className = class_getName( cls );
95
96 getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, NameAndTags( name.c_str(), desc.c_str() ), SourceLineInfo("",0) ) );
97 noTestMethods++;
98 }
99 }
100 free(methods);
101 }
102 }
103 return noTestMethods;
104 }
#define CATCH_UNSAFE_UNRETAINED
std::string name
#define Method
int * count
TestCase makeTestCase(ITestInvoker *_testCase, std::string const &_className, NameAndTags const &nameAndTags, SourceLineInfo const &_lineInfo)
IMutableRegistryHub & getMutableRegistryHub()
virtual void registerTest(TestCase const &testInfo)=0
Here is the call graph for this function:

◆ replaceInPlace()

bool Catch::replaceInPlace ( std::string & str,
std::string const & replaceThis,
std::string const & withThis )

Definition at line 56 of file catch_string_manip.cpp.

56 {
57 bool replaced = false;
58 std::size_t i = str.find( replaceThis );
59 while( i != std::string::npos ) {
60 replaced = true;
61 str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() );
62 if( i < str.size()-withThis.size() )
63 i = str.find( replaceThis, i+withThis.size() );
64 else
65 i = std::string::npos;
66 }
67 return replaced;
68 }
Here is the caller graph for this function:

◆ rng()

std::mt19937 & Catch::rng ( )

Definition at line 14 of file catch_random_number_generator.cpp.

14 {
15 static std::mt19937 s_rng;
16 return s_rng;
17 }
Here is the caller graph for this function:

◆ rngSeed()

unsigned int Catch::rngSeed ( )

Definition at line 26 of file catch_random_number_generator.cpp.

26 {
27 return getCurrentContext().getConfig()->rngSeed();
28 }
virtual IConfigPtr const & getConfig() const =0
Here is the call graph for this function:
Here is the caller graph for this function:

◆ seedRng()

void Catch::seedRng ( IConfig const & config)

Definition at line 19 of file catch_random_number_generator.cpp.

19 {
20 if( config.rngSeed() != 0 ) {
21 std::srand( config.rngSeed() );
22 rng().seed( config.rngSeed() );
23 }
24 }
std::mt19937 & rng()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ serializeFilters()

std::string Catch::serializeFilters ( std::vector< std::string > const & container)

Definition at line 44 of file catch_reporter_bases.cpp.

44 {
46 bool first = true;
47 for (auto&& filter : container)
48 {
49 if (!first)
50 oss << ' ';
51 else
52 first = false;
53
54 oss << filter;
55 }
56 return oss.str();
57 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTags()

void Catch::setTags ( TestCaseInfo & testCaseInfo,
std::vector< std::string > tags )

Definition at line 100 of file catch_test_case_info.cpp.

100 {
101 std::sort(begin(tags), end(tags));
102 tags.erase(std::unique(begin(tags), end(tags)), end(tags));
103 testCaseInfo.lcaseTags.clear();
104
105 for( auto const& tag : tags ) {
106 std::string lcaseTag = toLower( tag );
107 testCaseInfo.properties = static_cast<TestCaseInfo::SpecialProperties>( testCaseInfo.properties | parseSpecialTag( lcaseTag ) );
108 testCaseInfo.lcaseTags.push_back( lcaseTag );
109 }
110 testCaseInfo.tags = std::move(tags);
111 }
std::vector< std::string > lcaseTags
std::vector< std::string > tags
SpecialProperties properties
Here is the caller graph for this function:

◆ shouldContinueOnFailure()

bool Catch::shouldContinueOnFailure ( int flags)

Definition at line 24 of file catch_result_type.cpp.

24{ return ( flags & ResultDisposition::ContinueOnFailure ) != 0; }

◆ shouldSuppressFailure()

bool Catch::shouldSuppressFailure ( int flags)

Definition at line 25 of file catch_result_type.cpp.

25{ return ( flags & ResultDisposition::SuppressFail ) != 0; }
Here is the caller graph for this function:

◆ sortTests()

std::vector< TestCase > Catch::sortTests ( IConfig const & config,
std::vector< TestCase > const & unsortedTestCases )

Definition at line 21 of file catch_test_case_registry_impl.cpp.

21 {
22
23 std::vector<TestCase> sorted = unsortedTestCases;
24
25 switch( config.runOrder() ) {
26 case RunTests::InLexicographicalOrder:
27 std::sort( sorted.begin(), sorted.end() );
28 break;
29 case RunTests::InRandomOrder:
30 seedRng( config );
31 std::shuffle( sorted.begin(), sorted.end(), rng() );
32 break;
33 case RunTests::InDeclarationOrder:
34 // already in declaration order
35 break;
36 }
37 return sorted;
38 }
void seedRng(IConfig const &config)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ splitStringRef()

std::vector< StringRef > Catch::splitStringRef ( StringRef str,
char delimiter )

Definition at line 70 of file catch_string_manip.cpp.

70 {
71 std::vector<StringRef> subStrings;
72 std::size_t start = 0;
73 for(std::size_t pos = 0; pos < str.size(); ++pos ) {
74 if( str[pos] == delimiter ) {
75 if( pos - start > 1 )
76 subStrings.push_back( str.substr( start, pos-start ) );
77 start = pos+1;
78 }
79 }
80 if( start < str.size() )
81 subStrings.push_back( str.substr( start, str.size()-start ) );
82 return subStrings;
83 }
Here is the caller graph for this function:

◆ startsWith() [1/2]

bool Catch::startsWith ( std::string const & s,
char prefix )

Definition at line 28 of file catch_string_manip.cpp.

28 {
29 return !s.empty() && s[0] == prefix;
30 }

◆ startsWith() [2/2]

bool Catch::startsWith ( std::string const & s,
std::string const & prefix )

Definition at line 25 of file catch_string_manip.cpp.

25 {
26 return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin());
27 }
Here is the caller graph for this function:

◆ throw_exception()

void Catch::throw_exception ( std::exception const & e)

Definition at line 13 of file catch_enforce.cpp.

13 {
14 Catch::cerr() << "Catch will terminate because it needed to throw an exception.\n"
15 << "The message was: " << e.what() << '\n';
16 std::terminate();
17 }
std::ostream & cerr()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_string()

template<typename T >
std::string Catch::to_string ( T const & t)

Definition at line 17 of file catch_to_string.hpp.

17 {
18#if defined(CATCH_CONFIG_CPP11_TO_STRING)
19 return std::to_string(t);
20#else
22 rss << t;
23 return rss.str();
24#endif
25 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toLower()

std::string Catch::toLower ( std::string const & s)

Definition at line 43 of file catch_string_manip.cpp.

43 {
44 std::string lc = s;
45 toLowerInPlace( lc );
46 return lc;
47 }
void toLowerInPlace(std::string &s)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toLowerInPlace()

void Catch::toLowerInPlace ( std::string & s)

Definition at line 40 of file catch_string_manip.cpp.

40 {
41 std::transform( s.begin(), s.end(), s.begin(), toLowerCh );
42 }
Here is the caller graph for this function:

◆ translateActiveException()

std::string Catch::translateActiveException ( )

Definition at line 90 of file catch_registry_hub.cpp.

90 {
92 }
virtual std::string translateActiveException() const =0
virtual IExceptionTranslatorRegistry const & getExceptionTranslatorRegistry() const =0
Here is the call graph for this function:
Here is the caller graph for this function:

◆ trim()

std::string Catch::trim ( std::string const & str)

Definition at line 48 of file catch_string_manip.cpp.

48 {
49 static char const* whitespaceChars = "\n\r\t ";
50 std::string::size_type start = str.find_first_not_of( whitespaceChars );
51 std::string::size_type end = str.find_last_not_of( whitespaceChars );
52
53 return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string();
54 }
Here is the caller graph for this function:

◆ uncaught_exceptions()

bool Catch::uncaught_exceptions ( )

Definition at line 14 of file catch_uncaught_exceptions.cpp.

14 {
15#if defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
16 return std::uncaught_exceptions() > 0;
17#else
18 return std::uncaught_exception();
19#endif
20 }
Here is the caller graph for this function:

◆ writeToDebugConsole()

void Catch::writeToDebugConsole ( std::string const & text)

Definition at line 25 of file catch_debug_console.cpp.

25 {
26 // !TBD: Need a version for Mac/ XCode and other IDEs
27 Catch::cout() << text;
28 }
Here is the call graph for this function:

Variable Documentation

◆ begin

not_this_one Catch::begin ( ...)

◆ end

not_this_one Catch::end ( ...)

◆ leakDetector

LeakDetector Catch::leakDetector

Definition at line 26 of file catch_impl.hpp.