From d6312085a1ac97030fa768366585b9cfb6c955cd Mon Sep 17 00:00:00 2001 From: Bernardo Date: Fri, 21 Dec 2018 18:51:31 +0100 Subject: remove slower impl, add benchmarks --- crates/ra_text_edit/src/test_utils.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'crates/ra_text_edit') diff --git a/crates/ra_text_edit/src/test_utils.rs b/crates/ra_text_edit/src/test_utils.rs index 4a0ebc08e..f150288f6 100644 --- a/crates/ra_text_edit/src/test_utils.rs +++ b/crates/ra_text_edit/src/test_utils.rs @@ -24,6 +24,10 @@ pub fn arb_offset(text: &str) -> BoxedStrategy { } pub fn arb_edits(text: &str) -> BoxedStrategy> { + arb_edits_custom(&text, 0, 7) +} + +pub fn arb_edits_custom(text: &str, min: usize, max: usize) -> BoxedStrategy> { if text.is_empty() { // only valid edits return Just(vec![]) @@ -37,9 +41,10 @@ pub fn arb_edits(text: &str) -> BoxedStrategy> { } let offsets = text_offsets(text); - let max_cuts = offsets.len().min(7); + let max_cuts = max.min(offsets.len()); + let min_cuts = min.min(offsets.len() - 1); - proptest::sample::subsequence(offsets, 0..max_cuts) + proptest::sample::subsequence(offsets, min_cuts..max_cuts) .prop_flat_map(|cuts| { let strategies: Vec<_> = cuts .chunks(2) -- cgit v1.2.3