serde-rs/test

serde_test: Implement quickcheck Arbitrary on Token (suggestion)

rw opened this issue · 2 comments

rw commented

I want to use quickcheck to test my serde code. My ideal testcase would look like:

  1. Generate arbitrary serde value
  2. Serialize the serde value to my data format
  3. Deserialize a new serde value from my data format
  4. Check that the old and new serde values are equivalent

It seems to me that implementing the Arbitrary trait from the quickcheck crate would make this simple. Is that a good idea for the serde_test project?

rw commented

A related suggestion is to provide the ability to generate arbitrary JSON.

I think both of these would be outside the scope of the serde_test crate, but someone could put together a separate crate focused on testing data formats against arbitrarily generated data structures.