source: trunk/test/rnd_test.cc @ 680

Last change on this file since 680 was 680, checked in by Jari Häkkinen, 17 years ago

Addresses #153. Introduced yat namespace. Removed alignment namespace. Clean up of code.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.5 KB
Line 
1// $Id: rnd_test.cc 680 2006-10-11 17:49:03Z jari $
2
3/*
4  Copyright (C) The authors contributing to this file.
5
6  This file is part of the yat library, http://lev.thep.lu.se/trac/yat
7
8  The yat library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2 of the
11  License, or (at your option) any later version.
12
13  The yat library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21  02111-1307, USA.
22*/
23
24#include "yat/random/random.h"
25
26#include <iostream>
27#include <sstream>
28#include <fstream>
29
30int main(const int argc,const char* argv[])
31{
32  std::ostream* error;
33  if (argc>1 && argv[1]==std::string("-v"))
34    error = &std::cerr;
35  else {
36    error = new std::ofstream("/dev/null");
37    if (argc>1)
38      std::cout << "rnd_test -v : for printing extra information\n";
39  }
40  *error << "testing rnd" << std::endl;
41  bool ok = true;
42
43  theplu::yat::random::RNG* rng=theplu::yat::random::RNG::instance();
44  // testing that minimal integer is zero for the generator
45  if (rng->min()){
46    *error << "Error: rng->min is not zero" << std::endl;
47    ok = false;
48  }
49
50  if (error!=&std::cerr)
51    delete error;
52
53  return (ok ? 0 : -1);
54}
Note: See TracBrowser for help on using the repository browser.