top | item 23756118

(no title)

deadso | 5 years ago

Their point is that the test case provided would lead the developer to believe that the implementation is a correct identity function, when in fact it isn't.

Just clarifying, I do not take this as a good reason to not write tests.

discuss

order

nmfisher|5 years ago

Ah, right. I didn't realize some people believe tests should "prove" the correctness of a function (or that if they can't, they're worthless).

Testing has its flaws, but that's not one of them. There's often very good reason to ask the question "does this function operate the way I expect it to when I provide this input?"