gem5 v24.1.0.1
|
#include <gtest/gtest-spi.h>
#include <gtest/gtest.h>
#include <unordered_map>
#include <utility>
#include <set>
#include <algorithm>
#include "base/gtest/logging.hh"
#include "base/random.hh"
Go to the source code of this file.
Classes | |
class | gem5::RandomTest |
Helper class to access private members of Random. More... | |
Namespaces | |
namespace | gem5 |
Copyright (c) 2024 Arm Limited All rights reserved. | |
Typedefs | |
using | RandomPtr = gem5::Random::RandomPtr |
Functions | |
TEST (RandomCtor, UInt64DefaultConstruct) | |
Checking that default construction uses the default seed as specified by the standard. | |
TEST (RandomCtor, DoubleDefaultConstruct) | |
TEST (RandomCtor, FloatDefaultConstruct) | |
TEST (RandomCtor, ConstructUserSpecifiedSeed) | |
Checking that default construction uses the default see as specified by the standard. | |
TEST (RandomCtor, ConstructThenReseed) | |
Test that reseeding after construction with an explicit seed works. | |
TEST (RandomRange, MinEqualsMax) | |
This tests check that range generation works if min equals max. | |
bool | withinFreqRange (int count) |
Helper function for subsequent range tests, returns true if a random number was produced 32% <= freq <= 34%, otherwise false. | |
TEST (RandomRange, Coverage) | |
This tests check that range generation does generate all possible values within a range. | |
TEST (RandomConstruct, LiveInstancesAdd) | |
Test that all constructed objects get added to the live instance list. | |
TEST (RandomConstruct, LiveInstancesRemove) | |
Test that all destructed objects get removed from the live instance list. | |
TEST (RandomReseed, ConstructThenReseed) | |
Test that reseeding after construction with an explicit seed works. | |
TEST (RandomReseed, GlobalReseedLive) | |
Test if global reseeding updates seed of live instances. | |
TEST (RandomReseed, GlobalReseedFuture) | |
Test if global reseeding updates seed of future instances. | |
TEST (RandomDeathTest, InvalidRange) | |
Test that the range provided for random number generation is valid. | |
Variables | |
constexpr int | loopCount = 30000 |
using RandomPtr = gem5::Random::RandomPtr |
Definition at line 64 of file random.test.cc.
TEST | ( | RandomConstruct | , |
LiveInstancesAdd | |||
) |
Test that all constructed objects get added to the live instance list.
Definition at line 210 of file random.test.cc.
References gem5::Random::genRandom(), and gem5::RandomTest::getInstances().
TEST | ( | RandomConstruct | , |
LiveInstancesRemove | |||
) |
Test that all destructed objects get removed from the live instance list.
Definition at line 231 of file random.test.cc.
References gem5::Random::genRandom(), and gem5::RandomTest::getInstances().
TEST | ( | RandomCtor | , |
ConstructThenReseed | |||
) |
Test that reseeding after construction with an explicit seed works.
Definition at line 113 of file random.test.cc.
References gem5::Random::genRandom(), and gem5::ArmISA::u.
TEST | ( | RandomCtor | , |
ConstructUserSpecifiedSeed | |||
) |
Checking that default construction uses the default see as specified by the standard.
Definition at line 103 of file random.test.cc.
References gem5::Random::genRandom(), and gem5::ArmISA::u.
TEST | ( | RandomCtor | , |
DoubleDefaultConstruct | |||
) |
Definition at line 80 of file random.test.cc.
References gem5::ArmISA::d, and gem5::Random::genRandom().
TEST | ( | RandomCtor | , |
FloatDefaultConstruct | |||
) |
Definition at line 90 of file random.test.cc.
References gem5::Random::genRandom().
TEST | ( | RandomCtor | , |
UInt64DefaultConstruct | |||
) |
Checking that default construction uses the default seed as specified by the standard.
Definition at line 70 of file random.test.cc.
References gem5::Random::genRandom(), gem5::RandomTest::getGlobalSeed(), and gem5::ArmISA::u.
TEST | ( | RandomDeathTest | , |
InvalidRange | |||
) |
Test that the range provided for random number generation is valid.
Definition at line 289 of file random.test.cc.
References gem5::Random::genRandom().
TEST | ( | RandomRange | , |
Coverage | |||
) |
This tests check that range generation does generate all possible values within a range.
Definition at line 156 of file random.test.cc.
References gem5::Random::genRandom(), gem5::ArmISA::i, loopCount, and withinFreqRange().
TEST | ( | RandomRange | , |
MinEqualsMax | |||
) |
This tests check that range generation works if min equals max.
Definition at line 125 of file random.test.cc.
References gem5::Random::genRandom(), and gem5::ArmISA::i.
TEST | ( | RandomReseed | , |
ConstructThenReseed | |||
) |
Test that reseeding after construction with an explicit seed works.
Definition at line 248 of file random.test.cc.
References gem5::Random::genRandom(), gem5::RandomTest::getGlobalSeed(), and gem5::ArmISA::u.
TEST | ( | RandomReseed | , |
GlobalReseedFuture | |||
) |
Test if global reseeding updates seed of future instances.
Definition at line 279 of file random.test.cc.
References gem5::Random::genRandom(), gem5::Random::reseedAll(), and gem5::ArmISA::u.
TEST | ( | RandomReseed | , |
GlobalReseedLive | |||
) |
Test if global reseeding updates seed of live instances.
Definition at line 261 of file random.test.cc.
References gem5::Random::genRandom(), gem5::Random::reseedAll(), and gem5::ArmISA::u.
bool withinFreqRange | ( | int | count | ) |
Helper function for subsequent range tests, returns true if a random number was produced 32% <= freq <= 34%, otherwise false.
Assumes we are testing ranges that span 3 elements.
Definition at line 145 of file random.test.cc.
References gem5::X86ISA::count, and loopCount.
Referenced by TEST().
|
constexpr |
Definition at line 136 of file random.test.cc.
Referenced by TEST(), and withinFreqRange().