dub test
H. S. Teoh via Digitalmars-d
digitalmars-d at puremagic.com
Wed Aug 24 07:41:34 PDT 2016
On Wed, Aug 24, 2016 at 08:00:32AM -0400, Andrei Alexandrescu via Digitalmars-d wrote:
[...]
> Some of the Phobos tests I wrote use it (and virtually all of my
> current code e.g. on median computation), and when they fail I just
> print the seed of the RNG and then hardcode it to reproduce the test.
> -- Andrei
Just a side note: this depends on the assumption that the PRNG is
explicitly chosen, or that the default PRNG will never change; and that
the implementation of the RNG is independent of environmental factors
(such as different CPU's resulting in different answers).
Otherwise, if you find a bug with a specific seed and then hardcode that
seed in a unittest to prevent regression, a regression may go undetected
once somebody changes the default RNG, or tweaks the implementation
(e.g. to fix a RNG weakness due to security concerns) yielding different
results for the same seed, or is run in an environment other than the
one you tested it in.
T
--
An elephant: A mouse built to government specifications. -- Robert Heinlein
More information about the Digitalmars-d
mailing list