Skip to content

Commit

Permalink
Docs: Improve doc of module gen::vec
Browse files Browse the repository at this point in the history
  • Loading branch information
jockbert committed Mar 1, 2024
1 parent 7d5264a commit 7fab412
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions src/gen/vec.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,60 @@
//! Generators for vectors.
//!
//! One design choice of the vector generator implementation is that example
//! vectors are expected to over time be potentially longer and longer,
//! when iterating over the example iterator.
//!
//! ```rust
//! use monkey_test::*;
//!
//! let some_seed = 1337;
//! let vectors_of_nine = gen::vec::any(gen::fixed::constant(9));
//!
//! let actual_examples = vectors_of_nine
//! .examples(some_seed)
//! .take(20)
//! .collect::<Vec<Vec<i32>>>();
//!
//! assert_eq!{
//! actual_examples,
//! vec![
//! vec![],
//! vec![9],
//! vec![9, 9],
//! vec![9, 9, 9],
//! vec![9, 9, 9, 9],
//! vec![9, 9, 9],
//! vec![9, 9, 9, 9, 9, 9],
//! vec![9, 9, 9, 9, 9],
//! vec![9, 9, 9, 9, 9, 9],
//! vec![9, 9, 9],
//! vec![9, 9, 9, 9, 9, 9, 9],
//! vec![9, 9, 9],
//! vec![9],
//! vec![9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
//! vec![9],
//!
//! vec![9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
//!
//! vec![9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
//! 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
//! 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
//!
//! vec![9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
//! 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
//! 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
//! 9],
//!
//! vec![9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
//! 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
//! 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
//! 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
//! 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
//!
//! vec![9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]
//! ]
//! };
//! ```
use crate::BoxGen;
use crate::BoxIter;
Expand Down

0 comments on commit 7fab412

Please sign in to comment.