Module strategy

Source
Expand description

Property-based generators for randomized test input. TODO: Move into dedicated crate and access via Property-based generators for Selection and related types.

These strategies are used in proptest-based tests to construct randomized selection expressions for testing evaluation, routing, and normalization logic.

The main entry point is [gen_selection(depth)], which generates a structurally diverse Selection of bounded depth, supporting the True, Range, All, Union, and Intersection constructors.

Example usage:

use ndslice::strategy::gen_selection;
use proptest::prelude::*;

proptest! {
    #[test]
    fn test_selection(s in gen_selection(3)) {
        // Use `s` as input to evaluation or routing tests
    }
}

Functionsยง

gen_extent
Generate a random Extent with dims dimensions, where each size is in 1..=max_len.
gen_region
Generate a random Region strategy for property tests.
gen_region_strided
Generate a random Region strategy with striding for property tests.
gen_selection
Recursively generates a random Selection expression of bounded depth, aligned with the given slice shape.
gen_slice
Generates a random Slice with up to max_dims dimensions, where each dimension has a size between 1 and max_len (inclusive).
gen_slice_and_subview
Generates a pair (base, subview) where: