about summary refs log tree commit diff homepage
path: root/unittests/RNG/RNGTest.cpp
blob: 4dee36d12073ca831496c9c261a0049319f2a702 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "klee/ADT/RNG.h"

#include "gtest/gtest.h"

using namespace klee;

/* test equality with default seed */
TEST(RNG, InitialSeedEquality) {
  RNG noseed;
  RNG seed(5489U);

  ASSERT_EQ(noseed.getBool(), seed.getBool());
  ASSERT_EQ(noseed.getInt32(), seed.getInt32());
  ASSERT_EQ(noseed.getDouble(), seed.getDouble());
  ASSERT_EQ(noseed.getDoubleL(), seed.getDoubleL());
}


/* test inequality with default seed */
TEST(RNG, InitialSeedInEquality) {
  RNG noseed;
  RNG seed(42U);

  ASSERT_NE(noseed.getInt32(), seed.getInt32());
}


/* test inequality with zero seed */
TEST(RNG, InitialSeedZeroInEquality) {
  RNG noseed;
  RNG seed(0U);

  ASSERT_NE(noseed.getInt32(), seed.getInt32());
}


/* test equality with seed provided by ctor and seed() */
TEST(RNG, SeedEquality) {
  RNG noseed;
  noseed.seed(42U);
  RNG seed(42U);

  ASSERT_EQ(noseed.getInt32(), seed.getInt32());
}