SOFT CAT.ai
FIND SOMETHING USEFUL
← Prompt recipes

TESTING / A WORKED STARTING POINT

Find the test that would catch the bug

Generate small counterexamples from a behavioural contract instead of copying the implementation into tests.

Template reviewed

WHEN TO USE IT

A short function has a clear contract and you want tests that distinguish correct from incorrect behaviour.

Bring these inputs

{{contract}}
The test framework and externally defined behaviour.
{{code}}
The smallest relevant function or module.

01 / THE PROMPT

A template you can inspect.

Propose a minimal regression test for each distinct mismatch between the contract and the code below.

Use the named test framework. For every test, state the input, expected result from the contract and the specific failure it is meant to catch. Do not derive the expected result by repeating the implementation. Do not invent an executed test result. If the contract is ambiguous, identify the missing decision before writing that assertion. Keep the production code unchanged.

Framework and contract:
{{contract}}

Code:
{{code}}

Copying does not run the prompt. Workbench opens an editable draft with the example inputs. It does not save or send it.

02 / THE EXAMPLE TARGET

What a useful result should contain.

This is a target for the worked example, not a recorded model response. Equivalent wording can be valid where the task allows it.

assert.equal(admitted(-1, 10), false);
assert.equal(admitted(10, 10), false);
assert.equal(admitted(9, 10), true);

03 / JUDGE THE RESULT

Check the answer, not the confidence.

  • The negative count and equality boundary are both covered.
  • The expected values come from the contract and expose the current implementation.
  • The response does not say tests passed unless it actually ran them and reports the run.
Open the related workshop tool ↗

The worked example is a target to inspect, not a saved response from a model. Use the checks to judge an actual result.

This template was revised during the September prompt review. The earlier text remains in Git history.

Read the prompt collection review ↗