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

summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorMartin Hořeňovský2020-01-21 14:46:07 +0100
committerMartin Hořeňovský2020-01-21 14:46:07 +0100
commit17281c09c3f6ea3a04adfc12a651bcd97bcdc496 (patch)
tree4246ffea832877f8173c735ab286608574f96ff5 /examples
parent26f78f96aa6eed4be97281b5b740ab0cf0466c48 (diff)
downloadcatch3-17281c09c3f6ea3a04adfc12a651bcd97bcdc496.tar.gz
Convert examples to piecemeal includes
Diffstat (limited to 'examples')
-rw-r--r--examples/100-Fix-Section.cpp3
-rw-r--r--examples/110-Fix-ClassFixture.cpp2
-rw-r--r--examples/210-Evt-EventListeners.cpp6
-rw-r--r--examples/231-Cfg-OutputStreams.cpp2
-rw-r--r--examples/300-Gen-OwnGenerator.cpp4
-rw-r--r--examples/301-Gen-MapTypeConversion.cpp8
-rw-r--r--examples/310-Gen-VariablesInGenerators.cpp4
-rw-r--r--examples/311-Gen-CustomCapture.cpp6
8 files changed, 22 insertions, 13 deletions
diff --git a/examples/100-Fix-Section.cpp b/examples/100-Fix-Section.cpp
index d0b9f2da..6ec5ee80 100644
--- a/examples/100-Fix-Section.cpp
+++ b/examples/100-Fix-Section.cpp
@@ -6,7 +6,8 @@
// main() provided in 000-CatchMain.cpp
-#include <catch2/catch.hpp>
+#include <catch2/catch_test_macros.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 e42fd175..38617a3b 100644
--- a/examples/110-Fix-ClassFixture.cpp
+++ b/examples/110-Fix-ClassFixture.cpp
@@ -6,7 +6,7 @@
// main() provided in 000-CatchMain.cpp
-#include <catch2/catch.hpp>
+#include <catch2/catch_test_macros.hpp>
class DBConnection
{
diff --git a/examples/210-Evt-EventListeners.cpp b/examples/210-Evt-EventListeners.cpp
index f9113197..4b9d6519 100644
--- a/examples/210-Evt-EventListeners.cpp
+++ b/examples/210-Evt-EventListeners.cpp
@@ -10,7 +10,9 @@
// Let Catch provide the required interfaces:
#define CATCH_CONFIG_EXTERNAL_INTERFACES
-#include <catch2/catch.hpp>
+#include <catch2/catch_test_macros.hpp>
+#include <catch2/reporters/catch_reporter_bases.hpp>
+#include <catch2/catch_reporter_registrars.hpp>
#include <iostream>
// -----------------------------------------------------------------------
@@ -306,7 +308,7 @@ char const * dashed_line =
struct MyListener : Catch::TestEventListenerBase {
using TestEventListenerBase::TestEventListenerBase; // inherit constructor
-
+
// Get rid of Wweak-tables
~MyListener();
diff --git a/examples/231-Cfg-OutputStreams.cpp b/examples/231-Cfg-OutputStreams.cpp
index 8753fcf6..2e92ec80 100644
--- a/examples/231-Cfg-OutputStreams.cpp
+++ b/examples/231-Cfg-OutputStreams.cpp
@@ -8,7 +8,7 @@
#include <catch2/catch_default_main.hpp>
-#include <catch2/catch.hpp>
+#include <catch2/catch_test_macros.hpp>
#include <sstream>
#include <cstdio>
diff --git a/examples/300-Gen-OwnGenerator.cpp b/examples/300-Gen-OwnGenerator.cpp
index c8b6a65d..427d7b24 100644
--- a/examples/300-Gen-OwnGenerator.cpp
+++ b/examples/300-Gen-OwnGenerator.cpp
@@ -4,7 +4,9 @@
// Specifically we will implement a random number generator for integers
// It will have infinite capacity and settable lower/upper bound
-#include <catch2/catch.hpp>
+#include <catch2/catch_test_macros.hpp>
+#include <catch2/catch_generators.hpp>
+#include <catch2/catch_generators_generic.hpp>
#include <random>
diff --git a/examples/301-Gen-MapTypeConversion.cpp b/examples/301-Gen-MapTypeConversion.cpp
index 88772971..dee50822 100644
--- a/examples/301-Gen-MapTypeConversion.cpp
+++ b/examples/301-Gen-MapTypeConversion.cpp
@@ -1,9 +1,9 @@
// 301-Gen-MapTypeConversion.cpp
// Shows how to use map to modify generator's return type.
-// TODO
-#include <catch2/catch.hpp>
+#include <catch2/catch_test_macros.hpp>
+#include <catch2/catch_generators_generic.hpp>
#include <string>
#include <sstream>
@@ -23,7 +23,7 @@ public:
}
std::string const& get() const override;
-
+
bool next() override {
return !!std::getline(m_stream, m_line);
}
@@ -49,7 +49,7 @@ Catch::Generators::GeneratorWrapper<std::string> lines(std::string /* ignored fo
TEST_CASE("filter can convert types inside the generator expression", "[example][generator]") {
auto num = GENERATE(map<int>([](std::string const& line) { return std::stoi(line); },
lines("fake-file")));
-
+
REQUIRE(num > 0);
}
diff --git a/examples/310-Gen-VariablesInGenerators.cpp b/examples/310-Gen-VariablesInGenerators.cpp
index 422815d2..3fb089e8 100644
--- a/examples/310-Gen-VariablesInGenerators.cpp
+++ b/examples/310-Gen-VariablesInGenerators.cpp
@@ -6,7 +6,9 @@
// _WILL_ outlive the variables -- thus they should be either captured
// by value directly, or copied by the generators during construction.
-#include <catch2/catch.hpp>
+#include <catch2/catch_test_macros.hpp>
+#include <catch2/catch_generators_generic.hpp>
+#include <catch2/catch_generators_specific.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 da6d686f..35de7afc 100644
--- a/examples/311-Gen-CustomCapture.cpp
+++ b/examples/311-Gen-CustomCapture.cpp
@@ -9,7 +9,9 @@
// per-variable custom capture list, this example shows how to achieve
// that.
-#include <catch2/catch.hpp>
+#include <catch2/catch_test_macros.hpp>
+#include <catch2/catch_generators_generic.hpp>
+#include <catch2/catch_generators_specific.hpp>
TEST_CASE("Generate random doubles across different ranges",
"[generator][example][advanced]") {
@@ -23,7 +25,7 @@ TEST_CASE("Generate random doubles across different ranges",
}));
auto r2(r1);
-
+
// This will take r1 by reference and r2 by value.
// Note that there are no advantages for doing so in this example,
// it is done only for expository purposes.