Start on a simple randomized test for FragmentList
This commit is contained in:
parent
8354d1520d
commit
e37908cf3b
5 changed files with 99 additions and 6 deletions
|
@ -12,6 +12,14 @@ impl<T: Rng> Iterator for RandomCharIter<T> {
|
|||
type Item = char;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
if std::env::var("SIMPLE_TEXT").map_or(false, |v| !v.is_empty()) {
|
||||
return if self.0.gen_range(0..100) < 5 {
|
||||
Some('\n')
|
||||
} else {
|
||||
Some(self.0.gen_range(b'a'..b'z' + 1).into())
|
||||
};
|
||||
}
|
||||
|
||||
match self.0.gen_range(0..100) {
|
||||
// whitespace
|
||||
0..=19 => [' ', '\n', '\t'].choose(&mut self.0).copied(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue