This question applies to any particular programming language.
Let us imagine I have a function that converts a data structure to a string of hex.
func toHex(input: data) => string
Let's say I now want to use property based testing to test this. How do I go about coming up with properties upon which to base the test on?
All the examples I am seeing around property based testing assumes very simple mathematical relationship. Things like testing reversing a list or if a string is a sub string of another.
But in the case of toHex
function above, I cannot think of any workable way to come up with a property since it look like the only relationship is that some data gets converted to hex string. Well apart from implementing the conversion functionality of finding another library that does something similar and use that for the assertion in the test. But doing this will defeat using property based testing.
Any ideas or suggestions on how to approach property based testing and how to come up with properties to use in the test in the case of such a toHex
function?