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

summaryrefslogtreecommitdiffhomepage
path: root/docs/generators.md
diff options
context:
space:
mode:
authorMartin Hořeňovský2019-10-06 13:49:50 +0200
committerMartin Hořeňovský2019-10-06 13:55:10 +0200
commit319cb9e1daec5076ff1a3acd10b959c2bce05c5b (patch)
tree7a9d9bf9e8e257593283692b2fdbbeee454d0fdb /docs/generators.md
parentb8b765d55e552d5892b46ccafd3a40a8ca3b9e0a (diff)
downloadcatch3-319cb9e1daec5076ff1a3acd10b959c2bce05c5b.tar.gz
Add a generator that takes an iterator pair
Diffstat (limited to 'docs/generators.md')
-rw-r--r--docs/generators.md8
1 files changed, 7 insertions, 1 deletions
diff --git a/docs/generators.md b/docs/generators.md
index 490cfcac..934a6731 100644
--- a/docs/generators.md
+++ b/docs/generators.md
@@ -46,13 +46,16 @@ a test case,
* `MapGenerator<T, U, Func>` -- returns the result of applying `Func`
on elements from a different generator
* `ChunkGenerator<T>` -- returns chunks (inside `std::vector`) of n elements from a generator
-* 3 specific purpose generators
+* 4 specific purpose generators
* `RandomIntegerGenerator<Integral>` -- generates random Integrals from range
* `RandomFloatGenerator<Float>` -- generates random Floats from range
* `RangeGenerator<T>` -- generates all values inside a specific range
+ * `IteratorGenerator<T>` -- copies and returns values from an iterator range
> `ChunkGenerator<T>`, `RandomIntegerGenerator<Integral>`, `RandomFloatGenerator<Float>` and `RangeGenerator<T>` were introduced in Catch 2.7.0.
+> `IteratorGenerator<T>` was introduced in Catch X.Y.Z.
+
The generators also have associated helper functions that infer their
type, making their usage much nicer. These are
@@ -68,9 +71,12 @@ type, making their usage much nicer. These are
* `random(IntegerOrFloat a, IntegerOrFloat b)` for `RandomIntegerGenerator` or `RandomFloatGenerator`
* `range(start, end)` for `RangeGenerator<T>` with a step size of `1`
* `range(start, end, step)` for `RangeGenerator<T>` with a custom step size
+* `from_range(InputIterator from, InputIterator to)` for `IteratorGenerator<T>`
> `chunk()`, `random()` and both `range()` functions were introduced in Catch 2.7.0.
+> `from_range` has been introduced in Catch X.Y.Z
+
And can be used as shown in the example below to create a generator
that returns 100 odd random number: