mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Added StringMaker (for partially specialising string conversions), extended BDD macros and moved file/line info to top of message.
Re-enable ANSI colour by default - hopefully properly excluding Windows this time
This commit is contained in:
@@ -101,3 +101,12 @@ TEST_CASE
|
||||
REQUIRE( approx( d ) != 1.25 );
|
||||
}
|
||||
|
||||
inline double divide( double a, double b ) {
|
||||
return a/b;
|
||||
}
|
||||
|
||||
TEST_CASE( "Approximate PI", "[Approx][PI]" )
|
||||
{
|
||||
REQUIRE( divide( 22, 7 ) == Approx( 3.141 ).epsilon( 0.001 ) );
|
||||
REQUIRE( divide( 22, 7 ) != Approx( 3.141 ).epsilon( 0.0001 ) );
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -580,7 +580,6 @@
|
||||
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++98";
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = CATCH_CONFIG_USE_ANSI_COLOUR_CODES;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WARNING_CFLAGS = (
|
||||
@@ -596,7 +595,6 @@
|
||||
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++98";
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = CATCH_CONFIG_USE_ANSI_COLOUR_CODES;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WARNING_CFLAGS = (
|
||||
|
@@ -14,11 +14,14 @@
|
||||
|
||||
// !TBD: story scenarios map to class based tests
|
||||
#define SCENARIO( name, tags ) TEST_CASE( "Scenario: " name, tags )
|
||||
#define GIVEN( desc ) SECTION( " Given: " desc, "" )
|
||||
#define WHEN( desc ) SECTION( " When: " desc, "" )
|
||||
#define THEN( desc ) SECTION( " Then: " desc, "" )
|
||||
#define GIVEN( desc ) SECTION( "Given: " desc, "" )
|
||||
#define WHEN( desc ) SECTION( " When: " desc, "" )
|
||||
#define AND_WHEN( desc ) SECTION( " And: " desc, "" )
|
||||
#define THEN( desc ) SECTION( " Then: " desc, "" )
|
||||
#define AND_THEN( desc ) SECTION( " And: " desc, "" )
|
||||
|
||||
inline bool itDoesThis(){ return true; }
|
||||
inline bool itDoesThat(){ return true; }
|
||||
|
||||
SCENARIO( "Do that thing with the thing", "[tags]" ) {
|
||||
GIVEN( "This stuff exists" ) {
|
||||
@@ -26,7 +29,11 @@ SCENARIO( "Do that thing with the thing", "[tags]" ) {
|
||||
WHEN( "I do this" ) {
|
||||
// do this
|
||||
THEN( "it should do this")
|
||||
{
|
||||
REQUIRE( itDoesThis() );
|
||||
AND_THEN( "do that")
|
||||
REQUIRE( itDoesThat() );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user