Skip to content

Commit 0b480cc

Browse files
committed
Add examples to dictionary generator functions
1 parent 34f3837 commit 0b480cc

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Sources/PropertyBased/Gen+Collection.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ extension Generator {
105105

106106
/// Produces a new generator of dictionaries of this generator's pairs.
107107
///
108+
/// ### Example
109+
/// ```swift
110+
/// zip(
111+
/// Gen.int(),
112+
/// Gen.letter.string(of: 10)
113+
/// ).dictionary(ofAtMost: 1 ... 10)
114+
/// ```
115+
///
108116
/// - Parameter count: The size of the random dictionary. If duplicate keys are generated, the dictionary will have a smaller size.
109117
/// - Returns: A generator of dictionaries.
110118
@inlinable
@@ -117,6 +125,14 @@ extension Generator {
117125

118126
/// Produces a new generator of dictionaries of this generator's pairs.
119127
///
128+
/// ### Example
129+
/// ```swift
130+
/// zip(
131+
/// Gen.int(),
132+
/// Gen.letter.string(of: 10)
133+
/// ).dictionary(ofAtMost: 5)
134+
/// ```
135+
///
120136
/// - Parameter count: The size of the random dictionary. If duplicate keys are generated, the dictionary will have a smaller size.
121137
/// - Returns: A generator of dictionaries.
122138
@inlinable

Sources/PropertyBased/Gen+SIMD.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extension Generator {
1212
///
1313
/// ### Example
1414
/// ```swift
15-
/// Gen.cgFloat(in: 0 ..< 800).pair.map { CGPoint.init(x: $0, y: $1) }
15+
/// Gen.cgFloat(in: 0 ..< 800).pair.map { CGPoint(x: $0, y: $1) }
1616
/// ```
1717
public var pair: Generator<(ResultValue, ResultValue), Shrink.Tuple<(InputValue, InputValue)>> {
1818
return zip(self, self)

0 commit comments

Comments
 (0)