Awesome Reviewers

Verification · Testing · Property-based tests

Round-trip properties

decode(encode(x)) == x for serializers and parsers.

How to build it

  1. Write a property asserting that decoding an encoded value returns the original value.
  2. Generate inputs with the framework's strategies for the value's types.
  3. Keep the property test next to the codec and run it in the normal test job.

Signals in a repository

  • @given tests that call an encode and a decode function and assert equality.
  • fc.assert with fc.property calls around serializer or parser functions.

In practice

23 repositories run a tool for this check in the scanned set.

  • hypothesis · 10 repos
  • fast-check · 3 repos
  • proptest · 11 repos