Debian Codegraph @

debian/missing-sources/proptest/examples/tutorial-simplify-play.rs

raw
1 //-
2 // Copyright 2017 Jason Lingle
3 //
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
9
10 // Shows how to pick values from a strategy and simplify them.
11 //
12 // This is *not* how proptest is normally used; it is simply used to play
13 // around with value generation.
14
15 use proptest::strategy::{Strategy, ValueTree};
16 use proptest::test_runner::TestRunner;
17
18 fn main() {
19 let mut runner = TestRunner::default();
20 let mut str_val = "[a-z]{1,4}\\p{Cyrillic}{1,4}\\p{Greek}{1,4}"
21 .new_tree(&mut runner)
22 .unwrap();
23 println!("str_val = {}", str_val.current());
24 while str_val.simplify() {
25 println!(" = {}", str_val.current());
26 }
27 }