Horizon
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
catch_amalgamated.cpp File Reference

This is a special TU that combines what would otherwise be a very small benchmarking-related TUs into one bigger TU. More...

#include "catch_amalgamated.hpp"
#include <cassert>
#include <cstddef>
#include <iterator>
#include <random>
#include <exception>
#include <cmath>
#include <limits>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <set>
#include <cctype>
#include <string>
#include <vector>
#include <chrono>
#include <ostream>
#include <cerrno>
#include <fstream>
#include <utility>
#include <stdexcept>
#include <signal.h>
#include <cstring>
#include <cstdio>
#include <sstream>
#include <ctime>
#include <iostream>
#include <cstdint>
#include <type_traits>
#include <cstdlib>
#include <regex>
#include <cfloat>
#include <map>

Classes

struct  Catch::Benchmark::Detail::optimized_away_error
 
struct  Catch::SignalDefs
 
struct  Catch::StringStreams
 
struct  Catch::Generators::GeneratorTracker
 

Typedefs

using Catch::RegistryHubSingleton = Singleton< RegistryHub, IRegistryHub, IMutableRegistryHub >
 

Enumerations

enum class  FloatingPointKind : uint8_t { Float , Double }
 

Functions

bool Catch::Benchmark::Detail::directCompare (double lhs, double rhs)
 
double Catch::Benchmark::Detail::weighted_average_quantile (int k, int q, std::vector< double >::iterator first, std::vector< double >::iterator last)
 
double Catch::Benchmark::Detail::erfc_inv (double x)
 
double Catch::Benchmark::Detail::normal_quantile (double p)
 
double Catch::Benchmark::Detail::outlier_variance (Estimate< double > mean, Estimate< double > stddev, int n)
 
bootstrap_analysis Catch::Benchmark::Detail::analyse_samples (double confidence_level, unsigned int n_resamples, std::vector< double >::iterator first, std::vector< double >::iterator last)
 
void Catch::Benchmark::Detail::throw_optimized_away_error ()
 
Approx Catch::literals::operator""_a (long double val)
 
Approx Catch::literals::operator""_a (unsigned long long val)
 
bool Catch::operator== (ProcessedReporterSpec const &lhs, ProcessedReporterSpec const &rhs)
 
IRegistryHub const & Catch::getRegistryHub ()
 
IMutableRegistryHubCatch::getMutableRegistryHub ()
 
void Catch::cleanUp ()
 
std::string Catch::translateActiveException ()
 
std::ostream & Catch::operator<< (std::ostream &os, Version const &version)
 
Version const & Catch::libraryVersion ()
 
void Catch::Generators::Detail::throw_generator_exception (char const *msg)
 Throws GeneratorException with the provided message.
 
auto Catch::Generators::acquireGeneratorTracker (StringRef generatorName, SourceLineInfo const &lineInfo) -> IGeneratorTracker &
 
void Catch::handleExceptionMatchExpr (AssertionHandler &handler, std::string const &str, StringRef matcherString)
 
ParserResult Catch::Clara::Detail::convertInto (std::string const &source, std::string &target)
 
ParserResult Catch::Clara::Detail::convertInto (std::string const &source, bool &target)
 
bool Catch::isnan (float f)
 
bool Catch::isnan (double d)
 
bool Catch::uncaught_exceptions ()
 
void Catch::formatReconstructedExpression (std::ostream &os, std::string const &lhs, StringRef op, std::string const &rhs)
 
auto Catch::operator<< (std::ostream &os, LazyExpression const &lazyExpr) -> std::ostream &
 
Clara::Parser Catch::makeCommandLineParser (ConfigData &config)
 
uint32_t Catch::Detail::convertToBits (float f)
 
uint64_t Catch::Detail::convertToBits (double d)
 
auto Catch::makeStream (std::string const &filename) -> Detail::unique_ptr< IStream >
 Creates a stream wrapper that writes to specific file.
 
bool Catch::list (IEventListener &reporter, Config const &config)
 
int main (int argc, char *argv[])
 
bool Catch::operator== (SimplePcg32 const &lhs, SimplePcg32 const &rhs)
 
bool Catch::operator!= (SimplePcg32 const &lhs, SimplePcg32 const &rhs)
 
std::uint32_t Catch::generateRandomSeed (GenerateFrom from)
 
std::vector< std::string > Catch::Detail::splitReporterSpec (StringRef reporterSpec)
 Splits the reporter spec into reporter name and kv-pair options.
 
Optional< ColourModeCatch::Detail::stringToColourMode (StringRef colourMode)
 
bool Catch::operator== (ReporterSpec const &lhs, ReporterSpec const &rhs)
 
Optional< ReporterSpec > Catch::parseReporterSpec (StringRef reporterSpec)
 Parses provided reporter spec string into.
 
bool Catch::isOk (ResultWas::OfType resultType)
 
bool Catch::isJustInfo (int flags)
 
ResultDisposition::Flags Catch::operator| (ResultDisposition::Flags lhs, ResultDisposition::Flags rhs)
 
bool Catch::shouldContinueOnFailure (int flags)
 
bool Catch::shouldSuppressFailure (int flags)
 
IResultCaptureCatch::getResultCapture ()
 
void Catch::seedRng (IConfig const &config)
 
unsigned int Catch::rngSeed ()
 
void Catch::addSingleton (ISingleton *singleton)
 
void Catch::cleanupSingletons ()
 
std::ostream & Catch::operator<< (std::ostream &os, SourceLineInfo const &info)
 
std::ostream & Catch::cout ()
 
std::ostream & Catch::cerr ()
 
std::ostream & Catch::clog ()
 
bool Catch::startsWith (std::string const &s, std::string const &prefix)
 
bool Catch::startsWith (StringRef s, char prefix)
 
bool Catch::endsWith (std::string const &s, std::string const &suffix)
 
bool Catch::endsWith (std::string const &s, char suffix)
 
bool Catch::contains (std::string const &s, std::string const &infix)
 
void Catch::toLowerInPlace (std::string &s)
 
std::string Catch::toLower (std::string const &s)
 
char Catch::toLower (char c)
 
std::string Catch::trim (std::string const &str)
 Returns a new string without whitespace at the start/end.
 
StringRef Catch::trim (StringRef ref)
 Returns a substring of the original ref without whitespace. Beware lifetimes!
 
bool Catch::replaceInPlace (std::string &str, std::string const &replaceThis, std::string const &withThis)
 
std::vector< StringRefCatch::splitStringRef (StringRef str, char delimiter)
 
std::ostream & Catch::operator<< (std::ostream &os, pluralise const &pluraliser)
 
auto Catch::operator<< (std::ostream &os, StringRef str) -> std::ostream &
 
std::string Catch::operator+ (StringRef lhs, StringRef rhs)
 
auto Catch::operator+= (std::string &lhs, StringRef rhs) -> std::string &
 
std::vector< TestCaseHandleCatch::sortTests (IConfig const &config, std::vector< TestCaseHandle > const &unsortedTestCases)
 
bool Catch::isThrowSafe (TestCaseHandle const &testCase, IConfig const &config)
 
bool Catch::matchTest (TestCaseHandle const &testCase, TestSpec const &testSpec, IConfig const &config)
 
void Catch::enforceNoDuplicateTestCases (std::vector< TestCaseHandle > const &tests)
 
std::vector< TestCaseHandleCatch::filterTests (std::vector< TestCaseHandle > const &testCases, TestSpec const &testSpec, IConfig const &config)
 
std::vector< TestCaseHandle > const & Catch::getAllTestCasesSorted (IConfig const &config)
 
Detail::unique_ptr< ITestInvoker > Catch::makeTestInvoker (void(*testAsFunction)())
 
TestSpec Catch::parseTestSpec (std::string const &arg)
 
std::ostream & Catch::TextFlow::operator<< (std::ostream &os, Column const &col)
 
Column Catch::TextFlow::Spacer (size_t spaceWidth)
 Creates a column that serves as an empty space of specific width.
 
std::ostream & Catch::TextFlow::operator<< (std::ostream &os, Columns const &cols)
 
XmlFormatting Catch::operator| (XmlFormatting lhs, XmlFormatting rhs)
 
XmlFormatting Catch::operator& (XmlFormatting lhs, XmlFormatting rhs)
 
std::ostream & Catch::operator<< (std::ostream &os, XmlEncode const &xmlEncode)
 
WithinUlpsMatcher Catch::Matchers::WithinULP (double target, uint64_t maxUlpDiff)
 Creates a matcher that accepts doubles within certain ULP range of target.
 
WithinUlpsMatcher Catch::Matchers::WithinULP (float target, uint64_t maxUlpDiff)
 Creates a matcher that accepts floats within certain ULP range of target.
 
WithinAbsMatcher Catch::Matchers::WithinAbs (double target, double margin)
 Creates a matcher that accepts numbers within certain range of target.
 
WithinRelMatcher Catch::Matchers::WithinRel (double target, double eps)
 Creates a matcher that accepts doubles within certain relative range of target.
 
WithinRelMatcher Catch::Matchers::WithinRel (double target)
 Creates a matcher that accepts doubles within 100*DBL_EPS relative range of target.
 
WithinRelMatcher Catch::Matchers::WithinRel (float target, float eps)
 Creates a matcher that accepts doubles within certain relative range of target.
 
WithinRelMatcher Catch::Matchers::WithinRel (float target)
 Creates a matcher that accepts floats within 100*FLT_EPS relative range of target.
 
StringEqualsMatcher Catch::Matchers::Equals (std::string const &str, CaseSensitive caseSensitivity=CaseSensitive::Yes)
 Creates matcher that accepts strings that are exactly equal to str
 
StringContainsMatcher Catch::Matchers::ContainsSubstring (std::string const &str, CaseSensitive caseSensitivity=CaseSensitive::Yes)
 Creates matcher that accepts strings that contain str
 
EndsWithMatcher Catch::Matchers::EndsWith (std::string const &str, CaseSensitive caseSensitivity=CaseSensitive::Yes)
 Creates matcher that accepts strings that end with str
 
StartsWithMatcher Catch::Matchers::StartsWith (std::string const &str, CaseSensitive caseSensitivity=CaseSensitive::Yes)
 Creates matcher that accepts strings that start with str
 
RegexMatcher Catch::Matchers::Matches (std::string const &regex, CaseSensitive caseSensitivity=CaseSensitive::Yes)
 Creates matcher that accepts strings matching regex
 
std::string Catch::Matchers::Detail::describe_multi_matcher (StringRef combine, std::string const *descriptions_begin, std::string const *descriptions_end)
 
void Catch::handleExceptionMatchExpr (AssertionHandler &handler, StringMatcher const &matcher, StringRef matcherString)
 
IsEmptyMatcher Catch::Matchers::IsEmpty ()
 Creates a matcher that accepts empty ranges/containers.
 
HasSizeMatcher Catch::Matchers::SizeIs (std::size_t sz)
 Creates a matcher that accepts ranges/containers with specific size.
 
ExceptionMessageMatcher Catch::Matchers::Message (std::string const &message)
 Creates a matcher that checks whether a std derived exception has the provided message.
 
std::string Catch::getFormattedDuration (double duration)
 
bool Catch::shouldShowDuration (IConfig const &config, double duration)
 Should the reporter show duration of test given current configuration?
 
std::string Catch::serializeFilters (std::vector< std::string > const &filters)
 
std::ostream & Catch::operator<< (std::ostream &out, lineOfChars value)
 
void Catch::defaultListReporters (std::ostream &out, std::vector< ReporterDescription > const &descriptions, Verbosity verbosity)
 Lists reporter descriptions to the provided stream in user-friendly format.
 
void Catch::defaultListListeners (std::ostream &out, std::vector< ListenerDescription > const &descriptions)
 Lists listeners descriptions to the provided stream in user-friendly format.
 
void Catch::defaultListTags (std::ostream &out, std::vector< TagInfo > const &tags, bool isFiltered)
 Lists tag information to the provided stream in user-friendly format.
 
void Catch::defaultListTests (std::ostream &out, ColourImpl *streamColour, std::vector< TestCaseHandle > const &tests, bool isFiltered, Verbosity verbosity)
 Lists test case information to the provided stream in user-friendly format.
 

Detailed Description

This is a special TU that combines what would otherwise be a very small benchmarking-related TUs into one bigger TU.

This is a special TU that combines what would otherwise be a very small reporter-related TUs into one bigger TU.

This is a special TU that combines what would otherwise be a very small matcher-related TUs into one bigger TU.

This file provides platform specific implementations of FatalConditionHandler.

This is a special TU that combines what would otherwise be a very small top-level TUs into one bigger TU.

This is a special TU that combines what would otherwise be a very small interfaces-related TUs into one bigger TU.

This is a special TU that combines what would otherwise be a very small generator-related TUs into one bigger TU.

The reason for this is compilation performance improvements by avoiding reparsing headers for many small TUs, instead having this one TU include bit more, but having it all parsed only once.

To avoid heavy-tail problem with compilation times, each "subpart" of Catch2 has its own combined TU like this.

This means that there is a lot of conditional compilation, and platform specific code. Currently, Catch2 supports a dummy handler (if no handler is desired), and 2 platform specific handlers:

Consequently, various pieces of code below are compiled if either of the platform specific handlers is enabled, or if none of them are enabled. It is assumed that both cannot be enabled at the same time, and doing so should cause a compilation error.

If another platform specific handler is added, the compile guards below will need to be updated taking these assumptions into account.

Function Documentation

◆ defaultListReporters()

void Catch::defaultListReporters ( std::ostream &  out,
std::vector< ReporterDescription > const &  descriptions,
Verbosity  verbosity 
)

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.

◆ defaultListTags()

void Catch::defaultListTags ( std::ostream &  out,
std::vector< TagInfo > const &  tags,
bool  isFiltered 
)

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.

◆ defaultListTests()

void Catch::defaultListTests ( std::ostream &  out,
ColourImpl *  streamColour,
std::vector< TestCaseHandle > const &  tests,
bool  isFiltered,
Verbosity  verbosity 
)

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.

◆ makeStream()

auto Catch::makeStream ( std::string const &  filename) -> Detail::unique_ptr< IStream >

Creates a stream wrapper that writes to specific file.

Also recognizes 4 special filenames

  • - for stdout
  • stdout for stdout
  • stderr for stderr
  • debug for platform specific debugging output
Exceptions
ifpassed an unrecognized %-prefixed stream

◆ parseReporterSpec()

Optional< ReporterSpec > Catch::parseReporterSpec ( StringRef  reporterSpec)

Parses provided reporter spec string into.

Returns empty optional on errors, e.g.

  • field that is not first and not a key+value pair
  • duplicated keys in kv pair
  • unknown catch reporter option
  • empty key/value in an custom kv pair
  • ...