Fixes const int error seen on some compilers (see #136)

Added a new test to try to highlight issue.
This commit is contained in:
Phil Nash 2012-11-16 21:03:59 +00:00
commit 08142bfdb6
7 changed files with 26 additions and 8 deletions

2
README
View File

@ -1,4 +1,4 @@
CATCH v0.9 build 2 (integration branch) CATCH v0.9 build 3 (integration branch)
--------------------------------------------- ---------------------------------------------
CATCH is an automated test framework for C, C++ and Objective-C. CATCH is an automated test framework for C, C++ and Objective-C.

View File

@ -22,7 +22,7 @@ class ExpressionLhs {
void operator = ( const ExpressionLhs& ); void operator = ( const ExpressionLhs& );
public: public:
ExpressionLhs( const T& lhs ) : m_lhs( lhs ) {} ExpressionLhs( T lhs ) : m_lhs( lhs ) {}
template<typename RhsT> template<typename RhsT>
ExpressionResultBuilder& operator == ( const RhsT& rhs ) { ExpressionResultBuilder& operator == ( const RhsT& rhs ) {

View File

@ -13,7 +13,7 @@
namespace Catch { namespace Catch {
// These numbers are maintained by a script // These numbers are maintained by a script
Version libraryVersion = { 0, 9, 2, "integration" }; Version libraryVersion = { 0, 9, 3, "integration" };
} }
#endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED

View File

@ -226,6 +226,20 @@ TEST_CASE( "./succeeding/conditions//long_to_unsigned_x",
REQUIRE( long_var == unsigned_long_var ); REQUIRE( long_var == unsigned_long_var );
} }
TEST_CASE( "./succeeding/conditions/const ints to int literal",
"comparisons between const int variables" )
{
const unsigned char unsigned_char_var = 1;
const unsigned short unsigned_short_var = 1;
const unsigned int unsigned_int_var = 1;
const unsigned long unsigned_long_var = 1L;
REQUIRE( unsigned_char_var == 1 );
REQUIRE( unsigned_short_var == 1 );
REQUIRE( unsigned_int_var == 1 );
REQUIRE( unsigned_long_var == 1 );
}
TEST_CASE( "./succeeding/conditions/negative ints", TEST_CASE( "./succeeding/conditions/negative ints",
"Comparisons between unsigned ints and negative signed ints match c++ standard behaviour" ) "Comparisons between unsigned ints and negative signed ints match c++ standard behaviour" )
{ {

View File

@ -37,7 +37,7 @@ TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results"
SECTION( "selftest/test counts/succeeding tests", SECTION( "selftest/test counts/succeeding tests",
"Number of 'succeeding' tests is fixed" ) { "Number of 'succeeding' tests is fixed" ) {
Totals totals = runner.runMatching( "./succeeding/*" ); Totals totals = runner.runMatching( "./succeeding/*" );
CHECK( totals.assertions.passed == 289 ); CHECK( totals.assertions.passed == 293 );
CHECK( totals.assertions.failed == 0 ); CHECK( totals.assertions.failed == 0 );
} }

View File

@ -554,8 +554,10 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES; CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++98";
CLANG_WARN__DUPLICATE_METHOD_MATCH = NO; CLANG_WARN__DUPLICATE_METHOD_MATCH = NO;
GCC_PREPROCESSOR_DEFINITIONS = ""; GCC_PREPROCESSOR_DEFINITIONS = "";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
WARNING_CFLAGS = ( WARNING_CFLAGS = (
"-Weverything", "-Weverything",
@ -568,8 +570,10 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES; CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++98";
CLANG_WARN__DUPLICATE_METHOD_MATCH = NO; CLANG_WARN__DUPLICATE_METHOD_MATCH = NO;
GCC_PREPROCESSOR_DEFINITIONS = CATCH_CONFIG_USE_ANSI_COLOUR_CODES; GCC_PREPROCESSOR_DEFINITIONS = CATCH_CONFIG_USE_ANSI_COLOUR_CODES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
WARNING_CFLAGS = ( WARNING_CFLAGS = (
"-Weverything", "-Weverything",

View File

@ -1,6 +1,6 @@
/* /*
* CATCH v0.9 build 2 (integration branch) * CATCH v0.9 build 3 (integration branch)
* Generated: 2012-11-16 08:44:53.410120 * Generated: 2012-11-16 21:01:18.673384
* ---------------------------------------------------------- * ----------------------------------------------------------
* 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.
@ -939,7 +939,7 @@ class ExpressionLhs {
void operator = ( const ExpressionLhs& ); void operator = ( const ExpressionLhs& );
public: public:
ExpressionLhs( const T& lhs ) : m_lhs( lhs ) {} ExpressionLhs( T lhs ) : m_lhs( lhs ) {}
template<typename RhsT> template<typename RhsT>
ExpressionResultBuilder& operator == ( const RhsT& rhs ) { ExpressionResultBuilder& operator == ( const RhsT& rhs ) {
@ -5375,7 +5375,7 @@ namespace Catch {
namespace Catch { namespace Catch {
// These numbers are maintained by a script // These numbers are maintained by a script
Version libraryVersion = { 0, 9, 2, "integration" }; Version libraryVersion = { 0, 9, 3, "integration" };
} }
// #included from: ../reporters/catch_reporter_basic.hpp // #included from: ../reporters/catch_reporter_basic.hpp