Skip to content
Prev 38871 / 63424 Next

R vs. C

On 01/18/2011 10:53 AM, Patrick Burns wrote:
Patrick, I completely agree with you that
- Tests should not clutter the documentation and go to their proper place.
- Examples are there for the user's benefit - and must be written accordingly.
- Often, test should cover far more situations than good examples.

Yet it seems to me that (part of the) examples are justly considered a (small) 
subset of the tests:
As a potential user, I reqest two things from good examples that have an 
implicit testing message/side effect:
- I like the examples to roughly outline the space in which the code works: they 
should tell me what I'm supposed to do.
- Depending on the function's purpose, I like to see a demonstration of the 
correctness for some example calculation.
(I don't want to see all further tests - I can look them up if I feel the need)

The fact that the very same line of example code serves a testing (side) purpose 
  doesn't mean that it should be copied into the tests, does it?

Thus, I think of the "public" part (the "preface") of the tests living in the 
examples.

My 2 ct,
Best regards,

Claudia