Frankenmint / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Make the random seed accessible inside the tests #331

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
It would be gread if you could access the random seed inside the tests.

In this way, one could generate pseudo random numbers out of this seed and then 
test the functions with random inputs.

The problem now is, that when we test something with a random seed like 
"time(NULL)", and we have an error, it is really hard to see, what the actual 
input arguments to the function where.

However, if this is connected to the googletest random seed, one can reproduce 
it exactly like the order of the gtest_shuffle, and has really deterministic 
and repeatable results based on the (random) seed...

Original issue reported on code.google.com by rgg...@gmail.com on 19 Nov 2010 at 9:13

GoogleCodeExporter commented 8 years ago
You can access the current random seed now via UnitTest::random_seed().      

Original comment by vladlosev on 19 Nov 2010 at 3:46