Changeset 1245


Ignore:
Timestamp:
Mar 17, 2008, 1:50:37 PM (16 years ago)
Author:
Peter
Message:

working in #223

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/rnd_test.cc

    r1000 r1245  
    2525*/
    2626
     27#include "Suite.h"
     28
    2729#include "yat/random/random.h"
    2830#include "yat/statistics/Histogram.h"
     
    3234#include <fstream>
    3335
    34 int main(const int argc,const char* argv[])
     36int main(int argc, char* argv[])
    3537{
    3638  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;
    4741
    4842  RNG* rng=RNG::instance();
     
    5044
    5145  // 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;
    5347  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);
    5650  }
    5751
    58   *message << "Checking that all random generator can be constructed"
    59            << std::endl;
     52  suite.err() << "Checking that all random generator can be constructed"
     53              << std::endl;
    6054  theplu::yat::statistics::Histogram histogram(0,100,1000);
    6155  DiscreteGeneral dg(histogram);
     
    6761  Gaussian g;
    6862
    69   if (message!=&std::cerr)
    70     delete message;
    71 
    72   return (ok ? 0 : -1);
     63  return suite.return_value();
    7364}
Note: See TracChangeset for help on using the changeset viewer.