silentbicycle / theft

property-based testing for C: generate input to find obscure bugs, then reduce to minimal failing input
ISC License
611 stars 31 forks source link

Feature request: Seed parsing #27

Open katef opened 7 years ago

katef commented 7 years ago

Given that theft.h abstracts the theft_seed type, it'd be handy to provide something akin to strtoul() which parses a suitably-sized string in the same format which theft prints seeds.

silentbicycle commented 7 years ago

For the specific cases in which you want to parse them, would it work to set a hook (such as the trial_seed field on theft_run_config.hooks.trial_post's info struct) to capture it directly, rather than re-parsing the string output?

katef commented 7 years ago

I'm just after parsing a seed passed in by argv[], not to try and capture it during a run. My use-case is just for my own convenience, when running the CLI by hand: https://github.com/katef/libfsm/pull/73/files#diff-7e45faf72d5b4dc573ca4facacecbfe3R72

silentbicycle commented 7 years ago

That's a great idea, and what I said about hooks doesn't really apply -- something like theft_seed theft_seed_of_string(char *s) should go in theft_aux.c, near theft_seed_of_time.

silentbicycle commented 7 years ago

This should use strtoull(s, NULL, 16).