Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
catch_reporter_bases.cpp
Go to the documentation of this file.
1/*
2 * Created by Phil on 27/11/2013.
3 * Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
4 *
5 * Distributed under the Boost Software License, Version 1.0. (See accompanying
6 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 */
8
12
13#include <cstring>
14#include <cfloat>
15#include <cstdio>
16#include <cassert>
17#include <memory>
18
19namespace Catch {
23
24 // Because formatting using c++ streams is stateful, drop down to C is required
25 // Alternatively we could use stringstream, but its performance is... not good.
26 std::string getFormattedDuration( double duration ) {
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 }
43
44 std::string serializeFilters( std::vector<std::string> const& container ) {
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 }
58
61
65
67
69 return false;
70 }
71
72
73} // end namespace Catch
std::string getExpandedExpression() const
auto str() const -> std::string
void prepareExpandedExpression(AssertionResult &result)
std::string serializeFilters(std::vector< std::string > const &container)
std::string getFormattedDuration(double duration)
bool assertionEnded(AssertionStats const &) override
static std::set< Verbosity > getSupportedVerbosities()
void assertionStarting(AssertionInfo const &) override
TestEventListenerBase(ReporterConfig const &_config)