test/random_test.cc
author Peter Kovacs <kpeter@inf.elte.hu>
Tue, 18 Mar 2008 13:57:15 +0100
changeset 94 a4688e4138ec
parent 39 0a01d811071f
child 102 81563e019fa4
permissions -rw-r--r--
Fixes in the map concepts

- Now Value type needn't be default constructible.
- Extend the test file to check this.
alpar@10
     1
/* -*- C++ -*-
alpar@10
     2
 *
alpar@10
     3
 * This file is a part of LEMON, a generic C++ optimization library
alpar@10
     4
 *
alpar@39
     5
 * Copyright (C) 2003-2008
alpar@10
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@10
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
alpar@10
     8
 *
alpar@10
     9
 * Permission to use, modify and distribute this software is granted
alpar@10
    10
 * provided that this copyright notice appears in all copies. For
alpar@10
    11
 * precise terms see the accompanying LICENSE file.
alpar@10
    12
 *
alpar@10
    13
 * This software is provided "AS IS" with no warranty of any kind,
alpar@10
    14
 * express or implied, and with no claim as to its suitability for any
alpar@10
    15
 * purpose.
alpar@10
    16
 *
alpar@10
    17
 */
alpar@10
    18
alpar@10
    19
#include <lemon/random.h>
alpar@10
    20
#include "test_tools.h"
alpar@10
    21
alpar@10
    22
///\file \brief Test cases for random.h
alpar@10
    23
///
alpar@10
    24
///\todo To be extended
alpar@10
    25
///
alpar@10
    26
alpar@10
    27
int main()
alpar@10
    28
{
alpar@10
    29
  double a=lemon::rnd();
alpar@10
    30
  check(a<1.0&&a>0.0,"This should be in [0,1)");
alpar@10
    31
  a=lemon::rnd.gauss();
alpar@10
    32
  a=lemon::rnd.gamma(3.45,0);
alpar@10
    33
  a=lemon::rnd.gamma(4);
alpar@10
    34
  //Does gamma work with integer k?
alpar@10
    35
  a=lemon::rnd.gamma(4.0,0);
alpar@92
    36
  a=lemon::rnd.poisson(.5);
alpar@10
    37
}