2013-12-03 19:52:41 +01:00
|
|
|
/*
|
|
|
|
* Created by Phil on 27/11/2013.
|
|
|
|
* Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
|
|
|
|
*
|
|
|
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "catch_common.h"
|
2017-07-06 22:28:42 +02:00
|
|
|
#include "catch_context.h"
|
|
|
|
#include "catch_interfaces_config.h"
|
2013-12-03 19:52:41 +01:00
|
|
|
|
2017-01-29 22:03:27 +01:00
|
|
|
#include <cstring>
|
2017-08-01 18:46:33 +02:00
|
|
|
#include <ostream>
|
2017-01-29 22:03:27 +01:00
|
|
|
|
2013-12-03 19:52:41 +01:00
|
|
|
namespace Catch {
|
|
|
|
|
2017-07-13 09:25:47 +02:00
|
|
|
bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept {
|
2017-01-29 22:03:27 +01:00
|
|
|
return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0);
|
2013-12-03 19:52:41 +01:00
|
|
|
}
|
2017-07-13 09:25:47 +02:00
|
|
|
bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept {
|
2018-07-23 20:46:36 +02:00
|
|
|
// We can assume that the same file will usually have the same pointer.
|
|
|
|
// Thus, if the pointers are the same, there is no point in calling the strcmp
|
|
|
|
return line < other.line || ( line == other.line && file != other.file && (std::strcmp(file, other.file) < 0));
|
2015-03-04 08:08:53 +01:00
|
|
|
}
|
2013-12-03 19:52:41 +01:00
|
|
|
|
|
|
|
std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
|
|
|
|
#ifndef __GNUG__
|
2017-01-15 09:41:33 +01:00
|
|
|
os << info.file << '(' << info.line << ')';
|
2013-12-03 19:52:41 +01:00
|
|
|
#else
|
2017-01-15 09:41:33 +01:00
|
|
|
os << info.file << ':' << info.line;
|
2013-12-03 19:52:41 +01:00
|
|
|
#endif
|
|
|
|
return os;
|
|
|
|
}
|
2017-07-12 16:16:55 +02:00
|
|
|
|
2017-07-25 21:57:35 +02:00
|
|
|
std::string StreamEndStop::operator+() const {
|
|
|
|
return std::string();
|
|
|
|
}
|
|
|
|
|
2019-10-30 18:51:14 +01:00
|
|
|
} // end namespace Catch
|