Added ability to specify if macros should be prefixed with CATCH_

This commit is contained in:
Phil Nash
2012-07-20 18:43:48 +01:00
parent 5d73c5a008
commit 46bcd4b2b7
4 changed files with 111 additions and 18 deletions

View File

@@ -10,6 +10,9 @@
*
*/
// This define means we have to prefix all the CATCH macros with CATCH_
// We're using it here to test it out
#define CATCH_CONFIG_PREFIX_ALL
#include "catch.hpp"
inline int multiply( int a, int b )
@@ -17,13 +20,13 @@ inline int multiply( int a, int b )
return a*b;
}
TEST_CASE( "./succeeding/generators/1", "Generators over two ranges" )
CATCH_TEST_CASE( "./succeeding/generators/1", "Generators over two ranges" )
{
using namespace Catch::Generators;
int i = GENERATE( between( 1, 5 ).then( values( 15, 20, 21 ).then( 36 ) ) );
int j = GENERATE( between( 100, 107 ) );
int i = CATCH_GENERATE( between( 1, 5 ).then( values( 15, 20, 21 ).then( 36 ) ) );
int j = CATCH_GENERATE( between( 100, 107 ) );
REQUIRE( multiply( i, 2 ) == i*2 );
REQUIRE( multiply( j, 2 ) == j*2 );
CATCH_REQUIRE( multiply( i, 2 ) == i*2 );
CATCH_REQUIRE( multiply( j, 2 ) == j*2 );
}