13 std::ofstream
output(
"ranRestoreTest.cout");
15 std::ostream &
output = std::cout;
20#define TEST_ORIGINAL_SAVE
25#define TEST_ENGINE_NAMES
26#define TEST_INSTANCE_METHODS
27#define TEST_SHARED_ENGINES
28#define TEST_STATIC_SAVE
29#define TEST_SAVE_STATIC_STATES
30#define TEST_ANONYMOUS_ENGINE_RESTORE
31#define TEST_ANONYMOUS_RESTORE_STATICS
32#define TEST_VECTOR_ENGINE_RESTORE
37#define TEST_MISSING_FILES
38#define CREATE_OLD_SAVES
39#define VERIFY_OLD_SAVES
57 std::vector<double> ab(2);
66 output <<
"r(1) = " << r << std::endl;
69 output <<
"r(2) = " << r << std::endl;
72 output <<
"r(3) = " << r << std::endl;
73 for (
int i=0; i < 1001; i++) {
78 output <<
"r1005= " << r << std::endl;
86 output <<
"restored r(2) = " << r << std::endl;
88 output <<
"THIS DOES NOT MATCH REMEMBERED VALUE BUT THAT IS EXPECTED\n";
91 output <<
"restored r(3) = " << r << std::endl;
92 for (
int i=0; i < 1001; i++) {
96 output <<
"restored r1005= " << r << std::endl;
98 output <<
"THIS DOES NOT MATCH REMEMBERED VALUE BUT THAT IS EXPECTED\n";
105 output <<
"r(1) = " << r << std::endl;
108 output <<
"r(2) = " << r << std::endl;
111 output <<
"r(3) = " << r << std::endl;
113 for (
int i=0; i < 1001; i++) {
116 "This line inserted so clever compilers don't warn about not using d\n";
120 output <<
"r1005= " << r << std::endl;
128 output <<
"restored r(2) = " << r << std::endl;
130 output <<
"THIS DOES NOT MATCH REMEMBERED VALUE BUT THAT IS EXPECTED\n";
133 output <<
"restored r(3) = " << r << std::endl;
134 for (
int i=0; i < 1001; i++) {
138 output <<
"restored r1005= " << r << std::endl;
140 output <<
"THIS DOES NOT MATCH REMEMBERED VALUE BUT THAT IS EXPECTED\n";
150 output <<
"r(1) = " << r << std::endl;
153 output <<
"r(2) = " << r << std::endl;
156 output <<
"r(3) = " << r << std::endl;
157 for (
int i=0; i < 1001; i++) {
162 output <<
"r1005= " << r << std::endl;
171 output <<
"restored r(2) = " << r << std::endl;
173 std::cout <<
"restored r(2) = " << r << std::endl;
174 std::cout <<
"????? THIS DOES NOT MATCH REMEMBERED VALUE!\n";
178 output <<
"restored r(3) = " << r << std::endl;
179 for (
int i=0; i < 1001; i++) {
183 output <<
"restored r1005= " << r << std::endl;
185 std::cout <<
"restored r1005= " << r << std::endl;
186 std::cout <<
"????? THIS DOES NOT MATCH REMEMBERED VALUE!\n";
195 output <<
"r(1) = " << r << std::endl;
198 output <<
"r(2) = " << r << std::endl;
201 output <<
"r(3) = " << r << std::endl;
202 for (
int i=0; i < 1001; i++) {
207 output <<
"r1005 = " << r << std::endl;
210 output <<
"r1006 = " << r << std::endl;
213 output <<
"r1007 = " << r << std::endl;
222 output <<
"restored r(2) = " << r << std::endl;
225 std::cout <<
"restored r(2) = " << r << std::endl;
226 std::cout <<
"????? THIS DOES NOT MATCH REMEMBERED VALUE!\n";
229 output <<
"restored r(3) = " << r << std::endl;
230 for (
int i=0; i < 1001; i++) {
234 output <<
"restored r1005= " << r << std::endl;
237 std::cout <<
"restored r1005= " << r << std::endl;
238 std::cout <<
"????? THIS DOES NOT MATCH REMEMBERED VALUE!\n";
241 output <<
"restored r1006= " << r << std::endl;
244 std::cout <<
"restored r1006= " << r << std::endl;
245 std::cout <<
"????? THIS DOES NOT MATCH REMEMBERED VALUE!\n";
248 output <<
"restored r1007= " << r << std::endl;
251 std::cout <<
"restored r1007= " << r << std::endl;
252 std::cout <<
"????? THIS DOES NOT MATCH REMEMBERED VALUE!\n";
259template <
class E,
class D>
264 output <<
"File-not-found test restoring "<<D::distributionName()<<
":\n";
266 D::restoreEngineStatus(
"noSuchFile");
267 D::setTheEngine(old);
314template <
class E,
class D>
321 for (
int i=0; i<3; i++) r += D::shoot();
322 D::saveEngineStatus(filename);
323 if (r == -99999999.1) stat = 999;
325 D::setTheEngine(old);
333template <
class E,
class D>
342 for (
int i=0; i<3; i++) r += D::shoot();
343 D::saveEngineStatus();
346 double keyValue = D::shoot();
349 D::restoreEngineStatus(filename);
350 if (!
equals(D::shoot(), keyValue)) {
351 std::cout <<
"???? Value mismatch from file " << filename <<
"\n";
356 D::restoreEngineStatus();
357 if (!
equals(D::shoot(),keyValue)) {
358 std::cout <<
"???? Value mismatch from new-format file \n";
362 D::setTheEngine(old);
372 output << E::engineName() <<
"\n";
373 if (E::engineName() != name) {
374 std::cout <<
"???? engineName mismatch for " << name <<
" <--> "
375 << E::engineName() <<
"\n";
379 if (e.name() != name) {
380 std::cout <<
"???? name mismatch for " << name <<
" <--> "
387template <
class E,
class D>
392 if (d.engine().name() != e.name()) {
393 std::cout <<
"???? Improper d.engine() \n";
402 output <<
"checkEngineInstanceSave for " << e.name() <<
"\n";
403 int pr=
output.precision(20);
405 for (
int i=0; i<100; i++) r += e.flat();
406 {std::ofstream os (
"engine.save"); os << e;}
407 for (
int i=0; i<100; i++) r += e.flat();
408 double keyValue1 = e.flat();
409 double keyValue2 = e.flat();
411 output << keyValue1 <<
" " << keyValue2 <<
"\n";
414 {std::ifstream is (
"engine.save"); is >> e2;}
415 for (
int i=0; i<100; i++) r += e2.flat();
416 double k1 = e2.flat();
417 double k2 = e2.flat();
419 output << k1 <<
" " << k2 <<
"\n";
421 if ( !(
equals(k1,keyValue1)) || !(
equals(k2,keyValue2)) ) {
422 std::cout <<
"???? checkInstanceSave failed for " << e.name() <<
"\n";
429template <
class E,
class D>
431 dynamic_cast<E &
>(d.engine());
433 output <<
"checkSaveDistribution with " << d.engine().name()
434 <<
", " << d.name() <<
"\n";
437 double keyValue1, keyValue2, keyValue3, keyValue4;
438 for (
int i=0; i<nth; i++) r += d();
439 {std::ofstream os (
"distribution.save1"); os << d.engine() << d;}
444 {std::ofstream os (
"distribution.save2"); os << d.engine() << d;}
447 int pr =
output.precision(20);
449 output <<
"keyValue1 = " << keyValue1 <<
450 " keyValue2 = " << keyValue2 <<
"\n";
451 output <<
"keyValue3 = " << keyValue3 <<
452 " keyValue3 = " << keyValue4 <<
"\n";
457 { std::ifstream is (
"distribution.save1"); is >> e >> d2;}
460 { std::ifstream is (
"distribution.save2"); is >> e >> d2;}
464 pr =
output.precision(20);
465 output <<
"k1 = " << k1 <<
466 " k2 = " << k2 <<
"\n";
467 output <<
"k3 = " << k3 <<
468 " k4 = " << k4 <<
"\n";
473 std::cout <<
"???? Incorrect restored value for distribution "
483 dynamic_cast<E &
>(d.
engine());
486 <<
", " << d.
name() <<
"\n";
489 double keyValue1, keyValue2, keyValue3, keyValue4;
490 for (
int i=0; i<nth; i++) r += d();
491 {std::ofstream os (
"distribution.save1"); os << d.
engine() << d;}
496 {std::ofstream os (
"distribution.save2"); os << d.
engine() << d;}
499 int pr =
output.precision(20);
501 output <<
"keyValue1 = " << keyValue1 <<
502 " keyValue2 = " << keyValue2 <<
"\n";
503 output <<
"keyValue3 = " << keyValue3 <<
504 " keyValue3 = " << keyValue4 <<
"\n";
510 { std::ifstream is (
"distribution.save1"); is >> e >> d2;}
513 { std::ifstream is (
"distribution.save2"); is >> e >> d2;}
517 pr =
output.precision(20);
518 output <<
"k1 = " << k1 <<
519 " k2 = " << k2 <<
"\n";
520 output <<
"k3 = " << k3 <<
521 " k4 = " << k4 <<
"\n";
526 std::cout <<
"???? Incorrect restored value for distribution "
547 {
RandFlat d(
new E(12576),12.5,35.0);
617 {std::vector<double> pdf;
619 for (
int i = 0; i < nbins; ++i)
620 pdf.push_back( 5*i + (10.5-i) * (10.5-i) );
627template <
class E,
class D1,
class D2>
630 output <<
"checkSharingDistribution with: \n"
631 << d1.name() <<
" using " << d1.engine().name() <<
" and\n"
632 << d2.name() <<
" using " << d2.engine().name() <<
"\n";
636 double kv11,kv12,kv13,kv14;
637 double kv21,kv22,kv23,kv24;
638 for (
int i=0; i<n1; i++) r += d1();
639 for (
int j=0; j<n2; j++) r += d2();
640 {std::ofstream os (
"shared.save1"); os << d1.engine() << d1 << d2;}
647 {std::ofstream os (
"shared.save2"); os << d1.engine() << d1 << d2;}
653 int pr =
output.precision(20);
654 output <<
"kv11 = " << kv11 <<
655 " kv21 = " << kv21 <<
"\n";
656 output <<
"kv12 = " << kv12 <<
657 " kv22 = " << kv22 <<
"\n";
658 output <<
"kv13 = " << kv13 <<
659 " kv23 = " << kv23 <<
"\n";
660 output <<
"kv14 = " << kv14 <<
661 " kv24 = " << kv24 <<
"\n";
667 { std::ifstream is (
"shared.save1"); is >> e >> d1r >> d2r;}
672 { std::ifstream is (
"shared.save2"); is >> e >> d1r >> d2r;}
678 pr =
output.precision(20);
679 output <<
"k11 = " << k11 <<
680 " k21 = " << k21 <<
"\n";
681 output <<
"k12 = " << k12 <<
682 " k22 = " << k22 <<
"\n";
683 output <<
"k13 = " << k13 <<
684 " k23 = " << k23 <<
"\n";
685 output <<
"k14 = " << k14 <<
686 " k24 = " << k24 <<
"\n";
693 std::cout <<
"???? Incorrect restored value for distributions "
694 << d1.name() <<
" " << d2.name() <<
"\n";
723 std::vector<double> v;
726 for (
int i=0; i<n; i++) {
738 output <<
"staticSave for distribution " << D::distributionName() <<
"\n";
740 double v1, v2, k1, k2;
741 for (i=0; i < n; i++) r += D::shoot();
743 std::ofstream file (
"distribution.save1");
744 D::saveFullState(file);
746 D::saveFullState(file);
749 int pr =
output.precision(20);
750 output <<
"v1 = " << v1 <<
" v2 = " << v2 <<
"\n";
754 for (i=0; i < n; i++) r += D::shoot();
756 std::ifstream file (
"distribution.save1");
757 D::restoreFullState(file);
759 for (i=0; i < n; i++) r += D::shoot();
760 D::restoreFullState(file);
763 int pr =
output.precision(20);
764 output <<
"k1 = " << k1 <<
" k2 = " << k2 <<
"\n";
768 if ( (k1 != v1) || (k2 != v2) ) {
769 std::cout <<
"???? restoreFullState failed for " << D::distributionName() <<
"\n";
773 for (i=0; i < n; i++) r += D::shoot();
775 std::ofstream file (
"distribution.save2");
776 D::saveDistState(file) << *D::getTheEngine();
778 D::saveDistState(file) << *D::getTheEngine();
781 int pr =
output.precision(20);
782 output <<
"v1 = " << v1 <<
" v2 = " << v2 <<
"\n";
786 for (i=0; i < n; i++) r += D::shoot();
788 std::ifstream file (
"distribution.save2");
789 D::restoreDistState(file) >> *D::getTheEngine();
791 for (i=0; i < n; i++) r += D::shoot();
792 D::restoreDistState(file) >> *D::getTheEngine();
795 int pr =
output.precision(20);
796 output <<
"k1 = " << k1 <<
" k2 = " << k2 <<
"\n";
800 if ( (k1 != v1) || (k2 != v2) ) {
801 std::cout <<
"???? restoreDistState failed for " << D::distributionName() <<
"\n";
812 output <<
"staticSaveShootBit for " << D::distributionName() <<
"\n";
816 for (i=0; i < n; i++) r += D::shoot();
817 for (i=0; i < n; i++) bit |= D::shootBit();
819 std::ofstream file (
"distribution.save1");
820 D::saveFullState(file);
822 for (i=0; i<25; i++) {
826 for (i=0; i < n; i++) bit |= D::shootBit();
827 D::saveFullState(file);
829 for (i=0; i<25; i++) {
834 int pr =
output.precision(20);
835 output << std::hex <<
"v1 = " << v1 <<
" v2 = " << v2 << std::dec <<
"\n";
839 for (i=0; i < n; i++) r += D::shoot();
841 std::ifstream file (
"distribution.save1");
842 D::restoreFullState(file);
844 for (i=0; i<25; i++) {
848 for (i=0; i < n; i++) r += D::shoot();
849 D::restoreFullState(file);
851 for (i=0; i<25; i++) {
856 int pr =
output.precision(20);
857 output << std::hex <<
"k1 = " << k1 <<
" k2 = " << k2 << std::dec <<
"\n";
861 if ( (k1 != v1) || (k2 != v2) ) {
862 std::cout <<
"???? restoreFullState failed for D shootBit()\n";
866 for (i=0; i < n; i++) r += D::shoot();
867 for (i=0; i < n; i++) bit |= D::shootBit();
869 std::ofstream file (
"distribution.save2");
870 D::saveDistState(file) << *D::getTheEngine();
872 for (i=0; i<25; i++) {
876 for (i=0; i < n; i++) bit |= D::shootBit();
877 D::saveDistState(file) << *D::getTheEngine();
879 for (i=0; i<25; i++) {
884 int pr =
output.precision(20);
885 output << std::hex <<
"v1 = " << v1 <<
" v2 = " << v2 << std::dec <<
"\n";
889 for (i=0; i < n; i++) r += D::shoot();
891 std::ifstream file (
"distribution.save2");
892 D::restoreDistState(file) >> *D::getTheEngine();
894 for (i=0; i<25; i++) {
898 for (i=0; i < n; i++) r += D::shoot();
899 for (i=0; i < n; i++) r += D::shootBit();
900 D::restoreDistState(file) >> *D::getTheEngine();
902 for (i=0; i<25; i++) {
907 int pr =
output.precision(20);
908 output << std::hex <<
"k1 = " << k1 <<
" k2 = " << k2 << std::dec <<
"\n";
912 if ( (k1 != v1) || (k2 != v2) ) {
913 std::cout <<
"???? restoreDistState failed for RnadFlat::shootBit()\n";
923 for (
int i=0; i<n; i++) {
946 std::vector<double> c;
951 c.push_back( RandBit::shoot() );
952 for (
int i=0; i<20; i++) {
971 std::ofstream os(filename.c_str());
972 RandGeneral::saveStaticRandomStates(os);
979 std::ifstream is(filename.c_str());
980 RandLandau::restoreStaticRandomStates(is);
987 output <<
"Anonymous restore for " << E::engineName() <<
"\n";
990 for (
int i=0; i<n; i++) r += e.flat();
991 std::ofstream os(
"anonymous.save");
993 for (
int j=0; j<25; j++) v.push_back(e.flat());
995 output <<
"First four of v are: "
996 << v[0] <<
", " << v[1] <<
", " << v[2] <<
", " << v[3] <<
"\n";
1006 std::vector<double> nonRand =
aSequence(500);
1010 for (
int i=0; i<n; i++) r += e.
flat();
1011 std::ofstream os(
"anonymous.save");
1013 for (
int j=0; j<25; j++) v.push_back(e.
flat());
1015 output <<
"First four of v are: "
1016 << v[0] <<
", " << v[1] <<
", " << v[2] <<
", " << v[3] <<
"\n";
1024 std::vector<double> k;
1025 std::ifstream is(
"anonymous.save");
1028 for (
int j=0; j<25; j++) k.push_back(
a->flat());
1031 output <<
"First four of k are: "
1032 << k[0] <<
", " << k[1] <<
", " << k[2] <<
", " << k[3] <<
"\n";
1034 for (
int m=0; m<25; m++) {
1035 if ( v[m] != k[m] ) {
1036 std::cout <<
"???? Incorrect restored value for anonymous engine"
1037 << E::engineName() <<
"\n";
1048 std::vector<double> v;
1061 output <<
"\nRandomized, with theEngine = " << e->
name() <<
"\n";
1063 output <<
"Saved all static distributions\n";
1065 output <<
"Captured output of all static distributions\n";
1067 output <<
"Randomized all static distributions\n";
1069 output <<
"Restored all static distributions to saved state\n";
1071 output <<
"Captured output of all static distributions\n";
1072 for (
unsigned int iv=0; iv<c.size(); iv++) {
1073 if (c[iv] != d[iv]) {
1074 std::cout <<
"???? restoreStaticRandomStates failed at random "
1079 if (stat & 131072 == 0) {
1080 output <<
"All captured output agrees with earlier values\n";
1087template <
class E1,
class E2>
1090 if ( E1::engineName() == E2::engineName() ) {
1096 output <<
"\nRandomized, with theEngine = " << e1->
name() <<
"\n";
1099 output <<
"Saved all static distributions\n";
1103 output <<
"Captured output of all static distributions\n";
1108 output <<
"Switched to theEngine = " << e2->
name() <<
"\n";
1110 { std::ofstream os(
"engine.save"); os << *e2; }
1111 double v1 = e2->
flat();
1112 double v2 = e2->
flat();
1113 { std::ifstream is(
"engine.save"); is >> *e2; }
1115 output <<
"Saved the " << e2->
name() <<
" engine: \n"
1116 <<
"Next randoms to be " << v1 <<
" " << v2 <<
"\n"
1117 <<
"Restored the " << e2->
name() <<
" engine to that state\n";
1121 output <<
"Restored all static distributions to saved state\n"
1122 <<
"This changes the engine type back to " << E1::engineName() <<
"\n";
1126 output <<
"Captured output of all static distributions\n";
1128 for (
unsigned int iv=0; iv<c.size(); iv++) {
1129 if (c[iv] != d[iv]) {
1130 std::cout <<
"???? restoreStaticRandomStates failed at random "
1135 if (stat & 524288 == 0) {
1136 output <<
"All captured output agrees with earlier values\n";
1138 double k1 = e2->
flat();
1139 double k2 = e2->
flat();
1141 output <<
"The " << e2->
name() <<
" engine should not have been affected: \n"
1142 <<
"Next randoms are " << k1 <<
" " << k2 <<
"\n";
1145 std::cout <<
"???? Engine used as theEngine was affected by restoring \n"
1146 <<
" static distributions to use engine of a different type.\n";
1156 output <<
"Vector restore for " << E::engineName() <<
"\n";
1159 for (
int i=0; i<n; i++) r += e.flat();
1160 std::vector<unsigned long> state = e.put();
1161 for (
int j=0; j<25; j++) v.push_back(e.flat());
1163 output <<
"First four of v are: "
1164 << v[0] <<
", " << v[1] <<
", " << v[2] <<
", " << v[3] <<
"\n";
1170std::vector<unsigned long>
1175 std::vector<double> nonRand =
aSequence(500);
1179 for (
int i=0; i<
n; i++) r += e.
flat();
1180 std::vector<unsigned long> state = e.
put();
1181 for (
int j=0; j<25; j++) v.push_back(e.
flat());
1183 output <<
"First four of v are: "
1184 << v[0] <<
", " << v[1] <<
", " << v[2] <<
", " << v[3] <<
"\n";
1191 const std::vector<double> & v) {
1193 std::vector<double> k;
1197 std::cout <<
"???? could not restore engine state from vector for "
1198 << E::engineName() <<
"\n";
1202 if (
a->name() != E::engineName()) {
1203 std::cout <<
"???? restored engine state from vector for "
1204 << E::engineName() <<
"to different type of engine: "
1205 <<
a->name() <<
"\n"
1206 <<
"There is probably a clash in CRC hashes for these two names!\n";
1210 for (
int j=0; j<25; j++) k.push_back(
a->flat());
1213 output <<
"First four of k are: "
1214 << k[0] <<
", " << k[1] <<
", " << k[2] <<
", " << k[3] <<
"\n";
1216 for (
int m=0; m<25; m++) {
1217 if ( v[m] != k[m] ) {
1218 std::cout <<
"???? Incorrect vector restored value for anonymous engine: "
1219 << E::engineName() <<
"\n";
1230 std::vector<double> v;
1245#ifdef TEST_ORIGINAL_SAVE
1246 output <<
"=====================================\n";
1248 output <<
"Original tests of static save/restore\n";
1249 output <<
"=====================================\n\n";
1251 output <<
"Using old method or HepRandom::saveEngineStatus:\n";
1252 output <<
"All these tests should have a chance of failure.\n";
1254 output << RandGauss:: getTheEngine()->name();
1255 output << RandGaussQ::getTheEngine()->name();
1262 output <<
"Using the class-specific RandGauss::saveEngineStatus:\n";
1263 output <<
"All these tests should work properly.\n";
1271#ifdef TEST_MISSING_FILES
1272 output <<
"\n=======================================\n";
1274 output <<
"Test of behavior when a file is missing \n";
1275 output <<
"=======================================\n\n";
1277 output <<
"Testing restoreEngineStatus with missing file:\n";
1278 output <<
"Expect a number of <Failure to find or open> messages!\n";
1282#ifdef CREATE_OLD_SAVES
1296#ifdef VERIFY_OLD_SAVES
1297 output <<
"\n==============================================\n";
1299 output <<
" Verification that changes wont invalidate \n";
1300 output <<
"invalidate engine saves from previous versions \n";
1301 output <<
"==============================================\n\n";
1316#ifdef TEST_ENGINE_NAMES
1317 output <<
"\n=============================================\n";
1319 output <<
"Check all engine names were entered correctly \n";
1320 output <<
"=============================================\n\n";
1336#ifdef TEST_INSTANCE_METHODS
1337 output <<
"===========================================\n\n";
1339 output <<
"Check instance methods for specific engines \n";
1340 output <<
" specific engines and distributions\n";
1341 output <<
"===========================================\n\n";
1355 {std::vector<double> nonRand =
aSequence(500);
1373#ifdef TEST_SHARED_ENGINES
1374 output <<
"\n=============================================\n";
1376 output <<
"Check behavior when engines are shared \n";
1377 output <<
"=============================================\n\n";
1390#ifdef TEST_STATIC_SAVE
1391 output <<
"\n=========================================\n";
1393 output <<
"Static Save/restore to/from streams \n";
1394 output <<
"=========================================\n\n";
1400 for (
int ibinom=0; ibinom<15; ibinom++) {
1417#ifdef TEST_SAVE_STATIC_STATES
1418 output <<
"\n==============================================\n";
1420 output <<
"Save/restore all static states to/from streams \n";
1421 output <<
"==============================================\n\n";
1425 output <<
"Saved all static distributions\n";
1427 output <<
"Captured output of all static distributions\n";
1429 output <<
"Randomized all static distributions\n";
1431 output <<
"Restored all static distributions to saved state\n";
1433 output <<
"Captured output of all static distributions\n";
1434 for (
unsigned int iv=0; iv<c.size(); iv++) {
1435 if (c[iv] != d[iv]) {
1436 std::cout <<
"???? restoreStaticRandomStates failed at random "
1441 if (stat & 131072 == 0) {
1442 output <<
"All captured output agrees with earlier values\n";
1446#ifdef TEST_ANONYMOUS_ENGINE_RESTORE
1447 output <<
"\n=================================\n";
1448 output <<
" Part VII \n";
1449 output <<
"Anonymous restore of engines \n";
1450 output <<
"=================================\n\n";
1467#ifdef TEST_ANONYMOUS_RESTORE_STATICS
1468 output <<
"\n======================================\n";
1469 output <<
" Part VIII \n";
1470 output <<
"Anonymous restore static Distributions \n";
1471 output <<
"======================================\n\n";
1489#ifdef TEST_VECTOR_ENGINE_RESTORE
1490 output <<
"\n=================================\n";
1492 output <<
"Save/restore of engines to vectors\n";
1493 output <<
"=================================\n\n";
1513 output <<
"\n=============================================\n\n";
1516 std::cout <<
"One or more problems detected: stat = " << stat <<
"\n";
1518 output <<
"ranRestoreTest passed with no problems detected.\n";
virtual std::string name() const =0
static HepRandomEngine * newEngine(std::istream &is)
static void restoreEngineStatus(const char filename[]="Config.conf")
static void setTheEngine(HepRandomEngine *theNewEngine)
static void saveEngineStatus(const char filename[]="Config.conf")
virtual std::ostream & put(std::ostream &os) const
void setRandomSequence(double *s, int n)
static std::string engineName()
static double shoot(double a=1.0, double b=0.2)
static void restoreEngineStatus(const char filename[]="Config.conf")
static void saveEngineStatus(const char filename[]="Config.conf")
static void restoreEngineStatus(const char filename[]="Config.conf")
static void saveEngineStatus(const char filename[]="Config.conf")
HepRandomEngine & engine()
static long shoot(double m=1.0)
static long shoot(double m=1.0)
static long shoot(double m=1.0)
std::ofstream output("ranRestoreTest.cout")
int checkEngineInstanceSave(E &e)
int checkSaveDistribution(D &d, int nth)
int saveEngine(const char *filename)
int anonymousRestoreStatics()
int checkEngineName(const std::string &name)
int checkRandGeneralDistribution(RandGeneral &d, int nth)
void saveStatics(std::string filename)
int staticSaveShootBit(int n)
void randomizeStatics(int n)
void anonymousRestore1(int n, std::vector< double > &v)
int checkSaveEngine(const char *filename)
std::vector< double > aSequence(int n)
int anonymousRestoreStatics1()
int checkSharingDistributions(D1 &d1, D2 &d2, int n1, int n2)
void restoreStatics(std::string filename)
bool equals(double a, double b)
std::vector< double > captureStatics()
bool equals01(const std::vector< double > &ab)
int vectorRestore2(const std::vector< unsigned long > state, const std::vector< double > &v)
void anonymousRestore1< NonRandomEngine >(int n, std::vector< double > &v)
int anonymousRestore2(const std::vector< double > &v)
std::vector< unsigned long > vectorRestore1< NonRandomEngine >(int n, std::vector< double > &v)
std::vector< unsigned long > vectorRestore1(int n, std::vector< double > &v)
int anonymousRestore(int n)