Code RoomTests pass but miss bug
MediumPrep Room Coding #4087

Tests pass but miss bug

Vibe & agenticAlgorithms & data structuresMid–Senior~16 min

You asked an AI agent to add tests for a Python `discount(price, pct)` that you suspect is buggy. The function rounds with `int(price * (1 - pct))` (truncating, not rounding). The agent ran the code, observed outputs, and wrote tests that pass. Here's one:

The second test passes and coverage is now 100%. Why should you not trust these tests, and what would a meaningful test for this function look like?

Implement
discount_amount(price: int, pct_bps: int) → int
Examples
in[100,1000]out90
in[95,1000]out86
in[99,1000]out89
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 16 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.