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 9 #include "catch_common.h" 10 #include "catch_context.h" 11 #include "catch_interfaces_config.h" 12 13 #include <cstring> 14 #include <ostream> 15 16 namespace Catch { 17 operator ==(SourceLineInfo const & other) const18 bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept { 19 return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0); 20 } operator <(SourceLineInfo const & other) const21 bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept { 22 // We can assume that the same file will usually have the same pointer. 23 // Thus, if the pointers are the same, there is no point in calling the strcmp 24 return line < other.line || ( line == other.line && file != other.file && (std::strcmp(file, other.file) < 0)); 25 } 26 operator <<(std::ostream & os,SourceLineInfo const & info)27 std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) { 28 #ifndef __GNUG__ 29 os << info.file << '(' << info.line << ')'; 30 #else 31 os << info.file << ':' << info.line; 32 #endif 33 return os; 34 } 35 operator +() const36 std::string StreamEndStop::operator+() const { 37 return std::string(); 38 } 39 40 NonCopyable::NonCopyable() = default; 41 NonCopyable::~NonCopyable() = default; 42 43 } 44