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

The randomized structures make, for a seed, what they made with GSL. More...

#include <gtest/gtest.h>
#include <ah-random.H>
#include <ah_init_guard.H>
#include <tpl_dynSkipList.H>
#include <tpl_interval_tree.H>
#include <tpl_rand_tree.H>
#include <tpl_random_queue.H>
#include <tpl_treap.H>
#include <tpl_treapRk.H>
#include <tpl_skipList.H>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <limits>
#include <optional>
#include <string>
#include <thread>
#include <type_traits>
#include <utility>
#include <vector>
Include dependency graph for random_structures_test.cc:

Go to the source code of this file.

Macros

#define TEST_SKIP_LIST   1
 
#define TEST_UNDER_A_SANITIZER   0
 
#define TEST_SEES_THE_HEAP   0
 

Functions

 TEST (RandomStructures, WhatTheyMadeWithGsl)
 
 TEST (RandomStructures, TheTreapPrioritiesAreTheNumbersOfGsl)
 
 TEST (RandomStructures, TheDeprecatedGslRngActsOnTheGenerator)
 
 TEST (RandomStructures, TheDeprecatedGslRngFollowsItsGenerator)
 
 TEST (RandomStructures, TheDeprecatedGslRngCopiesSavesAndRestoresTheGenerator)
 
 TEST (RandomStructures, TheDeprecatedGslRngIsMadeOnceFromSeveralThreads)
 
 TEST (RandomStructures, MovesAndSwapsKeepTheGenerators)
 
 TEST (RandomStructures, AMovedTreapTakesItsNodesAndItsGenerator)
 
 TEST (RandomStructures, TheSeedsAreTakenAsForGsl)
 
 TYPED_TEST (Randomized_Structure, BuiltWithoutASeedItDrawsFromASplitMix64OfItsOwn)
 
 TYPED_TEST (Randomized_Structure, WithASeedItDrawsFromTheMersenneTwisterOfThatSeed)
 
 TYPED_TEST (Randomized_Structure, WithTheSameSeedTwoMakeTheSameWithEachEngine)
 
 TYPED_TEST (Randomized_Structure, TheDeprecatedRngMakesTheMersenneTwisterOfOneWithoutASeed)
 
 TYPED_TEST (Randomized_Structure, TheDeprecatedGslRngMakesTheMersenneTwisterOfOneWithoutASeed)
 
 TYPED_TEST (Randomized_Structure, ACopyDrawsFromASplitMix64OfItsOwn)
 
 TYPED_TEST (Randomized_Structure, AMoveTakesTheGeneratorAndTheOneMovedFromDrawsFromAnother)
 
 TYPED_TEST (Randomized_Structure, ASwapExchangesTheGenerators)
 
 TYPED_TEST (Randomized_Structure, ItHoldsNoMersenneTwisterUntilItIsAskedForOne)
 
 TEST (RandomStructures, ThePrioritiesAreTheNumbersOfTheSource)
 
 TEST (RandomStructures, TheTreesWithoutASeedAreBalanced)
 
 TEST (RandomStructures, TheTreesAreBuiltAndMovedWithoutThrowing)
 

Detailed Description

The randomized structures make, for a seed, what they made with GSL.

The treaps, the randomized trees, the skip lists, the random queue and the interval trees took their numbers from GSL, and take them now from a Gsl_Compatible_Rng. For six seeds, the shapes of the trees with their priorities, the levels of the skip lists, the order of a random queue and the next number of each generator after the operations must be those of before: each line of output is compared, by its FNV-1a hash, with the one of GSL. The deprecated accessors to a gsl_rng are checked too.

Each structure draws from a Random_Source: without a seed, from a SplitMix64 inside it; with one, from the Mersenne Twister of GSL. The typed tests at the end build, seed, copy, move and swap each of the seven, and look at the generator that each one is left with.

tpl_skipList.H makes the header node of a SkipList with a zero-sized array in a base class, which MSVC rejects, as it rejects skiplist_test, which is not built on Windows: with MSVC, the SkipList is left out.

Definition in file random_structures_test.cc.

Macro Definition Documentation

◆ TEST_SEES_THE_HEAP

#define TEST_SEES_THE_HEAP   0

Definition at line 96 of file random_structures_test.cc.

◆ TEST_SKIP_LIST

#define TEST_SKIP_LIST   1

Definition at line 66 of file random_structures_test.cc.

◆ TEST_UNDER_A_SANITIZER

#define TEST_UNDER_A_SANITIZER   0

Definition at line 93 of file random_structures_test.cc.

Function Documentation

◆ TEST() [1/12]

TEST ( RandomStructures  ,
AMovedTreapTakesItsNodesAndItsGenerator   
)

Definition at line 613 of file random_structures_test.cc.

◆ TEST() [2/12]

◆ TEST() [3/12]

TEST ( RandomStructures  ,
TheDeprecatedGslRngActsOnTheGenerator   
)

Definition at line 502 of file random_structures_test.cc.

◆ TEST() [4/12]

TEST ( RandomStructures  ,
TheDeprecatedGslRngCopiesSavesAndRestoresTheGenerator   
)

Definition at line 512 of file random_structures_test.cc.

◆ TEST() [5/12]

TEST ( RandomStructures  ,
TheDeprecatedGslRngFollowsItsGenerator   
)

Definition at line 507 of file random_structures_test.cc.

◆ TEST() [6/12]

TEST ( RandomStructures  ,
TheDeprecatedGslRngIsMadeOnceFromSeveralThreads   
)

Definition at line 517 of file random_structures_test.cc.

◆ TEST() [7/12]

◆ TEST() [8/12]

◆ TEST() [9/12]

TEST ( RandomStructures  ,
TheTreapPrioritiesAreTheNumbersOfGsl   
)

Definition at line 497 of file random_structures_test.cc.

◆ TEST() [10/12]

TEST ( RandomStructures  ,
TheTreesAreBuiltAndMovedWithoutThrowing   
)

Definition at line 1371 of file random_structures_test.cc.

◆ TEST() [11/12]

◆ TEST() [12/12]

TEST ( RandomStructures  ,
WhatTheyMadeWithGsl   
)

Definition at line 271 of file random_structures_test.cc.

◆ TYPED_TEST() [1/9]

TYPED_TEST ( Randomized_Structure  ,
ACopyDrawsFromASplitMix64OfItsOwn   
)

Definition at line 1046 of file random_structures_test.cc.

References Aleph::fill().

◆ TYPED_TEST() [2/9]

TYPED_TEST ( Randomized_Structure  ,
AMoveTakesTheGeneratorAndTheOneMovedFromDrawsFromAnother   
)

Definition at line 1092 of file random_structures_test.cc.

References Aleph::fill().

◆ TYPED_TEST() [3/9]

TYPED_TEST ( Randomized_Structure  ,
ASwapExchangesTheGenerators   
)

Definition at line 1155 of file random_structures_test.cc.

References Aleph::fill(), and Aleph::Gsl_Compatible_Rng::seed().

◆ TYPED_TEST() [4/9]

TYPED_TEST ( Randomized_Structure  ,
BuiltWithoutASeedItDrawsFromASplitMix64OfItsOwn   
)

Definition at line 885 of file random_structures_test.cc.

References Aleph::fill().

◆ TYPED_TEST() [5/9]

TYPED_TEST ( Randomized_Structure  ,
ItHoldsNoMersenneTwisterUntilItIsAskedForOne   
)

Definition at line 1232 of file random_structures_test.cc.

◆ TYPED_TEST() [6/9]

TYPED_TEST ( Randomized_Structure  ,
TheDeprecatedGslRngMakesTheMersenneTwisterOfOneWithoutASeed   
)

Definition at line 1020 of file random_structures_test.cc.

References Aleph::SkipList< Key, Type >::r.

◆ TYPED_TEST() [7/9]

TYPED_TEST ( Randomized_Structure  ,
TheDeprecatedRngMakesTheMersenneTwisterOfOneWithoutASeed   
)

◆ TYPED_TEST() [8/9]

TYPED_TEST ( Randomized_Structure  ,
WithASeedItDrawsFromTheMersenneTwisterOfThatSeed   
)

Definition at line 913 of file random_structures_test.cc.

References Aleph::fill(), and seed.

◆ TYPED_TEST() [9/9]

TYPED_TEST ( Randomized_Structure  ,
WithTheSameSeedTwoMakeTheSameWithEachEngine   
)

Definition at line 955 of file random_structures_test.cc.

References engine, and Aleph::fill().