0
Generate property-based tests that find edge cases, not happy-path duplicates
Write property-based tests (using {{framework, e.g. Hypothesis / fast-check / QuickCheck}}) for the function below. Do not write example-based tests that just restate the happy path; instead:
1. Identify the invariants the function should always satisfy (e.g. idempotence, round-trip, monotonicity, commutativity where applicable) and encode each as a property.
2. Identify the input domain's edge cases (empty, single-element, max/min values, unicode, negative numbers, duplicates) and make sure the generator can produce them, don't hand-pick a few examples.
3. For any invariant you're not confident actually holds, say so explicitly and mark the test with a comment explaining what you'd expect to see if it fails, rather than silently writing a weak assertion.
4. Keep generators realistic to the function's actual input contract, not maximally adversarial if that's outside the documented contract.
Function:
code
Language: language
Known contract/docstring: contract