pub fn gen_selection(
depth: u32,
shape: Vec<usize>,
dim: usize,
) -> BoxedStrategy<Selection>
Expand description
Recursively generates a random Selection
expression of bounded
depth, aligned with the given slice shape
.
Each recursive call corresponds to one dimension of the shape,
starting from dim
, and constructs a selection operator (range
,
all
, intersection
, etc.) that applies at that level.
The recursion proceeds until either:
depth == 0
, which limits structural complexity, ordim >= shape.len()
, which prevents exceeding the dimensionality.
In both cases, the recursion terminates with a true_()
leaf
node, effectively selecting all remaining elements.
The resulting selections are guaranteed to be valid under a strict
validation regime: they contain no empty ranges, no out-of-bounds
accesses, and no dynamic constructs like any
or first
.