Function gen_slice

Source
pub fn gen_slice(
    max_dims: usize,
    max_len: usize,
) -> impl Strategy<Value = Slice>
Expand description

Generates a random Slice with up to max_dims dimensions, where each dimension has a size between 1 and max_len (inclusive).

The slice is constructed using standard row-major layout with no offset, making it suitable for use in evaluation, routing, and normalization tests.

This generator is used in property-based tests to provide diverse input shapes for selection and routing logic.

§Parameters

  • max_dims: Maximum number of dimensions in the generated slice.
  • max_len: Maximum size per dimension.

§Example

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

proptest! {
    #[test]
    fn test_slice_generation(slice in gen_slice(4, 8)) {
        assert!(!slice.sizes().is_empty());
    }
}