First cut of single-evaluation fix

This commit is contained in:
Phil Nash
2011-03-09 19:45:05 +00:00
parent c57ff75cdb
commit b708789ee9
7 changed files with 181 additions and 6 deletions

View File

@@ -153,6 +153,33 @@ TEST_CASE( "./failing/conditions/ordered", "Ordering comparison checks that shou
CHECK( data.str_hello <= "a" );
}
// Comparisons with int literals
TEST_CASE( "./succeeding/conditions/int literals", "Comparisons with int literals don't warn when mixing signed/ unsigned" )
{
int i = 1;
unsigned int ui = 2;
long l = 3;
unsigned long ul = 4;
char c = 5;
unsigned char uc = 6;
REQUIRE( i == 1 );
REQUIRE( ui == 2 );
REQUIRE( l == 3 );
REQUIRE( ul == 4 );
REQUIRE( c == 5 );
REQUIRE( uc == 6 );
REQUIRE( 1 == i );
REQUIRE( 2 == ui );
REQUIRE( 3 == l );
REQUIRE( 4 == ul );
REQUIRE( 5 == c );
REQUIRE( 6 == uc );
REQUIRE( 62270208023445 > ul );
}
// Not (!) tests
// The problem with the ! operator is that it has right-to-left associativity.
// This means we can't isolate it when we decompose. The simple REQUIRE( !false ) form, therefore,

View File

@@ -113,3 +113,11 @@ TEST_CASE( "./succeeding/Misc/null strings", "" )
REQUIRE( makeString( false ) != static_cast<char*>(NULL));
REQUIRE( makeString( true ) == static_cast<char*>(NULL));
}
TEST_CASE( "./failing/info", "sends information to INFO" )
{
INFO( "hi" );
int i = 7;
CAPTURE( i );
REQUIRE( false );
}

View File

@@ -42,6 +42,7 @@
4A3BFFB8128DCF06005609E3 /* TestMain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestMain.cpp; sourceTree = "<group>"; };
4A3BFFF0128DD23C005609E3 /* catch_config.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_config.hpp; path = ../internal/catch_config.hpp; sourceTree = SOURCE_ROOT; };
4A6D514B12C8A547008F0415 /* catch_debugger.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_debugger.hpp; path = ../internal/catch_debugger.hpp; sourceTree = SOURCE_ROOT; };
4A72A6FE13217CB70008EC53 /* catch_evaluate.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_evaluate.hpp; path = ../internal/catch_evaluate.hpp; sourceTree = SOURCE_ROOT; };
4A8A68FF12F1F75100ACED26 /* catch_generators.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_generators.hpp; path = ../internal/catch_generators.hpp; sourceTree = SOURCE_ROOT; };
4A8A698812F2CDA100ACED26 /* catch_generators_impl.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_generators_impl.hpp; path = ../internal/catch_generators_impl.hpp; sourceTree = SOURCE_ROOT; };
4A8A69C512F2D1C600ACED26 /* GeneratorTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeneratorTests.cpp; sourceTree = "<group>"; };
@@ -171,6 +172,7 @@
4AFC341612809A36003A0C29 /* catch_common.h */,
4A992A6512B2156C002B7B66 /* catch_xmlwriter.hpp */,
4A15D4A812E4DF0D0005EB03 /* catch_stream.hpp */,
4A72A6FE13217CB70008EC53 /* catch_evaluate.hpp */,
);
name = support;
sourceTree = "<group>";

View File

@@ -20,13 +20,13 @@ TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results"
runner.runMatching( "./succeeding/*" );
INFO( runner.getOutput() );
CHECK( runner.getSuccessCount() == 199 );
CHECK( runner.getSuccessCount() == 212 );
CHECK( runner.getFailureCount() == 0 );
runner.runMatching( "./failing/*" );
INFO( runner.getOutput() );
CHECK( runner.getSuccessCount() == 0 );
CHECK( runner.getFailureCount() == 53 );
CHECK( runner.getFailureCount() == 54 );
}
TEST_CASE( "meta/Misc/Sections", "looped tests" )