Coding

Unit Test Generator

Paste a function and get comprehensive unit tests covering normal operations, edge cases, invalid inputs, and boundary conditions.

By The Prompt Black Magic Team

Copy the prompt, specify your testing framework, and paste the function you want tested.

Write comprehensive unit tests for this function using [TESTING FRAMEWORK].

Cover these scenarios:
1. Normal/expected inputs (at least 3 cases)
2. Edge cases (empty inputs, single elements, boundaries)
3. Invalid inputs (wrong types, null, undefined)
4. Boundary conditions (max/min values, overflow)
5. Error handling (expected exceptions)

For each test:
- Give it a descriptive name that explains what it tests
- Include a brief comment on why this test matters
- Use arrange-act-assert pattern

Also suggest any additional test scenarios specific to this function's logic.

Here is the function:
[paste your code here]