A requirement supplies the expectation
Delivery is free at a subtotal of 100 units or more, otherwise it costs 10. A test needs input, an independently chosen expectation and a comparison with actual behavior.
function deliveryCharge(subtotal) {
return subtotal >= 100 ? 0 : 10;
}
const actual = deliveryCharge(100);
const expected = 0;
console.assert(actual === expected, "Delivery should be free at the threshold");
The oracle is how you know what should happen: here, the confirmed rule. Calculating expected by calling deliveryCharge again would only compare the implementation with itself.
Guided selection
Choose 99, 100 and 101. They distinguish "at least" from "strictly above." Add a normal low subtotal such as 20. A thousand arbitrary high amounts would be less informative about the boundary than these few focused examples.
Tests are executable examples, not proof of correctness for every possible input. They provide evidence and detect regressions. A wrong expected value can produce a confident but misleading test.
Independent exercise
For a passing threshold of 10 on a scale from 0 through 20, write normal, boundary and invalid cases before implementing the decision. What should happen for a missing average?
Correction
Examples: 14 passes, 8 fails, 10 passes, 0 fails, 20 passes. -1 and 21 are invalid grades. Missing average is a separate no-assessment state, not automatically a grade of zero. The program's contract must say how that state is reported.
Review
A failing test starts an investigation: implementation, expectation or requirement may be wrong. Recheck the rule before changing expected values merely to make the test pass.