- Calculate the six member/threshold combinations manually.
- Run or inspect the candidate function against the independent table.
- Keep a failing threshold case as a regression after correcting the comparison.
An assistant can generate a function and tests that repeat the same misunderstanding. Passing those tests only shows that two pieces of code agree. Write expected results from the stated requirement first, then use both ordinary and boundary cases to evaluate the proposed implementation.
Build an oracle outside the implementation
The fictional discount rule applies ten percent only when subtotal is at least fifty and the customer is a member. Calculate expected totals by hand for four combinations around the threshold. Keep the calculations in a table before reading the suggested function. This table is your small test oracle. It prevents the test from importing the implementation’s internal branch conditions and declaring those same conditions to be the independent definition of correctness.
Target boundaries and combinations
Check member and non-member cases at 49.99, 50.00 and a higher subtotal. Clarify rounding and whether the subtotal is represented as integer cents. A test at one hundred alone cannot reveal a mistaken greater-than comparison at the threshold. Ask an assistant for a case that would break the rule, but confirm that its expected value follows the written requirement. Avoid inventing requirements about tax or shipping when those are outside this exercise.
Use failures to improve the explanation
If the threshold case fails, preserve the exact input, expected result and observed result before changing the function. A clear failure teaches more than an immediate rewrite with no record. After repair, rerun every previously recorded case and one deliberately invalid input. Explain which requirement each case covers and which behaviors remain untested. Test quantity is not coverage by itself; a smaller set that distinguishes plausible wrong implementations can be more useful than many repeated happy paths.
Fictional worked example — Threshold calculation
Supplied input
member=true; subtotalCents=5000
Example result to inspect
discountCents=500; payableCents=4500
Integer-cent arithmetic gives the expected threshold result without relying on a generated implementation.
This is an authored teaching example, not a recorded live provider run or an independent performance test.
Make the idea concrete.
- Calculate the six member/threshold combinations manually.
- Run or inspect the candidate function against the independent table.
- Keep a failing threshold case as a regression after correcting the comparison.
What a useful outcome looks like
The exact threshold distinguishes greater-than from greater-than-or-equal behavior.
Ask for reasoning you can verify.
Use fictional or permitted data. This is a copyable brief for a separate approved model; no model is called from this article.
Help me review this fictional coding with ai exercise: Use independent examples to challenge an AI-written function. I will supply the original input, my expected result and the actual transformation. Explain threshold inclusion, identify unsupported assumptions about untested behavior, and propose one bounded negative control. Keep observations separate from hypotheses; do not invent output or act on external systems.
Turn reading into a reviewed checkpoint.
Complete the manual exercise, review each item, then answer the evidence question. This records self-study, not independent assessment of expertise.
Review the checklist and pass the question to save this lesson.
Primary references
References support further checking; cited organizations do not endorse AgentX. This guide is original AI-assisted educational content with illustrative examples. Read the editorial policy or report a correction.
Continue with a related task.
Read the contract before asking for code
Map callers, inputs and invariants before requesting a change.
Request a minimal diff with explicit exclusions
Keep an AI-assisted patch focused enough to review and revert.
Check dependency advice against the installed version
Ground AI coding advice in the project lockfile and official API documentation.