2011-01-07 20:57:32 +01:00
|
|
|
/*
|
2012-08-14 20:30:30 +02:00
|
|
|
* Created by Phil on 14/08/2012.
|
|
|
|
* Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
|
2011-01-07 20:57:32 +01:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
2012-08-14 20:30:30 +02:00
|
|
|
#include "catch_test_case_info.h"
|
2011-01-07 20:57:32 +01:00
|
|
|
#include "catch_interfaces_testcase.h"
|
|
|
|
|
2012-05-16 00:58:23 +02:00
|
|
|
namespace Catch {
|
|
|
|
|
2012-08-14 20:30:30 +02:00
|
|
|
TestCaseInfo::TestCaseInfo( ITestCase* testCase,
|
|
|
|
const char* name,
|
|
|
|
const char* description,
|
|
|
|
const SourceLineInfo& lineInfo )
|
|
|
|
: m_test( testCase ),
|
|
|
|
m_name( name ),
|
|
|
|
m_description( description ),
|
|
|
|
m_lineInfo( lineInfo )
|
|
|
|
{}
|
2011-01-07 20:57:32 +01:00
|
|
|
|
2012-08-14 20:30:30 +02:00
|
|
|
TestCaseInfo::TestCaseInfo()
|
|
|
|
: m_test( NULL ),
|
|
|
|
m_name(),
|
|
|
|
m_description()
|
|
|
|
{}
|
2012-08-14 09:38:22 +02:00
|
|
|
|
2012-08-14 20:30:30 +02:00
|
|
|
TestCaseInfo::TestCaseInfo( const TestCaseInfo& other, const std::string& name )
|
|
|
|
: m_test( other.m_test ),
|
|
|
|
m_name( name ),
|
|
|
|
m_description( other.m_description ),
|
|
|
|
m_lineInfo( other.m_lineInfo )
|
|
|
|
{}
|
2011-01-07 20:57:32 +01:00
|
|
|
|
2012-08-14 20:30:30 +02:00
|
|
|
void TestCaseInfo::invoke() const {
|
|
|
|
m_test->invoke();
|
|
|
|
}
|
2011-01-14 09:47:43 +01:00
|
|
|
|
2012-08-14 20:30:30 +02:00
|
|
|
const std::string& TestCaseInfo::getName() const {
|
|
|
|
return m_name;
|
|
|
|
}
|
2011-04-21 09:59:42 +02:00
|
|
|
|
2012-08-14 20:30:30 +02:00
|
|
|
const std::string& TestCaseInfo::getDescription() const {
|
|
|
|
return m_description;
|
|
|
|
}
|
2011-01-07 20:57:32 +01:00
|
|
|
|
2012-08-14 20:30:30 +02:00
|
|
|
const SourceLineInfo& TestCaseInfo::getLineInfo() const {
|
|
|
|
return m_lineInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TestCaseInfo::isHidden() const {
|
|
|
|
return m_name.size() >= 2 && m_name[0] == '.' && m_name[1] == '/';
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestCaseInfo::swap( TestCaseInfo& other ) {
|
|
|
|
m_test.swap( other.m_test );
|
|
|
|
m_name.swap( other.m_name );
|
|
|
|
m_description.swap( other.m_description );
|
|
|
|
m_lineInfo.swap( other.m_lineInfo );
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TestCaseInfo::operator == ( const TestCaseInfo& other ) const {
|
|
|
|
return m_test.get() == other.m_test.get() && m_name == other.m_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TestCaseInfo::operator < ( const TestCaseInfo& other ) const {
|
|
|
|
return m_name < other.m_name;
|
|
|
|
}
|
2011-01-07 20:57:32 +01:00
|
|
|
}
|
|
|
|
|
2011-02-16 20:02:09 +01:00
|
|
|
#endif // TWOBLUECUBES_CATCH_TESTCASEINFO_HPP_INCLUDED
|