Struct proptest::char::CharStrategy [] [src]

pub struct CharStrategy<'a> { /* fields omitted */ }

Strategy for generating chars.

Character selection is more sophisticated than integer selection. Naïve selection (particularly in the larger context of generating strings) would result in starting inputs like ꂡ螧轎ቶᢹ糦狥芹ᘆ㶏曊ᒀ踔虙ჲ and "simplified" inputs consisting mostly of control characters. It also has difficulty locating edge cases, since the vast majority of code points (such as the enormous CJK regions) don't cause problems for anything with even basic Unicode support.

Instead, character selection is always based on explicit ranges, and is designed to bias to specifically chosen characters and character ranges to produce inputs that are both more useful and easier for humans to understand. There are also hard-wired simplification targets based on ASCII instead of simply simplifying towards NUL to avoid problematic inputs being reduced to a bunch of NUL characters.

Shrinking never crosses ranges. If you have a complex range like [A-Za-z] and the starting point x is chosen, it will not shrink to the first A-Z group, but rather simply to a.

The usual way to get instances of this class is with the module-level ANY constant or range function. Directly constructing a CharStrategy is only necessary for complex ranges or to override the default biases.

Methods

impl<'a> CharStrategy<'a>
[src]

Construct a new CharStrategy with the parameters it will pass to the function underlying select_char().

All arguments as per select_char().

Trait Implementations

impl<'a> Debug for CharStrategy<'a>
[src]

Formats the value using the given formatter.

impl<'a> Clone for CharStrategy<'a>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a> Strategy for CharStrategy<'a>
[src]

The value tree generated by this Strategy. Read more

Generate a new value tree from the given runner. Read more

Returns a strategy which produces values transformed by the function fun. Read more

Maps values produced by this strategy into new strategies and picks values from those strategies. Read more

Maps values produced by this strategy into new strategies and picks values from those strategies while considering the new strategies to be independent. Read more

Similar to prop_ind_flat_map(), but produces 2-tuples with the input generated from self in slot 0 and the derived strategy in slot 1. Read more

Returns a strategy which only produces values accepted by fun. Read more

Returns a strategy which picks uniformly from self and other. Read more

Generate a recursive structure with self items as leaves. Read more

Erases the type of this Strategy so it can be passed around as a simple trait object. Read more

Wraps this strategy to prevent values from being subject to shrinking. Read more