Skip to main content

Make the suite trustworthy

Challenge on lesson: Checkpoint: Advanced Testing

Implement audit_suite(records) and plan_fix(record): - audit_suite(records) returns {'sound': [names], 'flaky': [names]} — flaky when any of the four boolean causes is set (uses_time, uses_random_unseeded, shared_state, order_dependent); both lists keep input order - plan_fix(record) returns the ordered list of concrete fixes for a flaky record — the exact four strings from the diagnose drill — or [] for a sound one - the plan's fixes map 1:1 in order: time → inject a clock; randomness → seed it; shared state → isolate the world; order dependence → construct prerequisites The invariant: after applying every fix in the plan, re-running diagnose_flaky on the record yields 'sound'.

Difficulty: advanced

Back to lesson: Checkpoint: Advanced Testing