mirror of
https://github.com/catchorg/Catch2.git
synced 2025-05-25 14:09:26 +00:00
Moar reformatting
This commit is contained in:
parent
d0be9ed5d9
commit
c67a7eef2b
8 changed files with 140 additions and 429 deletions
|
@ -1,15 +1,10 @@
|
|||
/*
|
||||
* catch_test_case_info.hpp
|
||||
* Catch
|
||||
*
|
||||
* Created by Phil on 29/10/2010.
|
||||
* Copyright 2010 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)
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TWOBLUECUBES_CATCH_TESTCASEINFO_HPP_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_TESTCASEINFO_HPP_INCLUDED
|
||||
|
||||
|
@ -17,147 +12,82 @@
|
|||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace Catch
|
||||
{
|
||||
class TestCaseInfo
|
||||
{
|
||||
namespace Catch {
|
||||
|
||||
class TestCaseInfo {
|
||||
public:
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
TestCaseInfo
|
||||
(
|
||||
ITestCase* testCase,
|
||||
const char* name,
|
||||
const char* description,
|
||||
const SourceLineInfo& lineInfo
|
||||
)
|
||||
TestCaseInfo( ITestCase* testCase,
|
||||
const char* name,
|
||||
const char* description,
|
||||
const SourceLineInfo& lineInfo )
|
||||
: m_test( testCase ),
|
||||
m_name( name ),
|
||||
m_description( description ),
|
||||
m_lineInfo( lineInfo )
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
TestCaseInfo
|
||||
()
|
||||
TestCaseInfo()
|
||||
: m_test( NULL ),
|
||||
m_name(),
|
||||
m_description()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
TestCaseInfo
|
||||
(
|
||||
const TestCaseInfo& other
|
||||
)
|
||||
TestCaseInfo( const TestCaseInfo& other )
|
||||
: m_test( other.m_test->clone() ),
|
||||
m_name( other.m_name ),
|
||||
m_description( other.m_description ),
|
||||
m_lineInfo( other.m_lineInfo )
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
TestCaseInfo
|
||||
(
|
||||
const TestCaseInfo& other,
|
||||
const std::string& name
|
||||
)
|
||||
TestCaseInfo( const TestCaseInfo& other, const std::string& name )
|
||||
: m_test( other.m_test->clone() ),
|
||||
m_name( name ),
|
||||
m_description( other.m_description ),
|
||||
m_lineInfo( other.m_lineInfo )
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
TestCaseInfo& operator =
|
||||
(
|
||||
const TestCaseInfo& other
|
||||
)
|
||||
{
|
||||
TestCaseInfo& operator = ( const TestCaseInfo& other ) {
|
||||
TestCaseInfo temp( other );
|
||||
swap( temp );
|
||||
return *this;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
~TestCaseInfo
|
||||
()
|
||||
{
|
||||
~TestCaseInfo() {
|
||||
delete m_test;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
void invoke
|
||||
()
|
||||
const
|
||||
{
|
||||
void invoke() const {
|
||||
m_test->invoke();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
const std::string& getName
|
||||
()
|
||||
const
|
||||
{
|
||||
const std::string& getName() const {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
const std::string& getDescription
|
||||
()
|
||||
const
|
||||
{
|
||||
const std::string& getDescription() const {
|
||||
return m_description;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
const SourceLineInfo& getLineInfo
|
||||
()
|
||||
const
|
||||
{
|
||||
const SourceLineInfo& getLineInfo() const {
|
||||
return m_lineInfo;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
bool isHidden
|
||||
()
|
||||
const
|
||||
{
|
||||
bool isHidden() const {
|
||||
return m_name.size() >= 2 && m_name[0] == '.' && m_name[1] == '/';
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
void swap
|
||||
(
|
||||
TestCaseInfo& other
|
||||
)
|
||||
{
|
||||
void swap( TestCaseInfo& other ) {
|
||||
std::swap( m_test, other.m_test );
|
||||
m_name.swap( other.m_name );
|
||||
m_description.swap( other.m_description );
|
||||
m_lineInfo.swap( other.m_lineInfo );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
bool operator ==
|
||||
(
|
||||
const TestCaseInfo& other
|
||||
)
|
||||
const
|
||||
{
|
||||
bool operator == ( const TestCaseInfo& other ) const {
|
||||
return *m_test == *other.m_test && m_name == other.m_name;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
bool operator <
|
||||
(
|
||||
const TestCaseInfo& other
|
||||
)
|
||||
const
|
||||
{
|
||||
bool operator < ( const TestCaseInfo& other ) const {
|
||||
return m_name < other.m_name;
|
||||
}
|
||||
|
||||
|
@ -168,34 +98,21 @@ namespace Catch
|
|||
SourceLineInfo m_lineInfo;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class TestSpec
|
||||
{
|
||||
class TestSpec {
|
||||
public:
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
TestSpec
|
||||
(
|
||||
const std::string& rawSpec
|
||||
)
|
||||
TestSpec( const std::string& rawSpec )
|
||||
: m_rawSpec( rawSpec ),
|
||||
m_isWildcarded( false )
|
||||
{
|
||||
if( m_rawSpec[m_rawSpec.size()-1] == '*' )
|
||||
{
|
||||
m_isWildcarded( false ) {
|
||||
|
||||
if( m_rawSpec[m_rawSpec.size()-1] == '*' ) {
|
||||
m_rawSpec = m_rawSpec.substr( 0, m_rawSpec.size()-1 );
|
||||
m_isWildcarded = true;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
bool matches
|
||||
(
|
||||
const std::string& testName
|
||||
)
|
||||
const
|
||||
{
|
||||
bool matches ( const std::string& testName ) const {
|
||||
if( !m_isWildcarded )
|
||||
return m_rawSpec == testName;
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue