Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
ah_random_test.cc File Reference

Gsl_Compatible_Rng against GSL, bit by bit, but for the reals of flat() and gaussian() where GSL fuses multiply-adds, and for those of gaussian() and exponential() where the logarithm of the tests is not that of GSL, as with MSVC and clang-cl; and against hashes of the draws of GSL, which stand for it where it is not (ALEPH_WITH_GSL is 0). More...

#include <gtest/gtest.h>
#include <ah-random.H>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <iomanip>
#include <memory>
#include <numeric>
#include <random>
#include <vector>
Include dependency graph for ah_random_test.cc:

Go to the source code of this file.

Functions

 TEST (GslCompatibleRng, TheDefaultSeedIsTheOneOfGsl)
 
 TEST (GslCompatibleRng, TheDrawsOfGslByTheirHashes)
 
 TEST (GslCompatibleRng, EveryDrawIsTheOneOfGsl)
 
 TEST (GslCompatibleRng, TheRealDrawsRoundEachProduct)
 
 TEST (GslCompatibleRng, SeedingAgainIsAsGslRngSet)
 
 TEST (GslCompatibleRng, TheNumbersOfTheStandard)
 
 TEST (GslCompatibleRng, TheNumbersAreThoseOfStdMt19937)
 
 TEST (GslCompatibleRng, UniformIntRejectsZeroAndTooLargeBounds)
 
 TEST (GslCompatibleRng, UniformIntIsItsDefinitionWhereTheQuotientReachesTheBound)
 
 TEST (GslCompatibleRng, UniformIntTakesAnotherNumberAfterTheBoundInANewState)
 
 TEST (GslCompatibleRng, RangesOfTheDraws)
 
 TEST (GslCompatibleRng, MomentsOfTheDistributions)
 
 TEST (GslCompatibleRng, ACopyGoesOnWithTheSameNumbers)
 
 TEST (GslCompatibleRng, FeedsTheStandardLibrary)
 

Detailed Description

Gsl_Compatible_Rng against GSL, bit by bit, but for the reals of flat() and gaussian() where GSL fuses multiply-adds, and for those of gaussian() and exponential() where the logarithm of the tests is not that of GSL, as with MSVC and clang-cl; and against hashes of the draws of GSL, which stand for it where it is not (ALEPH_WITH_GSL is 0).

Each test seeds a Gsl_Compatible_Rng and a gsl_rng_mt19937 alike, and draws from both, in an order that another generator picks, so that a draw that took one number more or less from one of them would show in every later one.

Definition in file ah_random_test.cc.

Function Documentation

◆ TEST() [1/14]

TEST ( GslCompatibleRng  ,
ACopyGoesOnWithTheSameNumbers   
)

Definition at line 545 of file ah_random_test.cc.

References Aleph::Gsl_Compatible_Rng::uniform_int().

◆ TEST() [2/14]

TEST ( GslCompatibleRng  ,
EveryDrawIsTheOneOfGsl   
)

Definition at line 324 of file ah_random_test.cc.

◆ TEST() [3/14]

TEST ( GslCompatibleRng  ,
FeedsTheStandardLibrary   
)

Definition at line 560 of file ah_random_test.cc.

References w.

◆ TEST() [4/14]

TEST ( GslCompatibleRng  ,
MomentsOfTheDistributions   
)

◆ TEST() [5/14]

◆ TEST() [6/14]

TEST ( GslCompatibleRng  ,
SeedingAgainIsAsGslRngSet   
)

◆ TEST() [7/14]

TEST ( GslCompatibleRng  ,
TheDefaultSeedIsTheOneOfGsl   
)

◆ TEST() [8/14]

TEST ( GslCompatibleRng  ,
TheDrawsOfGslByTheirHashes   
)

Definition at line 237 of file ah_random_test.cc.

References Aleph::Gsl_Compatible_Rng::get(), r, and seed.

◆ TEST() [9/14]

TEST ( GslCompatibleRng  ,
TheNumbersAreThoseOfStdMt19937   
)

Definition at line 401 of file ah_random_test.cc.

References Aleph::Gsl_Compatible_Rng::seed().

◆ TEST() [10/14]

TEST ( GslCompatibleRng  ,
TheNumbersOfTheStandard   
)

Definition at line 389 of file ah_random_test.cc.

◆ TEST() [11/14]

TEST ( GslCompatibleRng  ,
TheRealDrawsRoundEachProduct   
)

◆ TEST() [12/14]

TEST ( GslCompatibleRng  ,
UniformIntIsItsDefinitionWhereTheQuotientReachesTheBound   
)

Definition at line 445 of file ah_random_test.cc.

References Aleph::and, Aleph::Gsl_Compatible_Rng::get(), and k.

◆ TEST() [13/14]

TEST ( GslCompatibleRng  ,
UniformIntRejectsZeroAndTooLargeBounds   
)

◆ TEST() [14/14]

TEST ( GslCompatibleRng  ,
UniformIntTakesAnotherNumberAfterTheBoundInANewState   
)