mirror of
https://github.com/catchorg/Catch2.git
synced 2025-06-01 01:18:02 +00:00
parent
503d5d0c8e
commit
f3d1f08c3b
62 changed files with 527 additions and 527 deletions
|
@ -30,7 +30,7 @@ namespace Catch {
|
|||
NonCopyable() {}
|
||||
virtual ~NonCopyable();
|
||||
};
|
||||
|
||||
|
||||
class SafeBool {
|
||||
public:
|
||||
typedef void (SafeBool::*type)() const;
|
||||
|
@ -41,7 +41,7 @@ namespace Catch {
|
|||
private:
|
||||
void trueValue() const {}
|
||||
};
|
||||
|
||||
|
||||
template<typename ContainerT>
|
||||
inline void deleteAll( ContainerT& container ) {
|
||||
typename ContainerT::const_iterator it = container.begin();
|
||||
|
@ -56,12 +56,12 @@ namespace Catch {
|
|||
for(; it != itEnd; ++it )
|
||||
delete it->second;
|
||||
}
|
||||
|
||||
|
||||
template<typename ContainerT, typename Function>
|
||||
inline void forEach( ContainerT& container, Function function ) {
|
||||
std::for_each( container.begin(), container.end(), function );
|
||||
}
|
||||
|
||||
|
||||
template<typename ContainerT, typename Function>
|
||||
inline void forEach( ContainerT const& container, Function function ) {
|
||||
std::for_each( container.begin(), container.end(), function );
|
||||
|
@ -103,7 +103,7 @@ namespace Catch {
|
|||
};
|
||||
|
||||
struct SourceLineInfo {
|
||||
|
||||
|
||||
SourceLineInfo() : line( 0 ){}
|
||||
SourceLineInfo( std::string const& _file, std::size_t _line )
|
||||
: file( _file ),
|
||||
|
@ -116,23 +116,23 @@ namespace Catch {
|
|||
bool empty() const {
|
||||
return file.empty();
|
||||
}
|
||||
|
||||
|
||||
std::string file;
|
||||
std::size_t line;
|
||||
std::size_t line;
|
||||
};
|
||||
|
||||
|
||||
inline std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
|
||||
#ifndef __GNUG__
|
||||
os << info.file << "(" << info.line << ")";
|
||||
#else
|
||||
#else
|
||||
os << info.file << ":" << info.line;
|
||||
#endif
|
||||
#endif
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// This is just here to avoid compiler warnings with macro constants and boolean literals
|
||||
inline bool isTrue( bool value ){ return value; }
|
||||
|
||||
|
||||
inline void throwLogicError( std::string const& message, SourceLineInfo const& locationInfo ) {
|
||||
std::ostringstream oss;
|
||||
oss << locationInfo << ": Internal Catch error: '" << message << "'";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue