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

summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorMartin Hořeňovský2026-02-09 19:05:39 +0100
committerMartin Hořeňovský2026-02-10 09:37:15 +0100
commitd079ee13ab137547ab26bd1ed5ca2858d7fbd847 (patch)
tree1e73da54d02eecbf095dd07bd4c0183d7a7f107b /docs
parent0056cd4efb01ab65f02af188e137fc65d79e18f8 (diff)
downloadcatch3-d079ee13ab137547ab26bd1ed5ca2858d7fbd847.tar.gz
Allow generators to declare themselves (infinite)
This will be useful later to implement warning on infinitely running `GENERATE` expressions.
Diffstat (limited to 'docs')
-rw-r--r--docs/deprecations.md15
-rw-r--r--docs/generators.md11
2 files changed, 26 insertions, 0 deletions
diff --git a/docs/deprecations.md b/docs/deprecations.md
index 20312cd5..b7efa862 100644
--- a/docs/deprecations.md
+++ b/docs/deprecations.md
@@ -48,6 +48,21 @@ If you are mutating the fixture instance from within the test case, and
want to keep doing so in the future, mark the mutated members as `mutable`.
+### Generator interfaces
+
+#### Defaulted `UntypedGeneratorBase::isFinite()`
+
+> Deprecated in Catch2 vX.Y.Z
+
+The `UntypedGeneratorBase` currently provides a default implementation
+for `isFinite` that always returns `true`. This was done to keep backwards
+compatibility with pre-existing generators, as infinite generators can
+be diagnosed as errors in some cases.
+
+In the future, all generators will be expected to override `isFinite`.
+
+
+
---
[Home](Readme.md#top)
diff --git a/docs/generators.md b/docs/generators.md
index f45eac06..5db2941b 100644
--- a/docs/generators.md
+++ b/docs/generators.md
@@ -276,11 +276,22 @@ struct IGenerator : GeneratorUntypedBase {
* Going backwards is not supported.
*/
virtual void skipToNthElementImpl( std::size_t n );
+
+ /**
+ * Returns true if calls to `next` will eventually return false
+ *
+ * Note that for backwards compatibility this is currently defaulted
+ * to return `true`, but in the future all generators will have to
+ * provide their own implementation.
+ */
+ virtual bool isFinite() const = 0;
};
```
> `skipToNthElementImpl` was added in Catch2 vX.Y.Z
+> `isFinite` was added in Catch2 vX.Y.Z
+
However, to be able to use your custom generator inside `GENERATE`, it
will need to be wrapped inside a `GeneratorWrapper<T>`.
`GeneratorWrapper<T>` is a value wrapper around a