What test would distinguish this surviving shipping mutant?
Instruction: Identify the exact missing case and give an assertion that passes the original and fails the mutant.
Context:
The independent specification says shipping costs 499 cents below a subtotal of 5,000 cents and is free at or above 5,000. Inputs in this exercise are valid nonnegative integers. Existing tests check 4,999 and 5,001. Mutation testing changes >= to >, and both existing tests still pass.
def shipping(subtotal_cents):
return 0 if subtotal_cents >= 5000 else 499
def mutant(subtotal_cents):
return 0 if subtotal_cents > 5000 else 499Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
I would add subtotal 5,000 and assert a zero shipping charge. The specification includes the boundary. The original returns zero, while the mutant returns 499...
Related Questions
-
easy
-
easy
-
easy
-
easy
-
easy
-
easy