Changeset 798 for trunk/test/rnd_test.cc
- Timestamp:
- Mar 13, 2007, 12:52:43 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/rnd_test.cc
r680 r798 23 23 24 24 #include "yat/random/random.h" 25 #include "yat/statistics/Histogram.h" 25 26 26 27 #include <iostream> … … 30 31 int main(const int argc,const char* argv[]) 31 32 { 32 std::ostream* error; 33 using namespace theplu::yat::random; 34 std::ostream* message; 33 35 if (argc>1 && argv[1]==std::string("-v")) 34 error= &std::cerr;36 message = &std::cerr; 35 37 else { 36 error= new std::ofstream("/dev/null");38 message = new std::ofstream("/dev/null"); 37 39 if (argc>1) 38 40 std::cout << "rnd_test -v : for printing extra information\n"; 39 41 } 40 * error<< "testing rnd" << std::endl;42 *message << "testing rnd" << std::endl; 41 43 bool ok = true; 42 44 43 theplu::yat::random::RNG* rng=theplu::yat::random::RNG::instance(); 45 RNG* rng=RNG::instance(); 46 rng->seed_from_devurandom(); 47 44 48 // testing that minimal integer is zero for the generator 49 *message << "Checking that RNG minimum value is zero" << std::endl; 45 50 if (rng->min()){ 46 * error<< "Error: rng->min is not zero" << std::endl;51 *message << "Error: rng->min is not zero" << std::endl; 47 52 ok = false; 48 53 } 49 54 50 if (error!=&std::cerr) 51 delete error; 55 *message << "Checking that all random generator can be constructed" 56 << std::endl; 57 theplu::yat::statistics::Histogram histogram(0,100,1000); 58 DiscreteGeneral dg(histogram); 59 DiscreteUniform du; 60 Poisson p; 61 ContinuousUniform cu; 62 ContinuousGeneral cg(histogram); 63 Exponential e; 64 Gaussian g; 65 66 if (message!=&std::cerr) 67 delete message; 52 68 53 69 return (ok ? 0 : -1);
Note: See TracChangeset
for help on using the changeset viewer.