Skip to content
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

Access seed in test #453

Closed
sdressler opened this issue Jul 2, 2015 · 2 comments
Closed

Access seed in test #453

sdressler opened this issue Jul 2, 2015 · 2 comments

Comments

@sdressler
Copy link

I was trying to get the seed inside the tests, because they are using random number generators themselves. Usually it is not std::rand but std::minstd_rand with some specific distribution. On the other hand, the classes under test also take a seed.

I have seen, that one can grab the current context with getCurrentContext and then access the configuration. But I am not able to compile it due to linkage errors, e.g.

const uint64_t seed = Catch::getCurrentContext().getConfig()->rngSeed();

will lead to multiple definition ofCatch::signalDefs', mostly because I had to includecatch_runner.hpp` which I think is not intended.

Maybe there already is a correct way to capture the seed inside the test, otherwise it would be a nice feature :-)

@philsquared
Copy link
Collaborator

as of v1.2.1-develop.2 you can now get the seed by calling Catch::rngSeed().

@sdressler
Copy link
Author

Awesome :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants