Is integration and differentiation code sepparate?
Subject: Is integration and differentiation code sepparate?
From: Steve Haflich
Date: Fri, 12 Nov 2010 07:46:57 -0800
Dr. David Kirkby <david.kirkby at onetel.net> wrote:
1) Generate a "random" polynomial using a pseudo random number generator.
2) Simplify the polynomail, so the output is in a form that's reproducible.
3) Integrate the polynomial.
4) Differentiate the result from (3)
5) Simplify the result from (4)
6) Compare the results from (2) and (5).
There may be some who disagree, but our experience with test suites for
large, complex, and long-lived software packages is this: It is a very
bad idea to generate test cases by any random process in the test suite.
The reason is that when something fails (or fails to fail) one cannot
simply rerun the entire test suite to duplicate the failure, whether for
confirmation of the failure, or debugging, or testing that a fix
actually fixes the problem.
This harm can be mitigated somewhat by providing a way to reset the
random generator (which certainly can be done in Common Lisp) but this
means the random-state must be isolated from anything else in the system
(i.e., it cannot be the same random-state used by other computations)
and even if this is done successfully, the CL random generator is
guaranteed only to reproduce the same sequence when executed in the same
implementation (including version and platform). So when a test failure
suddenly shows up when a new version of your favorite Lisp
implementation is released, you cannot tell whether the failure was a
real new bug, or merely revealed by a change in the generated random
sequence.
It is seductive to think that by executine randome tests with every
execution of the test suite, more exhaustive coverage is attained over
time. Don't get seduced by this notion!
Of course it can be effective to generate a large set of random tests
just once, and then capture those particular generated tests
indefinitely as source in the test suite. That eliminates the
variability between executions.