# HG changeset patch # User alfadur # Date 1531159148 -10800 # Node ID 7f3289a239dd7c28d63ea8df1f048deb163fa517 # Parent 8697b235f236279113bfa9b509d47c79786db9bd Optimize test string generation diff -r 8697b235f236 -r 7f3289a239dd gameServer2/src/protocol/test.rs --- a/gameServer2/src/protocol/test.rs Mon Jul 09 20:31:32 2018 +0300 +++ b/gameServer2/src/protocol/test.rs Mon Jul 09 20:59:08 2018 +0300 @@ -1,8 +1,7 @@ use proptest::{ test_runner::{TestRunner, Reason}, arbitrary::{any, any_with, Arbitrary, StrategyFor}, - strategy::{Strategy, BoxedStrategy, Just, Filter, ValueTree}, - string::RegexGeneratorValueTree, + strategy::{Strategy, BoxedStrategy, Just, Map}, }; use server::coretypes::{GameCfg, TeamInfo, HedgehogInfo}; @@ -55,14 +54,7 @@ type Parameters = ::Parameters; fn arbitrary_with(args: Self::Parameters) -> Self::Strategy { - any_with::(args) - .prop_filter("not ascii", |s| { - s.len() > 0 && s.is_ascii() && - s.find(|c| { - ['\0', '\n', '\x20'].contains(&c) - }).is_none()}) - .prop_map(Ascii) - .boxed() + "[a-zA-Z0-9]+".prop_map(Ascii).boxed() } type Strategy = BoxedStrategy;