src/core/test/random-variable-test-suite.cc
author Vedran Miletić <rivanvx@gmail.com>
Sat, 01 Sep 2012 20:57:21 +0200
changeset 9063 32755d0516f4
parent 7008 82c66d5c01f7
child 9079 1e5921e6507d
permissions -rw-r--r--
Bug 1237 - code cleanups related to includes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7003
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
     2
//
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
     3
// Copyright (c) 2006 Georgia Tech Research Corporation
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
     4
//
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
     5
// This program is free software; you can redistribute it and/or modify
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
     6
// it under the terms of the GNU General Public License version 2 as
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
     7
// published by the Free Software Foundation;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
     8
//
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
     9
// This program is distributed in the hope that it will be useful,
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    12
// GNU General Public License for more details.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    13
//
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    14
// You should have received a copy of the GNU General Public License
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    15
// along with this program; if not, write to the Free Software
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    16
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    17
//
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    18
// Author: Rajib Bhattacharjea<raj.b@gatech.edu>
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    19
// Author: Hadi Arbabi<marbabi@cs.odu.edu>
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    20
//
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    21
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    22
#include <iostream>
9063
32755d0516f4 Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents: 7008
diff changeset
    23
#include <cmath>
32755d0516f4 Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents: 7008
diff changeset
    24
#include <vector>
7003
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    25
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    26
#include "ns3/test.h"
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    27
#include "ns3/assert.h"
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    28
#include "ns3/integer.h"
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    29
#include "ns3/random-variable.h"
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    30
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    31
namespace ns3 {
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    32
class BasicRandomNumberTestCase : public TestCase
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    33
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    34
public:
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    35
  BasicRandomNumberTestCase ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    36
  virtual ~BasicRandomNumberTestCase ()
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    37
  {
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    38
  }
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    39
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    40
private:
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    41
  virtual void DoRun (void);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    42
};
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    43
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    44
BasicRandomNumberTestCase::BasicRandomNumberTestCase ()
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    45
  : TestCase ("Check basic random number operation")
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    46
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    47
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    48
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    49
void
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    50
BasicRandomNumberTestCase::DoRun (void)
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    51
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    52
  const double desiredMean = 1.0;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    53
  const double desiredStdDev = 1.0;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    54
9063
32755d0516f4 Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents: 7008
diff changeset
    55
  double tmp = std::log (1 + (desiredStdDev / desiredMean) * (desiredStdDev / desiredMean));
32755d0516f4 Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents: 7008
diff changeset
    56
  double sigma = std::sqrt (tmp);
32755d0516f4 Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents: 7008
diff changeset
    57
  double mu = std::log (desiredMean) - 0.5 * tmp;
7003
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    58
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    59
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    60
  // Test a custom lognormal instance to see if its moments have any relation
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    61
  // expected reality.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    62
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    63
  LogNormalVariable lognormal (mu, sigma);
9063
32755d0516f4 Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents: 7008
diff changeset
    64
  std::vector<double> samples;
7003
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    65
  const int NSAMPLES = 10000;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    66
  double sum = 0;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    67
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    68
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    69
  // Get and store a bunch of samples.  As we go along sum them and then find
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    70
  // the mean value of the samples.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    71
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    72
  for (int n = NSAMPLES; n; --n)
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    73
    {
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    74
      double value = lognormal.GetValue ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    75
      sum += value;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    76
      samples.push_back (value);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    77
    }
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    78
  double obtainedMean = sum / NSAMPLES;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    79
  NS_TEST_EXPECT_MSG_EQ_TOL (obtainedMean, desiredMean, 0.1, "Got unexpected mean value from LogNormalVariable");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    80
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    81
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    82
  // Wander back through the saved stamples and find their standard deviation
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    83
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    84
  sum = 0;
9063
32755d0516f4 Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents: 7008
diff changeset
    85
  for (std::vector<double>::iterator iter = samples.begin (); iter != samples.end (); iter++)
7003
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    86
    {
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    87
      double tmp = (*iter - obtainedMean);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    88
      sum += tmp * tmp;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    89
    }
9063
32755d0516f4 Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents: 7008
diff changeset
    90
  double obtainedStdDev = std::sqrt (sum / (NSAMPLES - 1));
7003
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    91
  NS_TEST_EXPECT_MSG_EQ_TOL (obtainedStdDev, desiredStdDev, 0.1, "Got unexpected standard deviation from LogNormalVariable");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    92
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    93
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    94
class RandomNumberSerializationTestCase : public TestCase
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    95
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    96
public:
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    97
  RandomNumberSerializationTestCase ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    98
  virtual ~RandomNumberSerializationTestCase ()
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    99
  {
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   100
  }
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   101
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   102
private:
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   103
  virtual void DoRun (void);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   104
};
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   105
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   106
RandomNumberSerializationTestCase::RandomNumberSerializationTestCase ()
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   107
  : TestCase ("Check basic random number operation")
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   108
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   109
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   110
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   111
void
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   112
RandomNumberSerializationTestCase::DoRun (void)
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   113
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   114
  RandomVariableValue val;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   115
  val.DeserializeFromString ("Uniform:0.1:0.2", MakeRandomVariableChecker ());
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   116
  RandomVariable rng = val.Get ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   117
  NS_TEST_ASSERT_MSG_EQ (val.SerializeToString (MakeRandomVariableChecker ()), "Uniform:0.1:0.2",
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   118
                         "Deserialize and Serialize \"Uniform:0.1:0.2\" mismatch");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   119
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   120
  val.DeserializeFromString ("Normal:0.1:0.2", MakeRandomVariableChecker ());
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   121
  rng = val.Get ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   122
  NS_TEST_ASSERT_MSG_EQ (val.SerializeToString (MakeRandomVariableChecker ()), "Normal:0.1:0.2",
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   123
                         "Deserialize and Serialize \"Normal:0.1:0.2\" mismatch");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   124
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   125
  val.DeserializeFromString ("Normal:0.1:0.2:0.15", MakeRandomVariableChecker ());
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   126
  rng = val.Get ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   127
  NS_TEST_ASSERT_MSG_EQ (val.SerializeToString (MakeRandomVariableChecker ()), "Normal:0.1:0.2:0.15",
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   128
                         "Deserialize and Serialize \"Normal:0.1:0.2:0.15\" mismatch");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   129
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   130
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   131
class BasicRandomNumberTestSuite : public TestSuite
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   132
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   133
public:
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   134
  BasicRandomNumberTestSuite ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   135
};
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   136
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   137
BasicRandomNumberTestSuite::BasicRandomNumberTestSuite ()
7008
82c66d5c01f7 Relabel all build verification tests (BVT) to be unit tests (UNIT)
Mitch Watrous <watrous@u.washington.edu>
parents: 7003
diff changeset
   138
  : TestSuite ("basic-random-number", UNIT)
7003
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   139
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   140
  AddTestCase (new BasicRandomNumberTestCase);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   141
  AddTestCase (new RandomNumberSerializationTestCase);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   142
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   143
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   144
static BasicRandomNumberTestSuite BasicRandomNumberTestSuite;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   145
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   146
} // namespace ns3