Question 410
In a secure development review, the following condition is confirmed: A sorting function must preserve tie order. What is the best next step under this constraint?
Explanation
Correct Answer
The appropriate action is "Test equal-key records and expected stable ordering". Tie cases expose semantic differences among implementations. The decisive condition is A sorting function must preserve tie order.
Incorrect Answers
The alternative "Assert exact input/output pairs without network dependencies" addresses A function is pure and returns a deterministic mapping. Isolated unit tests should not rely on external state. It does not resolve A sorting function must preserve tie order; the correct choice is "Test equal-key records and expected stable ordering". Tie cases expose semantic differences among implementations.
For the different scenario A generated test calls a method without verifying its result, "Add meaningful assertions about return values or state" could be appropriate. Smoke invocation is weaker than behavioral verification. The present requirement is A sorting function must preserve tie order, which calls for "Test equal-key records and expected stable ordering". Tie cases expose semantic differences among implementations.
"Generate unit cases using independently specified expected amounts" targets A price calculation must handle coupons and rounding rules. Tests should verify contractual behavior rather than duplicate code. That differs from A sorting function must preserve tie order; the required decision here is "Test equal-key records and expected stable ordering". Tie cases expose semantic differences among implementations.