Keep the generated tests that catch real bugs
Your task
An agent writes tests for a legacy service that has almost none. Coverage will rise either way, so each generated test is judged by mutation testing instead.
Write triage_generated_tests(assertions, mutants_killed): the rule your agent follows to keep, review or throw away each test.
assertions(list of str): what each generated test asserts, in plain words, for example"cart total equals 42 for three items".mutants_killed(list of int): how many mutants each test killed. A mutant is a copy of the code with one small bug planted on purpose, and a test kills it by failing on it.mutants_killed[i]belongs toassertions[i].- Return one verdict per pair, in order:
"accept","review"or"reject". If the lists differ in length, stop at the end of the shorter one.
Rules, for each pair:
- Lowercase the assertion and trim whitespace from both ends. If it is empty, or contains
not null,not none,is truthyordoes not throwanywhere:"reject", however many mutants it killed. - 0 or fewer mutants killed:
"reject". - Exactly 1:
"review". - 2 or more:
"accept".
Examples
triage_generated_tests(assertions: list[str], mutants_killed: list[int]) -> list[str]Example 1
Input
triage_generated_tests(["result is not null", "cart total equals 42 for three items"], [0, 4])Output
["reject", "accept"]Example 2
Input
triage_generated_tests(["response status is 200", "handler does not throw"], [1, 5])Output
["review", "reject"]Example 3
Input
triage_generated_tests(["discount is applied once per order", "user id is not none"], [3, 2])Output
["accept", "reject"]