From 9c089788ab68befd9c8ebccb3fb5ae08c4c8ef5e Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Sun, 21 Sep 2025 13:23:25 -0600 Subject: [PATCH] Upgrade to C++17 --- .clang-format | 2 +- .clang-tidy | 3 +- .github/workflows/linux-meson-builds.yml | 5 +- .github/workflows/linux-other-builds.yml | 18 +--- .github/workflows/linux-simple-builds.yml | 14 +--- .github/workflows/mac-builds.yml | 2 - .github/workflows/windows-simple-builds.yml | 4 +- BUILD.bazel | 10 --- CMake/CatchConfigOptions.cmake | 5 -- CMake/catch2-with-main.pc.in | 2 +- CMake/catch2.pc.in | 2 +- docs/configuration.md | 22 +---- docs/contributing.md | 8 +- docs/other-macros.md | 8 +- docs/test-cases-and-sections.md | 2 +- docs/why-catch.md | 2 +- examples/010-TestCase.cpp | 2 +- examples/020-TestCase-1.cpp | 4 +- examples/030-Asn-Require-Check.cpp | 2 +- examples/100-Fix-Section.cpp | 2 +- examples/110-Fix-ClassFixture.cpp | 4 +- examples/120-Bdd-ScenarioGivenWhenThen.cpp | 2 +- examples/210-Evt-EventListeners.cpp | 2 +- examples/302-Gen-Table.cpp | 23 ++--- extras/catch_amalgamated.cpp | 2 +- src/CMakeLists.txt | 9 +- src/catch2/benchmark/catch_optimizer.hpp | 4 +- src/catch2/benchmark/detail/catch_analyse.cpp | 2 +- .../detail/catch_benchmark_function.hpp | 2 +- src/catch2/catch_all.hpp | 3 - src/catch2/catch_approx.hpp | 26 +++--- src/catch2/catch_session.hpp | 1 - src/catch2/catch_tostring.cpp | 8 +- src/catch2/catch_tostring.hpp | 20 ++--- src/catch2/catch_user_config.hpp.in | 50 ----------- src/catch2/generators/catch_generators.hpp | 4 +- .../generators/catch_generators_adapters.hpp | 4 +- .../generators/catch_generators_random.hpp | 4 +- .../generators/catch_generators_range.hpp | 6 +- src/catch2/internal/catch_clara.hpp | 19 ++--- .../internal/catch_compiler_capabilities.hpp | 60 +------------ .../catch_config_uncaught_exceptions.hpp | 46 ---------- .../internal/catch_container_nonmembers.hpp | 73 ---------------- src/catch2/internal/catch_decomposer.hpp | 55 ++++++------ src/catch2/internal/catch_is_permutation.hpp | 2 +- src/catch2/internal/catch_jsonwriter.hpp | 4 +- src/catch2/internal/catch_logical_traits.hpp | 44 ---------- src/catch2/internal/catch_meta.hpp | 8 -- src/catch2/internal/catch_output_redirect.cpp | 17 ---- src/catch2/internal/catch_output_redirect.hpp | 4 - .../catch_random_floating_point_helpers.hpp | 2 +- .../internal/catch_random_integer_helpers.hpp | 14 ++-- .../internal/catch_uncaught_exceptions.cpp | 5 +- ...ch_uniform_floating_point_distribution.hpp | 4 +- .../catch_uniform_integer_distribution.hpp | 2 +- src/catch2/internal/catch_unique_ptr.hpp | 4 +- src/catch2/internal/catch_xmlwriter.hpp | 4 +- .../catch_matchers_container_properties.hpp | 1 - .../matchers/catch_matchers_predicate.hpp | 2 +- .../matchers/catch_matchers_templated.hpp | 11 ++- src/catch2/matchers/catch_matchers_vector.hpp | 6 +- src/catch2/meson.build | 7 +- tests/ExtraTests/CMakeLists.txt | 2 +- tests/ExtraTests/X01-PrefixedMacros.cpp | 8 +- .../Baselines/compact.sw.approved.txt | 58 ++++++------- .../Baselines/compact.sw.multi.approved.txt | 58 ++++++------- .../Baselines/console.sw.approved.txt | 84 +++++++++---------- .../Baselines/console.sw.multi.approved.txt | 84 +++++++++---------- .../Baselines/console.swa4.approved.txt | 2 +- tests/SelfTest/Baselines/tap.sw.approved.txt | 58 ++++++------- .../Baselines/tap.sw.multi.approved.txt | 58 ++++++------- tests/SelfTest/Baselines/xml.sw.approved.txt | 22 ++--- .../Baselines/xml.sw.multi.approved.txt | 22 ++--- .../IntrospectiveTests/CmdLine.tests.cpp | 10 +-- .../FloatingPoint.tests.cpp | 12 +-- .../GeneratorsImpl.tests.cpp | 2 +- .../IntrospectiveTests/Integer.tests.cpp | 6 +- .../RandomNumberGeneration.tests.cpp | 24 +----- .../IntrospectiveTests/StringManip.tests.cpp | 4 +- .../IntrospectiveTests/UniquePtr.tests.cpp | 12 +-- .../SelfTest/UsageTests/Compilation.tests.cpp | 10 +-- .../SelfTest/UsageTests/Generators.tests.cpp | 4 +- tests/SelfTest/UsageTests/Matchers.tests.cpp | 54 ++++++------ .../UsageTests/MatchersRanges.tests.cpp | 15 +--- tests/SelfTest/UsageTests/Misc.tests.cpp | 8 +- .../UsageTests/ToStringByte.tests.cpp | 4 - .../UsageTests/ToStringGeneral.tests.cpp | 4 - .../UsageTests/ToStringOptional.tests.cpp | 4 - .../UsageTests/ToStringPair.tests.cpp | 2 +- .../UsageTests/ToStringVariant.tests.cpp | 4 - .../helpers/type_with_lit_0_comparisons.hpp | 2 +- third_party/clara.hpp | 15 +--- 92 files changed, 428 insertions(+), 913 deletions(-) delete mode 100644 src/catch2/internal/catch_config_uncaught_exceptions.hpp delete mode 100644 src/catch2/internal/catch_container_nonmembers.hpp delete mode 100644 src/catch2/internal/catch_logical_traits.hpp diff --git a/.clang-format b/.clang-format index 9efb854d..7f71afcc 100644 --- a/.clang-format +++ b/.clang-format @@ -1,6 +1,6 @@ --- Language: Cpp -Standard: c++14 +Standard: c++17 # Note that we cannot use IncludeIsMainRegex functionality, because it # does not support includes in angle brackets (<>) diff --git a/.clang-tidy b/.clang-tidy index 3488457a..67b230ed 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -28,13 +28,12 @@ Checks: >- -modernize-concat-nested-namespaces, -modernize-use-nodiscard, -modernize-use-default-member-init, - -modernize-type-traits,# we need to support C++14, -modernize-deprecated-headers, ,# There's a lot of these and most of them are probably not useful, -modernize-pass-by-value, performance-*, - performance-enum-size, + -performance-enum-size, portability-*, diff --git a/.github/workflows/linux-meson-builds.yml b/.github/workflows/linux-meson-builds.yml index e48dea9d..1536e4fc 100644 --- a/.github/workflows/linux-meson-builds.yml +++ b/.github/workflows/linux-meson-builds.yml @@ -4,7 +4,7 @@ on: [push, pull_request] jobs: build: - name: meson ${{matrix.cxx}}, C++${{matrix.std}}, ${{matrix.build_type}} + name: meson ${{matrix.cxx}}, ${{matrix.build_type}} runs-on: ubuntu-22.04 strategy: fail-fast: false @@ -13,7 +13,6 @@ jobs: - g++-11 - clang++-11 build_type: [debug, release] - std: [14, 17] include: - cxx: clang++-11 other_pkgs: clang-11 @@ -29,7 +28,7 @@ jobs: - name: Configure env: CXX: ${{matrix.cxx}} - CXXFLAGS: -std=c++${{matrix.std}} ${{matrix.cxxflags}} + CXXFLAGS: -std=c++17 ${{matrix.cxxflags}} # Note: $GITHUB_WORKSPACE is distinct from ${{runner.workspace}}. # This is important run: | diff --git a/.github/workflows/linux-other-builds.yml b/.github/workflows/linux-other-builds.yml index 6095f24b..5b2d6563 100644 --- a/.github/workflows/linux-other-builds.yml +++ b/.github/workflows/linux-other-builds.yml @@ -7,7 +7,7 @@ on: [push, pull_request] jobs: build: - name: ${{matrix.build_description}}, ${{matrix.cxx}}, C++${{matrix.std}} ${{matrix.build_type}} + name: ${{matrix.build_description}}, ${{matrix.cxx}}, ${{matrix.build_type}} runs-on: ubuntu-22.04 strategy: fail-fast: false @@ -20,7 +20,6 @@ jobs: - cxx: clang++-14 build_description: Surrogates build build_type: Debug - std: 14 other_pkgs: clang-14 cmake_configurations: -DCATCH_BUILD_SURROGATES=ON @@ -28,13 +27,11 @@ jobs: - cxx: g++-11 build_description: Extras + Examples build_type: Debug - std: 14 other_pkgs: g++-11 cmake_configurations: -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_BUILD_EXAMPLES=ON -DCATCH_ENABLE_CMAKE_HELPER_TESTS=ON - cxx: g++-11 build_description: Extras + Examples build_type: Release - std: 14 other_pkgs: g++-11 cmake_configurations: -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_BUILD_EXAMPLES=ON -DCATCH_ENABLE_CMAKE_HELPER_TESTS=ON @@ -42,29 +39,18 @@ jobs: - cxx: clang++-14 build_description: Extras + Examples build_type: Debug - std: 17 other_pkgs: clang-14 cmake_configurations: -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_BUILD_EXAMPLES=ON -DCATCH_ENABLE_CMAKE_HELPER_TESTS=ON - cxx: clang++-14 build_description: Extras + Examples build_type: Release - std: 17 other_pkgs: clang-14 cmake_configurations: -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_BUILD_EXAMPLES=ON -DCATCH_ENABLE_CMAKE_HELPER_TESTS=ON - # Configure tests with Clang-14 - - cxx: clang++-14 - build_description: CMake configuration tests - build_type: Debug - std: 14 - other_pkgs: clang-14 - cmake_configurations: -DCATCH_ENABLE_CONFIGURE_TESTS=ON - # Valgrind test Clang-14 # - cxx: clang++-14 # build_description: Valgrind tests # build_type: Debug - # std: 14 # other_pkgs: clang-14 valgrind # cmake_configurations: -DMEMORYCHECK_COMMAND=`which valgrind` -DMEMORYCHECK_COMMAND_OPTIONS="-q --track-origins=yes --leak-check=full --num-callers=50 --show-leak-kinds=definite --error-exitcode=1" # other_ctest_args: -T memcheck -LE uses-python @@ -83,7 +69,6 @@ jobs: cmake --preset basic-tests -GNinja \ -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ -DCMAKE_CXX_COMPILER=${{matrix.cxx}} \ - -DCMAKE_CXX_STANDARD=${{matrix.std}} \ ${{matrix.cmake_configurations}} - name: Build @@ -116,7 +101,6 @@ jobs: -DCMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/true \ -DCMAKE_CXX_COMPILER=clang++-15 \ -DCMAKE_CXX_LINK_EXECUTABLE=/usr/bin/true \ - -DCMAKE_CXX_STANDARD=17 \ -DCMAKE_RANLIB=/usr/bin/true \ -DCATCH_BUILD_EXAMPLES=ON \ -DCATCH_ENABLE_CMAKE_HELPER_TESTS=ON diff --git a/.github/workflows/linux-simple-builds.yml b/.github/workflows/linux-simple-builds.yml index 15db5cf7..1a92371e 100644 --- a/.github/workflows/linux-simple-builds.yml +++ b/.github/workflows/linux-simple-builds.yml @@ -14,7 +14,6 @@ jobs: - g++-10 - g++-11 - g++-12 - - clang++-6.0 - clang++-7 - clang++-8 - clang++-9 @@ -24,7 +23,7 @@ jobs: - clang++-13 - clang++-14 build_type: [Debug, Release] - std: [14] + std: [17] include: - cxx: g++-9 other_pkgs: g++-9 @@ -34,8 +33,6 @@ jobs: other_pkgs: g++-11 - cxx: g++-12 other_pkgs: g++-12 - - cxx: clang++-6.0 - other_pkgs: clang-6.0 - cxx: clang++-7 other_pkgs: clang-7 - cxx: clang++-8 @@ -52,15 +49,6 @@ jobs: other_pkgs: clang-13 - cxx: clang++-14 other_pkgs: clang-14 - # Clang 14 + C++17 - - cxx: clang++-14 - build_type: Debug - std: 17 - other_pkgs: clang-14 - - cxx: clang++-14 - build_type: Release - std: 17 - other_pkgs: clang-14 - cxx: clang++-14 build_type: Debug std: 20 diff --git a/.github/workflows/mac-builds.yml b/.github/workflows/mac-builds.yml index 6ac4c2a9..1f542953 100644 --- a/.github/workflows/mac-builds.yml +++ b/.github/workflows/mac-builds.yml @@ -12,7 +12,6 @@ jobs: matrix: image: [macos-13, macos-14, macos-15] build_type: [Debug, Release] - std: [14, 17] steps: - uses: actions/checkout@v4 @@ -21,7 +20,6 @@ jobs: run: | cmake --preset basic-tests -GNinja \ -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ - -DCMAKE_CXX_STANDARD=${{matrix.std}} \ -DCATCH_BUILD_EXAMPLES=ON \ -DCATCH_BUILD_EXTRA_TESTS=ON diff --git a/.github/workflows/windows-simple-builds.yml b/.github/workflows/windows-simple-builds.yml index e6d852b6..107ac84a 100644 --- a/.github/workflows/windows-simple-builds.yml +++ b/.github/workflows/windows-simple-builds.yml @@ -4,7 +4,7 @@ on: [push, pull_request] jobs: build: - name: ${{matrix.os}}, ${{matrix.std}}, ${{matrix.build_type}}, ${{matrix.platform}} + name: ${{matrix.os}}, ${{matrix.build_type}}, ${{matrix.platform}} runs-on: ${{matrix.os}} strategy: fail-fast: false @@ -12,7 +12,6 @@ jobs: os: [windows-2022, windows-2025] platform: [Win32, x64] build_type: [Debug, Release] - std: [14, 17] steps: - uses: actions/checkout@v4 @@ -20,7 +19,6 @@ jobs: run: | cmake --preset all-tests ` -A ${{matrix.platform}} ` - -DCMAKE_CXX_STANDARD=${{matrix.std}} ` - name: Build tests run: cmake --build build --config ${{matrix.build_type}} --parallel %NUMBER_OF_PROCESSORS% diff --git a/BUILD.bazel b/BUILD.bazel index eb484e40..203ca90a 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -27,11 +27,6 @@ expand_template( "#cmakedefine CATCH_CONFIG_COLOUR_WIN32": "", "#cmakedefine CATCH_CONFIG_COUNTER": "", "#cmakedefine CATCH_CONFIG_CPP11_TO_STRING": "", - "#cmakedefine CATCH_CONFIG_CPP17_BYTE": "", - "#cmakedefine CATCH_CONFIG_CPP17_OPTIONAL": "", - "#cmakedefine CATCH_CONFIG_CPP17_STRING_VIEW": "", - "#cmakedefine CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS": "", - "#cmakedefine CATCH_CONFIG_CPP17_VARIANT": "", "#cmakedefine CATCH_CONFIG_DEPRECATION_ANNOTATIONS": "", "#cmakedefine CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER": "", "#cmakedefine CATCH_CONFIG_DISABLE_EXCEPTIONS": "", @@ -51,11 +46,6 @@ expand_template( "#cmakedefine CATCH_CONFIG_NO_COLOUR_WIN32": "", "#cmakedefine CATCH_CONFIG_NO_COUNTER": "", "#cmakedefine CATCH_CONFIG_NO_CPP11_TO_STRING": "", - "#cmakedefine CATCH_CONFIG_NO_CPP17_BYTE": "", - "#cmakedefine CATCH_CONFIG_NO_CPP17_OPTIONAL": "", - "#cmakedefine CATCH_CONFIG_NO_CPP17_STRING_VIEW": "", - "#cmakedefine CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS": "", - "#cmakedefine CATCH_CONFIG_NO_CPP17_VARIANT": "", "#cmakedefine CATCH_CONFIG_NO_DEPRECATION_ANNOTATIONS": "", "#cmakedefine CATCH_CONFIG_NO_GETENV": "", "#cmakedefine CATCH_CONFIG_NO_GLOBAL_NEXTAFTER": "", diff --git a/CMake/CatchConfigOptions.cmake b/CMake/CatchConfigOptions.cmake index 3621fac0..cab60324 100644 --- a/CMake/CatchConfigOptions.cmake +++ b/CMake/CatchConfigOptions.cmake @@ -31,11 +31,6 @@ set(_OverridableOptions "COLOUR_WIN32" "COUNTER" "CPP11_TO_STRING" - "CPP17_BYTE" - "CPP17_OPTIONAL" - "CPP17_STRING_VIEW" - "CPP17_UNCAUGHT_EXCEPTIONS" - "CPP17_VARIANT" "GLOBAL_NEXTAFTER" "POSIX_SIGNALS" "USE_ASYNC" diff --git a/CMake/catch2-with-main.pc.in b/CMake/catch2-with-main.pc.in index eeac3e35..516ac5c4 100644 --- a/CMake/catch2-with-main.pc.in +++ b/CMake/catch2-with-main.pc.in @@ -3,7 +3,7 @@ libdir=${prefix}/@lib_dir@ pkg_version=@Catch2_VERSION@ Name: Catch2 with main function -Description: A modern, C++-native test framework for C++14 and above (links in default main) +Description: A modern, C++-native test framework for C++17 and above (links in default main) URL: https://github.com/catchorg/Catch2 Version: ${pkg_version} Requires: catch2 = ${pkg_version} diff --git a/CMake/catch2.pc.in b/CMake/catch2.pc.in index 74e22c15..40d1f003 100644 --- a/CMake/catch2.pc.in +++ b/CMake/catch2.pc.in @@ -4,7 +4,7 @@ includedir=${prefix}/@include_dir@ libdir=${prefix}/@lib_dir@ Name: Catch2 -Description: A modern, C++-native, test framework for C++14 and above +Description: A modern, C++-native, test framework for C++17 and above URL: https://github.com/catchorg/Catch2 Version: @Catch2_VERSION@ Cflags: -I${includedir} diff --git a/docs/configuration.md b/docs/configuration.md index f63a6d41..99dadef2 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -10,7 +10,6 @@ [Default reporter](#default-reporter)
[Bazel support](#bazel-support)
[C++11 toggles](#c11-toggles)
-[C++17 toggles](#c17-toggles)
[Other toggles](#other-toggles)
[Enabling stringification](#enabling-stringification)
[Disabling exceptions](#disabling-exceptions)
@@ -128,23 +127,6 @@ Catch's selection, by defining either `CATCH_CONFIG_CPP11_TO_STRING` or `CATCH_CONFIG_NO_CPP11_TO_STRING`. -## C++17 toggles - - CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS // Override std::uncaught_exceptions (instead of std::uncaught_exception) support detection - CATCH_CONFIG_CPP17_STRING_VIEW // Override std::string_view support detection (Catch provides a StringMaker specialization by default) - CATCH_CONFIG_CPP17_VARIANT // Override std::variant support detection (checked by CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER) - CATCH_CONFIG_CPP17_OPTIONAL // Override std::optional support detection (checked by CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER) - CATCH_CONFIG_CPP17_BYTE // Override std::byte support detection (Catch provides a StringMaker specialization by default) - -> `CATCH_CONFIG_CPP17_STRING_VIEW` was [introduced](https://github.com/catchorg/Catch2/issues/1376) in Catch2 2.4.1. - -Catch contains basic compiler/standard detection and attempts to use -some C++17 features whenever appropriate. This automatic detection -can be manually overridden in both directions, that is, a feature -can be enabled by defining the macro in the table above, and disabled -by using `_NO_` in the macro, e.g. `CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS`. - - ## Other toggles CATCH_CONFIG_COUNTER // Use __COUNTER__ to generate unique names for test cases @@ -221,8 +203,8 @@ By default, Catch does not stringify some types from the standard library. This CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER // Provide StringMaker specialization for std::pair CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER // Provide StringMaker specialization for std::tuple - CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER // Provide StringMaker specialization for std::variant, std::monostate (on C++17) - CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER // Provide StringMaker specialization for std::optional (on C++17) + CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER // Provide StringMaker specialization for std::variant, std::monostate + CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER // Provide StringMaker specialization for std::optional CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS // Defines all of the above > `CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER` was [introduced](https://github.com/catchorg/Catch2/issues/1380) in Catch2 2.4.1. diff --git a/docs/contributing.md b/docs/contributing.md index d21323d9..5fa2f634 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -211,16 +211,10 @@ and so on. ### C++ standard version -Catch2 currently targets C++14 as the minimum supported C++ version. +Catch2 currently targets C++17 as the minimum supported C++ version. Features from higher language versions should be used only sparingly, when the benefits from using them outweigh the maintenance overhead. -Example of good use of polyfilling features is our use of `conjunction`, -where if available we use `std::conjunction` and otherwise provide our -own implementation. The reason it is good is that the surface area for -maintenance is quite small, and `std::conjunction` can directly use -compiler built-ins, thus providing significant compilation benefits. - Example of bad use of polyfilling features would be to keep around two sets of metaprogramming in the stringification implementation, once using C++14 compliant TMP and once using C++17's `if constexpr`. While diff --git a/docs/other-macros.md b/docs/other-macros.md index 79990a6a..90cb12c9 100644 --- a/docs/other-macros.md +++ b/docs/other-macros.md @@ -72,8 +72,8 @@ including the Catch2 header. Example: ```cpp TEST_CASE("STATIC_REQUIRE showcase", "[traits]") { - STATIC_REQUIRE( std::is_void::value ); - STATIC_REQUIRE_FALSE( std::is_void::value ); + STATIC_REQUIRE( std::is_void_v ); + STATIC_REQUIRE_FALSE( std::is_void_v ); } ``` @@ -86,8 +86,8 @@ becomes equivalent to `CHECK` instead of `REQUIRE`. Example: ```cpp TEST_CASE("STATIC_CHECK showcase", "[traits]") { - STATIC_CHECK( std::is_void::value ); - STATIC_CHECK_FALSE( std::is_void::value ); + STATIC_CHECK( std::is_void_v ); + STATIC_CHECK_FALSE( std::is_void_v ); } ``` diff --git a/docs/test-cases-and-sections.md b/docs/test-cases-and-sections.md index 14db55ae..49e19a3d 100644 --- a/docs/test-cases-and-sections.md +++ b/docs/test-cases-and-sections.md @@ -264,7 +264,7 @@ You can also have different arities in the _template-arg_ packs: ```cpp TEMPLATE_PRODUCT_TEST_CASE("Product with differing arities", "[template][product]", std::tuple, (int, (int, double), (int, double, float))) { TestType x; - REQUIRE(std::tuple_size::value >= 1); + REQUIRE(std::tuple_size_v >= 1); } ``` diff --git a/docs/why-catch.md b/docs/why-catch.md index b7367496..5df9980a 100644 --- a/docs/why-catch.md +++ b/docs/why-catch.md @@ -15,7 +15,7 @@ So what does Catch2 bring to the party that differentiates it from these? Apart ## Key Features * Quick and easy to get started. Just download two files, add them into your project and you're away. -* No external dependencies. As long as you can compile C++14 and have the C++ standard library available. +* No external dependencies. As long as you can compile C++17 and have the C++ standard library available. * Write test cases as, self-registering, functions (or methods, if you prefer). * Divide test cases into sections, each of which is run in isolation (eliminates the need for fixtures). * Use BDD-style Given-When-Then sections as well as traditional unit test cases. diff --git a/examples/010-TestCase.cpp b/examples/010-TestCase.cpp index 9e5cd8cd..36a54916 100644 --- a/examples/010-TestCase.cpp +++ b/examples/010-TestCase.cpp @@ -27,7 +27,7 @@ TEST_CASE( "Factorials of 1 and higher are computed (pass)", "[single-file]" ) { } // Compile & run: -// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 010-TestCase 010-TestCase.cpp && 010-TestCase --success +// - g++ -std=c++17 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 010-TestCase 010-TestCase.cpp && 010-TestCase --success // - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 010-TestCase.cpp && 010-TestCase --success // Expected compact output (all assertions): diff --git a/examples/020-TestCase-1.cpp b/examples/020-TestCase-1.cpp index a9d87dbc..63b4c532 100644 --- a/examples/020-TestCase-1.cpp +++ b/examples/020-TestCase-1.cpp @@ -18,8 +18,8 @@ TEST_CASE( "1: All test cases reside in other .cpp files (empty)", "[multi-file: // Here just to show there are two source files via option --list-tests. // Compile & run: -// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -c 020-TestCase-1.cpp -// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 020-TestCase TestCase-1.o 020-TestCase-2.cpp && 020-TestCase --success +// - g++ -std=c++17 -Wall -I$(CATCH_SINGLE_INCLUDE) -c 020-TestCase-1.cpp +// - g++ -std=c++17 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 020-TestCase TestCase-1.o 020-TestCase-2.cpp && 020-TestCase --success // // - cl -EHsc -I%CATCH_SINGLE_INCLUDE% -c 020-TestCase-1.cpp // - cl -EHsc -I%CATCH_SINGLE_INCLUDE% -Fe020-TestCase.exe 020-TestCase-1.obj 020-TestCase-2.cpp && 020-TestCase --success diff --git a/examples/030-Asn-Require-Check.cpp b/examples/030-Asn-Require-Check.cpp index 62cd3cfc..d9c526ab 100644 --- a/examples/030-Asn-Require-Check.cpp +++ b/examples/030-Asn-Require-Check.cpp @@ -61,7 +61,7 @@ TEST_CASE( "Assert that something is false (continue after failure)", "[check-fa } // Compile & run: -// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 030-Asn-Require-Check 030-Asn-Require-Check.cpp && 030-Asn-Require-Check --success +// - g++ -std=c++17 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 030-Asn-Require-Check 030-Asn-Require-Check.cpp && 030-Asn-Require-Check --success // - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 030-Asn-Require-Check.cpp && 030-Asn-Require-Check --success // Expected compact output (all assertions): diff --git a/examples/100-Fix-Section.cpp b/examples/100-Fix-Section.cpp index 7c8d8aa8..a7a79eb4 100644 --- a/examples/100-Fix-Section.cpp +++ b/examples/100-Fix-Section.cpp @@ -53,7 +53,7 @@ TEST_CASE( "vectors can be sized and resized", "[vector]" ) { } // Compile & run: -// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 100-Fix-Section 100-Fix-Section.cpp && 100-Fix-Section --success +// - g++ -std=c++17 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 100-Fix-Section 100-Fix-Section.cpp && 100-Fix-Section --success // - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 100-Fix-Section.cpp && 100-Fix-Section --success // Expected compact output (all assertions): diff --git a/examples/110-Fix-ClassFixture.cpp b/examples/110-Fix-ClassFixture.cpp index 614c3797..5faef13f 100644 --- a/examples/110-Fix-ClassFixture.cpp +++ b/examples/110-Fix-ClassFixture.cpp @@ -60,11 +60,11 @@ TEST_CASE_METHOD( UniqueTestsFixture, "Create Employee/Normal", "[create]" ) { } // Compile & run: -// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 110-Fix-ClassFixture 110-Fix-ClassFixture.cpp && 110-Fix-ClassFixture --success +// - g++ -std=c++17 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 110-Fix-ClassFixture 110-Fix-ClassFixture.cpp && 110-Fix-ClassFixture --success // - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 110-Fix-ClassFixture.cpp && 110-Fix-ClassFixture --success // // Compile with pkg-config: -// - g++ -std=c++14 -Wall $(pkg-config catch2-with-main --cflags) -o 110-Fix-ClassFixture 110-Fix-ClassFixture.cpp $(pkg-config catch2-with-main --libs) +// - g++ -std=c++17 -Wall $(pkg-config catch2-with-main --cflags) -o 110-Fix-ClassFixture 110-Fix-ClassFixture.cpp $(pkg-config catch2-with-main --libs) // Expected compact output (all assertions): // diff --git a/examples/120-Bdd-ScenarioGivenWhenThen.cpp b/examples/120-Bdd-ScenarioGivenWhenThen.cpp index 345d53c3..8e928b19 100644 --- a/examples/120-Bdd-ScenarioGivenWhenThen.cpp +++ b/examples/120-Bdd-ScenarioGivenWhenThen.cpp @@ -56,7 +56,7 @@ SCENARIO( "vectors can be sized and resized", "[vector]" ) { } // Compile & run: -// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 120-Bdd-ScenarioGivenWhenThen 120-Bdd-ScenarioGivenWhenThen.cpp && 120-Bdd-ScenarioGivenWhenThen --success +// - g++ -std=c++17 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 120-Bdd-ScenarioGivenWhenThen 120-Bdd-ScenarioGivenWhenThen.cpp && 120-Bdd-ScenarioGivenWhenThen --success // - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 120-Bdd-ScenarioGivenWhenThen.cpp && 120-Bdd-ScenarioGivenWhenThen --success // Expected compact output (all assertions): diff --git a/examples/210-Evt-EventListeners.cpp b/examples/210-Evt-EventListeners.cpp index d1cfdb4f..26d5c62c 100644 --- a/examples/210-Evt-EventListeners.cpp +++ b/examples/210-Evt-EventListeners.cpp @@ -427,7 +427,7 @@ TEST_CASE_METHOD( Fixture, "3: Testcase with class-based fixture", "[tag-C][tag- } // Compile & run: -// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 210-Evt-EventListeners 210-Evt-EventListeners.cpp && 210-Evt-EventListeners --success +// - g++ -std=c++17 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 210-Evt-EventListeners 210-Evt-EventListeners.cpp && 210-Evt-EventListeners --success // - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 210-Evt-EventListeners.cpp && 210-Evt-EventListeners --success // Expected compact output (all assertions): diff --git a/examples/302-Gen-Table.cpp b/examples/302-Gen-Table.cpp index 3cdb1430..4dabd9d9 100644 --- a/examples/302-Gen-Table.cpp +++ b/examples/302-Gen-Table.cpp @@ -22,24 +22,21 @@ struct TestSubject { TEST_CASE("Table allows pre-computed test inputs and outputs", "[example][generator]") { - using std::make_tuple; // do setup here as normal TestSubject subj; SECTION("This section is run for each row in the table") { - std::string test_input; - size_t expected_output; - std::tie( test_input, expected_output ) = + const auto [test_input, expected_output] = GENERATE( table( { /* In this case one of the parameters to our test case is the * expected output, but this is not required. There could be * multiple expected values in the table, which can have any * (fixed) number of columns. */ - make_tuple( "one", 3 ), - make_tuple( "two", 3 ), - make_tuple( "three", 5 ), - make_tuple( "four", 4 ) } ) ); + { "one", 3 }, + { "two", 3 }, + { "three", 5 }, + { "four", 4 } } ) ); // run the test auto result = subj.GetLength(test_input); @@ -50,14 +47,4 @@ TEST_CASE("Table allows pre-computed test inputs and outputs", "[example][genera } // end section } -/* Possible simplifications where less legacy toolchain support is needed: - * - * - With libstdc++6 or newer, the make_tuple() calls can be omitted - * (technically C++17 but does not require -std in GCC/Clang). See - * https://stackoverflow.com/questions/12436586/tuple-vector-and-initializer-list - * - * - In C++17 mode std::tie() and the preceding variable declarations can be - * replaced by structured bindings: auto [test_input, expected] = GENERATE( - * table({ ... - */ // Compiling and running this file will result in 4 successful assertions diff --git a/extras/catch_amalgamated.cpp b/extras/catch_amalgamated.cpp index c85f39b3..b931d47c 100644 --- a/extras/catch_amalgamated.cpp +++ b/extras/catch_amalgamated.cpp @@ -84,7 +84,7 @@ namespace Catch { std::vector samples2; samples2.reserve(samples.size()); for (auto s : samples) { - samples2.push_back( FDuration( s ) ); + samples2.emplace_back( s ); } return { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1e3af147..10e38dda 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -76,11 +76,9 @@ set(IMPL_HEADERS ${SOURCES_DIR}/internal/catch_config_counter.hpp ${SOURCES_DIR}/internal/catch_config_prefix_messages.hpp ${SOURCES_DIR}/internal/catch_config_static_analysis_support.hpp - ${SOURCES_DIR}/internal/catch_config_uncaught_exceptions.hpp ${SOURCES_DIR}/internal/catch_config_wchar.hpp ${SOURCES_DIR}/internal/catch_console_colour.hpp ${SOURCES_DIR}/internal/catch_console_width.hpp - ${SOURCES_DIR}/internal/catch_container_nonmembers.hpp ${SOURCES_DIR}/internal/catch_context.hpp ${SOURCES_DIR}/internal/catch_debug_console.hpp ${SOURCES_DIR}/internal/catch_debugger.hpp @@ -99,7 +97,6 @@ set(IMPL_HEADERS ${SOURCES_DIR}/internal/catch_lazy_expr.hpp ${SOURCES_DIR}/internal/catch_leak_detector.hpp ${SOURCES_DIR}/internal/catch_list.hpp - ${SOURCES_DIR}/internal/catch_logical_traits.hpp ${SOURCES_DIR}/internal/catch_message_info.hpp ${SOURCES_DIR}/internal/catch_meta.hpp ${SOURCES_DIR}/internal/catch_move_and_forward.hpp @@ -365,8 +362,8 @@ set_target_properties(Catch2 PROPERTIES SOVERSION ${PROJECT_VERSION} ) -# require C++14 -target_compile_features(Catch2 PUBLIC cxx_std_14) +# require C++17 +target_compile_features(Catch2 PUBLIC cxx_std_17) configure_file( "${SOURCES_DIR}/catch_user_config.hpp.in" @@ -450,7 +447,7 @@ if(CATCH_BUILD_EXAMPLES OR CATCH_BUILD_EXTRA_TESTS) $ ) target_compile_definitions(Catch2_buildall_interface INTERFACE CATCH_CONFIG_STATIC) - target_compile_features(Catch2_buildall_interface INTERFACE cxx_std_14) + target_compile_features(Catch2_buildall_interface INTERFACE cxx_std_17) endif() list(APPEND CATCH_IMPL_TARGETS Catch2 Catch2WithMain) diff --git a/src/catch2/benchmark/catch_optimizer.hpp b/src/catch2/benchmark/catch_optimizer.hpp index 61e6571f..e701f50f 100644 --- a/src/catch2/benchmark/catch_optimizer.hpp +++ b/src/catch2/benchmark/catch_optimizer.hpp @@ -64,12 +64,12 @@ namespace Catch { } template - inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> std::enable_if_t::value> { + inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> std::enable_if_t> { deoptimize_value(CATCH_FORWARD(fn) (CATCH_FORWARD(args)...)); } template - inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> std::enable_if_t::value> { + inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> std::enable_if_t> { CATCH_FORWARD((fn)) (CATCH_FORWARD(args)...); } } // namespace Benchmark diff --git a/src/catch2/benchmark/detail/catch_analyse.cpp b/src/catch2/benchmark/detail/catch_analyse.cpp index 14d7f450..7edb27d1 100644 --- a/src/catch2/benchmark/detail/catch_analyse.cpp +++ b/src/catch2/benchmark/detail/catch_analyse.cpp @@ -46,7 +46,7 @@ namespace Catch { std::vector samples2; samples2.reserve(samples.size()); for (auto s : samples) { - samples2.push_back( FDuration( s ) ); + samples2.emplace_back( s ); } return { diff --git a/src/catch2/benchmark/detail/catch_benchmark_function.hpp b/src/catch2/benchmark/detail/catch_benchmark_function.hpp index 90b07b76..f6371d48 100644 --- a/src/catch2/benchmark/detail/catch_benchmark_function.hpp +++ b/src/catch2/benchmark/detail/catch_benchmark_function.hpp @@ -21,7 +21,7 @@ namespace Catch { namespace Benchmark { namespace Detail { template - static constexpr bool is_related_v = std::is_same, std::decay_t>::value; + static constexpr bool is_related_v = std::is_same_v, std::decay_t>; /// We need to reinvent std::function because every piece of code that might add overhead /// in a measurement context needs to have consistent performance characteristics so that we diff --git a/src/catch2/catch_all.hpp b/src/catch2/catch_all.hpp index 2417d856..74db3ef0 100644 --- a/src/catch2/catch_all.hpp +++ b/src/catch2/catch_all.hpp @@ -57,11 +57,9 @@ #include #include #include -#include #include #include #include -#include #include #include #include @@ -80,7 +78,6 @@ #include #include #include -#include #include #include #include diff --git a/src/catch2/catch_approx.hpp b/src/catch2/catch_approx.hpp index de4d2ab4..06da31f9 100644 --- a/src/catch2/catch_approx.hpp +++ b/src/catch2/catch_approx.hpp @@ -29,7 +29,7 @@ namespace Catch { Approx operator-() const; - template ::value>> + template >> Approx operator()( T const& value ) const { Approx approx( static_cast(value) ); approx.m_epsilon = m_epsilon; @@ -38,67 +38,67 @@ namespace Catch { return approx; } - template ::value>> + template >> explicit Approx( T const& value ): Approx(static_cast(value)) {} - template ::value>> + template >> friend bool operator == ( const T& lhs, Approx const& rhs ) { auto lhs_v = static_cast(lhs); return rhs.equalityComparisonImpl(lhs_v); } - template ::value>> + template >> friend bool operator == ( Approx const& lhs, const T& rhs ) { return operator==( rhs, lhs ); } - template ::value>> + template >> friend bool operator != ( T const& lhs, Approx const& rhs ) { return !operator==( lhs, rhs ); } - template ::value>> + template >> friend bool operator != ( Approx const& lhs, T const& rhs ) { return !operator==( rhs, lhs ); } - template ::value>> + template >> friend bool operator <= ( T const& lhs, Approx const& rhs ) { return static_cast(lhs) < rhs.m_value || lhs == rhs; } - template ::value>> + template >> friend bool operator <= ( Approx const& lhs, T const& rhs ) { return lhs.m_value < static_cast(rhs) || lhs == rhs; } - template ::value>> + template >> friend bool operator >= ( T const& lhs, Approx const& rhs ) { return static_cast(lhs) > rhs.m_value || lhs == rhs; } - template ::value>> + template >> friend bool operator >= ( Approx const& lhs, T const& rhs ) { return lhs.m_value > static_cast(rhs) || lhs == rhs; } - template ::value>> + template >> Approx& epsilon( T const& newEpsilon ) { const auto epsilonAsDouble = static_cast(newEpsilon); setEpsilon(epsilonAsDouble); return *this; } - template ::value>> + template >> Approx& margin( T const& newMargin ) { const auto marginAsDouble = static_cast(newMargin); setMargin(marginAsDouble); return *this; } - template ::value>> + template >> Approx& scale( T const& newScale ) { m_scale = static_cast(newScale); return *this; diff --git a/src/catch2/catch_session.hpp b/src/catch2/catch_session.hpp index 23fc6f80..86f7235a 100644 --- a/src/catch2/catch_session.hpp +++ b/src/catch2/catch_session.hpp @@ -16,7 +16,6 @@ namespace Catch { - // TODO: Use C++17 `inline` variables constexpr int UnspecifiedErrorExitCode = 1; constexpr int NoTestsRunExitCode = 2; constexpr int UnmatchedTestSpecExitCode = 3; diff --git a/src/catch2/catch_tostring.cpp b/src/catch2/catch_tostring.cpp index 4d80b173..cadfdb56 100644 --- a/src/catch2/catch_tostring.cpp +++ b/src/catch2/catch_tostring.cpp @@ -13,6 +13,7 @@ #include #include +#include namespace Catch { @@ -135,11 +136,9 @@ std::string StringMaker::convert(const std::string& str) { return Detail::convertIntoString( str ); } -#ifdef CATCH_CONFIG_CPP17_STRING_VIEW std::string StringMaker::convert(std::string_view str) { return Detail::convertIntoString( StringRef( str.data(), str.size() ) ); } -#endif std::string StringMaker::convert(char const* str) { if (str) { @@ -166,11 +165,9 @@ std::string StringMaker::convert(const std::wstring& wstr) { return ::Catch::Detail::stringify(s); } -# ifdef CATCH_CONFIG_CPP17_STRING_VIEW std::string StringMaker::convert(std::wstring_view str) { return StringMaker::convert(std::wstring(str)); } -# endif std::string StringMaker::convert(wchar_t const * str) { if (str) { @@ -188,12 +185,9 @@ std::string StringMaker::convert(wchar_t * str) { } #endif -#if defined(CATCH_CONFIG_CPP17_BYTE) -#include std::string StringMaker::convert(std::byte value) { return ::Catch::Detail::stringify(std::to_integer(value)); } -#endif // defined(CATCH_CONFIG_CPP17_BYTE) std::string StringMaker::convert(int value) { return ::Catch::Detail::stringify(static_cast(value)); diff --git a/src/catch2/catch_tostring.hpp b/src/catch2/catch_tostring.hpp index 41f89413..bf6bcd56 100644 --- a/src/catch2/catch_tostring.hpp +++ b/src/catch2/catch_tostring.hpp @@ -20,9 +20,7 @@ #include #include -#ifdef CATCH_CONFIG_CPP17_STRING_VIEW #include -#endif #ifdef _MSC_VER #pragma warning(push) @@ -78,13 +76,13 @@ namespace Catch { template std::enable_if_t< - !std::is_enum::value && !std::is_base_of::value, + !std::is_enum_v && !std::is_base_of_v, std::string> convertUnstreamable( T const& ) { return std::string(Detail::unprintableString); } template std::enable_if_t< - !std::is_enum::value && std::is_base_of::value, + !std::is_enum_v && std::is_base_of_v, std::string> convertUnstreamable(T const& ex) { return ex.what(); } @@ -92,7 +90,7 @@ namespace Catch { template std::enable_if_t< - std::is_enum::value, + std::is_enum_v, std::string> convertUnstreamable( T const& value ) { return convertUnknownEnumToString( value ); } @@ -173,12 +171,10 @@ namespace Catch { static std::string convert(const std::string& str); }; -#ifdef CATCH_CONFIG_CPP17_STRING_VIEW template<> struct StringMaker { static std::string convert(std::string_view str); }; -#endif template<> struct StringMaker { @@ -195,12 +191,10 @@ namespace Catch { static std::string convert(const std::wstring& wstr); }; -# ifdef CATCH_CONFIG_CPP17_STRING_VIEW template<> struct StringMaker { static std::string convert(std::wstring_view str); }; -# endif template<> struct StringMaker { @@ -236,12 +230,10 @@ namespace Catch { } }; -#if defined(CATCH_CONFIG_CPP17_BYTE) template<> struct StringMaker { static std::string convert(std::byte value); }; -#endif // defined(CATCH_CONFIG_CPP17_BYTE) template<> struct StringMaker { static std::string convert(int value); @@ -387,7 +379,7 @@ namespace Catch { } #endif // CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER -#if defined(CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_OPTIONAL) +#if defined(CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER) #include namespace Catch { template @@ -417,7 +409,7 @@ namespace Catch { template< typename Tuple, std::size_t N = 0, - bool = (N < std::tuple_size::value) + bool = (N < std::tuple_size_v) > struct TupleElementPrinter { static void print(const Tuple& tuple, std::ostream& os) { @@ -451,7 +443,7 @@ namespace Catch { } #endif // CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER -#if defined(CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_VARIANT) +#if defined(CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER) #include namespace Catch { template<> diff --git a/src/catch2/catch_user_config.hpp.in b/src/catch2/catch_user_config.hpp.in index 18e2ef1a..880ec665 100644 --- a/src/catch2/catch_user_config.hpp.in +++ b/src/catch2/catch_user_config.hpp.in @@ -60,56 +60,6 @@ -#cmakedefine CATCH_CONFIG_CPP17_BYTE -#cmakedefine CATCH_CONFIG_NO_CPP17_BYTE - -#if defined( CATCH_CONFIG_CPP17_BYTE ) && \ - defined( CATCH_CONFIG_NO_CPP17_BYTE ) -# error Cannot force CPP17_BYTE to both ON and OFF -#endif - - - -#cmakedefine CATCH_CONFIG_CPP17_OPTIONAL -#cmakedefine CATCH_CONFIG_NO_CPP17_OPTIONAL - -#if defined( CATCH_CONFIG_CPP17_OPTIONAL ) && \ - defined( CATCH_CONFIG_NO_CPP17_OPTIONAL ) -# error Cannot force CPP17_OPTIONAL to both ON and OFF -#endif - - - -#cmakedefine CATCH_CONFIG_CPP17_STRING_VIEW -#cmakedefine CATCH_CONFIG_NO_CPP17_STRING_VIEW - -#if defined( CATCH_CONFIG_CPP17_STRING_VIEW ) && \ - defined( CATCH_CONFIG_NO_CPP17_STRING_VIEW ) -# error Cannot force CPP17_STRING_VIEW to both ON and OFF -#endif - - - -#cmakedefine CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS -#cmakedefine CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS - -#if defined( CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS ) && \ - defined( CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS ) -# error Cannot force CPP17_UNCAUGHT_EXCEPTIONS to both ON and OFF -#endif - - - -#cmakedefine CATCH_CONFIG_CPP17_VARIANT -#cmakedefine CATCH_CONFIG_NO_CPP17_VARIANT - -#if defined( CATCH_CONFIG_CPP17_VARIANT ) && \ - defined( CATCH_CONFIG_NO_CPP17_VARIANT ) -# error Cannot force CPP17_VARIANT to both ON and OFF -#endif - - - #cmakedefine CATCH_CONFIG_GLOBAL_NEXTAFTER #cmakedefine CATCH_CONFIG_NO_GLOBAL_NEXTAFTER diff --git a/src/catch2/generators/catch_generators.hpp b/src/catch2/generators/catch_generators.hpp index 0f35a996..0690bf6a 100644 --- a/src/catch2/generators/catch_generators.hpp +++ b/src/catch2/generators/catch_generators.hpp @@ -88,7 +88,7 @@ namespace Detail { template class FixedValuesGenerator final : public IGenerator { - static_assert(!std::is_same::value, + static_assert(!std::is_same_v, "FixedValuesGenerator does not support bools because of std::vector" "specialization, use SingleValue Generator instead."); std::vector m_values; @@ -131,7 +131,7 @@ namespace Detail { m_generators.emplace_back( value( CATCH_MOVE( val ) ) ); } template - std::enable_if_t, T>::value> + std::enable_if_t, T>> add_generator( U&& val ) { add_generator( T( CATCH_FORWARD( val ) ) ); } diff --git a/src/catch2/generators/catch_generators_adapters.hpp b/src/catch2/generators/catch_generators_adapters.hpp index f623bd29..f0418ebd 100644 --- a/src/catch2/generators/catch_generators_adapters.hpp +++ b/src/catch2/generators/catch_generators_adapters.hpp @@ -58,7 +58,7 @@ namespace Generators { class FilterGenerator final : public IGenerator { GeneratorWrapper m_generator; Predicate m_predicate; - static_assert(!std::is_reference::value, "This would most likely result in a dangling reference"); + static_assert(!std::is_reference_v, "This would most likely result in a dangling reference"); public: template FilterGenerator(P&& pred, GeneratorWrapper&& generator): @@ -97,7 +97,7 @@ namespace Generators { template class RepeatGenerator final : public IGenerator { - static_assert(!std::is_same::value, + static_assert(!std::is_same_v, "RepeatGenerator currently does not support bools" "because of std::vector specialization"); GeneratorWrapper m_generator; diff --git a/src/catch2/generators/catch_generators_random.hpp b/src/catch2/generators/catch_generators_random.hpp index 71283561..49e6052d 100644 --- a/src/catch2/generators/catch_generators_random.hpp +++ b/src/catch2/generators/catch_generators_random.hpp @@ -83,7 +83,7 @@ public: }; template -std::enable_if_t::value, GeneratorWrapper> +std::enable_if_t, GeneratorWrapper> random(T a, T b) { return GeneratorWrapper( Catch::Detail::make_unique>(a, b, Detail::getSeed()) @@ -91,7 +91,7 @@ random(T a, T b) { } template -std::enable_if_t::value, +std::enable_if_t, GeneratorWrapper> random(T a, T b) { return GeneratorWrapper( diff --git a/src/catch2/generators/catch_generators_range.hpp b/src/catch2/generators/catch_generators_range.hpp index 55d673c2..159459d8 100644 --- a/src/catch2/generators/catch_generators_range.hpp +++ b/src/catch2/generators/catch_generators_range.hpp @@ -52,20 +52,20 @@ public: template GeneratorWrapper range(T const& start, T const& end, T const& step) { - static_assert(std::is_arithmetic::value && !std::is_same::value, "Type must be numeric"); + static_assert(std::is_arithmetic_v && !std::is_same_v, "Type must be numeric"); return GeneratorWrapper(Catch::Detail::make_unique>(start, end, step)); } template GeneratorWrapper range(T const& start, T const& end) { - static_assert(std::is_integral::value && !std::is_same::value, "Type must be an integer"); + static_assert(std::is_integral_v && !std::is_same_v, "Type must be an integer"); return GeneratorWrapper(Catch::Detail::make_unique>(start, end)); } template class IteratorGenerator final : public IGenerator { - static_assert(!std::is_same::value, + static_assert(!std::is_same_v, "IteratorGenerator currently does not support bools" "because of std::vector specialization"); diff --git a/src/catch2/internal/catch_clara.hpp b/src/catch2/internal/catch_clara.hpp index 85874a15..49983b54 100644 --- a/src/catch2/internal/catch_clara.hpp +++ b/src/catch2/internal/catch_clara.hpp @@ -20,14 +20,7 @@ # pragma GCC diagnostic ignored "-Wsign-conversion" #endif -#ifndef CLARA_CONFIG_OPTIONAL_TYPE -# ifdef __has_include -# if __has_include( ) && __cplusplus >= 201703L -# include -# define CLARA_CONFIG_OPTIONAL_TYPE std::optional -# endif -# endif -#endif +#include #include #include @@ -328,10 +321,9 @@ namespace Catch { std::string& target ); ParserResult convertInto( std::string const& source, bool& target ); -#ifdef CLARA_CONFIG_OPTIONAL_TYPE template auto convertInto( std::string const& source, - CLARA_CONFIG_OPTIONAL_TYPE& target ) + std::optional& target ) -> ParserResult { T temp; auto result = convertInto( source, temp ); @@ -339,7 +331,6 @@ namespace Catch { target = CATCH_MOVE( temp ); return result; } -#endif // CLARA_CONFIG_OPTIONAL_TYPE struct BoundRef : Catch::Detail::NonCopyable { virtual ~BoundRef() = default; @@ -393,7 +384,7 @@ namespace Catch { template struct LambdaInvoker { static_assert( - std::is_same::value, + std::is_same_v, "Lambda must return void or clara::ParserResult" ); template @@ -449,8 +440,8 @@ namespace Catch { UnaryLambdaTraits::isValid, "Supplied lambda must take exactly one argument" ); static_assert( - std::is_same::ArgType, - bool>::value, + std::is_same_v::ArgType, + bool>, "flags must be boolean" ); explicit BoundFlagLambda( L const& lambda ): diff --git a/src/catch2/internal/catch_compiler_capabilities.hpp b/src/catch2/internal/catch_compiler_capabilities.hpp index 983fb63b..72fa55b0 100644 --- a/src/catch2/internal/catch_compiler_capabilities.hpp +++ b/src/catch2/internal/catch_compiler_capabilities.hpp @@ -29,10 +29,6 @@ #ifdef __cplusplus -# if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) -# define CATCH_CPP17_OR_GREATER -# endif - # if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) # define CATCH_CPP20_OR_GREATER # endif @@ -198,8 +194,7 @@ # define _BSD_SOURCE // some versions of cygwin (most) do not support std::to_string. Use the libstd check. // https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813 -# if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \ - && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) +# if !(defined(_GLIBCXX_USE_C99) && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) # define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING @@ -275,43 +270,6 @@ #define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER #endif -// Various stdlib support checks that require __has_include -#if defined(__has_include) - // Check if string_view is available and usable - #if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW - #endif - - // Check if optional is available and usable - # if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL - # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) - - // Check if byte is available and usable - # if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # include - # if defined(__cpp_lib_byte) && (__cpp_lib_byte > 0) - # define CATCH_INTERNAL_CONFIG_CPP17_BYTE - # endif - # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) - - // Check if variant is available and usable - # if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # if defined(__clang__) && (__clang_major__ < 8) - // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 - // fix should be in clang 8, workaround in libstdc++ 8.2 - # include - # if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) - # define CATCH_CONFIG_NO_CPP17_VARIANT - # else - # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT - # endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) - # else - # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT - # endif // defined(__clang__) && (__clang_major__ < 8) - # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) -#endif // defined(__has_include) - #if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH) # define CATCH_CONFIG_WINDOWS_SEH @@ -329,22 +287,6 @@ # define CATCH_CONFIG_CPP11_TO_STRING #endif -#if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL) -# define CATCH_CONFIG_CPP17_OPTIONAL -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW) -# define CATCH_CONFIG_CPP17_STRING_VIEW -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT) -# define CATCH_CONFIG_CPP17_VARIANT -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && !defined(CATCH_CONFIG_CPP17_BYTE) -# define CATCH_CONFIG_CPP17_BYTE -#endif - #if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) # define CATCH_INTERNAL_CONFIG_NEW_CAPTURE diff --git a/src/catch2/internal/catch_config_uncaught_exceptions.hpp b/src/catch2/internal/catch_config_uncaught_exceptions.hpp deleted file mode 100644 index 20b1dfca..00000000 --- a/src/catch2/internal/catch_config_uncaught_exceptions.hpp +++ /dev/null @@ -1,46 +0,0 @@ - -// Copyright Catch2 Authors -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE.txt or copy at -// https://www.boost.org/LICENSE_1_0.txt) - -// SPDX-License-Identifier: BSL-1.0 - -/** \file - * Wrapper for UNCAUGHT_EXCEPTIONS configuration option - * - * For some functionality, Catch2 requires to know whether there is - * an active exception. Because `std::uncaught_exception` is deprecated - * in C++17, we want to use `std::uncaught_exceptions` if possible. - */ - -#ifndef CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED -#define CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED - -#include - -#if defined(_MSC_VER) -# if _MSC_VER >= 1900 // Visual Studio 2015 or newer -# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS -# endif -#endif - - -#include - -#if defined(__cpp_lib_uncaught_exceptions) \ - && !defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) - -# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS -#endif // __cpp_lib_uncaught_exceptions - - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) \ - && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) \ - && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) - -# define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS -#endif - - -#endif // CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED diff --git a/src/catch2/internal/catch_container_nonmembers.hpp b/src/catch2/internal/catch_container_nonmembers.hpp deleted file mode 100644 index 33b28a9e..00000000 --- a/src/catch2/internal/catch_container_nonmembers.hpp +++ /dev/null @@ -1,73 +0,0 @@ - -// Copyright Catch2 Authors -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE.txt or copy at -// https://www.boost.org/LICENSE_1_0.txt) - -// SPDX-License-Identifier: BSL-1.0 -#ifndef CATCH_CONTAINER_NONMEMBERS_HPP_INCLUDED -#define CATCH_CONTAINER_NONMEMBERS_HPP_INCLUDED - -#include - -#include -#include - -// We want a simple polyfill over `std::empty`, `std::size` and so on -// for C++14 or C++ libraries with incomplete support. -// We also have to handle that MSVC std lib will happily provide these -// under older standards. -#if defined(CATCH_CPP17_OR_GREATER) || defined(_MSC_VER) - -// We are already using this header either way, so there shouldn't -// be much additional overhead in including it to get the feature -// test macros -#include - -# if !defined(__cpp_lib_nonmember_container_access) -# define CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS -# endif - -#else -#define CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS -#endif - - - -namespace Catch { -namespace Detail { - -#if defined(CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS) - template - constexpr auto empty(Container const& cont) -> decltype(cont.empty()) { - return cont.empty(); - } - template - constexpr bool empty(const T (&)[N]) noexcept { - // GCC < 7 does not support the const T(&)[] parameter syntax - // so we have to ignore the length explicitly - (void)N; - return false; - } - template - constexpr bool empty(std::initializer_list list) noexcept { - return list.size() > 0; - } - - - template - constexpr auto size(Container const& cont) -> decltype(cont.size()) { - return cont.size(); - } - template - constexpr std::size_t size(const T(&)[N]) noexcept { - return N; - } -#endif // CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS - -} // end namespace Detail -} // end namespace Catch - - - -#endif // CATCH_CONTAINER_NONMEMBERS_HPP_INCLUDED diff --git a/src/catch2/internal/catch_decomposer.hpp b/src/catch2/internal/catch_decomposer.hpp index fcc017dd..18398dc4 100644 --- a/src/catch2/internal/catch_decomposer.hpp +++ b/src/catch2/internal/catch_decomposer.hpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include @@ -129,7 +128,7 @@ namespace Catch { namespace Detail { - // This was added in C++20, but we require only C++14 for now. + // This was added in C++20, but we require only C++17 for now. template using RemoveCVRef_t = std::remove_cv_t>; } @@ -148,8 +147,8 @@ namespace Catch { template struct capture_by_value : std::integral_constant::value || - std::is_enum::value> {}; + std::is_arithmetic_v || + std::is_enum_v> {}; #if defined( CATCH_CONFIG_CPP20_COMPARE_OVERLOADS ) template <> @@ -294,9 +293,9 @@ namespace Catch { template \ constexpr friend auto operator op( ExprLhs&& lhs, RhsT&& rhs ) \ -> std::enable_if_t< \ - Detail::conjunction, \ - Detail::negation>>>::value, \ + std::conjunction_v, \ + std::negation>>>, \ BinaryExpr> { \ return { \ static_cast( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ @@ -304,8 +303,8 @@ namespace Catch { template \ constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ -> std::enable_if_t< \ - Detail::conjunction, \ - capture_by_value>::value, \ + std::conjunction_v, \ + capture_by_value>, \ BinaryExpr> { \ return { \ static_cast( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ @@ -313,12 +312,12 @@ namespace Catch { template \ constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ -> std::enable_if_t< \ - Detail::conjunction< \ - Detail::negation>, \ + std::conjunction_v< \ + std::negation>, \ Detail::is_eq_0_comparable, \ /* We allow long because we want `ptr op NULL` to be accepted */ \ - Detail::disjunction, \ - std::is_same>>::value, \ + std::disjunction, \ + std::is_same>>, \ BinaryExpr> { \ if ( rhs != 0 ) { throw_test_failure_exception(); } \ return { \ @@ -327,12 +326,12 @@ namespace Catch { template \ constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ -> std::enable_if_t< \ - Detail::conjunction< \ - Detail::negation>, \ + std::conjunction_v< \ + std::negation>, \ Detail::is_eq_0_comparable, \ /* We allow long because we want `ptr op NULL` to be accepted */ \ - Detail::disjunction, \ - std::is_same>>::value, \ + std::disjunction, \ + std::is_same>>, \ BinaryExpr> { \ if ( lhs.m_lhs != 0 ) { throw_test_failure_exception(); } \ return { static_cast( 0 op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ @@ -348,9 +347,9 @@ namespace Catch { template \ constexpr friend auto operator op( ExprLhs&& lhs, RhsT&& rhs ) \ -> std::enable_if_t< \ - Detail::conjunction, \ - Detail::negation>>>::value, \ + std::conjunction_v, \ + std::negation>>>, \ BinaryExpr> { \ return { \ static_cast( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ @@ -358,8 +357,8 @@ namespace Catch { template \ constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ -> std::enable_if_t< \ - Detail::conjunction, \ - capture_by_value>::value, \ + std::conjunction_v, \ + capture_by_value> , \ BinaryExpr> { \ return { \ static_cast( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ @@ -367,10 +366,10 @@ namespace Catch { template \ constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ -> std::enable_if_t< \ - Detail::conjunction< \ - Detail::negation>, \ + std::conjunction_v< \ + std::negation>, \ Detail::is_##id##_0_comparable, \ - std::is_same>::value, \ + std::is_same>, \ BinaryExpr> { \ if ( rhs != 0 ) { throw_test_failure_exception(); } \ return { \ @@ -379,10 +378,10 @@ namespace Catch { template \ constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ -> std::enable_if_t< \ - Detail::conjunction< \ - Detail::negation>, \ + std::conjunction_v< \ + std::negation>, \ Detail::is_##id##_0_comparable, \ - std::is_same>::value, \ + std::is_same>, \ BinaryExpr> { \ if ( lhs.m_lhs != 0 ) { throw_test_failure_exception(); } \ return { static_cast( 0 op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ diff --git a/src/catch2/internal/catch_is_permutation.hpp b/src/catch2/internal/catch_is_permutation.hpp index ba7082da..51716f07 100644 --- a/src/catch2/internal/catch_is_permutation.hpp +++ b/src/catch2/internal/catch_is_permutation.hpp @@ -49,7 +49,7 @@ namespace Catch { template constexpr - std::enable_if_t::value, + std::enable_if_t, std::ptrdiff_t> sentinel_distance( ForwardIter iter, const Sentinel sentinel ) { std::ptrdiff_t dist = 0; diff --git a/src/catch2/internal/catch_jsonwriter.hpp b/src/catch2/internal/catch_jsonwriter.hpp index 23b56d13..a0ad6300 100644 --- a/src/catch2/internal/catch_jsonwriter.hpp +++ b/src/catch2/internal/catch_jsonwriter.hpp @@ -35,7 +35,7 @@ namespace Catch { template void write( T const& value ) && { - writeImpl( value, !std::is_arithmetic::value ); + writeImpl( value, !std::is_arithmetic_v ); } void write( StringRef value ) &&; void write( bool value ) &&; @@ -49,7 +49,7 @@ namespace Catch { // and multiple iteration over the strings template ::value>> + !std::is_convertible_v>> void writeImpl( T const& value, bool quote_value ) { m_sstream << value; writeImpl( m_sstream.str(), quote_value ); diff --git a/src/catch2/internal/catch_logical_traits.hpp b/src/catch2/internal/catch_logical_traits.hpp deleted file mode 100644 index bd875659..00000000 --- a/src/catch2/internal/catch_logical_traits.hpp +++ /dev/null @@ -1,44 +0,0 @@ - -// Copyright Catch2 Authors -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE.txt or copy at -// https://www.boost.org/LICENSE_1_0.txt) - -// SPDX-License-Identifier: BSL-1.0 -#ifndef CATCH_LOGICAL_TRAITS_HPP_INCLUDED -#define CATCH_LOGICAL_TRAITS_HPP_INCLUDED - -#include - -namespace Catch { -namespace Detail { - -#if defined( __cpp_lib_logical_traits ) && __cpp_lib_logical_traits >= 201510 - - using std::conjunction; - using std::disjunction; - using std::negation; - -#else - - template struct conjunction : std::true_type {}; - template struct conjunction : B1 {}; - template - struct conjunction - : std::conditional_t, B1> {}; - - template struct disjunction : std::false_type {}; - template struct disjunction : B1 {}; - template - struct disjunction - : std::conditional_t> {}; - - template - struct negation : std::integral_constant {}; - -#endif - -} // namespace Detail -} // namespace Catch - -#endif // CATCH_LOGICAL_TRAITS_HPP_INCLUDED diff --git a/src/catch2/internal/catch_meta.hpp b/src/catch2/internal/catch_meta.hpp index 6fbc13a5..1395feca 100644 --- a/src/catch2/internal/catch_meta.hpp +++ b/src/catch2/internal/catch_meta.hpp @@ -27,16 +27,8 @@ namespace Catch { template struct is_callable : decltype(is_callable_tester::test(0)) {}; - -#if defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703 - // std::result_of is deprecated in C++17 and removed in C++20. Hence, it is - // replaced with std::invoke_result here. template using FunctionReturnType = std::remove_reference_t>>; -#else - template - using FunctionReturnType = std::remove_reference_t>>; -#endif } // namespace Catch diff --git a/src/catch2/internal/catch_output_redirect.cpp b/src/catch2/internal/catch_output_redirect.cpp index 245e1376..27c16b51 100644 --- a/src/catch2/internal/catch_output_redirect.cpp +++ b/src/catch2/internal/catch_output_redirect.cpp @@ -311,23 +311,6 @@ namespace Catch { } } - RedirectGuard::RedirectGuard( RedirectGuard&& rhs ) noexcept: - m_redirect( rhs.m_redirect ), - m_activate( rhs.m_activate ), - m_previouslyActive( rhs.m_previouslyActive ), - m_moved( false ) { - rhs.m_moved = true; - } - - RedirectGuard& RedirectGuard::operator=( RedirectGuard&& rhs ) noexcept { - m_redirect = rhs.m_redirect; - m_activate = rhs.m_activate; - m_previouslyActive = rhs.m_previouslyActive; - m_moved = false; - rhs.m_moved = true; - return *this; - } - } // namespace Catch #if defined( CATCH_CONFIG_NEW_CAPTURE ) diff --git a/src/catch2/internal/catch_output_redirect.hpp b/src/catch2/internal/catch_output_redirect.hpp index 51b796ba..7766e136 100644 --- a/src/catch2/internal/catch_output_redirect.hpp +++ b/src/catch2/internal/catch_output_redirect.hpp @@ -63,10 +63,6 @@ namespace Catch { RedirectGuard( RedirectGuard const& ) = delete; RedirectGuard& operator=( RedirectGuard const& ) = delete; - - // C++14 needs move-able guards to return them from functions - RedirectGuard( RedirectGuard&& rhs ) noexcept; - RedirectGuard& operator=( RedirectGuard&& rhs ) noexcept; }; RedirectGuard scopedActivate( OutputRedirect& redirectImpl ); diff --git a/src/catch2/internal/catch_random_floating_point_helpers.hpp b/src/catch2/internal/catch_random_floating_point_helpers.hpp index c59c0539..c056367e 100644 --- a/src/catch2/internal/catch_random_floating_point_helpers.hpp +++ b/src/catch2/internal/catch_random_floating_point_helpers.hpp @@ -27,7 +27,7 @@ namespace Catch { */ template FloatType gamma(FloatType a, FloatType b) { - static_assert( std::is_floating_point::value, + static_assert( std::is_floating_point_v, "gamma returns the largest ULP magnitude within " "floating point range [a, b]. This only makes sense " "for floating point types" ); diff --git a/src/catch2/internal/catch_random_integer_helpers.hpp b/src/catch2/internal/catch_random_integer_helpers.hpp index be4bbe92..14355a75 100644 --- a/src/catch2/internal/catch_random_integer_helpers.hpp +++ b/src/catch2/internal/catch_random_integer_helpers.hpp @@ -122,7 +122,7 @@ namespace Catch { template constexpr ExtendedMultResult extendedMult( UInt lhs, UInt rhs ) { - static_assert( std::is_unsigned::value, + static_assert( std::is_unsigned_v, "extendedMult can only handle unsigned integers" ); static_assert( sizeof( UInt ) < sizeof( std::uint64_t ), "Generic extendedMult can only handle types smaller " @@ -141,7 +141,7 @@ namespace Catch { std::enable_if_t= sizeof(TargetType), TargetType> fillBitsFrom(Generator& gen) { using gresult_type = typename Generator::result_type; - static_assert( std::is_unsigned::value, "Only unsigned integers are supported" ); + static_assert( std::is_unsigned_v, "Only unsigned integers are supported" ); static_assert( Generator::min() == 0 && Generator::max() == static_cast( -1 ), "Generator must be able to output all numbers in its result type (effectively it must be a random bit generator)" ); @@ -160,7 +160,7 @@ namespace Catch { std::enable_if_t fillBitsFrom(Generator& gen) { using gresult_type = typename Generator::result_type; - static_assert( std::is_unsigned::value, + static_assert( std::is_unsigned_v, "Only unsigned integers are supported" ); static_assert( Generator::min() == 0 && Generator::max() == static_cast( -1 ), @@ -188,12 +188,12 @@ namespace Catch { */ template constexpr - std::enable_if_t::value, UnsignedType> + std::enable_if_t, UnsignedType> transposeToNaturalOrder( UnsignedType in ) { static_assert( sizeof( OriginalType ) == sizeof( UnsignedType ), "reordering requires the same sized types on both sides" ); - static_assert( std::is_unsigned::value, + static_assert( std::is_unsigned_v, "Input type must be unsigned" ); // Assuming 2s complement (standardized in current C++), the // positive and negative numbers are already internally ordered, @@ -209,12 +209,12 @@ namespace Catch { template constexpr - std::enable_if_t::value, UnsignedType> + std::enable_if_t, UnsignedType> transposeToNaturalOrder(UnsignedType in) { static_assert( sizeof( OriginalType ) == sizeof( UnsignedType ), "reordering requires the same sized types on both sides" ); - static_assert( std::is_unsigned::value, "Input type must be unsigned" ); + static_assert( std::is_unsigned_v, "Input type must be unsigned" ); // No reordering is needed for unsigned -> unsigned return in; } diff --git a/src/catch2/internal/catch_uncaught_exceptions.cpp b/src/catch2/internal/catch_uncaught_exceptions.cpp index 8cfabc0f..da999da4 100644 --- a/src/catch2/internal/catch_uncaught_exceptions.cpp +++ b/src/catch2/internal/catch_uncaught_exceptions.cpp @@ -7,7 +7,6 @@ // SPDX-License-Identifier: BSL-1.0 #include -#include #include #include @@ -16,10 +15,8 @@ namespace Catch { bool uncaught_exceptions() { #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) return false; -#elif defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) - return std::uncaught_exceptions() > 0; #else - return std::uncaught_exception(); + return std::uncaught_exceptions() > 0; #endif } } // end namespace Catch diff --git a/src/catch2/internal/catch_uniform_floating_point_distribution.hpp b/src/catch2/internal/catch_uniform_floating_point_distribution.hpp index 23d03b43..93a2fe38 100644 --- a/src/catch2/internal/catch_uniform_floating_point_distribution.hpp +++ b/src/catch2/internal/catch_uniform_floating_point_distribution.hpp @@ -67,8 +67,8 @@ namespace Catch { */ template class uniform_floating_point_distribution { - static_assert(std::is_floating_point::value, "..."); - static_assert(!std::is_same::value, + static_assert(std::is_floating_point_v, "..."); + static_assert(!std::is_same_v, "We do not support long double due to inconsistent behaviour between platforms"); using WidthType = Detail::DistanceType; diff --git a/src/catch2/internal/catch_uniform_integer_distribution.hpp b/src/catch2/internal/catch_uniform_integer_distribution.hpp index 799a93e2..7830372a 100644 --- a/src/catch2/internal/catch_uniform_integer_distribution.hpp +++ b/src/catch2/internal/catch_uniform_integer_distribution.hpp @@ -26,7 +26,7 @@ namespace Catch { */ template class uniform_integer_distribution { - static_assert(std::is_integral::value, "..."); + static_assert(std::is_integral_v, "..."); using UnsignedIntegerType = Detail::SizedUnsignedType_t; diff --git a/src/catch2/internal/catch_unique_ptr.hpp b/src/catch2/internal/catch_unique_ptr.hpp index 8add2a8d..f33d4796 100644 --- a/src/catch2/internal/catch_unique_ptr.hpp +++ b/src/catch2/internal/catch_unique_ptr.hpp @@ -31,12 +31,12 @@ namespace Detail { m_ptr(ptr) {} - template ::value>> + template >> unique_ptr(unique_ptr&& from): m_ptr(from.release()) {} - template ::value>> + template >> unique_ptr& operator=(unique_ptr&& from) { reset(from.release()); diff --git a/src/catch2/internal/catch_xmlwriter.hpp b/src/catch2/internal/catch_xmlwriter.hpp index 22b42c5c..232a2272 100644 --- a/src/catch2/internal/catch_xmlwriter.hpp +++ b/src/catch2/internal/catch_xmlwriter.hpp @@ -81,7 +81,7 @@ namespace Catch { // While it would still work, it would cause code bloat // and multiple iteration over the strings typename = typename std::enable_if_t< - !std::is_convertible::value>> + !std::is_convertible_v>> ScopedElement& writeAttribute( StringRef name, T const& attribute ) { m_writer->writeAttribute( name, attribute ); @@ -122,7 +122,7 @@ namespace Catch { // While it would still work, it would cause code bloat // and multiple iteration over the strings typename = typename std::enable_if_t< - !std::is_convertible::value>> + !std::is_convertible_v>> XmlWriter& writeAttribute( StringRef name, T const& attribute ) { ReusableStringStream rss; rss << attribute; diff --git a/src/catch2/matchers/catch_matchers_container_properties.hpp b/src/catch2/matchers/catch_matchers_container_properties.hpp index 33795fbe..6417181e 100644 --- a/src/catch2/matchers/catch_matchers_container_properties.hpp +++ b/src/catch2/matchers/catch_matchers_container_properties.hpp @@ -9,7 +9,6 @@ #define CATCH_MATCHERS_CONTAINER_PROPERTIES_HPP_INCLUDED #include -#include #include namespace Catch { diff --git a/src/catch2/matchers/catch_matchers_predicate.hpp b/src/catch2/matchers/catch_matchers_predicate.hpp index 2d1cc33a..354c90e4 100644 --- a/src/catch2/matchers/catch_matchers_predicate.hpp +++ b/src/catch2/matchers/catch_matchers_predicate.hpp @@ -49,7 +49,7 @@ public: template PredicateMatcher Predicate(Pred&& predicate, std::string const& description = "") { static_assert(is_callable::value, "Predicate not callable with argument T"); - static_assert(std::is_same>::value, "Predicate does not return bool"); + static_assert(std::is_same_v>, "Predicate does not return bool"); return PredicateMatcher(CATCH_FORWARD(predicate), description); } diff --git a/src/catch2/matchers/catch_matchers_templated.hpp b/src/catch2/matchers/catch_matchers_templated.hpp index fc9fcb2b..79063446 100644 --- a/src/catch2/matchers/catch_matchers_templated.hpp +++ b/src/catch2/matchers/catch_matchers_templated.hpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -58,19 +57,19 @@ namespace Matchers { } template - static constexpr bool is_generic_matcher_v = std::is_base_of< + static constexpr bool is_generic_matcher_v = std::is_base_of_v< Catch::Matchers::MatcherGenericBase, std::remove_cv_t> - >::value; + >; template - static constexpr bool are_generic_matchers_v = Catch::Detail::conjunction>...>::value; + static constexpr bool are_generic_matchers_v = std::conjunction_v>...>; template - static constexpr bool is_matcher_v = std::is_base_of< + static constexpr bool is_matcher_v = std::is_base_of_v< Catch::Matchers::MatcherUntypedBase, std::remove_cv_t> - >::value; + >; template diff --git a/src/catch2/matchers/catch_matchers_vector.hpp b/src/catch2/matchers/catch_matchers_vector.hpp index fffbfdf6..bbaba044 100644 --- a/src/catch2/matchers/catch_matchers_vector.hpp +++ b/src/catch2/matchers/catch_matchers_vector.hpp @@ -117,17 +117,17 @@ namespace Matchers { std::string describe() const override { return "is approx: " + ::Catch::Detail::stringify( m_comparator ); } - template ::value>> + template >> ApproxMatcher& epsilon( T const& newEpsilon ) { approx.epsilon(static_cast(newEpsilon)); return *this; } - template ::value>> + template >> ApproxMatcher& margin( T const& newMargin ) { approx.margin(static_cast(newMargin)); return *this; } - template ::value>> + template >> ApproxMatcher& scale( T const& newScale ) { approx.scale(static_cast(newScale)); return *this; diff --git a/src/catch2/meson.build b/src/catch2/meson.build index 60f7777a..861869a2 100644 --- a/src/catch2/meson.build +++ b/src/catch2/meson.build @@ -83,11 +83,9 @@ internal_headers = [ 'internal/catch_config_counter.hpp', 'internal/catch_config_prefix_messages.hpp', 'internal/catch_config_static_analysis_support.hpp', - 'internal/catch_config_uncaught_exceptions.hpp', 'internal/catch_config_wchar.hpp', 'internal/catch_console_colour.hpp', 'internal/catch_console_width.hpp', - 'internal/catch_container_nonmembers.hpp', 'internal/catch_context.hpp', 'internal/catch_debug_console.hpp', 'internal/catch_debugger.hpp', @@ -106,7 +104,6 @@ internal_headers = [ 'internal/catch_lazy_expr.hpp', 'internal/catch_leak_detector.hpp', 'internal/catch_list.hpp', - 'internal/catch_logical_traits.hpp', 'internal/catch_message_info.hpp', 'internal/catch_meta.hpp', 'internal/catch_move_and_forward.hpp', @@ -374,7 +371,7 @@ if get_option('install') pkg.generate( catch2, filebase: 'catch2', - description: 'A modern, C++-native, test framework for C++14 and above', + description: 'A modern, C++-native, test framework for C++17 and above', url: 'https://github.com/catchorg/Catch2', ) endif @@ -396,7 +393,7 @@ if get_option('install') pkg.generate( catch2_with_main, filebase: 'catch2-with-main', - description: 'A modern, C++-native, test framework for C++14 and above (links in default main)', + description: 'A modern, C++-native, test framework for C++17 and above (links in default main)', requires: 'catch2 = ' + meson.project_version(), ) endif diff --git a/tests/ExtraTests/CMakeLists.txt b/tests/ExtraTests/CMakeLists.txt index bb7292d6..9dc5e1fd 100644 --- a/tests/ExtraTests/CMakeLists.txt +++ b/tests/ExtraTests/CMakeLists.txt @@ -514,7 +514,7 @@ add_executable(AmalgamatedTestCompilation ${CATCH_DIR}/extras/catch_amalgamated.cpp ) target_include_directories(AmalgamatedTestCompilation PRIVATE ${CATCH_DIR}/extras) -target_compile_features(AmalgamatedTestCompilation PRIVATE cxx_std_14) +target_compile_features(AmalgamatedTestCompilation PRIVATE cxx_std_17) add_test(NAME AmalgamatedFileTest COMMAND AmalgamatedTestCompilation) set_tests_properties(AmalgamatedFileTest diff --git a/tests/ExtraTests/X01-PrefixedMacros.cpp b/tests/ExtraTests/X01-PrefixedMacros.cpp index d1c246ec..7f4a9b16 100644 --- a/tests/ExtraTests/X01-PrefixedMacros.cpp +++ b/tests/ExtraTests/X01-PrefixedMacros.cpp @@ -72,10 +72,10 @@ CATCH_TEST_CASE("PrefixedMacros") { } } - CATCH_STATIC_REQUIRE( std::is_void::value ); - CATCH_STATIC_REQUIRE_FALSE( std::is_void::value ); - CATCH_STATIC_CHECK( std::is_void::value ); - CATCH_STATIC_CHECK_FALSE( std::is_void::value ); + CATCH_STATIC_REQUIRE( std::is_void_v ); + CATCH_STATIC_REQUIRE_FALSE( std::is_void_v ); + CATCH_STATIC_CHECK( std::is_void_v ); + CATCH_STATIC_CHECK_FALSE( std::is_void_v ); CATCH_FAIL(""); } diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index cacb898a..229292ab 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -21,7 +21,7 @@ This warning message starts with a linebreak' This would not be caught previously Nor would this Tricky.tests.cpp:: failed: explicitly with 1 message: '1514' -Compilation.tests.cpp:: passed: std::is_same, TypeList>::value for: true +Compilation.tests.cpp:: passed: std::is_same_v, TypeList> for: true TestSpec.tests.cpp:: passed: spec.matches(*fakeTestCase("spec . char")) for: true TestSpec.tests.cpp:: passed: spec.matches(*fakeTestCase("spec , char")) for: true TestSpec.tests.cpp:: passed: !(spec.matches(*fakeTestCase(R"(spec \, char)"))) for: !false @@ -436,32 +436,32 @@ B Using code: 0 C " -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), Catch::Matchers::Detail:: MatchAllOfGeneric>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v< decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), Catch::Matchers::Detail:: MatchAllOfGeneric>' Matchers.tests.cpp:: passed: 1, ( MatcherA() && MatcherB() ) && MatcherC() for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v< decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>' Matchers.tests.cpp:: passed: 1, MatcherA() && ( MatcherB() && MatcherC() ) for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>:: value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v< decltype( ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>' Matchers.tests.cpp:: passed: 1, ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 and equals: true ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), Catch::Matchers::Detail:: MatchAnyOfGeneric>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v< decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), Catch::Matchers::Detail:: MatchAnyOfGeneric>' Matchers.tests.cpp:: passed: 1, ( MatcherA() || MatcherB() ) || MatcherC() for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v< decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>' Matchers.tests.cpp:: passed: 1, MatcherA() || ( MatcherB() || MatcherC() ) for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>:: value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v< decltype( ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>' Matchers.tests.cpp:: passed: 1, ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 or equals: true ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( !MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v< decltype( !MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>' Matchers.tests.cpp:: passed: 0, !MatcherA() for: 0 not equals: (int) 1 or (string) "1" -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v' Matchers.tests.cpp:: passed: 1, !!MatcherA() for: 1 equals: (int) 1 or (string) "1" -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( !!!MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v< decltype( !!!MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>' Matchers.tests.cpp:: passed: 0, !!!MatcherA() for: 0 not equals: (int) 1 or (string) "1" -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v' Matchers.tests.cpp:: passed: 1, !!!!MatcherA() for: 1 equals: (int) 1 or (string) "1" -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same>::value' -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v>' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v>' Matchers.tests.cpp:: passed: 1, MatcherA() || MatcherB() for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v>' Matchers.tests.cpp:: passed: 1, MatcherA() && MatcherB() for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( MatcherA() || !MatcherB() ), Catch::Matchers::Detail::MatchAnyOfGeneric< MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric>>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v< decltype( MatcherA() || !MatcherB() ), Catch::Matchers::Detail::MatchAnyOfGeneric< MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric>>' Matchers.tests.cpp:: passed: 1, MatcherA() || !MatcherB() for: 1 ( equals: (int) 1 or (string) "1" or not equals: (long long) 1 ) Matchers.tests.cpp:: passed: vec, Predicate>( []( auto const& v ) { return std::all_of( v.begin(), v.end(), []( int elem ) { return elem % 2 == 1; } ); }, "All elements are odd" ) && !EqualsRange( a ) for: { 1, 3, 5 } ( matches predicate: "All elements are odd" and not Equals: { 5, 3, 1 } ) Matchers.tests.cpp:: passed: str, StartsWith( "foo" ) && EqualsRange( arr ) && EndsWith( "bar" ) for: "foobar" ( starts with: "foo" and Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and ends with: "bar" ) @@ -1273,10 +1273,10 @@ Exception.tests.cpp:: failed: unexpected exception with message: 'c Tricky.tests.cpp:: passed: True for: {?} Tricky.tests.cpp:: passed: !False for: true Tricky.tests.cpp:: passed: !(False) for: !{?} -Compilation.tests.cpp:: passed: with 1 message: 'std::is_void::value' -Compilation.tests.cpp:: passed: with 1 message: '!(std::is_void::value)' -Compilation.tests.cpp:: passed: with 1 message: 'std::is_void::value' -Compilation.tests.cpp:: passed: with 1 message: '!(std::is_void::value)' +Compilation.tests.cpp:: passed: with 1 message: 'std::is_void_v' +Compilation.tests.cpp:: passed: with 1 message: '!(std::is_void_v)' +Compilation.tests.cpp:: passed: with 1 message: 'std::is_void_v' +Compilation.tests.cpp:: passed: with 1 message: '!(std::is_void_v)' Condition.tests.cpp:: failed: data.int_seven > 7 for: 7 > 7 Condition.tests.cpp:: failed: data.int_seven < 7 for: 7 < 7 Condition.tests.cpp:: failed: data.int_seven > 8 for: 7 > 8 @@ -1511,9 +1511,9 @@ CmdLine.tests.cpp:: passed: cli.parse({ "test", "--benchmark-no-ana CmdLine.tests.cpp:: passed: config.benchmarkNoAnalysis for: true CmdLine.tests.cpp:: passed: cli.parse({ "test", "--benchmark-warmup-time=10" }) for: {?} CmdLine.tests.cpp:: passed: config.benchmarkWarmupTime == 10 for: 10 == 10 -Misc.tests.cpp:: passed: std::tuple_size::value >= 1 for: 3 >= 1 -Misc.tests.cpp:: passed: std::tuple_size::value >= 1 for: 2 >= 1 -Misc.tests.cpp:: passed: std::tuple_size::value >= 1 for: 1 >= 1 +Misc.tests.cpp:: passed: std::tuple_size_v >= 1 for: 3 >= 1 +Misc.tests.cpp:: passed: std::tuple_size_v >= 1 for: 2 >= 1 +Misc.tests.cpp:: passed: std::tuple_size_v >= 1 for: 1 >= 1 RandomNumberGeneration.tests.cpp:: passed: Catch::generateRandomSeed(method) RandomNumberGeneration.tests.cpp:: passed: Catch::generateRandomSeed(method) RandomNumberGeneration.tests.cpp:: passed: Catch::generateRandomSeed(method) @@ -1906,13 +1906,13 @@ Tag.tests.cpp:: passed: testCase.tags, VectorContains( Tag( "tag wi Class.tests.cpp:: passed: Template_Fixture::m_a == 1 for: 1 == 1 Class.tests.cpp:: passed: Template_Fixture::m_a == 1 for: 1 == 1 Class.tests.cpp:: passed: Template_Fixture::m_a == 1 for: 1.0 == 1 -Misc.tests.cpp:: passed: std::is_default_constructible::value for: true -Misc.tests.cpp:: passed: std::is_default_constructible::value for: true -Misc.tests.cpp:: passed: std::is_trivially_copyable::value for: true -Misc.tests.cpp:: passed: std::is_trivially_copyable::value for: true -Misc.tests.cpp:: passed: std::is_arithmetic::value for: true -Misc.tests.cpp:: passed: std::is_arithmetic::value for: true -Misc.tests.cpp:: passed: std::is_arithmetic::value for: true +Misc.tests.cpp:: passed: std::is_default_constructible_v for: true +Misc.tests.cpp:: passed: std::is_default_constructible_v for: true +Misc.tests.cpp:: passed: std::is_trivially_copyable_v for: true +Misc.tests.cpp:: passed: std::is_trivially_copyable_v for: true +Misc.tests.cpp:: passed: std::is_arithmetic_v for: true +Misc.tests.cpp:: passed: std::is_arithmetic_v for: true +Misc.tests.cpp:: passed: std::is_arithmetic_v for: true Misc.tests.cpp:: passed: v.size() == 5 for: 5 == 5 Misc.tests.cpp:: passed: v.capacity() >= 5 for: 5 >= 5 Misc.tests.cpp:: passed: v.size() == 10 for: 10 == 10 diff --git a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt index 10395c9a..ecec0bf5 100644 --- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt @@ -19,7 +19,7 @@ Message.tests.cpp:: warning: ' This info message starts with a linebreak' with 1 message: ' This warning message starts with a linebreak' Tricky.tests.cpp:: failed: explicitly with 1 message: '1514' -Compilation.tests.cpp:: passed: std::is_same, TypeList>::value for: true +Compilation.tests.cpp:: passed: std::is_same_v, TypeList> for: true TestSpec.tests.cpp:: passed: spec.matches(*fakeTestCase("spec . char")) for: true TestSpec.tests.cpp:: passed: spec.matches(*fakeTestCase("spec , char")) for: true TestSpec.tests.cpp:: passed: !(spec.matches(*fakeTestCase(R"(spec \, char)"))) for: !false @@ -434,32 +434,32 @@ B Using code: 0 C " -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), Catch::Matchers::Detail:: MatchAllOfGeneric>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v< decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), Catch::Matchers::Detail:: MatchAllOfGeneric>' Matchers.tests.cpp:: passed: 1, ( MatcherA() && MatcherB() ) && MatcherC() for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v< decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>' Matchers.tests.cpp:: passed: 1, MatcherA() && ( MatcherB() && MatcherC() ) for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>:: value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v< decltype( ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>' Matchers.tests.cpp:: passed: 1, ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 and equals: true ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), Catch::Matchers::Detail:: MatchAnyOfGeneric>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v< decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), Catch::Matchers::Detail:: MatchAnyOfGeneric>' Matchers.tests.cpp:: passed: 1, ( MatcherA() || MatcherB() ) || MatcherC() for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v< decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>' Matchers.tests.cpp:: passed: 1, MatcherA() || ( MatcherB() || MatcherC() ) for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>:: value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v< decltype( ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>' Matchers.tests.cpp:: passed: 1, ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 or equals: true ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( !MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v< decltype( !MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>' Matchers.tests.cpp:: passed: 0, !MatcherA() for: 0 not equals: (int) 1 or (string) "1" -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v' Matchers.tests.cpp:: passed: 1, !!MatcherA() for: 1 equals: (int) 1 or (string) "1" -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( !!!MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v< decltype( !!!MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>' Matchers.tests.cpp:: passed: 0, !!!MatcherA() for: 0 not equals: (int) 1 or (string) "1" -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v' Matchers.tests.cpp:: passed: 1, !!!!MatcherA() for: 1 equals: (int) 1 or (string) "1" -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same>::value' -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v>' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v>' Matchers.tests.cpp:: passed: 1, MatcherA() || MatcherB() for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v>' Matchers.tests.cpp:: passed: 1, MatcherA() && MatcherB() for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 ) -Matchers.tests.cpp:: passed: with 1 message: 'std::is_same< decltype( MatcherA() || !MatcherB() ), Catch::Matchers::Detail::MatchAnyOfGeneric< MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric>>::value' +Matchers.tests.cpp:: passed: with 1 message: 'std::is_same_v< decltype( MatcherA() || !MatcherB() ), Catch::Matchers::Detail::MatchAnyOfGeneric< MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric>>' Matchers.tests.cpp:: passed: 1, MatcherA() || !MatcherB() for: 1 ( equals: (int) 1 or (string) "1" or not equals: (long long) 1 ) Matchers.tests.cpp:: passed: vec, Predicate>( []( auto const& v ) { return std::all_of( v.begin(), v.end(), []( int elem ) { return elem % 2 == 1; } ); }, "All elements are odd" ) && !EqualsRange( a ) for: { 1, 3, 5 } ( matches predicate: "All elements are odd" and not Equals: { 5, 3, 1 } ) Matchers.tests.cpp:: passed: str, StartsWith( "foo" ) && EqualsRange( arr ) && EndsWith( "bar" ) for: "foobar" ( starts with: "foo" and Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and ends with: "bar" ) @@ -1271,10 +1271,10 @@ Exception.tests.cpp:: failed: unexpected exception with message: 'c Tricky.tests.cpp:: passed: True for: {?} Tricky.tests.cpp:: passed: !False for: true Tricky.tests.cpp:: passed: !(False) for: !{?} -Compilation.tests.cpp:: passed: with 1 message: 'std::is_void::value' -Compilation.tests.cpp:: passed: with 1 message: '!(std::is_void::value)' -Compilation.tests.cpp:: passed: with 1 message: 'std::is_void::value' -Compilation.tests.cpp:: passed: with 1 message: '!(std::is_void::value)' +Compilation.tests.cpp:: passed: with 1 message: 'std::is_void_v' +Compilation.tests.cpp:: passed: with 1 message: '!(std::is_void_v)' +Compilation.tests.cpp:: passed: with 1 message: 'std::is_void_v' +Compilation.tests.cpp:: passed: with 1 message: '!(std::is_void_v)' Condition.tests.cpp:: failed: data.int_seven > 7 for: 7 > 7 Condition.tests.cpp:: failed: data.int_seven < 7 for: 7 < 7 Condition.tests.cpp:: failed: data.int_seven > 8 for: 7 > 8 @@ -1509,9 +1509,9 @@ CmdLine.tests.cpp:: passed: cli.parse({ "test", "--benchmark-no-ana CmdLine.tests.cpp:: passed: config.benchmarkNoAnalysis for: true CmdLine.tests.cpp:: passed: cli.parse({ "test", "--benchmark-warmup-time=10" }) for: {?} CmdLine.tests.cpp:: passed: config.benchmarkWarmupTime == 10 for: 10 == 10 -Misc.tests.cpp:: passed: std::tuple_size::value >= 1 for: 3 >= 1 -Misc.tests.cpp:: passed: std::tuple_size::value >= 1 for: 2 >= 1 -Misc.tests.cpp:: passed: std::tuple_size::value >= 1 for: 1 >= 1 +Misc.tests.cpp:: passed: std::tuple_size_v >= 1 for: 3 >= 1 +Misc.tests.cpp:: passed: std::tuple_size_v >= 1 for: 2 >= 1 +Misc.tests.cpp:: passed: std::tuple_size_v >= 1 for: 1 >= 1 RandomNumberGeneration.tests.cpp:: passed: Catch::generateRandomSeed(method) RandomNumberGeneration.tests.cpp:: passed: Catch::generateRandomSeed(method) RandomNumberGeneration.tests.cpp:: passed: Catch::generateRandomSeed(method) @@ -1899,13 +1899,13 @@ Tag.tests.cpp:: passed: testCase.tags, VectorContains( Tag( "tag wi Class.tests.cpp:: passed: Template_Fixture::m_a == 1 for: 1 == 1 Class.tests.cpp:: passed: Template_Fixture::m_a == 1 for: 1 == 1 Class.tests.cpp:: passed: Template_Fixture::m_a == 1 for: 1.0 == 1 -Misc.tests.cpp:: passed: std::is_default_constructible::value for: true -Misc.tests.cpp:: passed: std::is_default_constructible::value for: true -Misc.tests.cpp:: passed: std::is_trivially_copyable::value for: true -Misc.tests.cpp:: passed: std::is_trivially_copyable::value for: true -Misc.tests.cpp:: passed: std::is_arithmetic::value for: true -Misc.tests.cpp:: passed: std::is_arithmetic::value for: true -Misc.tests.cpp:: passed: std::is_arithmetic::value for: true +Misc.tests.cpp:: passed: std::is_default_constructible_v for: true +Misc.tests.cpp:: passed: std::is_default_constructible_v for: true +Misc.tests.cpp:: passed: std::is_trivially_copyable_v for: true +Misc.tests.cpp:: passed: std::is_trivially_copyable_v for: true +Misc.tests.cpp:: passed: std::is_arithmetic_v for: true +Misc.tests.cpp:: passed: std::is_arithmetic_v for: true +Misc.tests.cpp:: passed: std::is_arithmetic_v for: true Misc.tests.cpp:: passed: v.size() == 5 for: 5 == 5 Misc.tests.cpp:: passed: v.capacity() >= 5 for: 5 >= 5 Misc.tests.cpp:: passed: v.size() == 10 for: 10 == 10 diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index 7fd59514..3faeea4c 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -159,7 +159,7 @@ Compilation.tests.cpp: ............................................................................... Compilation.tests.cpp:: PASSED: - REQUIRE( std::is_same, TypeList>::value ) + REQUIRE( std::is_same_v, TypeList> ) with expansion: true @@ -3274,8 +3274,8 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), Catch:: - Matchers::Detail:: MatchAllOfGeneric>::value + std::is_same_v< decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), + Catch::Matchers::Detail:: MatchAllOfGeneric> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, ( MatcherA() && MatcherB() ) && MatcherC() ) @@ -3285,8 +3285,8 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), Catch:: - Matchers::Detail:: MatchAllOfGeneric>::value + std::is_same_v< decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), + Catch::Matchers::Detail:: MatchAllOfGeneric> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() && ( MatcherB() && MatcherC() ) ) @@ -3296,9 +3296,9 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype( ( MatcherA() && MatcherB() ) && ( MatcherC() && + std::is_same_v< decltype( ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>:: value + MatcherB, MatcherC, MatcherD>> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ) @@ -3314,8 +3314,8 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), Catch:: - Matchers::Detail:: MatchAnyOfGeneric>::value + std::is_same_v< decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), + Catch::Matchers::Detail:: MatchAnyOfGeneric> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, ( MatcherA() || MatcherB() ) || MatcherC() ) @@ -3325,8 +3325,8 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), Catch:: - Matchers::Detail:: MatchAnyOfGeneric>::value + std::is_same_v< decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), + Catch::Matchers::Detail:: MatchAnyOfGeneric> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() || ( MatcherB() || MatcherC() ) ) @@ -3336,9 +3336,9 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype( ( MatcherA() || MatcherB() ) || ( MatcherC() || + std::is_same_v< decltype( ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>:: value + MatcherB, MatcherC, MatcherD>> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ) @@ -3354,8 +3354,8 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype( !MatcherA() ), Catch::Matchers::Detail:: - MatchNotOfGeneric>::value + std::is_same_v< decltype( !MatcherA() ), Catch::Matchers::Detail:: + MatchNotOfGeneric> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 0, !MatcherA() ) @@ -3364,7 +3364,7 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same::value + std::is_same_v Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, !!MatcherA() ) @@ -3373,8 +3373,8 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype( !!!MatcherA() ), Catch::Matchers::Detail:: - MatchNotOfGeneric>::value + std::is_same_v< decltype( !!!MatcherA() ), Catch::Matchers::Detail:: + MatchNotOfGeneric> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 0, !!!MatcherA() ) @@ -3383,7 +3383,7 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same::value + std::is_same_v Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, !!!!MatcherA() ) @@ -3398,9 +3398,9 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: with message: - std::is_same>::value + MatchAnyOf> ------------------------------------------------------------------------------- Combining only templated matchers @@ -3410,8 +3410,8 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: with message: - std::is_same>::value + std::is_same_v> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() || MatcherB() ) @@ -3420,8 +3420,8 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same>::value + std::is_same_v> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() && MatcherB() ) @@ -3430,9 +3430,9 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype( MatcherA() || !MatcherB() ), Catch::Matchers::Detail: - :MatchAnyOfGeneric< MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric - >>::value + std::is_same_v< decltype( MatcherA() || !MatcherB() ), Catch::Matchers:: + Detail::MatchAnyOfGeneric< MatcherA, Catch::Matchers::Detail:: + MatchNotOfGeneric>> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() || !MatcherB() ) @@ -8475,19 +8475,19 @@ Compilation.tests.cpp: Compilation.tests.cpp:: PASSED: with message: - std::is_void::value + std::is_void_v Compilation.tests.cpp:: PASSED: with message: - !(std::is_void::value) + !(std::is_void_v) Compilation.tests.cpp:: PASSED: with message: - std::is_void::value + std::is_void_v Compilation.tests.cpp:: PASSED: with message: - !(std::is_void::value) + !(std::is_void_v) ------------------------------------------------------------------------------- Ordering comparison checks that should fail @@ -10052,7 +10052,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::tuple_size::value >= 1 ) + REQUIRE( std::tuple_size_v >= 1 ) with expansion: 3 >= 1 @@ -10063,7 +10063,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::tuple_size::value >= 1 ) + REQUIRE( std::tuple_size_v >= 1 ) with expansion: 2 >= 1 @@ -10074,7 +10074,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::tuple_size::value >= 1 ) + REQUIRE( std::tuple_size_v >= 1 ) with expansion: 1 >= 1 @@ -12106,7 +12106,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::is_default_constructible::value ) + REQUIRE( std::is_default_constructible_v ) with expansion: true @@ -12118,7 +12118,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::is_default_constructible::value ) + REQUIRE( std::is_default_constructible_v ) with expansion: true @@ -12130,7 +12130,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::is_trivially_copyable::value ) + REQUIRE( std::is_trivially_copyable_v ) with expansion: true @@ -12142,7 +12142,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::is_trivially_copyable::value ) + REQUIRE( std::is_trivially_copyable_v ) with expansion: true @@ -12153,7 +12153,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::is_arithmetic::value ) + REQUIRE( std::is_arithmetic_v ) with expansion: true @@ -12164,7 +12164,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::is_arithmetic::value ) + REQUIRE( std::is_arithmetic_v ) with expansion: true @@ -12175,7 +12175,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::is_arithmetic::value ) + REQUIRE( std::is_arithmetic_v ) with expansion: true diff --git a/tests/SelfTest/Baselines/console.sw.multi.approved.txt b/tests/SelfTest/Baselines/console.sw.multi.approved.txt index 08ab1b2b..b3f60920 100644 --- a/tests/SelfTest/Baselines/console.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.multi.approved.txt @@ -157,7 +157,7 @@ Compilation.tests.cpp: ............................................................................... Compilation.tests.cpp:: PASSED: - REQUIRE( std::is_same, TypeList>::value ) + REQUIRE( std::is_same_v, TypeList> ) with expansion: true @@ -3272,8 +3272,8 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), Catch:: - Matchers::Detail:: MatchAllOfGeneric>::value + std::is_same_v< decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), + Catch::Matchers::Detail:: MatchAllOfGeneric> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, ( MatcherA() && MatcherB() ) && MatcherC() ) @@ -3283,8 +3283,8 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), Catch:: - Matchers::Detail:: MatchAllOfGeneric>::value + std::is_same_v< decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), + Catch::Matchers::Detail:: MatchAllOfGeneric> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() && ( MatcherB() && MatcherC() ) ) @@ -3294,9 +3294,9 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype( ( MatcherA() && MatcherB() ) && ( MatcherC() && + std::is_same_v< decltype( ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>:: value + MatcherB, MatcherC, MatcherD>> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ) @@ -3312,8 +3312,8 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), Catch:: - Matchers::Detail:: MatchAnyOfGeneric>::value + std::is_same_v< decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), + Catch::Matchers::Detail:: MatchAnyOfGeneric> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, ( MatcherA() || MatcherB() ) || MatcherC() ) @@ -3323,8 +3323,8 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), Catch:: - Matchers::Detail:: MatchAnyOfGeneric>::value + std::is_same_v< decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), + Catch::Matchers::Detail:: MatchAnyOfGeneric> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() || ( MatcherB() || MatcherC() ) ) @@ -3334,9 +3334,9 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype( ( MatcherA() || MatcherB() ) || ( MatcherC() || + std::is_same_v< decltype( ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>:: value + MatcherB, MatcherC, MatcherD>> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ) @@ -3352,8 +3352,8 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype( !MatcherA() ), Catch::Matchers::Detail:: - MatchNotOfGeneric>::value + std::is_same_v< decltype( !MatcherA() ), Catch::Matchers::Detail:: + MatchNotOfGeneric> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 0, !MatcherA() ) @@ -3362,7 +3362,7 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same::value + std::is_same_v Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, !!MatcherA() ) @@ -3371,8 +3371,8 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype( !!!MatcherA() ), Catch::Matchers::Detail:: - MatchNotOfGeneric>::value + std::is_same_v< decltype( !!!MatcherA() ), Catch::Matchers::Detail:: + MatchNotOfGeneric> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 0, !!!MatcherA() ) @@ -3381,7 +3381,7 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same::value + std::is_same_v Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, !!!!MatcherA() ) @@ -3396,9 +3396,9 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: with message: - std::is_same>::value + MatchAnyOf> ------------------------------------------------------------------------------- Combining only templated matchers @@ -3408,8 +3408,8 @@ Matchers.tests.cpp: Matchers.tests.cpp:: PASSED: with message: - std::is_same>::value + std::is_same_v> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() || MatcherB() ) @@ -3418,8 +3418,8 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same>::value + std::is_same_v> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() && MatcherB() ) @@ -3428,9 +3428,9 @@ with expansion: Matchers.tests.cpp:: PASSED: with message: - std::is_same< decltype( MatcherA() || !MatcherB() ), Catch::Matchers::Detail: - :MatchAnyOfGeneric< MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric - >>::value + std::is_same_v< decltype( MatcherA() || !MatcherB() ), Catch::Matchers:: + Detail::MatchAnyOfGeneric< MatcherA, Catch::Matchers::Detail:: + MatchNotOfGeneric>> Matchers.tests.cpp:: PASSED: REQUIRE_THAT( 1, MatcherA() || !MatcherB() ) @@ -8473,19 +8473,19 @@ Compilation.tests.cpp: Compilation.tests.cpp:: PASSED: with message: - std::is_void::value + std::is_void_v Compilation.tests.cpp:: PASSED: with message: - !(std::is_void::value) + !(std::is_void_v) Compilation.tests.cpp:: PASSED: with message: - std::is_void::value + std::is_void_v Compilation.tests.cpp:: PASSED: with message: - !(std::is_void::value) + !(std::is_void_v) ------------------------------------------------------------------------------- Ordering comparison checks that should fail @@ -10050,7 +10050,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::tuple_size::value >= 1 ) + REQUIRE( std::tuple_size_v >= 1 ) with expansion: 3 >= 1 @@ -10061,7 +10061,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::tuple_size::value >= 1 ) + REQUIRE( std::tuple_size_v >= 1 ) with expansion: 2 >= 1 @@ -10072,7 +10072,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::tuple_size::value >= 1 ) + REQUIRE( std::tuple_size_v >= 1 ) with expansion: 1 >= 1 @@ -12099,7 +12099,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::is_default_constructible::value ) + REQUIRE( std::is_default_constructible_v ) with expansion: true @@ -12111,7 +12111,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::is_default_constructible::value ) + REQUIRE( std::is_default_constructible_v ) with expansion: true @@ -12123,7 +12123,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::is_trivially_copyable::value ) + REQUIRE( std::is_trivially_copyable_v ) with expansion: true @@ -12135,7 +12135,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::is_trivially_copyable::value ) + REQUIRE( std::is_trivially_copyable_v ) with expansion: true @@ -12146,7 +12146,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::is_arithmetic::value ) + REQUIRE( std::is_arithmetic_v ) with expansion: true @@ -12157,7 +12157,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::is_arithmetic::value ) + REQUIRE( std::is_arithmetic_v ) with expansion: true @@ -12168,7 +12168,7 @@ Misc.tests.cpp: ............................................................................... Misc.tests.cpp:: PASSED: - REQUIRE( std::is_arithmetic::value ) + REQUIRE( std::is_arithmetic_v ) with expansion: true diff --git a/tests/SelfTest/Baselines/console.swa4.approved.txt b/tests/SelfTest/Baselines/console.swa4.approved.txt index 63fb2113..7f070c73 100644 --- a/tests/SelfTest/Baselines/console.swa4.approved.txt +++ b/tests/SelfTest/Baselines/console.swa4.approved.txt @@ -159,7 +159,7 @@ Compilation.tests.cpp: ............................................................................... Compilation.tests.cpp:: PASSED: - REQUIRE( std::is_same, TypeList>::value ) + REQUIRE( std::is_same_v, TypeList> ) with expansion: true diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index 3e5d1832..4ef99012 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -39,7 +39,7 @@ Nor would this # #1514: stderr/stdout is not captured in tests aborted by an exception not ok {test-number} - explicitly with 1 message: '1514' # #1548 -ok {test-number} - std::is_same, TypeList>::value for: true +ok {test-number} - std::is_same_v, TypeList> for: true # #1905 -- test spec parser properly clears internal state between compound tests ok {test-number} - spec.matches(*fakeTestCase("spec . char")) for: true # #1905 -- test spec parser properly clears internal state between compound tests @@ -773,57 +773,57 @@ ok {test-number} - streamWrapper.str() == "1\nUsing code: 2\n2\nUsing code: 0\n3 # ColourGuard behaviour ok {test-number} - streamWrapper.str() == "Using code: 2\nA\nB\nUsing code: 0\nC\n" for: "Using code: 2 A B Using code: 0 C " == "Using code: 2 A B Using code: 0 C " # Combining MatchAllOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), Catch::Matchers::Detail:: MatchAllOfGeneric>::value' +ok {test-number} - with 1 message: 'std::is_same_v< decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), Catch::Matchers::Detail:: MatchAllOfGeneric>' # Combining MatchAllOfGeneric does not nest ok {test-number} - 1, ( MatcherA() && MatcherB() ) && MatcherC() for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) # Combining MatchAllOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>::value' +ok {test-number} - with 1 message: 'std::is_same_v< decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>' # Combining MatchAllOfGeneric does not nest ok {test-number} - 1, MatcherA() && ( MatcherB() && MatcherC() ) for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) # Combining MatchAllOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype( ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>:: value' +ok {test-number} - with 1 message: 'std::is_same_v< decltype( ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>' # Combining MatchAllOfGeneric does not nest ok {test-number} - 1, ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 and equals: true ) # Combining MatchAnyOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), Catch::Matchers::Detail:: MatchAnyOfGeneric>::value' +ok {test-number} - with 1 message: 'std::is_same_v< decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), Catch::Matchers::Detail:: MatchAnyOfGeneric>' # Combining MatchAnyOfGeneric does not nest ok {test-number} - 1, ( MatcherA() || MatcherB() ) || MatcherC() for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) # Combining MatchAnyOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>::value' +ok {test-number} - with 1 message: 'std::is_same_v< decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>' # Combining MatchAnyOfGeneric does not nest ok {test-number} - 1, MatcherA() || ( MatcherB() || MatcherC() ) for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) # Combining MatchAnyOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype( ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>:: value' +ok {test-number} - with 1 message: 'std::is_same_v< decltype( ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>' # Combining MatchAnyOfGeneric does not nest ok {test-number} - 1, ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 or equals: true ) # Combining MatchNotOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype( !MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>::value' +ok {test-number} - with 1 message: 'std::is_same_v< decltype( !MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>' # Combining MatchNotOfGeneric does not nest ok {test-number} - 0, !MatcherA() for: 0 not equals: (int) 1 or (string) "1" # Combining MatchNotOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same::value' +ok {test-number} - with 1 message: 'std::is_same_v' # Combining MatchNotOfGeneric does not nest ok {test-number} - 1, !!MatcherA() for: 1 equals: (int) 1 or (string) "1" # Combining MatchNotOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype( !!!MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>::value' +ok {test-number} - with 1 message: 'std::is_same_v< decltype( !!!MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>' # Combining MatchNotOfGeneric does not nest ok {test-number} - 0, !!!MatcherA() for: 0 not equals: (int) 1 or (string) "1" # Combining MatchNotOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same::value' +ok {test-number} - with 1 message: 'std::is_same_v' # Combining MatchNotOfGeneric does not nest ok {test-number} - 1, !!!!MatcherA() for: 1 equals: (int) 1 or (string) "1" # Combining concrete matchers does not use templated matchers -ok {test-number} - with 1 message: 'std::is_same>::value' +ok {test-number} - with 1 message: 'std::is_same_v>' # Combining only templated matchers -ok {test-number} - with 1 message: 'std::is_same>::value' +ok {test-number} - with 1 message: 'std::is_same_v>' # Combining only templated matchers ok {test-number} - 1, MatcherA() || MatcherB() for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 ) # Combining only templated matchers -ok {test-number} - with 1 message: 'std::is_same>::value' +ok {test-number} - with 1 message: 'std::is_same_v>' # Combining only templated matchers ok {test-number} - 1, MatcherA() && MatcherB() for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 ) # Combining only templated matchers -ok {test-number} - with 1 message: 'std::is_same< decltype( MatcherA() || !MatcherB() ), Catch::Matchers::Detail::MatchAnyOfGeneric< MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric>>::value' +ok {test-number} - with 1 message: 'std::is_same_v< decltype( MatcherA() || !MatcherB() ), Catch::Matchers::Detail::MatchAnyOfGeneric< MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric>>' # Combining only templated matchers ok {test-number} - 1, MatcherA() || !MatcherB() for: 1 ( equals: (int) 1 or (string) "1" or not equals: (long long) 1 ) # Combining templated and concrete matchers @@ -2085,13 +2085,13 @@ ok {test-number} - !False for: true # Objects that evaluated in boolean contexts can be checked ok {test-number} - !(False) for: !{?} # Optionally static assertions -ok {test-number} - with 1 message: 'std::is_void::value' +ok {test-number} - with 1 message: 'std::is_void_v' # Optionally static assertions -ok {test-number} - with 1 message: '!(std::is_void::value)' +ok {test-number} - with 1 message: '!(std::is_void_v)' # Optionally static assertions -ok {test-number} - with 1 message: 'std::is_void::value' +ok {test-number} - with 1 message: 'std::is_void_v' # Optionally static assertions -ok {test-number} - with 1 message: '!(std::is_void::value)' +ok {test-number} - with 1 message: '!(std::is_void_v)' # Ordering comparison checks that should fail not ok {test-number} - data.int_seven > 7 for: 7 > 7 # Ordering comparison checks that should fail @@ -2497,11 +2497,11 @@ ok {test-number} - cli.parse({ "test", "--benchmark-warmup-time=10" }) for: {?} # Process can be configured on command line ok {test-number} - config.benchmarkWarmupTime == 10 for: 10 == 10 # Product with differing arities - std::tuple -ok {test-number} - std::tuple_size::value >= 1 for: 3 >= 1 +ok {test-number} - std::tuple_size_v >= 1 for: 3 >= 1 # Product with differing arities - std::tuple -ok {test-number} - std::tuple_size::value >= 1 for: 2 >= 1 +ok {test-number} - std::tuple_size_v >= 1 for: 2 >= 1 # Product with differing arities - std::tuple -ok {test-number} - std::tuple_size::value >= 1 for: 1 >= 1 +ok {test-number} - std::tuple_size_v >= 1 for: 1 >= 1 # Random seed generation accepts known methods ok {test-number} - Catch::generateRandomSeed(method) # Random seed generation accepts known methods @@ -2882,19 +2882,19 @@ ok {test-number} - Template_Fixture::m_a == 1 for: 1 == 1 # Template test case method with test types specified inside std::tuple - MyTypes - 2 ok {test-number} - Template_Fixture::m_a == 1 for: 1.0 == 1 # Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 0 -ok {test-number} - std::is_default_constructible::value for: true +ok {test-number} - std::is_default_constructible_v for: true # Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 1 -ok {test-number} - std::is_default_constructible::value for: true +ok {test-number} - std::is_default_constructible_v for: true # Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 0 -ok {test-number} - std::is_trivially_copyable::value for: true +ok {test-number} - std::is_trivially_copyable_v for: true # Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 1 -ok {test-number} - std::is_trivially_copyable::value for: true +ok {test-number} - std::is_trivially_copyable_v for: true # Template test case with test types specified inside std::tuple - MyTypes - 0 -ok {test-number} - std::is_arithmetic::value for: true +ok {test-number} - std::is_arithmetic_v for: true # Template test case with test types specified inside std::tuple - MyTypes - 1 -ok {test-number} - std::is_arithmetic::value for: true +ok {test-number} - std::is_arithmetic_v for: true # Template test case with test types specified inside std::tuple - MyTypes - 2 -ok {test-number} - std::is_arithmetic::value for: true +ok {test-number} - std::is_arithmetic_v for: true # TemplateTest: vectors can be sized and resized - float ok {test-number} - v.size() == 5 for: 5 == 5 # TemplateTest: vectors can be sized and resized - float diff --git a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt index 0fdb266a..81322cf9 100644 --- a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt @@ -37,7 +37,7 @@ This warning message starts with a linebreak' # #1514: stderr/stdout is not captured in tests aborted by an exception not ok {test-number} - explicitly with 1 message: '1514' # #1548 -ok {test-number} - std::is_same, TypeList>::value for: true +ok {test-number} - std::is_same_v, TypeList> for: true # #1905 -- test spec parser properly clears internal state between compound tests ok {test-number} - spec.matches(*fakeTestCase("spec . char")) for: true # #1905 -- test spec parser properly clears internal state between compound tests @@ -771,57 +771,57 @@ ok {test-number} - streamWrapper.str() == "1\nUsing code: 2\n2\nUsing code: 0\n3 # ColourGuard behaviour ok {test-number} - streamWrapper.str() == "Using code: 2\nA\nB\nUsing code: 0\nC\n" for: "Using code: 2 A B Using code: 0 C " == "Using code: 2 A B Using code: 0 C " # Combining MatchAllOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), Catch::Matchers::Detail:: MatchAllOfGeneric>::value' +ok {test-number} - with 1 message: 'std::is_same_v< decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), Catch::Matchers::Detail:: MatchAllOfGeneric>' # Combining MatchAllOfGeneric does not nest ok {test-number} - 1, ( MatcherA() && MatcherB() ) && MatcherC() for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) # Combining MatchAllOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>::value' +ok {test-number} - with 1 message: 'std::is_same_v< decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>' # Combining MatchAllOfGeneric does not nest ok {test-number} - 1, MatcherA() && ( MatcherB() && MatcherC() ) for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) # Combining MatchAllOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype( ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>:: value' +ok {test-number} - with 1 message: 'std::is_same_v< decltype( ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ), Catch::Matchers::Detail:: MatchAllOfGeneric>' # Combining MatchAllOfGeneric does not nest ok {test-number} - 1, ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 and equals: true ) # Combining MatchAnyOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), Catch::Matchers::Detail:: MatchAnyOfGeneric>::value' +ok {test-number} - with 1 message: 'std::is_same_v< decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), Catch::Matchers::Detail:: MatchAnyOfGeneric>' # Combining MatchAnyOfGeneric does not nest ok {test-number} - 1, ( MatcherA() || MatcherB() ) || MatcherC() for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) # Combining MatchAnyOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>::value' +ok {test-number} - with 1 message: 'std::is_same_v< decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>' # Combining MatchAnyOfGeneric does not nest ok {test-number} - 1, MatcherA() || ( MatcherB() || MatcherC() ) for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) # Combining MatchAnyOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype( ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>:: value' +ok {test-number} - with 1 message: 'std::is_same_v< decltype( ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ), Catch::Matchers::Detail:: MatchAnyOfGeneric>' # Combining MatchAnyOfGeneric does not nest ok {test-number} - 1, ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 or equals: true ) # Combining MatchNotOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype( !MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>::value' +ok {test-number} - with 1 message: 'std::is_same_v< decltype( !MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>' # Combining MatchNotOfGeneric does not nest ok {test-number} - 0, !MatcherA() for: 0 not equals: (int) 1 or (string) "1" # Combining MatchNotOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same::value' +ok {test-number} - with 1 message: 'std::is_same_v' # Combining MatchNotOfGeneric does not nest ok {test-number} - 1, !!MatcherA() for: 1 equals: (int) 1 or (string) "1" # Combining MatchNotOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype( !!!MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>::value' +ok {test-number} - with 1 message: 'std::is_same_v< decltype( !!!MatcherA() ), Catch::Matchers::Detail::MatchNotOfGeneric>' # Combining MatchNotOfGeneric does not nest ok {test-number} - 0, !!!MatcherA() for: 0 not equals: (int) 1 or (string) "1" # Combining MatchNotOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same::value' +ok {test-number} - with 1 message: 'std::is_same_v' # Combining MatchNotOfGeneric does not nest ok {test-number} - 1, !!!!MatcherA() for: 1 equals: (int) 1 or (string) "1" # Combining concrete matchers does not use templated matchers -ok {test-number} - with 1 message: 'std::is_same>::value' +ok {test-number} - with 1 message: 'std::is_same_v>' # Combining only templated matchers -ok {test-number} - with 1 message: 'std::is_same>::value' +ok {test-number} - with 1 message: 'std::is_same_v>' # Combining only templated matchers ok {test-number} - 1, MatcherA() || MatcherB() for: 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 ) # Combining only templated matchers -ok {test-number} - with 1 message: 'std::is_same>::value' +ok {test-number} - with 1 message: 'std::is_same_v>' # Combining only templated matchers ok {test-number} - 1, MatcherA() && MatcherB() for: 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 ) # Combining only templated matchers -ok {test-number} - with 1 message: 'std::is_same< decltype( MatcherA() || !MatcherB() ), Catch::Matchers::Detail::MatchAnyOfGeneric< MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric>>::value' +ok {test-number} - with 1 message: 'std::is_same_v< decltype( MatcherA() || !MatcherB() ), Catch::Matchers::Detail::MatchAnyOfGeneric< MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric>>' # Combining only templated matchers ok {test-number} - 1, MatcherA() || !MatcherB() for: 1 ( equals: (int) 1 or (string) "1" or not equals: (long long) 1 ) # Combining templated and concrete matchers @@ -2083,13 +2083,13 @@ ok {test-number} - !False for: true # Objects that evaluated in boolean contexts can be checked ok {test-number} - !(False) for: !{?} # Optionally static assertions -ok {test-number} - with 1 message: 'std::is_void::value' +ok {test-number} - with 1 message: 'std::is_void_v' # Optionally static assertions -ok {test-number} - with 1 message: '!(std::is_void::value)' +ok {test-number} - with 1 message: '!(std::is_void_v)' # Optionally static assertions -ok {test-number} - with 1 message: 'std::is_void::value' +ok {test-number} - with 1 message: 'std::is_void_v' # Optionally static assertions -ok {test-number} - with 1 message: '!(std::is_void::value)' +ok {test-number} - with 1 message: '!(std::is_void_v)' # Ordering comparison checks that should fail not ok {test-number} - data.int_seven > 7 for: 7 > 7 # Ordering comparison checks that should fail @@ -2495,11 +2495,11 @@ ok {test-number} - cli.parse({ "test", "--benchmark-warmup-time=10" }) for: {?} # Process can be configured on command line ok {test-number} - config.benchmarkWarmupTime == 10 for: 10 == 10 # Product with differing arities - std::tuple -ok {test-number} - std::tuple_size::value >= 1 for: 3 >= 1 +ok {test-number} - std::tuple_size_v >= 1 for: 3 >= 1 # Product with differing arities - std::tuple -ok {test-number} - std::tuple_size::value >= 1 for: 2 >= 1 +ok {test-number} - std::tuple_size_v >= 1 for: 2 >= 1 # Product with differing arities - std::tuple -ok {test-number} - std::tuple_size::value >= 1 for: 1 >= 1 +ok {test-number} - std::tuple_size_v >= 1 for: 1 >= 1 # Random seed generation accepts known methods ok {test-number} - Catch::generateRandomSeed(method) # Random seed generation accepts known methods @@ -2875,19 +2875,19 @@ ok {test-number} - Template_Fixture::m_a == 1 for: 1 == 1 # Template test case method with test types specified inside std::tuple - MyTypes - 2 ok {test-number} - Template_Fixture::m_a == 1 for: 1.0 == 1 # Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 0 -ok {test-number} - std::is_default_constructible::value for: true +ok {test-number} - std::is_default_constructible_v for: true # Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 1 -ok {test-number} - std::is_default_constructible::value for: true +ok {test-number} - std::is_default_constructible_v for: true # Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 0 -ok {test-number} - std::is_trivially_copyable::value for: true +ok {test-number} - std::is_trivially_copyable_v for: true # Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 1 -ok {test-number} - std::is_trivially_copyable::value for: true +ok {test-number} - std::is_trivially_copyable_v for: true # Template test case with test types specified inside std::tuple - MyTypes - 0 -ok {test-number} - std::is_arithmetic::value for: true +ok {test-number} - std::is_arithmetic_v for: true # Template test case with test types specified inside std::tuple - MyTypes - 1 -ok {test-number} - std::is_arithmetic::value for: true +ok {test-number} - std::is_arithmetic_v for: true # Template test case with test types specified inside std::tuple - MyTypes - 2 -ok {test-number} - std::is_arithmetic::value for: true +ok {test-number} - std::is_arithmetic_v for: true # TemplateTest: vectors can be sized and resized - float ok {test-number} - v.size() == 5 for: 5 == 5 # TemplateTest: vectors can be sized and resized - float diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index 142d6620..8f606c38 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -154,7 +154,7 @@ Nor would this - std::is_same<TypeList<int>, TypeList<int>>::value + std::is_same_v<TypeList<int>, TypeList<int>> true @@ -12057,7 +12057,7 @@ Approx( 0.98999999999999999 ) - std::tuple_size<TestType>::value >= 1 + std::tuple_size_v<TestType> >= 1 3 >= 1 @@ -12068,7 +12068,7 @@ Approx( 0.98999999999999999 ) - std::tuple_size<TestType>::value >= 1 + std::tuple_size_v<TestType> >= 1 2 >= 1 @@ -12079,7 +12079,7 @@ Approx( 0.98999999999999999 ) - std::tuple_size<TestType>::value >= 1 + std::tuple_size_v<TestType> >= 1 1 >= 1 @@ -14113,7 +14113,7 @@ Message from section two - std::is_default_constructible<TestType>::value + std::is_default_constructible_v<TestType> true @@ -14124,7 +14124,7 @@ Message from section two - std::is_default_constructible<TestType>::value + std::is_default_constructible_v<TestType> true @@ -14135,7 +14135,7 @@ Message from section two - std::is_trivially_copyable<TestType>::value + std::is_trivially_copyable_v<TestType> true @@ -14146,7 +14146,7 @@ Message from section two - std::is_trivially_copyable<TestType>::value + std::is_trivially_copyable_v<TestType> true @@ -14157,7 +14157,7 @@ Message from section two - std::is_arithmetic<TestType>::value + std::is_arithmetic_v<TestType> true @@ -14168,7 +14168,7 @@ Message from section two - std::is_arithmetic<TestType>::value + std::is_arithmetic_v<TestType> true @@ -14179,7 +14179,7 @@ Message from section two - std::is_arithmetic<TestType>::value + std::is_arithmetic_v<TestType> true diff --git a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt index 62562332..de6ee1fc 100644 --- a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt @@ -154,7 +154,7 @@ Nor would this - std::is_same<TypeList<int>, TypeList<int>>::value + std::is_same_v<TypeList<int>, TypeList<int>> true @@ -12057,7 +12057,7 @@ Approx( 0.98999999999999999 ) - std::tuple_size<TestType>::value >= 1 + std::tuple_size_v<TestType> >= 1 3 >= 1 @@ -12068,7 +12068,7 @@ Approx( 0.98999999999999999 ) - std::tuple_size<TestType>::value >= 1 + std::tuple_size_v<TestType> >= 1 2 >= 1 @@ -12079,7 +12079,7 @@ Approx( 0.98999999999999999 ) - std::tuple_size<TestType>::value >= 1 + std::tuple_size_v<TestType> >= 1 1 >= 1 @@ -14113,7 +14113,7 @@ Message from section two - std::is_default_constructible<TestType>::value + std::is_default_constructible_v<TestType> true @@ -14124,7 +14124,7 @@ Message from section two - std::is_default_constructible<TestType>::value + std::is_default_constructible_v<TestType> true @@ -14135,7 +14135,7 @@ Message from section two - std::is_trivially_copyable<TestType>::value + std::is_trivially_copyable_v<TestType> true @@ -14146,7 +14146,7 @@ Message from section two - std::is_trivially_copyable<TestType>::value + std::is_trivially_copyable_v<TestType> true @@ -14157,7 +14157,7 @@ Message from section two - std::is_arithmetic<TestType>::value + std::is_arithmetic_v<TestType> true @@ -14168,7 +14168,7 @@ Message from section two - std::is_arithmetic<TestType>::value + std::is_arithmetic_v<TestType> true @@ -14179,7 +14179,7 @@ Message from section two - std::is_arithmetic<TestType>::value + std::is_arithmetic_v<TestType> true diff --git a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp index 404bad27..8ccfbeaa 100644 --- a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp @@ -443,13 +443,9 @@ TEST_CASE( "Parse rng seed in different formats", "[approvals][cli][rng-seed]" ) auto cli = Catch::makeCommandLineParser( config ); SECTION("well formed cases") { - char const* seed_string; - uint32_t seed_value; - // GCC-5 workaround - using gen_type = std::tuple; - std::tie( seed_string, seed_value ) = GENERATE( table({ - gen_type{ "0xBEEF", 0xBEEF }, - gen_type{ "12345678", 12345678 } + auto [seed_string, seed_value] = GENERATE( table({ + { "0xBEEF", 0xBEEF }, + { "12345678", 12345678 } } ) ); CAPTURE( seed_string ); diff --git a/tests/SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp b/tests/SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp index d2181702..24058197 100644 --- a/tests/SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp @@ -130,10 +130,10 @@ TEST_CASE( "count_equidistant_floats", std::numeric_limits::max() ) == 18014398509481982 ); // (1 << 54) - 2 due to not including infinities - STATIC_REQUIRE( std::is_same::value ); - STATIC_REQUIRE( std::is_same::value ); + STATIC_REQUIRE( std::is_same_v ); + STATIC_REQUIRE( std::is_same_v ); } diff --git a/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp b/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp index c044547d..5ef7dc51 100644 --- a/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp @@ -427,7 +427,7 @@ TEST_CASE("GENERATE handles function (pointers)", "[generators][compilation][app TEST_CASE("GENERATE decays arrays", "[generators][compilation][approvals]") { auto str = GENERATE("abc", "def", "gh"); (void)str; - STATIC_REQUIRE(std::is_same::value); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("Generators count returned elements", "[generators][approvals]") { diff --git a/tests/SelfTest/IntrospectiveTests/Integer.tests.cpp b/tests/SelfTest/IntrospectiveTests/Integer.tests.cpp index 4ce2ae6a..c6655085 100644 --- a/tests/SelfTest/IntrospectiveTests/Integer.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/Integer.tests.cpp @@ -146,11 +146,11 @@ TEST_CASE( "SizedUnsignedType helpers", "[integer][approvals]" ) { STATIC_REQUIRE( sizeof( SizedUnsignedType_t<8> ) == 8 ); STATIC_REQUIRE( sizeof( DoubleWidthUnsignedType_t ) == 2 ); - STATIC_REQUIRE( std::is_unsigned>::value ); + STATIC_REQUIRE( std::is_unsigned_v> ); STATIC_REQUIRE( sizeof( DoubleWidthUnsignedType_t ) == 4 ); - STATIC_REQUIRE( std::is_unsigned>::value ); + STATIC_REQUIRE( std::is_unsigned_v> ); STATIC_REQUIRE( sizeof( DoubleWidthUnsignedType_t ) == 8 ); - STATIC_REQUIRE( std::is_unsigned>::value ); + STATIC_REQUIRE( std::is_unsigned_v> ); } TEST_CASE( "extendedMult 32x32", "[integer][approvals]" ) { diff --git a/tests/SelfTest/IntrospectiveTests/RandomNumberGeneration.tests.cpp b/tests/SelfTest/IntrospectiveTests/RandomNumberGeneration.tests.cpp index 5166070a..cccb2ad7 100644 --- a/tests/SelfTest/IntrospectiveTests/RandomNumberGeneration.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/RandomNumberGeneration.tests.cpp @@ -214,7 +214,7 @@ TEMPLATE_TEST_CASE( "uniform_integer_distribution can handle full width ranges", constexpr auto lowest = std::numeric_limits::min(); constexpr auto highest = std::numeric_limits::max(); Catch::uniform_integer_distribution dist( lowest, highest ); - STATIC_REQUIRE( std::is_same::value ); + STATIC_REQUIRE( std::is_same_v ); // We need to do bit operations on the results, so we will have to // cast them to unsigned type. @@ -451,21 +451,6 @@ namespace { 381264073 }; }; - // We need these definitions for C++14 and earlier, but - // GCC will complain about them in newer C++ standards -#if __cplusplus <= 201402L - constexpr bool uniform_integer_test_params::expected[]; - constexpr char uniform_integer_test_params::expected[]; - constexpr uint8_t uniform_integer_test_params::expected[]; - constexpr int8_t uniform_integer_test_params::expected[]; - constexpr uint16_t uniform_integer_test_params::expected[]; - constexpr int16_t uniform_integer_test_params::expected[]; - constexpr uint32_t uniform_integer_test_params::expected[]; - constexpr int32_t uniform_integer_test_params::expected[]; - constexpr uint64_t uniform_integer_test_params::expected[]; - constexpr int64_t uniform_integer_test_params::expected[]; -#endif - } TEMPLATE_TEST_CASE( "uniform_integer_distribution is reproducible", @@ -559,13 +544,6 @@ namespace { 60912.7615841752, -149060.05936760217 }; }; - -// We need these definitions for C++14 and earlier, but -// GCC will complain about them in newer C++ standards -#if __cplusplus <= 201402L - constexpr float uniform_fp_test_params::expected[]; - constexpr double uniform_fp_test_params::expected[]; -#endif } // namespace TEMPLATE_TEST_CASE( "uniform_floating_point_distribution is reproducible", diff --git a/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp b/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp index f30573cc..b3b80db8 100644 --- a/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp @@ -17,8 +17,8 @@ static const char * const whitespace_at_both_ends = " \r\n \t There is no extra TEST_CASE("Trim strings", "[string-manip]") { using Catch::trim; using Catch::StringRef; - static_assert(std::is_same::value, "Trimming std::string should return std::string"); - static_assert(std::is_same::value, "Trimming StringRef should return StringRef"); + static_assert(std::is_same_v, "Trimming std::string should return std::string"); + static_assert(std::is_same_v, "Trimming StringRef should return StringRef"); REQUIRE(trim(std::string(no_whitespace)) == no_whitespace); REQUIRE(trim(std::string(leading_whitespace)) == no_whitespace); diff --git a/tests/SelfTest/IntrospectiveTests/UniquePtr.tests.cpp b/tests/SelfTest/IntrospectiveTests/UniquePtr.tests.cpp index 420bf1b3..83ee6ab1 100644 --- a/tests/SelfTest/IntrospectiveTests/UniquePtr.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/UniquePtr.tests.cpp @@ -83,12 +83,12 @@ namespace { } // end unnamed namespace -static_assert( std::is_constructible, - Catch::Detail::unique_ptr>::value, "Upcasting is supported"); -static_assert(!std::is_constructible, - Catch::Detail::unique_ptr>::value, "Downcasting is not supported"); -static_assert(!std::is_constructible, - Catch::Detail::unique_ptr>::value, "Cannot just convert one ptr type to another"); +static_assert( std::is_constructible_v, + Catch::Detail::unique_ptr>, "Upcasting is supported"); +static_assert(!std::is_constructible_v, + Catch::Detail::unique_ptr>, "Downcasting is not supported"); +static_assert(!std::is_constructible_v, + Catch::Detail::unique_ptr>, "Cannot just convert one ptr type to another"); TEST_CASE("Upcasting special member functions", "[internals][unique-ptr]") { using Catch::Detail::unique_ptr; diff --git a/tests/SelfTest/UsageTests/Compilation.tests.cpp b/tests/SelfTest/UsageTests/Compilation.tests.cpp index d8813353..d1b7e442 100644 --- a/tests/SelfTest/UsageTests/Compilation.tests.cpp +++ b/tests/SelfTest/UsageTests/Compilation.tests.cpp @@ -194,15 +194,15 @@ TEST_CASE("#1403", "[compilation]") { } TEST_CASE("Optionally static assertions", "[compilation]") { - STATIC_REQUIRE( std::is_void::value ); - STATIC_REQUIRE_FALSE( std::is_void::value ); - STATIC_CHECK( std::is_void::value ); - STATIC_CHECK_FALSE( std::is_void::value ); + STATIC_REQUIRE( std::is_void_v ); + STATIC_REQUIRE_FALSE( std::is_void_v ); + STATIC_CHECK( std::is_void_v ); + STATIC_CHECK_FALSE( std::is_void_v ); } TEST_CASE("#1548", "[compilation]") { using namespace bar; - REQUIRE(std::is_same, TypeList>::value); + REQUIRE(std::is_same_v, TypeList>); } // #925 diff --git a/tests/SelfTest/UsageTests/Generators.tests.cpp b/tests/SelfTest/UsageTests/Generators.tests.cpp index f04cf4f0..5771db3d 100644 --- a/tests/SelfTest/UsageTests/Generators.tests.cpp +++ b/tests/SelfTest/UsageTests/Generators.tests.cpp @@ -193,13 +193,13 @@ TEST_CASE("Generators -- adapters", "[generators][generic]") { TEST_CASE("Random generator", "[generators][approvals]") { SECTION("Infer int from integral arguments") { auto val = GENERATE(take(4, random(0, 1))); - STATIC_REQUIRE(std::is_same::value); + STATIC_REQUIRE(std::is_same_v); REQUIRE(0 <= val); REQUIRE(val <= 1); } SECTION("Infer double from double arguments") { auto val = GENERATE(take(4, random(0., 1.))); - STATIC_REQUIRE(std::is_same::value); + STATIC_REQUIRE(std::is_same_v); REQUIRE(0. <= val); REQUIRE(val < 1); } diff --git a/tests/SelfTest/UsageTests/Matchers.tests.cpp b/tests/SelfTest/UsageTests/Matchers.tests.cpp index 7c4501c6..fabb5c61 100644 --- a/tests/SelfTest/UsageTests/Matchers.tests.cpp +++ b/tests/SelfTest/UsageTests/Matchers.tests.cpp @@ -879,10 +879,10 @@ TEST_CASE( "Combining concrete matchers does not use templated matchers", using Catch::Matchers::StartsWith; STATIC_REQUIRE( - std::is_same>::value ); + Catch::Matchers::Detail::MatchAnyOf> ); } struct MatcherA : Catch::Matchers::MatcherGenericBase { @@ -910,25 +910,25 @@ struct MatcherD : Catch::Matchers::MatcherGenericBase { TEST_CASE( "Combining only templated matchers", "[matchers][templated]" ) { STATIC_REQUIRE( - std::is_same>::value ); + MatchAnyOfGeneric> ); REQUIRE_THAT( 1, MatcherA() || MatcherB() ); STATIC_REQUIRE( - std::is_same>::value ); + MatchAllOfGeneric> ); REQUIRE_THAT( 1, MatcherA() && MatcherB() ); STATIC_REQUIRE( - std::is_same< + std::is_same_v< decltype( MatcherA() || !MatcherB() ), Catch::Matchers::Detail::MatchAnyOfGeneric< MatcherA, - Catch::Matchers::Detail::MatchNotOfGeneric>>::value ); + Catch::Matchers::Detail::MatchNotOfGeneric>> ); REQUIRE_THAT( 1, MatcherA() || !MatcherB() ); } @@ -937,30 +937,29 @@ TEST_CASE( "Combining MatchAnyOfGeneric does not nest", "[matchers][templated]" ) { // MatchAnyOfGeneric LHS + some matcher RHS STATIC_REQUIRE( - std::is_same< + std::is_same_v< decltype( ( MatcherA() || MatcherB() ) || MatcherC() ), Catch::Matchers::Detail:: - MatchAnyOfGeneric>::value ); + MatchAnyOfGeneric> ); REQUIRE_THAT( 1, ( MatcherA() || MatcherB() ) || MatcherC() ); // some matcher LHS + MatchAnyOfGeneric RHS STATIC_REQUIRE( - std::is_same< + std::is_same_v< decltype( MatcherA() || ( MatcherB() || MatcherC() ) ), Catch::Matchers::Detail:: - MatchAnyOfGeneric>::value ); + MatchAnyOfGeneric> ); REQUIRE_THAT( 1, MatcherA() || ( MatcherB() || MatcherC() ) ); // MatchAnyOfGeneric LHS + MatchAnyOfGeneric RHS STATIC_REQUIRE( - std::is_same< + std::is_same_v< decltype( ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ), Catch::Matchers::Detail:: - MatchAnyOfGeneric>:: - value ); + MatchAnyOfGeneric>); REQUIRE_THAT( 1, ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) ); @@ -970,30 +969,29 @@ TEST_CASE( "Combining MatchAllOfGeneric does not nest", "[matchers][templated]" ) { // MatchAllOfGeneric lhs + some matcher RHS STATIC_REQUIRE( - std::is_same< + std::is_same_v< decltype( ( MatcherA() && MatcherB() ) && MatcherC() ), Catch::Matchers::Detail:: - MatchAllOfGeneric>::value ); + MatchAllOfGeneric> ); REQUIRE_THAT( 1, ( MatcherA() && MatcherB() ) && MatcherC() ); // some matcher LHS + MatchAllOfGeneric RSH STATIC_REQUIRE( - std::is_same< + std::is_same_v< decltype( MatcherA() && ( MatcherB() && MatcherC() ) ), Catch::Matchers::Detail:: - MatchAllOfGeneric>::value ); + MatchAllOfGeneric> ); REQUIRE_THAT( 1, MatcherA() && ( MatcherB() && MatcherC() ) ); // MatchAllOfGeneric LHS + MatchAllOfGeneric RHS STATIC_REQUIRE( - std::is_same< + std::is_same_v< decltype( ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ), Catch::Matchers::Detail:: - MatchAllOfGeneric>:: - value ); + MatchAllOfGeneric>); REQUIRE_THAT( 1, ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) ); @@ -1002,26 +1000,26 @@ TEST_CASE( "Combining MatchAllOfGeneric does not nest", TEST_CASE( "Combining MatchNotOfGeneric does not nest", "[matchers][templated]" ) { STATIC_REQUIRE( - std::is_same< + std::is_same_v< decltype( !MatcherA() ), - Catch::Matchers::Detail::MatchNotOfGeneric>::value ); + Catch::Matchers::Detail::MatchNotOfGeneric> ); REQUIRE_THAT( 0, !MatcherA() ); STATIC_REQUIRE( - std::is_same::value ); + std::is_same_v ); REQUIRE_THAT( 1, !!MatcherA() ); STATIC_REQUIRE( - std::is_same< + std::is_same_v< decltype( !!!MatcherA() ), - Catch::Matchers::Detail::MatchNotOfGeneric>::value ); + Catch::Matchers::Detail::MatchNotOfGeneric> ); REQUIRE_THAT( 0, !!!MatcherA() ); STATIC_REQUIRE( - std::is_same::value ); + std::is_same_v ); REQUIRE_THAT( 1, !!!!MatcherA() ); } diff --git a/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp b/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp index 4f906b99..6037f24f 100644 --- a/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp +++ b/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp @@ -123,7 +123,7 @@ TEST_CASE("Basic use of the Empty range matcher", "[matchers][templated][empty]" REQUIRE_THAT(non_empty_vec, !IsEmpty()); std::list>> inner_lists_are_empty; - inner_lists_are_empty.push_back({}); + inner_lists_are_empty.emplace_back(); REQUIRE_THAT(inner_lists_are_empty, !IsEmpty()); REQUIRE_THAT(inner_lists_are_empty.front(), IsEmpty()); } @@ -592,11 +592,6 @@ TEST_CASE("All/Any/None True matchers support types with ADL begin", } } -// Range loop iterating over range with different types for begin and end is a -// C++17 feature, and GCC refuses to compile such code unless the lang mode is -// set to C++17 or later. -#if defined(CATCH_CPP17_OR_GREATER) - TEST_CASE( "The quantifier range matchers support types with different types returned from begin and end", "[matchers][templated][quantifiers][approvals]" ) { using Catch::Matchers::AllMatch; @@ -656,8 +651,6 @@ TEST_CASE( "RangeContains supports ranges with different types returned from " REQUIRE_THAT( diff_types, Contains( LessThanMatcher( size_t( 4 ) ) ) ); } -#endif - TEST_CASE( "Usage of RangeEquals range matcher", "[matchers][templated][quantifiers]" ) { using Catch::Matchers::RangeEquals; @@ -849,8 +842,8 @@ static constexpr bool ContainerIsRandomAccess( const Container& ) { using array_iter_category = typename std::iterator_traits< typename Container::iterator>::iterator_category; - return std::is_base_of::value; + return std::is_base_of_v; } TEST_CASE( "Type conversions of RangeEquals and similar", @@ -933,4 +926,4 @@ TEST_CASE( "Type conversions of RangeEquals and similar", UnorderedRangeEquals( array_a_plus_1, close_enough ) ); } } -} \ No newline at end of file +} diff --git a/tests/SelfTest/UsageTests/Misc.tests.cpp b/tests/SelfTest/UsageTests/Misc.tests.cpp index dec51ab8..6baecef5 100644 --- a/tests/SelfTest/UsageTests/Misc.tests.cpp +++ b/tests/SelfTest/UsageTests/Misc.tests.cpp @@ -389,13 +389,13 @@ TEMPLATE_PRODUCT_TEST_CASE_SIG("A Template product test case with array signatur } TEMPLATE_PRODUCT_TEST_CASE("Product with differing arities", "[template][product]", std::tuple, (int, (int, double), (int, double, float))) { - REQUIRE(std::tuple_size::value >= 1); + REQUIRE(std::tuple_size_v >= 1); } using MyTypes = std::tuple; TEMPLATE_LIST_TEST_CASE("Template test case with test types specified inside std::tuple", "[template][list]", MyTypes) { - REQUIRE(std::is_arithmetic::value); + REQUIRE(std::is_arithmetic_v); } struct NonDefaultConstructibleType { @@ -405,7 +405,7 @@ struct NonDefaultConstructibleType { using MyNonDefaultConstructibleTypes = std::tuple; TEMPLATE_LIST_TEST_CASE("Template test case with test types specified inside non-default-constructible std::tuple", "[template][list]", MyNonDefaultConstructibleTypes) { - REQUIRE(std::is_trivially_copyable::value); + REQUIRE(std::is_trivially_copyable_v); } struct NonCopyableAndNonMovableType { @@ -420,7 +420,7 @@ struct NonCopyableAndNonMovableType { using NonCopyableAndNonMovableTypes = std::tuple; TEMPLATE_LIST_TEST_CASE("Template test case with test types specified inside non-copyable and non-movable std::tuple", "[template][list]", NonCopyableAndNonMovableTypes) { - REQUIRE(std::is_default_constructible::value); + REQUIRE(std::is_default_constructible_v); } // https://github.com/philsquared/Catch/issues/166 diff --git a/tests/SelfTest/UsageTests/ToStringByte.tests.cpp b/tests/SelfTest/UsageTests/ToStringByte.tests.cpp index 624abbf1..1675f8cc 100644 --- a/tests/SelfTest/UsageTests/ToStringByte.tests.cpp +++ b/tests/SelfTest/UsageTests/ToStringByte.tests.cpp @@ -8,8 +8,6 @@ #include -#if defined(CATCH_CONFIG_CPP17_BYTE) - TEST_CASE( "std::byte -> toString", "[toString][byte][approvals]" ) { using type = std::byte; REQUIRE( "0" == ::Catch::Detail::stringify( type{ 0 } ) ); @@ -19,5 +17,3 @@ TEST_CASE( "std::vector -> toString", "[toString][byte][approvals]" ) using type = std::vector; REQUIRE( "{ 0, 1, 2 }" == ::Catch::Detail::stringify( type{ std::byte{0}, std::byte{1}, std::byte{2} } ) ); } - -#endif // CATCH_INTERNAL_CONFIG_CPP17_BYTE diff --git a/tests/SelfTest/UsageTests/ToStringGeneral.tests.cpp b/tests/SelfTest/UsageTests/ToStringGeneral.tests.cpp index 78c0c80a..710422f6 100644 --- a/tests/SelfTest/UsageTests/ToStringGeneral.tests.cpp +++ b/tests/SelfTest/UsageTests/ToStringGeneral.tests.cpp @@ -106,8 +106,6 @@ TEST_CASE("Static arrays are convertible to string", "[toString]") { } } -#ifdef CATCH_CONFIG_CPP17_STRING_VIEW - TEST_CASE("String views are stringified like other strings", "[toString][approvals]") { std::string_view view{"abc"}; CHECK(Catch::Detail::stringify(view) == R"("abc")"); @@ -116,8 +114,6 @@ TEST_CASE("String views are stringified like other strings", "[toString][approva CHECK(Catch::Detail::stringify(arr) == R"({ "abc" })"); } -#endif - TEST_CASE("Precision of floating point stringification can be set", "[toString][floatingPoint]") { SECTION("Floats") { using sm = Catch::StringMaker; diff --git a/tests/SelfTest/UsageTests/ToStringOptional.tests.cpp b/tests/SelfTest/UsageTests/ToStringOptional.tests.cpp index 3671771a..5ca69854 100644 --- a/tests/SelfTest/UsageTests/ToStringOptional.tests.cpp +++ b/tests/SelfTest/UsageTests/ToStringOptional.tests.cpp @@ -9,8 +9,6 @@ #define CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER #include -#if defined(CATCH_CONFIG_CPP17_OPTIONAL) - TEST_CASE( "std::optional -> toString", "[toString][optional][approvals]" ) { using type = std::optional; REQUIRE( "{ }" == ::Catch::Detail::stringify( type{} ) ); @@ -31,5 +29,3 @@ TEST_CASE( "std::vector > -> toString", "[toString][optional] TEST_CASE( "std::nullopt -> toString", "[toString][optional][approvals]" ) { REQUIRE( "{ }" == ::Catch::Detail::stringify( std::nullopt ) ); } - -#endif // CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL diff --git a/tests/SelfTest/UsageTests/ToStringPair.tests.cpp b/tests/SelfTest/UsageTests/ToStringPair.tests.cpp index f5cb239c..11995aa1 100644 --- a/tests/SelfTest/UsageTests/ToStringPair.tests.cpp +++ b/tests/SelfTest/UsageTests/ToStringPair.tests.cpp @@ -21,7 +21,7 @@ TEST_CASE( "std::pair -> toString", "[toString][pair]" ) TEST_CASE( "std::vector > -> toString", "[toString][pair]" ) { std::vector > pr; - pr.push_back( std::make_pair("green", 55 ) ); + pr.emplace_back( "green", 55 ); REQUIRE( ::Catch::Detail::stringify( pr ) == "{ { \"green\", 55 } }" ); } diff --git a/tests/SelfTest/UsageTests/ToStringVariant.tests.cpp b/tests/SelfTest/UsageTests/ToStringVariant.tests.cpp index 197ba557..cc5a3ce0 100644 --- a/tests/SelfTest/UsageTests/ToStringVariant.tests.cpp +++ b/tests/SelfTest/UsageTests/ToStringVariant.tests.cpp @@ -9,8 +9,6 @@ #define CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER #include -#if defined(CATCH_CONFIG_CPP17_VARIANT) - #include #include @@ -95,5 +93,3 @@ TEST_CASE( "variant", "[toString][variant][approvals]" CHECK( "42" == ::Catch::Detail::stringify(type{42}) ); CHECK( "\"Catch me\"" == ::Catch::Detail::stringify(type{"Catch me"}) ); } - -#endif // CATCH_INTERNAL_CONFIG_CPP17_VARIANT diff --git a/tests/SelfTest/helpers/type_with_lit_0_comparisons.hpp b/tests/SelfTest/helpers/type_with_lit_0_comparisons.hpp index a8e517c0..1085e2a0 100644 --- a/tests/SelfTest/helpers/type_with_lit_0_comparisons.hpp +++ b/tests/SelfTest/helpers/type_with_lit_0_comparisons.hpp @@ -20,7 +20,7 @@ struct ZeroLiteralAsPointer { constexpr ZeroLiteralAsPointer( ZeroLiteralAsPointer* ) noexcept {} template ::value>> + typename = std::enable_if_t>> constexpr ZeroLiteralAsPointer( T ) = delete; }; diff --git a/third_party/clara.hpp b/third_party/clara.hpp index eb4c7275..e3a6fd93 100644 --- a/third_party/clara.hpp +++ b/third_party/clara.hpp @@ -18,14 +18,7 @@ #define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CLARA_CONFIG_CONSOLE_WIDTH #endif -#ifndef CLARA_CONFIG_OPTIONAL_TYPE -#ifdef __has_include -#if __has_include() && __cplusplus >= 201703L #include -#define CLARA_CONFIG_OPTIONAL_TYPE std::optional -#endif -#endif -#endif // ----------- #included from clara_textflow.hpp ----------- @@ -676,16 +669,14 @@ namespace detail { return ParserResult::runtimeError( "Expected a boolean value but did not recognise: '" + source + "'" ); return ParserResult::ok( ParseResultType::Matched ); } -#ifdef CLARA_CONFIG_OPTIONAL_TYPE template - inline auto convertInto( std::string const &source, CLARA_CONFIG_OPTIONAL_TYPE& target ) -> ParserResult { + inline auto convertInto( std::string const &source, std::optional& target ) -> ParserResult { T temp; auto result = convertInto( source, temp ); if( result ) target = std::move(temp); return result; } -#endif // CLARA_CONFIG_OPTIONAL_TYPE struct NonCopyable { NonCopyable() = default; @@ -749,7 +740,7 @@ namespace detail { template struct LambdaInvoker { - static_assert( std::is_same::value, "Lambda must return void or clara::ParserResult" ); + static_assert( std::is_same_v, "Lambda must return void or clara::ParserResult" ); template static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult { @@ -793,7 +784,7 @@ namespace detail { L m_lambda; static_assert( UnaryLambdaTraits::isValid, "Supplied lambda must take exactly one argument" ); - static_assert( std::is_same::ArgType, bool>::value, "flags must be boolean" ); + static_assert( std::is_same_v::ArgType, bool>, "flags must be boolean" ); explicit BoundFlagLambda( L const &lambda ) : m_lambda( lambda ) {}