Changed relative #includes and made SourceLineInfo sortable (added < op)

This commit is contained in:
Phil Nash 2015-03-04 07:08:53 +00:00
parent 7f5615272b
commit 5eb7748a55
7 changed files with 9 additions and 5 deletions

View File

@ -15,7 +15,7 @@
#include "catch_common.h" #include "catch_common.h"
#include "catch_tostring.h" #include "catch_tostring.h"
#include "catch_interfaces_runner.h" #include "catch_interfaces_runner.h"
#include "internal/catch_compiler_capabilities.h" #include "catch_compiler_capabilities.h"
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -94,6 +94,7 @@ namespace Catch {
# endif # endif
bool empty() const; bool empty() const;
bool operator == ( SourceLineInfo const& other ) const; bool operator == ( SourceLineInfo const& other ) const;
bool operator < ( SourceLineInfo const& other ) const;
std::string file; std::string file;
std::size_t line; std::size_t line;

View File

@ -78,6 +78,9 @@ namespace Catch {
bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const { bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const {
return line == other.line && file == other.file; return line == other.line && file == other.file;
} }
bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const {
return line < other.line || ( line == other.line && file < other.file );
}
std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) { std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
#ifndef __GNUG__ #ifndef __GNUG__

View File

@ -60,7 +60,7 @@ namespace Catch {
std::string testName = getResultCapture()->getCurrentTestName(); std::string testName = getResultCapture()->getCurrentTestName();
std::map<std::string, IGeneratorsForTest*>::const_iterator it = std::map<std::string, IGeneratorsForTest*>::const_iterator it =
m_generatorsByTestName.find( testName ); m_generatorsByTestName.find( testName );
return it != m_generatorsByTestName.end() return it != m_generatorsByTestName.end()
? it->second ? it->second
: NULL; : NULL;

View File

@ -16,7 +16,7 @@
#pragma clang diagnostic ignored "-Wweak-vtables" #pragma clang diagnostic ignored "-Wweak-vtables"
#endif #endif
#include "catch_runner.hpp" #include "../catch_runner.hpp"
#include "catch_registry_hub.hpp" #include "catch_registry_hub.hpp"
#include "catch_notimplemented_exception.hpp" #include "catch_notimplemented_exception.hpp"
#include "catch_context_impl.hpp" #include "catch_context_impl.hpp"

View File

@ -17,7 +17,7 @@
// NB. Any general catch headers included here must be included // NB. Any general catch headers included here must be included
// in catch.hpp first to make sure they are included by the single // in catch.hpp first to make sure they are included by the single
// header for non obj-usage // header for non obj-usage
#include "internal/catch_test_case_info.h" #include "catch_test_case_info.h"
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// This protocol is really only here for (self) documenting purposes, since // This protocol is really only here for (self) documenting purposes, since

View File

@ -10,7 +10,7 @@
#include "catch_common.h" #include "catch_common.h"
#include "catch_interfaces_testcase.h" #include "catch_interfaces_testcase.h"
#include "internal/catch_compiler_capabilities.h" #include "catch_compiler_capabilities.h"
namespace Catch { namespace Catch {