Verification · Testing · Property-based tests
Round-trip properties
decode(encode(x)) == x for serializers and parsers.
How to build it
- Write a property asserting that decoding an encoded value returns the original value.
- Generate inputs with the framework's strategies for the value's types.
- 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 reposfast-check· 3 reposproptest· 11 repos