Skip to content

Commit 5b3b228

Browse files
learn-moreChrisThrasher
authored andcommitted
Update generator docs with relevant headers
1 parent 2b60af8 commit 5b3b228

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

docs/generators.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ The "Generators" `TEST_CASE` will be entered 3 times, and the value of
2121
`i` will be 1, 3, and 5 in turn. `GENERATE`s can also be used multiple
2222
times at the same scope, in which case the result will be a cartesian
2323
product of all elements in the generators. This means that in the snippet
24-
below, the test case will be run 6 (2\*3) times.
24+
below, the test case will be run 6 (2\*3) times. The `GENERATE` macro
25+
is defined in the `catch_generators.hpp` header, so compiling
26+
the code examples below also requires
27+
`#include <catch2/generators/catch_generators.hpp>`.
2528
2629
```cpp
2730
TEST_CASE("Generators") {
@@ -103,19 +106,19 @@ a test case,
103106
* 2 fundamental generators
104107
* `SingleValueGenerator<T>` -- contains only single element
105108
* `FixedValuesGenerator<T>` -- contains multiple elements
106-
* 5 generic generators that modify other generators
109+
* 5 generic generators that modify other generators (defined in `catch2/generators/catch_generators_adapters.hpp`)
107110
* `FilterGenerator<T, Predicate>` -- filters out elements from a generator
108111
for which the predicate returns "false"
109112
* `TakeGenerator<T>` -- takes first `n` elements from a generator
110113
* `RepeatGenerator<T>` -- repeats output from a generator `n` times
111114
* `MapGenerator<T, U, Func>` -- returns the result of applying `Func`
112115
on elements from a different generator
113116
* `ChunkGenerator<T>` -- returns chunks (inside `std::vector`) of n elements from a generator
114-
* 4 specific purpose generators
117+
* 4 specific purpose generators (defined in `catch2/generators/catch_generators_random.hpp`)
115118
* `RandomIntegerGenerator<Integral>` -- generates random Integrals from range
116119
* `RandomFloatGenerator<Float>` -- generates random Floats from range
117-
* `RangeGenerator<T>(first, last)` -- generates all values inside a `[first, last)` arithmetic range
118-
* `IteratorGenerator<T>` -- copies and returns values from an iterator range
120+
* `RangeGenerator<T>(first, last)` -- generates all values inside a `[first, last)` arithmetic range (defined in `catch2/generators/catch_generators_range.hpp`)
121+
* `IteratorGenerator<T>` -- copies and returns values from an iterator range (defined in `catch2/generators/catch_generators_range.hpp`)
119122
120123
> `ChunkGenerator<T>`, `RandomIntegerGenerator<Integral>`, `RandomFloatGenerator<Float>` and `RangeGenerator<T>` were introduced in Catch2 2.7.0.
121124

0 commit comments

Comments
 (0)