Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorLeitwolf112026-10-25 02:37:35 +0300
committerLeitwolf112026-10-25 02:37:35 +0300
commit126dc333564cb72b5115d9a9242d66694694b6d0 (patch)
tree0bce4462b2e190c39b3e1c5f697e3e4abd1a5e2a /examples
parent13f81a480a93807c14dddb5abdb97355ced4d4c5 (diff)
downloadcatch3-126dc333564cb72b5115d9a9242d66694694b6d0.tar.gz
Give Catch3 its own build names and headers
Catch2 compatibility means the API tests are written in: the macros, such as TEST_CASE and REQUIRE, and the Catch:: namespace. It does not mean Catch2's build names or header paths. find_package(Catch2) found Catch3, and a project using both frameworks met two packages, two sets of targets, two Catch.cmake modules and two catch2/ header trees with the same names. Build names: - CMake: project and package Catch3, targets Catch3::Catch3 and Catch3::Catch3WithMain, libraries Catch3 and Catch3Main, options CATCH3_*, lib/cmake/Catch3 with Catch3Config, and pkg-config catch3 and catch3-with-main. The version is Catch3's, 0.3.0, compatible within a minor version. - The CMake scripts are Catch3.cmake (catch3_discover_tests), Catch3AddTests.cmake and Catch3ShardTests.cmake (catch3_add_sharded_tests); the helpers they define at ctest time have a catch3_ prefix. ParseAndAddCatchTests.cmake, deprecated upstream, is gone. - Bazel //:catch3 and //:catch3_main, Meson catch3 and catch3-with-main (with override_dependency), Xmake catch3 and catch3_main, Premake Catch3 and Catch3WithMain. Visual Studio projects get GUIDs of their own. - The Progmasoft::Catch3 target and package are gone: property testing and snapshots are part of Catch3::Catch3. Their sources now build with the library's warning flags, so property failures are built field by field (no missing initializers) and the default property name is a thread-local pointer to the name its scope owns (no global destructor). Headers: the engine moved from src/catch2 to src/Progmasoft/Catch3 with Progmasoft names, so <catch2/catch_test_macros.hpp> is <Progmasoft/Catch3/TestMacros.hpp>, <catch2/matchers/catch_matchers_string.hpp> is <Progmasoft/Catch3/Matchers/String.hpp>, and interface headers are named after their interface, such as Interfaces/IConfig.hpp. Include guards became #pragma once. The installed headers go to include/Progmasoft. src/Progmasoft/Context.cpp is StrategyContext.cpp, so no two sources share a file name. tools/scripts/upstreamFiles.txt lists the files that come from Catch2. The license check expects BSL-1.0 on them and Progmasoft's header on the rest of src/Progmasoft; the convenience-header check, the amalgamation script and the surrogate tests take the engine's headers from it. The amalgamated files are regenerated. The header-guard workflow checks for #pragma once instead of checkguard. Documents, the README and the release notes describe the new names.
Diffstat (limited to 'examples')
-rw-r--r--examples/010-TestCase.cpp2
-rw-r--r--examples/020-TestCase-1.cpp2
-rw-r--r--examples/020-TestCase-2.cpp2
-rw-r--r--examples/030-Asn-Require-Check.cpp2
-rw-r--r--examples/100-Fix-Section.cpp2
-rw-r--r--examples/110-Fix-ClassFixture.cpp2
-rw-r--r--examples/111-Fix-PersistentFixture.cpp2
-rw-r--r--examples/120-Bdd-ScenarioGivenWhenThen.cpp2
-rw-r--r--examples/210-Evt-EventListeners.cpp8
-rw-r--r--examples/231-Cfg-OutputStreams.cpp2
-rw-r--r--examples/232-Cfg-CustomMain.cpp2
-rw-r--r--examples/300-Gen-OwnGenerator.cpp6
-rw-r--r--examples/301-Gen-MapTypeConversion.cpp4
-rw-r--r--examples/302-Gen-Table.cpp4
-rw-r--r--examples/310-Gen-VariablesInGenerators.cpp6
-rw-r--r--examples/311-Gen-CustomCapture.cpp6
-rw-r--r--examples/CMakeLists.txt6
17 files changed, 30 insertions, 30 deletions
diff --git a/examples/010-TestCase.cpp b/examples/010-TestCase.cpp
index 9e5cd8cd..5eb982c8 100644
--- a/examples/010-TestCase.cpp
+++ b/examples/010-TestCase.cpp
@@ -8,7 +8,7 @@
// 010-TestCase.cpp
// And write tests in the same file:
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
static int Factorial( int number ) {
return number <= 1 ? number : Factorial( number - 1 ) * number; // fail
diff --git a/examples/020-TestCase-1.cpp b/examples/020-TestCase-1.cpp
index a9d87dbc..86de07a9 100644
--- a/examples/020-TestCase-1.cpp
+++ b/examples/020-TestCase-1.cpp
@@ -8,7 +8,7 @@
// 020-TestCase-1.cpp
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
TEST_CASE( "1: All test cases reside in other .cpp files (empty)", "[multi-file:1]" ) {
}
diff --git a/examples/020-TestCase-2.cpp b/examples/020-TestCase-2.cpp
index 72dd0ffb..908db1c0 100644
--- a/examples/020-TestCase-2.cpp
+++ b/examples/020-TestCase-2.cpp
@@ -10,7 +10,7 @@
// main() provided by Catch in file 020-TestCase-1.cpp.
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
static int Factorial( int number ) {
return number <= 1 ? number : Factorial( number - 1 ) * number; // fail
diff --git a/examples/030-Asn-Require-Check.cpp b/examples/030-Asn-Require-Check.cpp
index 62cd3cfc..ed6ad752 100644
--- a/examples/030-Asn-Require-Check.cpp
+++ b/examples/030-Asn-Require-Check.cpp
@@ -18,7 +18,7 @@
// main() provided by linkage to Catch2WithMain
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
static std::string one() {
return "1";
diff --git a/examples/100-Fix-Section.cpp b/examples/100-Fix-Section.cpp
index 7c8d8aa8..d1e4cdbc 100644
--- a/examples/100-Fix-Section.cpp
+++ b/examples/100-Fix-Section.cpp
@@ -14,7 +14,7 @@
// main() provided by linkage to Catch2WithMain
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
#include <vector>
TEST_CASE( "vectors can be sized and resized", "[vector]" ) {
diff --git a/examples/110-Fix-ClassFixture.cpp b/examples/110-Fix-ClassFixture.cpp
index 614c3797..1b3f053f 100644
--- a/examples/110-Fix-ClassFixture.cpp
+++ b/examples/110-Fix-ClassFixture.cpp
@@ -14,7 +14,7 @@
// main() provided by linkage to Catch2WithMain
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
class DBConnection
{
diff --git a/examples/111-Fix-PersistentFixture.cpp b/examples/111-Fix-PersistentFixture.cpp
index 2bef90ff..bed9d3e3 100644
--- a/examples/111-Fix-PersistentFixture.cpp
+++ b/examples/111-Fix-PersistentFixture.cpp
@@ -17,7 +17,7 @@
// main() provided by linkage to Catch2WithMain
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
#include <thread>
diff --git a/examples/120-Bdd-ScenarioGivenWhenThen.cpp b/examples/120-Bdd-ScenarioGivenWhenThen.cpp
index 345d53c3..b3edcd8c 100644
--- a/examples/120-Bdd-ScenarioGivenWhenThen.cpp
+++ b/examples/120-Bdd-ScenarioGivenWhenThen.cpp
@@ -10,7 +10,7 @@
// main() provided by linkage with Catch2WithMain
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
SCENARIO( "vectors can be sized and resized", "[vector]" ) {
diff --git a/examples/210-Evt-EventListeners.cpp b/examples/210-Evt-EventListeners.cpp
index f0a9f0af..48ccce20 100644
--- a/examples/210-Evt-EventListeners.cpp
+++ b/examples/210-Evt-EventListeners.cpp
@@ -13,10 +13,10 @@
// 2. My listener and registration
// 3. Test cases
-#include <catch2/catch_test_macros.hpp>
-#include <catch2/reporters/catch_reporter_event_listener.hpp>
-#include <catch2/reporters/catch_reporter_registrars.hpp>
-#include <catch2/catch_test_case_info.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
+#include <Progmasoft/Catch3/Reporters/EventListener.hpp>
+#include <Progmasoft/Catch3/Reporters/Registrars.hpp>
+#include <Progmasoft/Catch3/TestCaseInfo.hpp>
#include <iostream>
// -----------------------------------------------------------------------
diff --git a/examples/231-Cfg-OutputStreams.cpp b/examples/231-Cfg-OutputStreams.cpp
index 5aee38bc..e750333d 100644
--- a/examples/231-Cfg-OutputStreams.cpp
+++ b/examples/231-Cfg-OutputStreams.cpp
@@ -13,7 +13,7 @@
// semantic, because it buffers the output. For most uses however,
// there is no important difference between having `std::cerr` buffered
// or unbuffered.
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
#include <sstream>
#include <cstdio>
diff --git a/examples/232-Cfg-CustomMain.cpp b/examples/232-Cfg-CustomMain.cpp
index 6ef05fe7..0ba58250 100644
--- a/examples/232-Cfg-CustomMain.cpp
+++ b/examples/232-Cfg-CustomMain.cpp
@@ -14,7 +14,7 @@
// same `main`: what happens before `run` happens in every worker too, which
// is where global set-up belongs.
-#include <catch2/catch_session.hpp>
+#include <Progmasoft/Catch3/Session.hpp>
#include <cstdlib>
#include <iostream>
diff --git a/examples/300-Gen-OwnGenerator.cpp b/examples/300-Gen-OwnGenerator.cpp
index ff28ad73..12859026 100644
--- a/examples/300-Gen-OwnGenerator.cpp
+++ b/examples/300-Gen-OwnGenerator.cpp
@@ -12,9 +12,9 @@
// Specifically we will implement a random number generator for integers
// It will have infinite capacity and settable lower/upper bound
-#include <catch2/catch_test_macros.hpp>
-#include <catch2/generators/catch_generators.hpp>
-#include <catch2/generators/catch_generators_adapters.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
+#include <Progmasoft/Catch3/Generators/Generators.hpp>
+#include <Progmasoft/Catch3/Generators/Adapters.hpp>
#include <random>
diff --git a/examples/301-Gen-MapTypeConversion.cpp b/examples/301-Gen-MapTypeConversion.cpp
index 26f7538c..99bb1f6b 100644
--- a/examples/301-Gen-MapTypeConversion.cpp
+++ b/examples/301-Gen-MapTypeConversion.cpp
@@ -13,8 +13,8 @@
// that converts the strings using stoi, so the returned type is actually
// an int.
-#include <catch2/catch_test_macros.hpp>
-#include <catch2/generators/catch_generators_adapters.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
+#include <Progmasoft/Catch3/Generators/Adapters.hpp>
#include <string>
#include <sstream>
diff --git a/examples/302-Gen-Table.cpp b/examples/302-Gen-Table.cpp
index 3cdb1430..54afc802 100644
--- a/examples/302-Gen-Table.cpp
+++ b/examples/302-Gen-Table.cpp
@@ -10,8 +10,8 @@
// Shows how to use table to run a test many times with different inputs. Lifted from examples on
// issue #850.
-#include <catch2/catch_test_macros.hpp>
-#include <catch2/generators/catch_generators.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
+#include <Progmasoft/Catch3/Generators/Generators.hpp>
#include <string>
struct TestSubject {
diff --git a/examples/310-Gen-VariablesInGenerators.cpp b/examples/310-Gen-VariablesInGenerators.cpp
index 5d24d45a..ab584520 100644
--- a/examples/310-Gen-VariablesInGenerators.cpp
+++ b/examples/310-Gen-VariablesInGenerators.cpp
@@ -14,9 +14,9 @@
// _WILL_ outlive the variables -- thus they should be either captured
// by value directly, or copied by the generators during construction.
-#include <catch2/catch_test_macros.hpp>
-#include <catch2/generators/catch_generators_adapters.hpp>
-#include <catch2/generators/catch_generators_random.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
+#include <Progmasoft/Catch3/Generators/Adapters.hpp>
+#include <Progmasoft/Catch3/Generators/Random.hpp>
TEST_CASE("Generate random doubles across different ranges",
"[generator][example][advanced]") {
diff --git a/examples/311-Gen-CustomCapture.cpp b/examples/311-Gen-CustomCapture.cpp
index ee310383..5c01a084 100644
--- a/examples/311-Gen-CustomCapture.cpp
+++ b/examples/311-Gen-CustomCapture.cpp
@@ -17,9 +17,9 @@
// per-variable custom capture list, this example shows how to achieve
// that.
-#include <catch2/catch_test_macros.hpp>
-#include <catch2/generators/catch_generators_adapters.hpp>
-#include <catch2/generators/catch_generators_random.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
+#include <Progmasoft/Catch3/Generators/Adapters.hpp>
+#include <Progmasoft/Catch3/Generators/Random.hpp>
TEST_CASE("Generate random doubles across different ranges",
"[generator][example][advanced]") {
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 74b65995..292dac9a 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.16)
-project(Catch2Examples LANGUAGES CXX)
+project(Catch3Examples LANGUAGES CXX)
message(STATUS "Examples included")
@@ -18,7 +18,7 @@ add_executable(020-MultiFile
add_executable(231-Cfg_OutputStreams
231-Cfg-OutputStreams.cpp
)
-target_link_libraries(231-Cfg_OutputStreams Catch2_buildall_interface)
+target_link_libraries(231-Cfg_OutputStreams Catch3_buildall_interface)
target_compile_definitions(231-Cfg_OutputStreams PUBLIC CATCH_CONFIG_NOSTDOUT)
# These examples use the standard separate compilation
@@ -51,7 +51,7 @@ set(ALL_EXAMPLE_TARGETS
)
foreach(name ${ALL_EXAMPLE_TARGETS})
- target_link_libraries(${name} Catch2WithMain)
+ target_link_libraries(${name} Catch3WithMain)
endforeach()
list(APPEND CATCH_TEST_TARGETS ${ALL_EXAMPLE_TARGETS})