Function nalgebra::proptest::matrix [−][src]
pub fn matrix<R, C, ScalarStrategy>(
value_strategy: ScalarStrategy,
rows: impl Into<DimRange<R>>,
cols: impl Into<DimRange<C>>
) -> MatrixStrategy<ScalarStrategy, R, C> where
ScalarStrategy: Strategy + Clone + 'static,
ScalarStrategy::Value: Scalar,
R: Dim,
C: Dim,
DefaultAllocator: Allocator<ScalarStrategy::Value, R, C>,
Expand description
Create a strategy to generate matrices containing values drawn from the given strategy, with rows and columns in the provided ranges.
Examples
use nalgebra::proptest::matrix; use nalgebra::{OMatrix, Const, Dynamic}; use proptest::prelude::*; proptest! { #[test] fn my_test(a in matrix(0 .. 5i32, Const::<3>, 0 ..= 5)) { // Let's make sure we've got the correct type first let a: OMatrix<_, Const::<3>, Dynamic> = a; prop_assert!(a.nrows() == 3); prop_assert!(a.ncols() <= 5); prop_assert!(a.iter().all(|x_ij| *x_ij >= 0 && *x_ij < 5)); } }
Limitations
The current implementation has some limitations that lead to suboptimal shrinking behavior. See the module-level documentation for more.