Changeset 1245
- Timestamp:
- Mar 17, 2008, 1:50:37 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/rnd_test.cc
r1000 r1245 25 25 */ 26 26 27 #include "Suite.h" 28 27 29 #include "yat/random/random.h" 28 30 #include "yat/statistics/Histogram.h" … … 32 34 #include <fstream> 33 35 34 int main( const int argc,constchar* argv[])36 int main(int argc, char* argv[]) 35 37 { 36 38 using namespace theplu::yat::random; 37 std::ostream* message; 38 if (argc>1 && argv[1]==std::string("-v")) 39 message = &std::cerr; 40 else { 41 message = new std::ofstream("/dev/null"); 42 if (argc>1) 43 std::cout << "rnd_test -v : for printing extra information\n"; 44 } 45 *message << "testing rnd" << std::endl; 46 bool ok = true; 39 theplu::yat::test::Suite suite(argc, argv); 40 suite.err() << "testing rnd" << std::endl; 47 41 48 42 RNG* rng=RNG::instance(); … … 50 44 51 45 // testing that minimal integer is zero for the generator 52 *message<< "Checking that RNG minimum value is zero" << std::endl;46 suite.err() << "Checking that RNG minimum value is zero" << std::endl; 53 47 if (rng->min()){ 54 *message<< "Error: rng->min is not zero" << std::endl;55 ok = false;48 suite.err() << "Error: rng->min is not zero" << std::endl; 49 suite.add(false); 56 50 } 57 51 58 *message<< "Checking that all random generator can be constructed"59 52 suite.err() << "Checking that all random generator can be constructed" 53 << std::endl; 60 54 theplu::yat::statistics::Histogram histogram(0,100,1000); 61 55 DiscreteGeneral dg(histogram); … … 67 61 Gaussian g; 68 62 69 if (message!=&std::cerr) 70 delete message; 71 72 return (ok ? 0 : -1); 63 return suite.return_value(); 73 64 }
Note: See TracChangeset
for help on using the changeset viewer.