Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Fixed more warnings and applied workaround for getting to std::numeric_limits without clashing with Windows' min() and max() macros.

Commit
73acd945cdc7e53892e1fc9e679bc2fbb99f9505
Author
Phil Nash ·
Parents
dea778138ee2

Files · Download .tar.gz

Changes

 Test/ClassTests.cpp                  |  4 ++--
 Test/GeneratorTests.cpp              |  2 +-
 Test/MessageTests.cpp                |  2 +-
 Test/Test.xcodeproj/project.pbxproj  | 28 ++++++++++++++++++++++++++++
 Test/TestMain.cpp                    |  1 +
 catch.hpp                            |  2 +-
 catch_reporter_basic.hpp             |  2 +-
 catch_reporter_junit.hpp             |  2 +-
 catch_reporter_xml.hpp               |  2 +-
 catch_runner.hpp                     |  8 ++++----
 catch_with_main.hpp                  |  2 +-
 internal/catch_common.h              |  5 +++--
 internal/catch_hub.h                 |  5 ++++-
 internal/catch_interfaces_testcase.h |  2 +-
 internal/catch_list.hpp              |  2 +-
 internal/catch_reporter_registry.hpp |  2 +-
 internal/catch_stream.hpp            |  4 ++--
 internal/catch_test_case_info.hpp    |  2 +-
 18 files changed, 55 insertions(+), 22 deletions(-)

diff --git a/Test/ClassTests.cpp b/Test/ClassTests.cpp
index 8d456d4e..3cadd645 100644
--- a/Test/ClassTests.cpp
+++ b/Test/ClassTests.cpp
@@ -35,8 +35,8 @@ namespace
 }
 
 
-METHOD_AS_TEST_CASE( TestClass::succeedingCase, "./succeeding/TestClass/succeedingCase", "A method based test run that succeeds" );
-METHOD_AS_TEST_CASE( TestClass::failingCase, "./failing/TestClass/failingCase", "A method based test run that fails" );
+METHOD_AS_TEST_CASE( TestClass::succeedingCase, "./succeeding/TestClass/succeedingCase", "A method based test run that succeeds" )
+METHOD_AS_TEST_CASE( TestClass::failingCase, "./failing/TestClass/failingCase", "A method based test run that fails" )
 
 
 struct Fixture
diff --git a/Test/GeneratorTests.cpp b/Test/GeneratorTests.cpp
index 8dec53f5..db8ea2a1 100644
--- a/Test/GeneratorTests.cpp
+++ b/Test/GeneratorTests.cpp
@@ -12,7 +12,7 @@
 
 #include "../catch.hpp"
 
-size_t multiply( int a, int b )
+size_t multiply( size_t a, size_t b )
 {
     return a*b;
 }
diff --git a/Test/MessageTests.cpp b/Test/MessageTests.cpp
index a8e067ed..af674f57 100644
--- a/Test/MessageTests.cpp
+++ b/Test/MessageTests.cpp
@@ -48,4 +48,4 @@ TEST_CASE( "./mixed/message/info/2", "INFO gets logged on failure" )
 TEST_CASE( "./failing/message/fail", "FAIL aborts the test" )
 {
     FAIL( "This is a " << "failure" );    // This should output the message and abort
-}
\ No newline at end of file
+}
diff --git a/Test/Test.xcodeproj/project.pbxproj b/Test/Test.xcodeproj/project.pbxproj
index 3901574b..68a12f74 100644
--- a/Test/Test.xcodeproj/project.pbxproj
+++ b/Test/Test.xcodeproj/project.pbxproj
@@ -321,7 +321,35 @@
 				GCC_C_LANGUAGE_STANDARD = gnu99;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
+				GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
+				GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS = YES;
+				GCC_TREAT_WARNINGS_AS_ERRORS = NO;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_GLOBAL_CONSTRUCTORS = NO;
+				GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
+				GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
+				GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
+				GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = NO;
+				GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+				GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
+				GCC_WARN_INHIBIT_ALL_WARNINGS = NO;
+				GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
+				GCC_WARN_MISSING_PARENTHESES = YES;
+				GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES;
+				GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
+				GCC_WARN_PEDANTIC = YES;
+				GCC_WARN_PROTOTYPE_CONVERSION = YES;
+				GCC_WARN_SHADOW = YES;
+				GCC_WARN_SIGN_COMPARE = YES;
+				GCC_WARN_STRICT_SELECTOR_MATCH = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = NO;
+				GCC_WARN_UNKNOWN_PRAGMAS = YES;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_LABEL = YES;
+				GCC_WARN_UNUSED_PARAMETER = YES;
+				GCC_WARN_UNUSED_VALUE = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				PREBINDING = NO;
diff --git a/Test/TestMain.cpp b/Test/TestMain.cpp
index 3bf7c311..b3d29805 100644
--- a/Test/TestMain.cpp
+++ b/Test/TestMain.cpp
@@ -26,6 +26,7 @@ TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results"
     CHECK( runner.getFailureCount() == 0 );
 
     runner.runMatching( "./failing/*" );        
+    INFO( runner.getOutput() );
     CHECK( runner.getSuccessCount() == 0 );
     CHECK( runner.getFailureCount() == 53 );
 }
diff --git a/catch.hpp b/catch.hpp
index 440ec253..cae477db 100644
--- a/catch.hpp
+++ b/catch.hpp
@@ -67,4 +67,4 @@
 
 using Catch::Approx;
 
-#endif // TWOBLUECUBES_CATCH_HPP_INCLUDED
\ No newline at end of file
+#endif // TWOBLUECUBES_CATCH_HPP_INCLUDED
diff --git a/catch_reporter_basic.hpp b/catch_reporter_basic.hpp
index 689be63c..655ab175 100644
--- a/catch_reporter_basic.hpp
+++ b/catch_reporter_basic.hpp
@@ -282,7 +282,7 @@ namespace Catch
         SpanInfo m_testSpan;
     };
 
-    INTERNAL_CATCH_REGISTER_REPORTER( "basic", BasicReporter );
+    INTERNAL_CATCH_REGISTER_REPORTER( "basic", BasicReporter )
     
 } // end namespace Catch
     
diff --git a/catch_reporter_junit.hpp b/catch_reporter_junit.hpp
index a232f783..aa22b586 100644
--- a/catch_reporter_junit.hpp
+++ b/catch_reporter_junit.hpp
@@ -256,7 +256,7 @@ namespace Catch
         std::ostringstream m_stdErr;
     };
 
-    INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter );
+    INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter )
     
 } // end namespace Catch
 
diff --git a/catch_reporter_xml.hpp b/catch_reporter_xml.hpp
index 4d6bb349..7eb62455 100644
--- a/catch_reporter_xml.hpp
+++ b/catch_reporter_xml.hpp
@@ -168,7 +168,7 @@ namespace Catch
         XmlWriter m_xml;
     };
 
-    INTERNAL_CATCH_REGISTER_REPORTER( "xml", XmlReporter );
+    INTERNAL_CATCH_REGISTER_REPORTER( "xml", XmlReporter )
 
 } // end namespace Catch
 
diff --git a/catch_runner.hpp b/catch_runner.hpp
index 22f08637..800c1586 100644
--- a/catch_runner.hpp
+++ b/catch_runner.hpp
@@ -34,7 +34,7 @@ namespace Catch
         if( !config.getMessage().empty() )
         {
             std::cerr << config.getMessage() << std::endl;
-            return std::numeric_limits<int>::max();
+            return (std::numeric_limits<int>::max)();
         }
         
         // Handle help
@@ -70,7 +70,7 @@ namespace Catch
             if( ofs.fail() )
             {
                 std::cerr << "Unable to open file: '" << config.getFilename() << "'" << std::endl;
-                return std::numeric_limits<int>::max();
+                return (std::numeric_limits<int>::max)();
             }
             config.setStreamBuf( ofs.rdbuf() );
         }
@@ -103,9 +103,9 @@ namespace Catch
                 config.getReporter()->EndGroup( *it, runner.getSuccessCount()-prevSuccess, runner.getFailureCount()-prevFail );
             }
         }
-        return runner.getFailureCount();
+        return static_cast<int>( runner.getFailureCount() );
     }
     
 } // end namespace Catch
 
-#endif // TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
\ No newline at end of file
+#endif // TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
diff --git a/catch_with_main.hpp b/catch_with_main.hpp
index 3ea9d8bb..ae68c7cc 100644
--- a/catch_with_main.hpp
+++ b/catch_with_main.hpp
@@ -20,4 +20,4 @@ int main (int argc, char * const argv[])
     return Catch::Main( argc, argv );
 }
 
-#endif // TWOBLUECUBES_CATCH_WITH_MAIN_HPP_INCLUDED
\ No newline at end of file
+#endif // TWOBLUECUBES_CATCH_WITH_MAIN_HPP_INCLUDED
diff --git a/internal/catch_common.h b/internal/catch_common.h
index 47c32bb0..27bbae16 100644
--- a/internal/catch_common.h
+++ b/internal/catch_common.h
@@ -53,7 +53,7 @@ namespace Catch
             delete it->second;
         }
     }
-    
+
 }
 #ifdef __GNUC__
 #define ATTRIBUTE_NORETURN __attribute__ ((noreturn))
@@ -61,4 +61,5 @@ namespace Catch
 #define ATTRIBUTE_NORETURN
 #endif
 
-#endif // TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
\ No newline at end of file
+#endif // TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
+
diff --git a/internal/catch_hub.h b/internal/catch_hub.h
index 08983003..1926e141 100644
--- a/internal/catch_hub.h
+++ b/internal/catch_hub.h
@@ -36,6 +36,9 @@ namespace Catch
         
         static Hub& me();
         
+        Hub( const Hub& );
+        void operator=( const Hub& );
+        
     public:
         
         static void setRunner
@@ -85,4 +88,4 @@ namespace Catch
     };
 }
 
-#endif // TWOBLUECUBES_CATCH_HUB_H_INCLUDED
\ No newline at end of file
+#endif // TWOBLUECUBES_CATCH_HUB_H_INCLUDED
diff --git a/internal/catch_interfaces_testcase.h b/internal/catch_interfaces_testcase.h
index 69366c3d..0bede865 100644
--- a/internal/catch_interfaces_testcase.h
+++ b/internal/catch_interfaces_testcase.h
@@ -57,4 +57,4 @@ namespace Catch
 
 
 
-#endif // TWOBLUECUBES_CATCH_INTERFACES_TESTCASE_H_INCLUDED
\ No newline at end of file
+#endif // TWOBLUECUBES_CATCH_INTERFACES_TESTCASE_H_INCLUDED
diff --git a/internal/catch_list.hpp b/internal/catch_list.hpp
index 85e19345..255df919 100644
--- a/internal/catch_list.hpp
+++ b/internal/catch_list.hpp
@@ -51,7 +51,7 @@ namespace Catch
         if( ( config.listWhat() & Config::List::All ) == 0 )
         {
             std::cerr << "Unknown list type" << std::endl;
-            return std::numeric_limits<int>::max();
+            return (std::numeric_limits<int>::max)();
         }
         
         if( config.getReporter() )
diff --git a/internal/catch_reporter_registry.hpp b/internal/catch_reporter_registry.hpp
index 57643e3c..c1943791 100644
--- a/internal/catch_reporter_registry.hpp
+++ b/internal/catch_reporter_registry.hpp
@@ -66,4 +66,4 @@ namespace Catch
     };
 }
 
-#endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRY_HPP_INCLUDED
\ No newline at end of file
+#endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRY_HPP_INCLUDED
diff --git a/internal/catch_stream.hpp b/internal/catch_stream.hpp
index 7fc254c1..7717a798 100644
--- a/internal/catch_stream.hpp
+++ b/internal/catch_stream.hpp
@@ -53,7 +53,7 @@ namespace Catch
                 if( pbase() == epptr() )
                     m_writer( std::string( 1, static_cast<char>( c ) ) );
                 else
-                    sputc( c );
+                    sputc( static_cast<char>( c ) );
             }            
             return 0;
         }
@@ -87,4 +87,4 @@ namespace Catch
     };
 }
 
-#endif // TWOBLUECUBES_CATCH_STREAM_HPP_INCLUDED
\ No newline at end of file
+#endif // TWOBLUECUBES_CATCH_STREAM_HPP_INCLUDED
diff --git a/internal/catch_test_case_info.hpp b/internal/catch_test_case_info.hpp
index 51da0320..f004b0f5 100644
--- a/internal/catch_test_case_info.hpp
+++ b/internal/catch_test_case_info.hpp
@@ -159,4 +159,4 @@ namespace Catch
     
 }
 
-#endif // TWOBLUECUBES_CATCH_TESTCASEINFO_HPP_INCLUDED
\ No newline at end of file
+#endif // TWOBLUECUBES_CATCH_TESTCASEINFO_HPP_INCLUDED