Start using piecemeal includes in test files

This commit is contained in:
Martin Hořeňovský 2020-01-20 23:24:04 +01:00
parent c381b49c60
commit 26f78f96aa
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
40 changed files with 88 additions and 98 deletions

View File

@ -11,14 +11,6 @@
#include <catch2/catch_version_macros.hpp>
#ifdef __clang__
# pragma clang system_header
#elif defined __GNUC__
# pragma GCC system_header
#endif
#include <catch2/catch_suppress_warnings.h>
#if !defined(CATCH_CONFIG_IMPL_ONLY)

View File

@ -16,6 +16,7 @@
#include <catch2/catch_interfaces_registry_hub.h>
#include <catch2/catch_capture_matchers.h>
#include <catch2/catch_run_context.h>
#include <catch2/catch_matchers_string.h>
namespace Catch {

View File

@ -10,11 +10,6 @@
#include <catch2/catch_capture.hpp>
#include <catch2/catch_matchers.h>
#include <catch2/catch_matchers_exception.hpp>
#include <catch2/catch_matchers_floating.h>
#include <catch2/catch_matchers_generic.hpp>
#include <catch2/catch_matchers_string.h>
#include <catch2/catch_matchers_vector.h>
#include <catch2/catch_stringref.h>
namespace Catch {

View File

@ -23,6 +23,14 @@
#pragma warning(disable:4800) // Forcing result to true or false
#endif
#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wsign-compare"
#elif defined __GNUC__
# pragma GCC diagnostic push
# pragma clang diagnostic ignored "-Wsign-compare"
#endif
namespace Catch {
struct ITransientExpression {
@ -243,5 +251,10 @@ namespace Catch {
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#ifdef __clang__
# pragma clang diagnostic pop
#elif defined __GNUC__
# pragma GCC diagnostic pop
#endif
#endif // TWOBLUECUBES_CATCH_DECOMPOSER_H_INCLUDED

View File

@ -7,6 +7,10 @@
#define TWOBLUECUBES_CATCH_TEST_MACROS_HPP_INCLUDED
#include <catch2/catch_capture.hpp>
#include <catch2/catch_capture_matchers.h>
#include <catch2/catch_interfaces_exception.h>
#include <catch2/catch_preprocessor.hpp>
#include <catch2/catch_section.h>
#include <catch2/catch_test_registry.h>
#if !defined(CATCH_CONFIG_DISABLE)

View File

@ -649,6 +649,8 @@ struct ratio_string<std::milli> {
}
#endif // CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
#include <catch2/catch_interfaces_registry_hub.h>
#define INTERNAL_CATCH_REGISTER_ENUM( enumName, ... ) \
namespace Catch { \
template<> struct StringMaker<enumName> { \

View File

@ -4,7 +4,9 @@
#include <catch2/catch_default_main.hpp>
// This won't provide full coverage, but it might be worth checking
// the other branch as well
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_matchers_generic.hpp>
#include <catch2/catch_matchers_string.h>
#include <type_traits>
#include <stdexcept>

View File

@ -1,12 +1,11 @@
/*
* Created by Phil on 13/5/2013.
* Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include <catch2/catch.hpp>
#include <catch2/catch_approx.h>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_matchers_string.h>
#include <catch2/catch_test_spec_parser.h>
#include <catch2/catch_test_case_info.h>
#include <catch2/catch_config.hpp>

View File

@ -3,7 +3,8 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_enforce.h>
#if defined(_MSC_VER)
#pragma warning(push)

View File

@ -1,4 +1,7 @@
#include <catch2/catch.hpp>
#include <catch2/catch_approx.h>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_generators_generic.hpp>
#include <catch2/catch_generators_specific.hpp>
// Tests of generator implementation details
TEST_CASE("Generators internals", "[generators][internals]") {
@ -175,6 +178,7 @@ TEST_CASE("Generators internals", "[generators][internals]") {
}
SECTION("Floating Point") {
using Catch::Detail::Approx;
SECTION("Exact") {
const auto rangeStart = -1.;
const auto rangeEnd = 1.;

View File

@ -1,14 +1,12 @@
/*
* Created by Phil on 1/10/2015.
* Copyright 2015 Two Blue Cubes Ltd
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_suppress_warnings.h>
#include <catch2/catch_test_case_tracker.h>
#include <catch2/catch.hpp>
using namespace Catch;

View File

@ -1,12 +1,9 @@
/*
* Created by Martin on 06/10/2019.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_random_number_generator.h>
TEST_CASE("Our PCG implementation provides expected results for known seeds", "[rng]") {

View File

@ -1,7 +1,6 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_stringref.h>
#include <catch2/catch.hpp>
#include <cstring>
TEST_CASE( "StringRef", "[Strings][StringRef]" ) {

View File

@ -1,7 +1,7 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_matchers_vector.h>
#include <catch2/catch_string_manip.h>
#include <catch2/catch.hpp>
static const char * const no_whitespace = "There is no extra whitespace here";
static const char * const leading_whitespace = " \r \t\n There is no extra whitespace here";
static const char * const trailing_whitespace = "There is no extra whitespace here \t \n \r ";

View File

@ -1,13 +1,13 @@
/*
* Created by Phil on 27/06/2014.
* Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include <catch2/catch.hpp>
#include <catch2/catch_matchers_string.h>
#include <catch2/catch_matchers_vector.h>
#include <catch2/catch_tag_alias_registry.h>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_test_case_info.h>
TEST_CASE( "Tag alias can be registered against tag patterns" ) {

View File

@ -1,6 +1,6 @@
#include <catch2/catch.hpp>
#include <catch2/catch_enum_values_registry.h>
#include <catch2/catch_matchers_vector.h>
#include <catch2/catch_test_macros.hpp>
enum class EnumClass3 { Value1, Value2, Value3, Value4 };

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_xmlwriter.h>
#include <sstream>

View File

@ -6,10 +6,13 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.h>
#include <cmath>
using Catch::Detail::Approx;
namespace { namespace ApproxTests {
#ifndef APPROX_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU

View File

@ -1,12 +1,9 @@
/*
* Created by Phil on 29/11/2010.
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
namespace { namespace BDDTests {

View File

@ -1,12 +1,9 @@
/*
* Created by Phil on 09/11/2010.
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <array>
namespace{ namespace ClassTests {

View File

@ -1,6 +1,4 @@
/*
* Created by Martin on 17/02/2017.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
@ -30,7 +28,8 @@ std::ostream& operator<<(std::ostream& out, foo::helper_1403 const&) {
}
///////////////////////////////
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_matchers_string.h>
#include <cstring>

View File

@ -1,7 +1,4 @@
/*
* Created by Phil on 08/11/2010.
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
@ -14,7 +11,10 @@
# endif
#endif
#include <catch2/catch.hpp>
#include <catch2/catch_approx.h>
#include <catch2/catch_test_macros.hpp>
using Catch::Detail::Approx;
#include <string>
#include <limits>

View File

@ -1,7 +1,4 @@
/*
* Created by Martin on 27/5/2017.
* Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
@ -26,7 +23,7 @@ std::ostream& operator<<(std::ostream& o, truthy) {
} // end anonymous namespace
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
TEST_CASE( "Reconstruction should be based on stringification: #914" , "[Decomposition][failing][.]") {
CHECK(truthy(false));

View File

@ -1,4 +1,5 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_enum_values_registry.h>
namespace {

View File

@ -1,12 +1,10 @@
/*
* Created by Phil on 09/11/2010.
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_matchers_string.h>
#include <string>
#include <stdexcept>

View File

@ -1,4 +1,6 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_generators_generic.hpp>
#include <catch2/catch_generators_specific.hpp>
#include <cstring>

View File

@ -1,15 +1,18 @@
/*
* Created by Phil on 21/02/2017.
* Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_matchers_exception.hpp>
#include <catch2/catch_matchers_floating.h>
#include <catch2/catch_matchers_generic.hpp>
#include <catch2/catch_matchers_string.h>
#include <catch2/catch_matchers_vector.h>
#include <sstream>
#include <algorithm>
#include <cmath>
#ifdef __clang__
#pragma clang diagnostic push

View File

@ -1,12 +1,9 @@
/*
* Created by Phil on 09/11/2010.
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <iostream>
TEST_CASE( "INFO and WARN do not abort tests", "[messages][.]" ) {

View File

@ -1,12 +1,9 @@
/*
* Created by Phil on 29/11/2010.
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#ifdef __clang__
# pragma clang diagnostic ignored "-Wc++98-compat"

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#if defined(CATCH_CONFIG_CPP17_BYTE)

View File

@ -1,5 +1,5 @@
#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <chrono>
#include <cstdint>

View File

@ -1,12 +1,10 @@
/*
* Created by Martin on 17/02/2017.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <map>
#include <set>

View File

@ -1,5 +1,5 @@
#define CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#if defined(CATCH_CONFIG_CPP17_OPTIONAL)

View File

@ -1,5 +1,5 @@
#define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
TEST_CASE( "std::pair<int,std::string> -> toString", "[toString][pair]" ) {
std::pair<int,std::string> value( 34, "xyzzy" );

View File

@ -1,5 +1,5 @@
#define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <tuple>

View File

@ -1,5 +1,5 @@
#define CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#if defined(CATCH_CONFIG_CPP17_VARIANT)

View File

@ -13,7 +13,7 @@ std::string fallbackStringifier(T const&) {
}
#define CATCH_CONFIG_FALLBACK_STRINGIFIER fallbackStringifier
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

View File

@ -1,7 +1,4 @@
/*
* Created by Phil on 09/11/2010.
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
@ -15,7 +12,7 @@
// that is triggered when compiling as Win32|Release
#endif
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <stdio.h>
#include <sstream>

View File

@ -1,12 +1,9 @@
/*
* Created by Phil on 15/03/2013.
* Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
TEST_CASE()