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

Tests for Olhash. More...

#include <gtest/gtest.h>
#include <numeric>
#include <random>
#include <set>
#include <tpl_olhash.H>
Include dependency graph for olhash.cc:

Go to the source code of this file.

Classes

struct  MyRecord
 
struct  MyRecord::Eq
 
struct  BucketStats
 

Functions

 TEST (OLhashTable, Simplest)
 
size_t my_hash (const MyRecord &r) noexcept
 
 TEST (OLhashTable, Map)
 
 TEST (OLhashTable, KeyToBucketRoundTrip)
 
 TEST (OLhashTable, RemoveNonExistentKeyPreservesTableIntegrity)
 
 TEST (OLhashTable, RemoveWithExternalKey)
 
 TEST (OLhashTable, RemoveWithInternalKey)
 
 TEST (OLhashTable, ManyCollisions)
 
 TEST (OLhashTable, RemoveNonExistentDoesNotChangeCapacity)
 
 TEST (OLhashTable, Fuzz_RandomOperationsWithOracle)
 
 TEST (OLhashTable, Stress_FillAndEmpty)
 
 TEST (OLhashTable, Stress_LinearProbingCollisions)
 
 TEST (OLhashTable, Stress_InsertRemoveCycles)
 
 TEST (OLhashTable, Stress_ResizeOperations)
 
 TEST (OLhashTable, Fuzz_InterleavedOperations)
 
 TEST (OLhashTable, Stress_WithAutoResize)
 
template<typename HashTable >
BucketStats count_bucket_states (const HashTable &tbl)
 
 TEST (OLhashTable, DeletedCleanup_LastInChainBecomesEmpty)
 
 TEST (OLhashTable, DeletedCleanup_BackwardPropagation)
 
 TEST (OLhashTable, DeletedCleanup_MiddleStaysDeleted)
 
 TEST (OLhashTable, DeletedCleanup_NoAccumulationAfterCycles)
 
 TEST (OLhashTable, DeletedCleanup_WrapAround)
 
 TEST (OLhashTable, DeletedCleanup_StressNoAccumulation)
 
 TEST (OLhashTable, CopyConstructor)
 
 TEST (OLhashTable, MoveConstructor)
 
 TEST (OLhashTable, CopyAssignment)
 
 TEST (OLhashTable, MoveAssignment)
 
 TEST (OLhashTable, SelfAssignment)
 
 TEST (OLhashTable, DeletedSlotReuse)
 
 TEST (OLhashTable, SearchOrInsert_NewKey)
 
 TEST (OLhashTable, SearchOrInsert_ExistingKey)
 
 TEST (OLhashTable, ContainsOrInsert_NewKey)
 
 TEST (OLhashTable, ContainsOrInsert_ExistingKey)
 
 TEST (OLhashTable, ManualRehash)
 
 TEST (OLhashTable, ResizeUp)
 
 TEST (OLhashTable, ResizeDown)
 
 TEST (OLhashTable, EmptyTableOperations)
 
 TEST (OLhashTable, SingleElement)
 
 TEST (OLhashTable, DuplicateInsertReturnsNull)
 
 TEST (OLhashTable, HasAndContains)
 
 TEST (OLhashTable, Find)
 
 TEST (OLhashTable, IteratorBasic)
 
 TEST (OLhashTable, IteratorEmpty)
 
 TEST (OLhashTable, IteratorSingleElement)
 
 TEST (OLhashTable, IteratorDelete)
 
 TEST (OLhashTable, IteratorDeleteEmptiesACollisionRun)
 
 TEST (OLhashTable, StatsCorrectness)
 
 TEST (OLhashTable, ForEach)
 
 TEST (OLhashTable, All)
 
 TEST (OLhashTable, Exists)
 
 TEST (OLhashTable, Filter)
 

Detailed Description

Tests for Olhash.

Definition in file olhash.cc.

Function Documentation

◆ count_bucket_states()

template<typename HashTable >
BucketStats count_bucket_states ( const HashTable &  tbl)

Definition at line 602 of file olhash.cc.

References BucketStats::busy, BucketStats::deleted, BucketStats::empty, and tbl.

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ my_hash()

size_t my_hash ( const MyRecord &  r)
inlinenoexcept

Definition at line 104 of file olhash.cc.

References Aleph::dft_hash_fct(), and r.

Referenced by TEST().

◆ TEST() [1/49]

TEST ( OLhashTable  ,
All   
)

Definition at line 1275 of file olhash.cc.

References tbl.

◆ TEST() [2/49]

TEST ( OLhashTable  ,
ContainsOrInsert_ExistingKey   
)

Definition at line 991 of file olhash.cc.

References tbl.

◆ TEST() [3/49]

TEST ( OLhashTable  ,
ContainsOrInsert_NewKey   
)

Definition at line 980 of file olhash.cc.

References tbl.

◆ TEST() [4/49]

TEST ( OLhashTable  ,
CopyAssignment   
)

◆ TEST() [5/49]

◆ TEST() [6/49]

TEST ( OLhashTable  ,
DeletedCleanup_BackwardPropagation   
)

Definition at line 651 of file olhash.cc.

References count_bucket_states(), and tbl.

◆ TEST() [7/49]

TEST ( OLhashTable  ,
DeletedCleanup_LastInChainBecomesEmpty   
)

Definition at line 618 of file olhash.cc.

References count_bucket_states(), and tbl.

◆ TEST() [8/49]

TEST ( OLhashTable  ,
DeletedCleanup_MiddleStaysDeleted   
)

Definition at line 688 of file olhash.cc.

References count_bucket_states(), and tbl.

◆ TEST() [9/49]

TEST ( OLhashTable  ,
DeletedCleanup_NoAccumulationAfterCycles   
)

Definition at line 717 of file olhash.cc.

References count_bucket_states(), and tbl.

◆ TEST() [10/49]

TEST ( OLhashTable  ,
DeletedCleanup_StressNoAccumulation   
)

Definition at line 775 of file olhash.cc.

References count_bucket_states(), rng, and tbl.

◆ TEST() [11/49]

◆ TEST() [12/49]

TEST ( OLhashTable  ,
DeletedSlotReuse   
)

Definition at line 922 of file olhash.cc.

References count_bucket_states(), and tbl.

◆ TEST() [13/49]

TEST ( OLhashTable  ,
DuplicateInsertReturnsNull   
)

Definition at line 1107 of file olhash.cc.

References tbl.

◆ TEST() [14/49]

TEST ( OLhashTable  ,
EmptyTableOperations   
)

Definition at line 1077 of file olhash.cc.

References tbl.

◆ TEST() [15/49]

TEST ( OLhashTable  ,
Exists   
)

Definition at line 1285 of file olhash.cc.

References tbl.

◆ TEST() [16/49]

TEST ( OLhashTable  ,
Filter   
)

Definition at line 1295 of file olhash.cc.

References tbl.

◆ TEST() [17/49]

TEST ( OLhashTable  ,
Find   
)

Definition at line 1135 of file olhash.cc.

References tbl.

◆ TEST() [18/49]

TEST ( OLhashTable  ,
ForEach   
)

Definition at line 1263 of file olhash.cc.

References Aleph::sum(), and tbl.

◆ TEST() [19/49]

TEST ( OLhashTable  ,
Fuzz_InterleavedOperations   
)

Definition at line 511 of file olhash.cc.

References FAIL, rng, and tbl.

◆ TEST() [20/49]

TEST ( OLhashTable  ,
Fuzz_RandomOperationsWithOracle   
)

Definition at line 313 of file olhash.cc.

References FAIL, rng, and tbl.

◆ TEST() [21/49]

TEST ( OLhashTable  ,
HasAndContains   
)

Definition at line 1120 of file olhash.cc.

References tbl.

◆ TEST() [22/49]

TEST ( OLhashTable  ,
IteratorBasic   
)

Definition at line 1152 of file olhash.cc.

References tbl.

◆ TEST() [23/49]

TEST ( OLhashTable  ,
IteratorDelete   
)

Definition at line 1191 of file olhash.cc.

References tbl.

◆ TEST() [24/49]

TEST ( OLhashTable  ,
IteratorDeleteEmptiesACollisionRun   
)

Definition at line 1209 of file olhash.cc.

References tbl.

◆ TEST() [25/49]

TEST ( OLhashTable  ,
IteratorEmpty   
)

Definition at line 1170 of file olhash.cc.

References tbl.

◆ TEST() [26/49]

TEST ( OLhashTable  ,
IteratorSingleElement   
)

Definition at line 1178 of file olhash.cc.

References tbl.

◆ TEST() [27/49]

TEST ( OLhashTable  ,
KeyToBucketRoundTrip   
)

Definition at line 138 of file olhash.cc.

References OhashCommon< HashTbl, Key >::insert(), and tbl.

◆ TEST() [28/49]

TEST ( OLhashTable  ,
ManualRehash   
)

Definition at line 1007 of file olhash.cc.

References count_bucket_states(), and tbl.

◆ TEST() [29/49]

TEST ( OLhashTable  ,
ManyCollisions   
)

Definition at line 244 of file olhash.cc.

References tbl.

◆ TEST() [30/49]

TEST ( OLhashTable  ,
Map   
)

Definition at line 109 of file olhash.cc.

References my_hash(), tbl, and Aleph::to_string().

◆ TEST() [31/49]

◆ TEST() [32/49]

◆ TEST() [33/49]

TEST ( OLhashTable  ,
RemoveNonExistentDoesNotChangeCapacity   
)

Definition at line 278 of file olhash.cc.

References tbl.

◆ TEST() [34/49]

TEST ( OLhashTable  ,
RemoveNonExistentKeyPreservesTableIntegrity   
)

Definition at line 154 of file olhash.cc.

References tbl.

◆ TEST() [35/49]

TEST ( OLhashTable  ,
RemoveWithExternalKey   
)

Definition at line 200 of file olhash.cc.

References tbl.

◆ TEST() [36/49]

TEST ( OLhashTable  ,
RemoveWithInternalKey   
)

Definition at line 225 of file olhash.cc.

References tbl.

◆ TEST() [37/49]

TEST ( OLhashTable  ,
ResizeDown   
)

Definition at line 1058 of file olhash.cc.

References tbl.

◆ TEST() [38/49]

TEST ( OLhashTable  ,
ResizeUp   
)

Definition at line 1041 of file olhash.cc.

References tbl.

◆ TEST() [39/49]

TEST ( OLhashTable  ,
SearchOrInsert_ExistingKey   
)

Definition at line 969 of file olhash.cc.

References tbl.

◆ TEST() [40/49]

TEST ( OLhashTable  ,
SearchOrInsert_NewKey   
)

Definition at line 959 of file olhash.cc.

References tbl.

◆ TEST() [41/49]

TEST ( OLhashTable  ,
SelfAssignment   
)

Definition at line 905 of file olhash.cc.

References tbl.

◆ TEST() [42/49]

TEST ( OLhashTable  ,
Simplest   
)

Definition at line 49 of file olhash.cc.

References tbl.

◆ TEST() [43/49]

TEST ( OLhashTable  ,
SingleElement   
)

Definition at line 1089 of file olhash.cc.

References count_bucket_states(), and tbl.

◆ TEST() [44/49]

TEST ( OLhashTable  ,
StatsCorrectness   
)

Definition at line 1238 of file olhash.cc.

References tbl.

◆ TEST() [45/49]

TEST ( OLhashTable  ,
Stress_FillAndEmpty   
)

Definition at line 388 of file olhash.cc.

References Aleph::iota(), keys, rng, Aleph::shuffle(), and tbl.

◆ TEST() [46/49]

TEST ( OLhashTable  ,
Stress_InsertRemoveCycles   
)

Definition at line 458 of file olhash.cc.

References tbl.

◆ TEST() [47/49]

TEST ( OLhashTable  ,
Stress_LinearProbingCollisions   
)

Definition at line 423 of file olhash.cc.

References tbl.

◆ TEST() [48/49]

TEST ( OLhashTable  ,
Stress_ResizeOperations   
)

Definition at line 486 of file olhash.cc.

References rng, and tbl.

◆ TEST() [49/49]

TEST ( OLhashTable  ,
Stress_WithAutoResize   
)

Definition at line 563 of file olhash.cc.

References rng, and tbl.