-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detecting replicants using --runs #48
Comments
How do you want the seed to work for each test within the suite? For a particular run, should a) each test start with the same seed, b) each test generate a new seed for itself, or c) each suite generates a particular seed once and then every test contained within starts with that seed? |
Hmm, clearly there would be multiple ways to play this, but my initial idea was to gain access to the replicant number in the I suppose we need to be careful about the terms, or the message gets mixed up. I am assuming that there is one or more "tests" defined in the suite by The So to answer your specific questions, I think what I want is for every replicant of a specific test to always start with the same seed, generated by a unique identifier like "3". It is OK if different tests in the suite use the same seed, as long as their replicants are different within the test. So it is OK if test1, replicant3 has the same seed as test2, replicant3. But test1, replicant2 must have a different seed than test1, replicant3, and so on. It is also OK if each test runs a different pseudo-random sequence from each other; I don't care as much about this about this, because the draws are going to affect different stuff in each test. I suppose it is slightly preferable to have completely unique sequences across tests too, but this would not be worth a lot of pain to get if it was hard. |
Well, the easy way is to pick your favorite way to generate a unique seed in If you want to reuse the same seed for each test within the suite, that seems like something that you could solve fairly easily with the (currently nonexistent) suite<int> my_suite("my random suite", [](auto &_) {
_.setup_suite([](int &seed) {
seed = generate_seed();
});
_.setup([](int &seed) {
set_seed(seed);
});
_.test("test 1", [](int &) { /* ... */ });
_.test("test 2", [](int &) { /* ... */ });
// ...
}); That would run the following, once for each run:
A similar thing would happen for teardown as well, of course. Note that |
I would like to write a
setup()
or some other fixture that sets a unique random number seed for each replicant launched with--runs
. Hence, if I used--runs 5
then I would get five identical tests, except each test would have a distinct pseudo-random sequence of draws. The five sequences would be the same on every run.Is this possible?
The text was updated successfully, but these errors were encountered: