stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: test for lib.alg.random_shuffle
Date Tue, 24 Jan 2006 02:20:53 GMT
Anton Pevtsov wrote:
> I'm porting the test for the lib.alg.random_shuffle algorithm and I have
> a question about the current test implementation.
> 
> There is the special test case for the built-in random number generator
> which does the following:
> some test array is defined and initialized with numbers, when the
> random_shuffle algorithm is called for this array, and the result is
> compared with another predefined array (which was initialized with the
> same numbers and "shuffled" manually). The results of the random_shuffle
> of the given array depends on the implementation of the random number
> generator used by random_shuffle,

Correct.

> and this results in that the test case may be passed for the 1025-th
> invocation of the random_shuffle algorithm only. 

Not sure what you mean here.

> 
> The question is: is it necessary to keep this test case in the ported
> test version?

I believe the point of comparing the result of the algorithm against
the hardcoded values is to verify that the algorithm produces the same
results across all platforms and architectures. The standard doesn't
require this degree of portability but our implementation provides it
anyway -- to guarantee consistent behavior.

I'm not seeing any runtime problems with the test and I'm not sure
I understand where you think the problem is.

Martin

Mime
View raw message