Commit 1974e6eb authored by Lynn Garren's avatar Lynn Garren
Browse files

Merge branch 'develop' into 'develop'

Fix testThreaded on x86

See merge request !5
parents c26ecfea 849f0250
...@@ -65,23 +65,38 @@ void testRandGauss(std::vector<double> const& reference, bool& result) { ...@@ -65,23 +65,38 @@ void testRandGauss(std::vector<double> const& reference, bool& result) {
result = true; result = true;
std::vector<double> v;
v.push_back(dist.fire());
v.push_back(dist.fire());
v.push_back(dist.fire());
v.push_back(dist.fire());
v.push_back(dist.fire());
// Just a sanity check first. The fire method reproduces // Just a sanity check first. The fire method reproduces
// itself. // itself.
if (reference[0] != dist.fire() || if (reference[0] != v[0] ||
reference[1] != dist.fire() || reference[1] != v[1] ||
reference[2] != dist.fire() || reference[2] != v[2] ||
reference[3] != dist.fire() || reference[3] != v[3] ||
reference[4] != dist.fire()) { reference[4] != v[4]) {
result = false; result = false;
} }
// check the shoot method where we pass in an engine // check the shoot method where we pass in an engine
CLHEP::HepJamesRandom engine1(seedL1); CLHEP::HepJamesRandom engine1(seedL1);
if (reference[0] != CLHEP::RandGauss::shoot(&engine1) ||
reference[1] != CLHEP::RandGauss::shoot(&engine1) || v.clear();
reference[2] != CLHEP::RandGauss::shoot(&engine1) || v.push_back(CLHEP::RandGauss::shoot(&engine1));
reference[3] != CLHEP::RandGauss::shoot(&engine1) || v.push_back(CLHEP::RandGauss::shoot(&engine1));
reference[4] != CLHEP::RandGauss::shoot(&engine1)) { v.push_back(CLHEP::RandGauss::shoot(&engine1));
v.push_back(CLHEP::RandGauss::shoot(&engine1));
v.push_back(CLHEP::RandGauss::shoot(&engine1));
if (reference[0] != v[0] ||
reference[1] != v[1] ||
reference[2] != v[2] ||
reference[3] != v[3] ||
reference[4] != v[4]) {
result = false; result = false;
} }
...@@ -93,11 +108,19 @@ void testRandGauss(std::vector<double> const& reference, bool& result) { ...@@ -93,11 +108,19 @@ void testRandGauss(std::vector<double> const& reference, bool& result) {
// setFlag causes it to not use the cached value // setFlag causes it to not use the cached value
// and generate a new pair of random numbers // and generate a new pair of random numbers
CLHEP::RandGauss::setFlag(false); CLHEP::RandGauss::setFlag(false);
if (reference[0] != CLHEP::RandGauss::shoot() ||
reference[1] != CLHEP::RandGauss::shoot() || v.clear();
reference[2] != CLHEP::RandGauss::shoot() || v.push_back(CLHEP::RandGauss::shoot());
reference[3] != CLHEP::RandGauss::shoot() || v.push_back(CLHEP::RandGauss::shoot());
reference[4] != CLHEP::RandGauss::shoot()) { v.push_back(CLHEP::RandGauss::shoot());
v.push_back(CLHEP::RandGauss::shoot());
v.push_back(CLHEP::RandGauss::shoot());
if (reference[0] != v[0] ||
reference[1] != v[1] ||
reference[2] != v[2] ||
reference[3] != v[3] ||
reference[4] != v[4]) {
result = false; result = false;
} }
CLHEP::HepRandom::setTheEngine(savedEngine); CLHEP::HepRandom::setTheEngine(savedEngine);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment