Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
catch_common.h
Go to the documentation of this file.
1/*
2 * Created by Phil on 29/10/2010.
3 * Copyright 2010 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#ifndef TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
9#define TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
10
12
13#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line
14#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )
15#ifdef CATCH_CONFIG_COUNTER
16# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )
17#else
18# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
19#endif
20
21#include <iosfwd>
22#include <string>
23#include <cstdint>
24
25// We need a dummy global operator<< so we can bring it into Catch namespace later
27std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy);
28
29namespace Catch {
30
31 struct CaseSensitive { enum Choice {
33 No
34 }; };
35
36 class NonCopyable {
37 NonCopyable( NonCopyable const& ) = delete;
38 NonCopyable( NonCopyable && ) = delete;
39 NonCopyable& operator = ( NonCopyable const& ) = delete;
40 NonCopyable& operator = ( NonCopyable && ) = delete;
41
42 protected:
44 virtual ~NonCopyable();
45 };
46
47 struct SourceLineInfo {
48
49 SourceLineInfo() = delete;
50 SourceLineInfo( char const* _file, std::size_t _line ) noexcept
51 : file( _file ),
52 line( _line )
53 {}
54
55 SourceLineInfo( SourceLineInfo const& other ) = default;
57 SourceLineInfo( SourceLineInfo&& ) noexcept = default;
58 SourceLineInfo& operator = ( SourceLineInfo&& ) noexcept = default;
59
60 bool empty() const noexcept;
61 bool operator == ( SourceLineInfo const& other ) const noexcept;
62 bool operator < ( SourceLineInfo const& other ) const noexcept;
63
64 char const* file;
65 std::size_t line;
66 };
67
68 std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info );
69
70 // Bring in operator<< from global namespace into Catch namespace
71 // This is necessary because the overload of operator<< above makes
72 // lookup stop at namespace Catch
73 using ::operator<<;
74
75 // Use this in variadic streaming macros to allow
76 // >> +StreamEndStop
77 // as well as
78 // >> stuff +StreamEndStop
79 struct StreamEndStop {
80 std::string operator+() const;
81 };
82 template<typename T>
83 T const& operator + ( T const& value, StreamEndStop ) {
84 return value;
85 }
86}
87
88#define CATCH_INTERNAL_LINEINFO \
89 ::Catch::SourceLineInfo( __FILE__, static_cast<std::size_t>( __LINE__ ) )
90
91#endif // TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
92
std::ostream & operator<<(std::ostream &, Catch_global_namespace_dummy)
virtual ~NonCopyable()
os_t os
T const & operator+(T const &value, StreamEndStop)
Definition name.hpp:106
#define value
Definition pkcs11.h:157
#define T(meth, val, expected)
bool empty() const noexcept
SourceLineInfo(char const *_file, std::size_t _line) noexcept
SourceLineInfo(SourceLineInfo &&) noexcept=default
SourceLineInfo(SourceLineInfo const &other)=default
SourceLineInfo & operator=(SourceLineInfo const &)=default