mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-17 03:02:24 +01:00
merge from upstream
This commit is contained in:
commit
af18bcdab7
@ -1,6 +1,6 @@
|
|||||||
![catch logo](catch-logo-small.png)
|
![catch logo](catch-logo-small.png)
|
||||||
|
|
||||||
*v1.0 build 20 (master branch)*
|
*v1.0 build 23 (master branch)*
|
||||||
|
|
||||||
Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch)
|
Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch)
|
||||||
|
|
||||||
|
@ -144,9 +144,8 @@ namespace Catch {
|
|||||||
|
|
||||||
int applyCommandLine( int argc, char* const argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) {
|
int applyCommandLine( int argc, char* const argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) {
|
||||||
try {
|
try {
|
||||||
|
m_cli.setThrowOnUnrecognisedTokens( unusedOptionBehaviour == OnUnusedOptions::Fail );
|
||||||
m_unusedTokens = m_cli.parseInto( argc, argv, m_configData );
|
m_unusedTokens = m_cli.parseInto( argc, argv, m_configData );
|
||||||
if( unusedOptionBehaviour == OnUnusedOptions::Fail )
|
|
||||||
enforceNoUsedTokens();
|
|
||||||
if( m_configData.showHelp )
|
if( m_configData.showHelp )
|
||||||
showHelp( m_configData.processName );
|
showHelp( m_configData.processName );
|
||||||
m_config.reset();
|
m_config.reset();
|
||||||
@ -154,7 +153,7 @@ namespace Catch {
|
|||||||
catch( std::exception& ex ) {
|
catch( std::exception& ex ) {
|
||||||
{
|
{
|
||||||
Colour colourGuard( Colour::Red );
|
Colour colourGuard( Colour::Red );
|
||||||
std::cerr << "\nError in input:\n"
|
std::cerr << "\nError(s) in input:\n"
|
||||||
<< Text( ex.what(), TextAttributes().setIndent(2) )
|
<< Text( ex.what(), TextAttributes().setIndent(2) )
|
||||||
<< "\n\n";
|
<< "\n\n";
|
||||||
}
|
}
|
||||||
@ -169,18 +168,6 @@ namespace Catch {
|
|||||||
m_config.reset();
|
m_config.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void enforceNoUsedTokens() const {
|
|
||||||
if( !m_unusedTokens.empty() ) {
|
|
||||||
std::vector<Clara::Parser::Token>::const_iterator
|
|
||||||
it = m_unusedTokens.begin(),
|
|
||||||
itEnd = m_unusedTokens.end();
|
|
||||||
std::string msg;
|
|
||||||
for(; it != itEnd; ++it )
|
|
||||||
msg += " unrecognised option: " + it->data + "\n";
|
|
||||||
throw std::runtime_error( msg.substr( 0, msg.size()-1 ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int run( int argc, char* const argv[] ) {
|
int run( int argc, char* const argv[] ) {
|
||||||
|
|
||||||
int returnCode = applyCommandLine( argc, argv );
|
int returnCode = applyCommandLine( argc, argv );
|
||||||
|
@ -70,7 +70,7 @@ namespace Detail {
|
|||||||
|
|
||||||
std::string toString() const {
|
std::string toString() const {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Approx( " << m_value << " )";
|
oss << "Approx( " << Catch::toString( m_value ) << " )";
|
||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ namespace Catch {
|
|||||||
|
|
||||||
// These numbers are maintained by a script
|
// These numbers are maintained by a script
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const T LibraryVersionInfo<T>::value( 1, 0, 20, "master" );
|
const T LibraryVersionInfo<T>::value( 1, 0, 23, "master" );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED
|
||||||
|
@ -206,7 +206,8 @@ namespace Clara {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void parseIntoTokens( int argc, char const * const * argv, std::vector<Parser::Token>& tokens ) const {
|
void parseIntoTokens( int argc, char const * const * argv, std::vector<Parser::Token>& tokens ) const {
|
||||||
for( int i = 1; i < argc; ++i )
|
const std::string doubleDash = "--";
|
||||||
|
for( int i = 1; i < argc && argv[i] != doubleDash; ++i )
|
||||||
parseIntoTokens( argv[i] , tokens);
|
parseIntoTokens( argv[i] , tokens);
|
||||||
}
|
}
|
||||||
void parseIntoTokens( std::string arg, std::vector<Parser::Token>& tokens ) const {
|
void parseIntoTokens( std::string arg, std::vector<Parser::Token>& tokens ) const {
|
||||||
@ -371,18 +372,25 @@ namespace Clara {
|
|||||||
|
|
||||||
CommandLine()
|
CommandLine()
|
||||||
: m_boundProcessName( new Detail::NullBinder<ConfigT>() ),
|
: m_boundProcessName( new Detail::NullBinder<ConfigT>() ),
|
||||||
m_highestSpecifiedArgPosition( 0 )
|
m_highestSpecifiedArgPosition( 0 ),
|
||||||
|
m_throwOnUnrecognisedTokens( false )
|
||||||
{}
|
{}
|
||||||
CommandLine( CommandLine const& other )
|
CommandLine( CommandLine const& other )
|
||||||
: m_boundProcessName( other.m_boundProcessName ),
|
: m_boundProcessName( other.m_boundProcessName ),
|
||||||
m_options ( other.m_options ),
|
m_options ( other.m_options ),
|
||||||
m_positionalArgs( other.m_positionalArgs ),
|
m_positionalArgs( other.m_positionalArgs ),
|
||||||
m_highestSpecifiedArgPosition( other.m_highestSpecifiedArgPosition )
|
m_highestSpecifiedArgPosition( other.m_highestSpecifiedArgPosition ),
|
||||||
|
m_throwOnUnrecognisedTokens( other.m_throwOnUnrecognisedTokens )
|
||||||
{
|
{
|
||||||
if( other.m_arg.get() )
|
if( other.m_arg.get() )
|
||||||
m_arg = ArgAutoPtr( new Arg( *other.m_arg ) );
|
m_arg = ArgAutoPtr( new Arg( *other.m_arg ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CommandLine& setThrowOnUnrecognisedTokens( bool shouldThrow = true ) {
|
||||||
|
m_throwOnUnrecognisedTokens = shouldThrow;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
ArgBinder bind( F f ) {
|
ArgBinder bind( F f ) {
|
||||||
ArgBinder binder( this, f );
|
ArgBinder binder( this, f );
|
||||||
@ -488,6 +496,7 @@ namespace Clara {
|
|||||||
|
|
||||||
std::vector<Parser::Token> populateOptions( std::vector<Parser::Token> const& tokens, ConfigT& config ) const {
|
std::vector<Parser::Token> populateOptions( std::vector<Parser::Token> const& tokens, ConfigT& config ) const {
|
||||||
std::vector<Parser::Token> unusedTokens;
|
std::vector<Parser::Token> unusedTokens;
|
||||||
|
std::vector<std::string> errors;
|
||||||
for( std::size_t i = 0; i < tokens.size(); ++i ) {
|
for( std::size_t i = 0; i < tokens.size(); ++i ) {
|
||||||
Parser::Token const& token = tokens[i];
|
Parser::Token const& token = tokens[i];
|
||||||
typename std::vector<Arg>::const_iterator it = m_options.begin(), itEnd = m_options.end();
|
typename std::vector<Arg>::const_iterator it = m_options.begin(), itEnd = m_options.end();
|
||||||
@ -499,8 +508,9 @@ namespace Clara {
|
|||||||
( token.type == Parser::Token::LongOpt && arg.hasLongName( token.data ) ) ) {
|
( token.type == Parser::Token::LongOpt && arg.hasLongName( token.data ) ) ) {
|
||||||
if( arg.takesArg() ) {
|
if( arg.takesArg() ) {
|
||||||
if( i == tokens.size()-1 || tokens[i+1].type != Parser::Token::Positional )
|
if( i == tokens.size()-1 || tokens[i+1].type != Parser::Token::Positional )
|
||||||
throw std::domain_error( "Expected argument to option " + token.data );
|
errors.push_back( "Expected argument to option: " + token.data );
|
||||||
arg.boundField.set( config, tokens[++i].data );
|
else
|
||||||
|
arg.boundField.set( config, tokens[++i].data );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
arg.boundField.setFlag( config );
|
arg.boundField.setFlag( config );
|
||||||
@ -509,11 +519,26 @@ namespace Clara {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( std::exception& ex ) {
|
catch( std::exception& ex ) {
|
||||||
throw std::runtime_error( std::string( ex.what() ) + "\n- while parsing: (" + arg.commands() + ")" );
|
errors.push_back( std::string( ex.what() ) + "\n- while parsing: (" + arg.commands() + ")" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( it == itEnd )
|
if( it == itEnd ) {
|
||||||
unusedTokens.push_back( token );
|
if( token.type == Parser::Token::Positional || !m_throwOnUnrecognisedTokens )
|
||||||
|
unusedTokens.push_back( token );
|
||||||
|
else if( m_throwOnUnrecognisedTokens )
|
||||||
|
errors.push_back( "unrecognised option: " + token.data );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( !errors.empty() ) {
|
||||||
|
std::ostringstream oss;
|
||||||
|
for( std::vector<std::string>::const_iterator it = errors.begin(), itEnd = errors.end();
|
||||||
|
it != itEnd;
|
||||||
|
++it ) {
|
||||||
|
if( it != errors.begin() )
|
||||||
|
oss << "\n";
|
||||||
|
oss << *it;
|
||||||
|
}
|
||||||
|
throw std::runtime_error( oss.str() );
|
||||||
}
|
}
|
||||||
return unusedTokens;
|
return unusedTokens;
|
||||||
}
|
}
|
||||||
@ -552,6 +577,7 @@ namespace Clara {
|
|||||||
std::map<int, Arg> m_positionalArgs;
|
std::map<int, Arg> m_positionalArgs;
|
||||||
ArgAutoPtr m_arg;
|
ArgAutoPtr m_arg;
|
||||||
int m_highestSpecifiedArgPosition;
|
int m_highestSpecifiedArgPosition;
|
||||||
|
bool m_throwOnUnrecognisedTokens;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace Clara
|
} // end namespace Clara
|
||||||
|
@ -49,22 +49,22 @@ with expansion:
|
|||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.float_nine_point_one == Approx( 9.11f ) )
|
CHECK( data.float_nine_point_one == Approx( 9.11f ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
9.1 == Approx( 9.11 )
|
9.1 == Approx( 9.1099996567 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.float_nine_point_one == Approx( 9.0f ) )
|
CHECK( data.float_nine_point_one == Approx( 9.0f ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
9.1 == Approx( 9 )
|
9.1 == Approx( 9.0 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.float_nine_point_one == Approx( 1 ) )
|
CHECK( data.float_nine_point_one == Approx( 1 ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
9.1 == Approx( 1 )
|
9.1 == Approx( 1.0 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.float_nine_point_one == Approx( 0 ) )
|
CHECK( data.float_nine_point_one == Approx( 0 ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
9.1 == Approx( 0 )
|
9.1 == Approx( 0.0 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.double_pi == Approx( 3.1415 ) )
|
CHECK( data.double_pi == Approx( 3.1415 ) )
|
||||||
@ -110,12 +110,12 @@ with expansion:
|
|||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.float_nine_point_one != Approx( 9.1f ) )
|
CHECK( data.float_nine_point_one != Approx( 9.1f ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
9.1 != Approx( 9.1 )
|
9.1 != Approx( 9.1000003815 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.double_pi != Approx( 3.1415926535 ) )
|
CHECK( data.double_pi != Approx( 3.1415926535 ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
3.1415926535 != Approx( 3.14159 )
|
3.1415926535 != Approx( 3.1415926535 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.str_hello != "hello" )
|
CHECK( data.str_hello != "hello" )
|
||||||
@ -569,8 +569,8 @@ with expansion:
|
|||||||
with message:
|
with message:
|
||||||
Testing if fib[7] (21) is even
|
Testing if fib[7] (21) is even
|
||||||
|
|
||||||
Some information
|
A string sent directly to stdout
|
||||||
An error
|
A string sent directly to stderr
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
checkedIf, failing
|
checkedIf, failing
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
@ -73,13 +73,13 @@ ApproxTests.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( 1.23f == Approx( 1.23f ) )
|
REQUIRE( 1.23f == Approx( 1.23f ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
1.23 == Approx( 1.23 )
|
1.23 == Approx( 1.2300000191 )
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
ApproxTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( 0.0f == Approx( 0.0f ) )
|
REQUIRE( 0.0f == Approx( 0.0f ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
0 == Approx( 0 )
|
0 == Approx( 0.0 )
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Approximate comparisons with ints
|
Approximate comparisons with ints
|
||||||
@ -90,10 +90,14 @@ ApproxTests.cpp:<line number>
|
|||||||
ApproxTests.cpp:<line number>:
|
ApproxTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( 1 == Approx( 1 ) )
|
REQUIRE( 1 == Approx( 1 ) )
|
||||||
|
with expansion:
|
||||||
|
1 == Approx( 1.0 )
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
ApproxTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( 0 == Approx( 0 ) )
|
REQUIRE( 0 == Approx( 0 ) )
|
||||||
|
with expansion:
|
||||||
|
0 == Approx( 0.0 )
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Approximate comparisons with mixed numeric types
|
Approximate comparisons with mixed numeric types
|
||||||
@ -105,19 +109,19 @@ ApproxTests.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( 1.0f == Approx( 1 ) )
|
REQUIRE( 1.0f == Approx( 1 ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
1 == Approx( 1 )
|
1 == Approx( 1.0 )
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
ApproxTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( 0 == Approx( dZero) )
|
REQUIRE( 0 == Approx( dZero) )
|
||||||
with expansion:
|
with expansion:
|
||||||
0 == Approx( 0 )
|
0 == Approx( 0.0 )
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
ApproxTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( 0 == Approx( dSmall ).epsilon( 0.001 ) )
|
REQUIRE( 0 == Approx( dSmall ).epsilon( 0.001 ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
0 == Approx( 1e-05 )
|
0 == Approx( 0.00001 )
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
ApproxTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
@ -129,7 +133,7 @@ ApproxTests.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( dMedium == Approx( 1.234f ) )
|
REQUIRE( dMedium == Approx( 1.234f ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
1.234 == Approx( 1.234 )
|
1.234 == Approx( 1.2339999676 )
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Use a custom approx
|
Use a custom approx
|
||||||
@ -265,13 +269,13 @@ ConditionTests.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( data.float_nine_point_one == Approx( 9.1f ) )
|
REQUIRE( data.float_nine_point_one == Approx( 9.1f ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
9.1 == Approx( 9.1 )
|
9.1 == Approx( 9.1000003815 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
ConditionTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( data.double_pi == Approx( 3.1415926535 ) )
|
REQUIRE( data.double_pi == Approx( 3.1415926535 ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
3.1415926535 == Approx( 3.14159 )
|
3.1415926535 == Approx( 3.1415926535 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
ConditionTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
@ -321,22 +325,22 @@ with expansion:
|
|||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.float_nine_point_one == Approx( 9.11f ) )
|
CHECK( data.float_nine_point_one == Approx( 9.11f ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
9.1 == Approx( 9.11 )
|
9.1 == Approx( 9.1099996567 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.float_nine_point_one == Approx( 9.0f ) )
|
CHECK( data.float_nine_point_one == Approx( 9.0f ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
9.1 == Approx( 9 )
|
9.1 == Approx( 9.0 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.float_nine_point_one == Approx( 1 ) )
|
CHECK( data.float_nine_point_one == Approx( 1 ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
9.1 == Approx( 1 )
|
9.1 == Approx( 1.0 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.float_nine_point_one == Approx( 0 ) )
|
CHECK( data.float_nine_point_one == Approx( 0 ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
9.1 == Approx( 0 )
|
9.1 == Approx( 0.0 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.double_pi == Approx( 3.1415 ) )
|
CHECK( data.double_pi == Approx( 3.1415 ) )
|
||||||
@ -390,25 +394,25 @@ ConditionTests.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( data.float_nine_point_one != Approx( 9.11f ) )
|
REQUIRE( data.float_nine_point_one != Approx( 9.11f ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
9.1 != Approx( 9.11 )
|
9.1 != Approx( 9.1099996567 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
ConditionTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( data.float_nine_point_one != Approx( 9.0f ) )
|
REQUIRE( data.float_nine_point_one != Approx( 9.0f ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
9.1 != Approx( 9 )
|
9.1 != Approx( 9.0 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
ConditionTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( data.float_nine_point_one != Approx( 1 ) )
|
REQUIRE( data.float_nine_point_one != Approx( 1 ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
9.1 != Approx( 1 )
|
9.1 != Approx( 1.0 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
ConditionTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( data.float_nine_point_one != Approx( 0 ) )
|
REQUIRE( data.float_nine_point_one != Approx( 0 ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
9.1 != Approx( 0 )
|
9.1 != Approx( 0.0 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
ConditionTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
@ -454,12 +458,12 @@ with expansion:
|
|||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.float_nine_point_one != Approx( 9.1f ) )
|
CHECK( data.float_nine_point_one != Approx( 9.1f ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
9.1 != Approx( 9.1 )
|
9.1 != Approx( 9.1000003815 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.double_pi != Approx( 3.1415926535 ) )
|
CHECK( data.double_pi != Approx( 3.1415926535 ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
3.1415926535 != Approx( 3.14159 )
|
3.1415926535 != Approx( 3.1415926535 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>: FAILED:
|
ConditionTests.cpp:<line number>: FAILED:
|
||||||
CHECK( data.str_hello != "hello" )
|
CHECK( data.str_hello != "hello" )
|
||||||
@ -3014,8 +3018,8 @@ with expansion:
|
|||||||
with message:
|
with message:
|
||||||
Testing if fib[7] (21) is even
|
Testing if fib[7] (21) is even
|
||||||
|
|
||||||
Some information
|
A string sent directly to stdout
|
||||||
An error
|
A string sent directly to stderr
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Sends stuff to stdout and stderr
|
Sends stuff to stdout and stderr
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
@ -73,13 +73,13 @@ ApproxTests.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( 1.23f == Approx( 1.23f ) )
|
REQUIRE( 1.23f == Approx( 1.23f ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
1.23 == Approx( 1.23 )
|
1.23 == Approx( 1.2300000191 )
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
ApproxTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( 0.0f == Approx( 0.0f ) )
|
REQUIRE( 0.0f == Approx( 0.0f ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
0 == Approx( 0 )
|
0 == Approx( 0.0 )
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Approximate comparisons with ints
|
Approximate comparisons with ints
|
||||||
@ -90,10 +90,14 @@ ApproxTests.cpp:<line number>
|
|||||||
ApproxTests.cpp:<line number>:
|
ApproxTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( 1 == Approx( 1 ) )
|
REQUIRE( 1 == Approx( 1 ) )
|
||||||
|
with expansion:
|
||||||
|
1 == Approx( 1.0 )
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
ApproxTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( 0 == Approx( 0 ) )
|
REQUIRE( 0 == Approx( 0 ) )
|
||||||
|
with expansion:
|
||||||
|
0 == Approx( 0.0 )
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Approximate comparisons with mixed numeric types
|
Approximate comparisons with mixed numeric types
|
||||||
@ -105,19 +109,19 @@ ApproxTests.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( 1.0f == Approx( 1 ) )
|
REQUIRE( 1.0f == Approx( 1 ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
1 == Approx( 1 )
|
1 == Approx( 1.0 )
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
ApproxTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( 0 == Approx( dZero) )
|
REQUIRE( 0 == Approx( dZero) )
|
||||||
with expansion:
|
with expansion:
|
||||||
0 == Approx( 0 )
|
0 == Approx( 0.0 )
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
ApproxTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( 0 == Approx( dSmall ).epsilon( 0.001 ) )
|
REQUIRE( 0 == Approx( dSmall ).epsilon( 0.001 ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
0 == Approx( 1e-05 )
|
0 == Approx( 0.00001 )
|
||||||
|
|
||||||
ApproxTests.cpp:<line number>:
|
ApproxTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
@ -129,7 +133,7 @@ ApproxTests.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( dMedium == Approx( 1.234f ) )
|
REQUIRE( dMedium == Approx( 1.234f ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
1.234 == Approx( 1.234 )
|
1.234 == Approx( 1.2339999676 )
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Use a custom approx
|
Use a custom approx
|
||||||
@ -265,13 +269,13 @@ ConditionTests.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( data.float_nine_point_one == Approx( 9.1f ) )
|
REQUIRE( data.float_nine_point_one == Approx( 9.1f ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
9.1 == Approx( 9.1 )
|
9.1 == Approx( 9.1000003815 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
ConditionTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( data.double_pi == Approx( 3.1415926535 ) )
|
REQUIRE( data.double_pi == Approx( 3.1415926535 ) )
|
||||||
with expansion:
|
with expansion:
|
||||||
3.1415926535 == Approx( 3.14159 )
|
3.1415926535 == Approx( 3.1415926535 )
|
||||||
|
|
||||||
ConditionTests.cpp:<line number>:
|
ConditionTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
|
@ -30,16 +30,16 @@ ConditionTests.cpp:<line number>
|
|||||||
<failure message="7 == 0" type="CHECK">
|
<failure message="7 == 0" type="CHECK">
|
||||||
ConditionTests.cpp:<line number>
|
ConditionTests.cpp:<line number>
|
||||||
</failure>
|
</failure>
|
||||||
<failure message="9.1 == Approx( 9.11 )" type="CHECK">
|
<failure message="9.1 == Approx( 9.1099996567 )" type="CHECK">
|
||||||
ConditionTests.cpp:<line number>
|
ConditionTests.cpp:<line number>
|
||||||
</failure>
|
</failure>
|
||||||
<failure message="9.1 == Approx( 9 )" type="CHECK">
|
<failure message="9.1 == Approx( 9.0 )" type="CHECK">
|
||||||
ConditionTests.cpp:<line number>
|
ConditionTests.cpp:<line number>
|
||||||
</failure>
|
</failure>
|
||||||
<failure message="9.1 == Approx( 1 )" type="CHECK">
|
<failure message="9.1 == Approx( 1.0 )" type="CHECK">
|
||||||
ConditionTests.cpp:<line number>
|
ConditionTests.cpp:<line number>
|
||||||
</failure>
|
</failure>
|
||||||
<failure message="9.1 == Approx( 0 )" type="CHECK">
|
<failure message="9.1 == Approx( 0.0 )" type="CHECK">
|
||||||
ConditionTests.cpp:<line number>
|
ConditionTests.cpp:<line number>
|
||||||
</failure>
|
</failure>
|
||||||
<failure message="3.1415926535 == Approx( 3.1415 )" type="CHECK">
|
<failure message="3.1415926535 == Approx( 3.1415 )" type="CHECK">
|
||||||
@ -66,10 +66,10 @@ ConditionTests.cpp:<line number>
|
|||||||
<failure message="7 != 7" type="CHECK">
|
<failure message="7 != 7" type="CHECK">
|
||||||
ConditionTests.cpp:<line number>
|
ConditionTests.cpp:<line number>
|
||||||
</failure>
|
</failure>
|
||||||
<failure message="9.1 != Approx( 9.1 )" type="CHECK">
|
<failure message="9.1 != Approx( 9.1000003815 )" type="CHECK">
|
||||||
ConditionTests.cpp:<line number>
|
ConditionTests.cpp:<line number>
|
||||||
</failure>
|
</failure>
|
||||||
<failure message="3.1415926535 != Approx( 3.14159 )" type="CHECK">
|
<failure message="3.1415926535 != Approx( 3.1415926535 )" type="CHECK">
|
||||||
ConditionTests.cpp:<line number>
|
ConditionTests.cpp:<line number>
|
||||||
</failure>
|
</failure>
|
||||||
<failure message=""hello" != "hello"" type="CHECK">
|
<failure message=""hello" != "hello"" type="CHECK">
|
||||||
@ -351,10 +351,10 @@ MiscTests.cpp:<line number>
|
|||||||
</testcase>
|
</testcase>
|
||||||
<testcase classname="global" name="Sends stuff to stdout and stderr" time="{duration}">
|
<testcase classname="global" name="Sends stuff to stdout and stderr" time="{duration}">
|
||||||
<system-out>
|
<system-out>
|
||||||
Some information
|
A string sent directly to stdout
|
||||||
</system-out>
|
</system-out>
|
||||||
<system-err>
|
<system-err>
|
||||||
An error
|
A string sent directly to stderr
|
||||||
</system-err>
|
</system-err>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase classname="global" name="null strings" time="{duration}"/>
|
<testcase classname="global" name="null strings" time="{duration}"/>
|
||||||
@ -550,12 +550,12 @@ TrickyTests.cpp:<line number>
|
|||||||
<system-out>
|
<system-out>
|
||||||
Message from section one
|
Message from section one
|
||||||
Message from section two
|
Message from section two
|
||||||
Some information
|
A string sent directly to stdout
|
||||||
hello
|
hello
|
||||||
hello
|
hello
|
||||||
</system-out>
|
</system-out>
|
||||||
<system-err>
|
<system-err>
|
||||||
An error
|
A string sent directly to stderr
|
||||||
</system-err>
|
</system-err>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
|
@ -76,7 +76,7 @@
|
|||||||
1.23f == Approx( 1.23f )
|
1.23f == Approx( 1.23f )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
1.23 == Approx( 1.23 )
|
1.23 == Approx( 1.2300000191 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" >
|
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" >
|
||||||
@ -84,7 +84,7 @@
|
|||||||
0.0f == Approx( 0.0f )
|
0.0f == Approx( 0.0f )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
0 == Approx( 0 )
|
0 == Approx( 0.0 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
@ -95,7 +95,7 @@
|
|||||||
1 == Approx( 1 )
|
1 == Approx( 1 )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
1 == Approx( 1 )
|
1 == Approx( 1.0 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" >
|
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" >
|
||||||
@ -103,7 +103,7 @@
|
|||||||
0 == Approx( 0 )
|
0 == Approx( 0 )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
0 == Approx( 0 )
|
0 == Approx( 0.0 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
@ -114,7 +114,7 @@
|
|||||||
1.0f == Approx( 1 )
|
1.0f == Approx( 1 )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
1 == Approx( 1 )
|
1 == Approx( 1.0 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" >
|
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" >
|
||||||
@ -122,7 +122,7 @@
|
|||||||
0 == Approx( dZero)
|
0 == Approx( dZero)
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
0 == Approx( 0 )
|
0 == Approx( 0.0 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" >
|
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" >
|
||||||
@ -130,7 +130,7 @@
|
|||||||
0 == Approx( dSmall ).epsilon( 0.001 )
|
0 == Approx( dSmall ).epsilon( 0.001 )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
0 == Approx( 1e-05 )
|
0 == Approx( 0.00001 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" >
|
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ApproxTests.cpp" >
|
||||||
@ -146,7 +146,7 @@
|
|||||||
dMedium == Approx( 1.234f )
|
dMedium == Approx( 1.234f )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
1.234 == Approx( 1.234 )
|
1.234 == Approx( 1.2339999676 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
@ -295,7 +295,7 @@
|
|||||||
data.float_nine_point_one == Approx( 9.1f )
|
data.float_nine_point_one == Approx( 9.1f )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
9.1 == Approx( 9.1 )
|
9.1 == Approx( 9.1000003815 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
||||||
@ -303,7 +303,7 @@
|
|||||||
data.double_pi == Approx( 3.1415926535 )
|
data.double_pi == Approx( 3.1415926535 )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
3.1415926535 == Approx( 3.14159 )
|
3.1415926535 == Approx( 3.1415926535 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
||||||
@ -370,7 +370,7 @@
|
|||||||
data.float_nine_point_one == Approx( 9.11f )
|
data.float_nine_point_one == Approx( 9.11f )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
9.1 == Approx( 9.11 )
|
9.1 == Approx( 9.1099996567 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
||||||
@ -378,7 +378,7 @@
|
|||||||
data.float_nine_point_one == Approx( 9.0f )
|
data.float_nine_point_one == Approx( 9.0f )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
9.1 == Approx( 9 )
|
9.1 == Approx( 9.0 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
||||||
@ -386,7 +386,7 @@
|
|||||||
data.float_nine_point_one == Approx( 1 )
|
data.float_nine_point_one == Approx( 1 )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
9.1 == Approx( 1 )
|
9.1 == Approx( 1.0 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
||||||
@ -394,7 +394,7 @@
|
|||||||
data.float_nine_point_one == Approx( 0 )
|
data.float_nine_point_one == Approx( 0 )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
9.1 == Approx( 0 )
|
9.1 == Approx( 0.0 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
||||||
@ -469,7 +469,7 @@
|
|||||||
data.float_nine_point_one != Approx( 9.11f )
|
data.float_nine_point_one != Approx( 9.11f )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
9.1 != Approx( 9.11 )
|
9.1 != Approx( 9.1099996567 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
||||||
@ -477,7 +477,7 @@
|
|||||||
data.float_nine_point_one != Approx( 9.0f )
|
data.float_nine_point_one != Approx( 9.0f )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
9.1 != Approx( 9 )
|
9.1 != Approx( 9.0 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
||||||
@ -485,7 +485,7 @@
|
|||||||
data.float_nine_point_one != Approx( 1 )
|
data.float_nine_point_one != Approx( 1 )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
9.1 != Approx( 1 )
|
9.1 != Approx( 1.0 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
||||||
@ -493,7 +493,7 @@
|
|||||||
data.float_nine_point_one != Approx( 0 )
|
data.float_nine_point_one != Approx( 0 )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
9.1 != Approx( 0 )
|
9.1 != Approx( 0.0 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
||||||
@ -552,7 +552,7 @@
|
|||||||
data.float_nine_point_one != Approx( 9.1f )
|
data.float_nine_point_one != Approx( 9.1f )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
9.1 != Approx( 9.1 )
|
9.1 != Approx( 9.1000003815 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
||||||
@ -560,7 +560,7 @@
|
|||||||
data.double_pi != Approx( 3.1415926535 )
|
data.double_pi != Approx( 3.1415926535 )
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
3.1415926535 != Approx( 3.14159 )
|
3.1415926535 != Approx( 3.1415926535 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ConditionTests.cpp" >
|
||||||
|
@ -116,7 +116,7 @@ TEST_CASE( "cmdline" ) {
|
|||||||
.shortOpt( "d" )
|
.shortOpt( "d" )
|
||||||
.longOpt( "description" )
|
.longOpt( "description" )
|
||||||
.hint( "some text" );
|
.hint( "some text" );
|
||||||
|
|
||||||
const char* argv[] = { "test", "-n 42", "-d some text" };
|
const char* argv[] = { "test", "-n 42", "-d some text" };
|
||||||
std::vector<Clara::Parser::Token> unusedTokens = parseInto( cli, argv, config1 );
|
std::vector<Clara::Parser::Token> unusedTokens = parseInto( cli, argv, config1 );
|
||||||
|
|
||||||
|
@ -116,9 +116,9 @@ namespace MiscTests
|
|||||||
|
|
||||||
TEST_CASE( "Sends stuff to stdout and stderr", "" )
|
TEST_CASE( "Sends stuff to stdout and stderr", "" )
|
||||||
{
|
{
|
||||||
std::cout << "Some information" << std::endl;
|
std::cout << "A string sent directly to stdout" << std::endl;
|
||||||
|
|
||||||
std::cerr << "An error" << std::endl;
|
std::cerr << "A string sent directly to stderr" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const char* makeString( bool makeNull )
|
inline const char* makeString( bool makeNull )
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* CATCH v1.0 build 20 (master branch)
|
* CATCH v1.0 build 23 (master branch)
|
||||||
* Generated: 2013-12-18 08:38:15.171445
|
* Generated: 2013-12-23 10:22:45.547645
|
||||||
* ----------------------------------------------------------
|
* ----------------------------------------------------------
|
||||||
* This file has been merged from multiple headers. Please don't edit it directly
|
* This file has been merged from multiple headers. Please don't edit it directly
|
||||||
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
|
||||||
@ -2096,7 +2096,7 @@ namespace Detail {
|
|||||||
|
|
||||||
std::string toString() const {
|
std::string toString() const {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Approx( " << m_value << " )";
|
oss << "Approx( " << Catch::toString( m_value ) << " )";
|
||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3224,7 +3224,8 @@ namespace Clara {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void parseIntoTokens( int argc, char const * const * argv, std::vector<Parser::Token>& tokens ) const {
|
void parseIntoTokens( int argc, char const * const * argv, std::vector<Parser::Token>& tokens ) const {
|
||||||
for( int i = 1; i < argc; ++i )
|
const std::string doubleDash = "--";
|
||||||
|
for( int i = 1; i < argc && argv[i] != doubleDash; ++i )
|
||||||
parseIntoTokens( argv[i] , tokens);
|
parseIntoTokens( argv[i] , tokens);
|
||||||
}
|
}
|
||||||
void parseIntoTokens( std::string arg, std::vector<Parser::Token>& tokens ) const {
|
void parseIntoTokens( std::string arg, std::vector<Parser::Token>& tokens ) const {
|
||||||
@ -3389,18 +3390,25 @@ namespace Clara {
|
|||||||
|
|
||||||
CommandLine()
|
CommandLine()
|
||||||
: m_boundProcessName( new Detail::NullBinder<ConfigT>() ),
|
: m_boundProcessName( new Detail::NullBinder<ConfigT>() ),
|
||||||
m_highestSpecifiedArgPosition( 0 )
|
m_highestSpecifiedArgPosition( 0 ),
|
||||||
|
m_throwOnUnrecognisedTokens( false )
|
||||||
{}
|
{}
|
||||||
CommandLine( CommandLine const& other )
|
CommandLine( CommandLine const& other )
|
||||||
: m_boundProcessName( other.m_boundProcessName ),
|
: m_boundProcessName( other.m_boundProcessName ),
|
||||||
m_options ( other.m_options ),
|
m_options ( other.m_options ),
|
||||||
m_positionalArgs( other.m_positionalArgs ),
|
m_positionalArgs( other.m_positionalArgs ),
|
||||||
m_highestSpecifiedArgPosition( other.m_highestSpecifiedArgPosition )
|
m_highestSpecifiedArgPosition( other.m_highestSpecifiedArgPosition ),
|
||||||
|
m_throwOnUnrecognisedTokens( other.m_throwOnUnrecognisedTokens )
|
||||||
{
|
{
|
||||||
if( other.m_arg.get() )
|
if( other.m_arg.get() )
|
||||||
m_arg = ArgAutoPtr( new Arg( *other.m_arg ) );
|
m_arg = ArgAutoPtr( new Arg( *other.m_arg ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CommandLine& setThrowOnUnrecognisedTokens( bool shouldThrow = true ) {
|
||||||
|
m_throwOnUnrecognisedTokens = shouldThrow;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
ArgBinder bind( F f ) {
|
ArgBinder bind( F f ) {
|
||||||
ArgBinder binder( this, f );
|
ArgBinder binder( this, f );
|
||||||
@ -3506,6 +3514,7 @@ namespace Clara {
|
|||||||
|
|
||||||
std::vector<Parser::Token> populateOptions( std::vector<Parser::Token> const& tokens, ConfigT& config ) const {
|
std::vector<Parser::Token> populateOptions( std::vector<Parser::Token> const& tokens, ConfigT& config ) const {
|
||||||
std::vector<Parser::Token> unusedTokens;
|
std::vector<Parser::Token> unusedTokens;
|
||||||
|
std::vector<std::string> errors;
|
||||||
for( std::size_t i = 0; i < tokens.size(); ++i ) {
|
for( std::size_t i = 0; i < tokens.size(); ++i ) {
|
||||||
Parser::Token const& token = tokens[i];
|
Parser::Token const& token = tokens[i];
|
||||||
typename std::vector<Arg>::const_iterator it = m_options.begin(), itEnd = m_options.end();
|
typename std::vector<Arg>::const_iterator it = m_options.begin(), itEnd = m_options.end();
|
||||||
@ -3517,8 +3526,9 @@ namespace Clara {
|
|||||||
( token.type == Parser::Token::LongOpt && arg.hasLongName( token.data ) ) ) {
|
( token.type == Parser::Token::LongOpt && arg.hasLongName( token.data ) ) ) {
|
||||||
if( arg.takesArg() ) {
|
if( arg.takesArg() ) {
|
||||||
if( i == tokens.size()-1 || tokens[i+1].type != Parser::Token::Positional )
|
if( i == tokens.size()-1 || tokens[i+1].type != Parser::Token::Positional )
|
||||||
throw std::domain_error( "Expected argument to option " + token.data );
|
errors.push_back( "Expected argument to option: " + token.data );
|
||||||
arg.boundField.set( config, tokens[++i].data );
|
else
|
||||||
|
arg.boundField.set( config, tokens[++i].data );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
arg.boundField.setFlag( config );
|
arg.boundField.setFlag( config );
|
||||||
@ -3527,11 +3537,26 @@ namespace Clara {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( std::exception& ex ) {
|
catch( std::exception& ex ) {
|
||||||
throw std::runtime_error( std::string( ex.what() ) + "\n- while parsing: (" + arg.commands() + ")" );
|
errors.push_back( std::string( ex.what() ) + "\n- while parsing: (" + arg.commands() + ")" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( it == itEnd )
|
if( it == itEnd ) {
|
||||||
unusedTokens.push_back( token );
|
if( token.type == Parser::Token::Positional || !m_throwOnUnrecognisedTokens )
|
||||||
|
unusedTokens.push_back( token );
|
||||||
|
else if( m_throwOnUnrecognisedTokens )
|
||||||
|
errors.push_back( "unrecognised option: " + token.data );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( !errors.empty() ) {
|
||||||
|
std::ostringstream oss;
|
||||||
|
for( std::vector<std::string>::const_iterator it = errors.begin(), itEnd = errors.end();
|
||||||
|
it != itEnd;
|
||||||
|
++it ) {
|
||||||
|
if( it != errors.begin() )
|
||||||
|
oss << "\n";
|
||||||
|
oss << *it;
|
||||||
|
}
|
||||||
|
throw std::runtime_error( oss.str() );
|
||||||
}
|
}
|
||||||
return unusedTokens;
|
return unusedTokens;
|
||||||
}
|
}
|
||||||
@ -3570,6 +3595,7 @@ namespace Clara {
|
|||||||
std::map<int, Arg> m_positionalArgs;
|
std::map<int, Arg> m_positionalArgs;
|
||||||
ArgAutoPtr m_arg;
|
ArgAutoPtr m_arg;
|
||||||
int m_highestSpecifiedArgPosition;
|
int m_highestSpecifiedArgPosition;
|
||||||
|
bool m_throwOnUnrecognisedTokens;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace Clara
|
} // end namespace Clara
|
||||||
@ -4812,9 +4838,8 @@ namespace Catch {
|
|||||||
|
|
||||||
int applyCommandLine( int argc, char* const argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) {
|
int applyCommandLine( int argc, char* const argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) {
|
||||||
try {
|
try {
|
||||||
|
m_cli.setThrowOnUnrecognisedTokens( unusedOptionBehaviour == OnUnusedOptions::Fail );
|
||||||
m_unusedTokens = m_cli.parseInto( argc, argv, m_configData );
|
m_unusedTokens = m_cli.parseInto( argc, argv, m_configData );
|
||||||
if( unusedOptionBehaviour == OnUnusedOptions::Fail )
|
|
||||||
enforceNoUsedTokens();
|
|
||||||
if( m_configData.showHelp )
|
if( m_configData.showHelp )
|
||||||
showHelp( m_configData.processName );
|
showHelp( m_configData.processName );
|
||||||
m_config.reset();
|
m_config.reset();
|
||||||
@ -4822,7 +4847,7 @@ namespace Catch {
|
|||||||
catch( std::exception& ex ) {
|
catch( std::exception& ex ) {
|
||||||
{
|
{
|
||||||
Colour colourGuard( Colour::Red );
|
Colour colourGuard( Colour::Red );
|
||||||
std::cerr << "\nError in input:\n"
|
std::cerr << "\nError(s) in input:\n"
|
||||||
<< Text( ex.what(), TextAttributes().setIndent(2) )
|
<< Text( ex.what(), TextAttributes().setIndent(2) )
|
||||||
<< "\n\n";
|
<< "\n\n";
|
||||||
}
|
}
|
||||||
@ -4837,18 +4862,6 @@ namespace Catch {
|
|||||||
m_config.reset();
|
m_config.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void enforceNoUsedTokens() const {
|
|
||||||
if( !m_unusedTokens.empty() ) {
|
|
||||||
std::vector<Clara::Parser::Token>::const_iterator
|
|
||||||
it = m_unusedTokens.begin(),
|
|
||||||
itEnd = m_unusedTokens.end();
|
|
||||||
std::string msg;
|
|
||||||
for(; it != itEnd; ++it )
|
|
||||||
msg += " unrecognised option: " + it->data + "\n";
|
|
||||||
throw std::runtime_error( msg.substr( 0, msg.size()-1 ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int run( int argc, char* const argv[] ) {
|
int run( int argc, char* const argv[] ) {
|
||||||
|
|
||||||
int returnCode = applyCommandLine( argc, argv );
|
int returnCode = applyCommandLine( argc, argv );
|
||||||
@ -6166,7 +6179,7 @@ namespace Catch {
|
|||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
// These numbers are maintained by a script
|
// These numbers are maintained by a script
|
||||||
Version libraryVersion( 1, 0, 20, "master" );
|
Version libraryVersion( 1, 0, 23, "master" );
|
||||||
}
|
}
|
||||||
|
|
||||||
// #included from: catch_text.hpp
|
// #included from: catch_text.hpp
|
||||||
|
Loading…
Reference in New Issue
Block a user