use crate::path::{ESCAPE, SEPARATOR};
use proptest::prelude::*;
pub fn segment() -> impl Strategy<Value = String> {
prop::collection::vec(
prop_oneof![
4 => Just(SEPARATOR),
4 => Just(ESCAPE),
6 => prop::char::range('a', 'c'),
4 => prop::char::range('0', '9'),
3 => prop_oneof![Just('\0'), Just('\u{1}'), Just('\u{2}')],
3 => prop_oneof![
Just('_'), Just('-'), Just(' '), Just('['), Just(']'),
Just('*'), Just('%'), Just('"'), Just('\''), Just('/'),
],
1 => any::<char>(),
],
1..6,
)
.prop_map(|chars| chars.into_iter().collect())
}
pub fn name_holding_the_separator() -> impl Strategy<Value = (String, String, String)> {
(segment(), segment()).prop_map(|(left, right)| {
(
left.clone(),
right.clone(),
format!("{left}{SEPARATOR}{right}"),
)
})
}
pub fn key() -> impl Strategy<Value = String> {
prop::collection::vec(
prop_oneof![
4 => Just(SEPARATOR),
4 => Just(ESCAPE),
4 => prop::char::range('a', 'c'),
4 => prop::char::range('0', '9'),
1 => any::<char>(),
],
0..8,
)
.prop_map(|chars| chars.into_iter().collect())
}