Closed camshaft closed 4 months ago
This change adds a utility to bolero-generator for tracing/debugging generated inputs. This can be enabled on any type that implements ValueGenerator:
ValueGenerator
#[derive(Debug, TypeGenerator)] struct MyType { field: u8, } check!().with_generator(gen::<MyType>().trace()).for_each(|_| { });
Running this will write all of the generated values to stderr:
stderr
product MyType { u8 -> 23 } product MyType { u8 -> 23 } product MyType { u8 -> 242 } product MyType { u8 -> 242 } product MyType { u8 -> 139 } product MyType { u8 -> 139 } product MyType { u8 -> 137 } product MyType { u8 -> 137 } product MyType { u8 -> 164 } product MyType { u8 -> 164 } ...
It will also log any values that failed to return Some from generate:
Some
generate
sum EvenTree { variant Pair { sum EvenTree { variant Leaf { product Even { u8 -> 74 } } } sum EvenTree { variant Leaf { product Even { u8 -> 137 } -> <None> } -> <None> } -> <None> } -> <None> } -> <None> sum EvenTree { variant Leaf { product Even { u8 -> 10 } } } sum EvenTree { variant Leaf { product Even { u8 -> 10 } } } sum EvenTree { variant Pair { sum EvenTree { variant Leaf { product Even { u8 -> 74 } } } sum EvenTree { variant Leaf { product Even { u8 -> 60 } } } } }
This change adds a utility to bolero-generator for tracing/debugging generated inputs. This can be enabled on any type that implements
ValueGenerator
:Running this will write all of the generated values to
stderr
:It will also log any values that failed to return
Some
fromgenerate
: