samedi 8 septembre 2018

Random parameters generation in googletest parameter tests

I want to generate some random values for my parametrized googletest tests. Here two problems occur:

  1. I want to use built-in C++ rand() function, but generated numbers repeats in all tests. Then, I tried to use GetParam() as seed, but I have problems with assigning the value returned by this function to srand() function. It is attached to question with the necessity to make const to non-const cast, I use different variants of static_cast, and const_cast from const int to long int*, but none has been even compiled.
  2. Maybe there is a built-in function in Google Tests for generating a random set of variables used for tests? I dig through documentation, but there is hardly anything about that.



Aucun commentaire:

Enregistrer un commentaire