Aleph-w 3.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 <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, 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 601 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 103 of file olhash.cc.

References Aleph::dft_hash_fct().

Referenced by TEST().

◆ TEST() [1/48]

TEST ( OLhashTable  ,
All   
)

Definition at line 1236 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [2/48]

TEST ( OLhashTable  ,
ContainsOrInsert_ExistingKey   
)

Definition at line 980 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [3/48]

TEST ( OLhashTable  ,
ContainsOrInsert_NewKey   
)

Definition at line 969 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [4/48]

TEST ( OLhashTable  ,
CopyAssignment   
)

◆ TEST() [5/48]

TEST ( OLhashTable  ,
CopyConstructor   
)

◆ TEST() [6/48]

TEST ( OLhashTable  ,
DeletedCleanup_BackwardPropagation   
)

Definition at line 648 of file olhash.cc.

References count_bucket_states(), Aleph::maps(), Aleph::DynList< T >::remove(), and tbl.

◆ TEST() [7/48]

TEST ( OLhashTable  ,
DeletedCleanup_LastInChainBecomesEmpty   
)

Definition at line 617 of file olhash.cc.

References count_bucket_states(), Aleph::DynList< T >::empty(), Aleph::maps(), and tbl.

◆ TEST() [8/48]

TEST ( OLhashTable  ,
DeletedCleanup_MiddleStaysDeleted   
)

Definition at line 683 of file olhash.cc.

References count_bucket_states(), Aleph::maps(), Aleph::DynList< T >::remove(), and tbl.

◆ TEST() [9/48]

TEST ( OLhashTable  ,
DeletedCleanup_NoAccumulationAfterCycles   
)

Definition at line 710 of file olhash.cc.

References count_bucket_states(), Aleph::maps(), and tbl.

◆ TEST() [10/48]

TEST ( OLhashTable  ,
DeletedCleanup_StressNoAccumulation   
)

◆ TEST() [11/48]

◆ TEST() [12/48]

TEST ( OLhashTable  ,
DeletedSlotReuse   
)

Definition at line 913 of file olhash.cc.

References count_bucket_states(), Aleph::maps(), and tbl.

◆ TEST() [13/48]

TEST ( OLhashTable  ,
DuplicateInsertReturnsNull   
)

Definition at line 1096 of file olhash.cc.

References Aleph::DynList< T >::insert(), Aleph::maps(), and tbl.

◆ TEST() [14/48]

TEST ( OLhashTable  ,
EmptyTableOperations   
)

Definition at line 1066 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [15/48]

TEST ( OLhashTable  ,
Exists   
)

Definition at line 1246 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [16/48]

TEST ( OLhashTable  ,
Filter   
)

◆ TEST() [17/48]

TEST ( OLhashTable  ,
Find   
)

Definition at line 1124 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [18/48]

TEST ( OLhashTable  ,
ForEach   
)

Definition at line 1224 of file olhash.cc.

References Aleph::maps(), Aleph::sum(), and tbl.

◆ TEST() [19/48]

TEST ( OLhashTable  ,
Fuzz_InterleavedOperations   
)

Definition at line 510 of file olhash.cc.

References FAIL, Aleph::DynList< T >::insert(), Aleph::maps(), rng, Aleph::HTList::size(), and tbl.

◆ TEST() [20/48]

TEST ( OLhashTable  ,
Fuzz_RandomOperationsWithOracle   
)

◆ TEST() [21/48]

TEST ( OLhashTable  ,
HasAndContains   
)

Definition at line 1109 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [22/48]

TEST ( OLhashTable  ,
IteratorBasic   
)

Definition at line 1141 of file olhash.cc.

References Aleph::DynList< T >::insert(), Aleph::maps(), and tbl.

◆ TEST() [23/48]

TEST ( OLhashTable  ,
IteratorDelete   
)

Definition at line 1180 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [24/48]

TEST ( OLhashTable  ,
IteratorEmpty   
)

Definition at line 1159 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [25/48]

TEST ( OLhashTable  ,
IteratorSingleElement   
)

Definition at line 1167 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [26/48]

TEST ( OLhashTable  ,
KeyToBucketRoundTrip   
)

Definition at line 137 of file olhash.cc.

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

◆ TEST() [27/48]

TEST ( OLhashTable  ,
ManualRehash   
)

◆ TEST() [28/48]

TEST ( OLhashTable  ,
ManyCollisions   
)

Definition at line 243 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [29/48]

TEST ( OLhashTable  ,
Map   
)

Definition at line 108 of file olhash.cc.

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

◆ TEST() [30/48]

TEST ( OLhashTable  ,
MoveAssignment   
)

Definition at line 877 of file olhash.cc.

References Aleph::DynList< T >::insert(), Aleph::maps(), and Aleph::HTList::size().

◆ TEST() [31/48]

TEST ( OLhashTable  ,
MoveConstructor   
)

Definition at line 839 of file olhash.cc.

References Aleph::DynList< T >::insert(), Aleph::maps(), and Aleph::HTList::size().

◆ TEST() [32/48]

TEST ( OLhashTable  ,
RemoveNonExistentDoesNotChangeCapacity   
)

Definition at line 277 of file olhash.cc.

References Aleph::maps(), Aleph::HTList::size(), and tbl.

◆ TEST() [33/48]

TEST ( OLhashTable  ,
RemoveNonExistentKeyPreservesTableIntegrity   
)

Definition at line 153 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [34/48]

TEST ( OLhashTable  ,
RemoveWithExternalKey   
)

Definition at line 199 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [35/48]

TEST ( OLhashTable  ,
RemoveWithInternalKey   
)

Definition at line 224 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [36/48]

TEST ( OLhashTable  ,
ResizeDown   
)

Definition at line 1047 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [37/48]

TEST ( OLhashTable  ,
ResizeUp   
)

Definition at line 1030 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [38/48]

TEST ( OLhashTable  ,
SearchOrInsert_ExistingKey   
)

Definition at line 958 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [39/48]

TEST ( OLhashTable  ,
SearchOrInsert_NewKey   
)

Definition at line 948 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [40/48]

TEST ( OLhashTable  ,
SelfAssignment   
)

Definition at line 896 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [41/48]

TEST ( OLhashTable  ,
Simplest   
)

Definition at line 48 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [42/48]

TEST ( OLhashTable  ,
SingleElement   
)

Definition at line 1078 of file olhash.cc.

References count_bucket_states(), Aleph::maps(), and tbl.

◆ TEST() [43/48]

TEST ( OLhashTable  ,
StatsCorrectness   
)

Definition at line 1199 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [44/48]

TEST ( OLhashTable  ,
Stress_FillAndEmpty   
)

Definition at line 387 of file olhash.cc.

References Aleph::DynList< T >::insert(), Aleph::maps(), rng, Aleph::shuffle(), and tbl.

◆ TEST() [45/48]

TEST ( OLhashTable  ,
Stress_InsertRemoveCycles   
)

Definition at line 457 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [46/48]

TEST ( OLhashTable  ,
Stress_LinearProbingCollisions   
)

Definition at line 422 of file olhash.cc.

References Aleph::maps(), and tbl.

◆ TEST() [47/48]

TEST ( OLhashTable  ,
Stress_ResizeOperations   
)

Definition at line 485 of file olhash.cc.

References Aleph::DynList< T >::insert(), Aleph::maps(), rng, Aleph::HTList::size(), and tbl.

◆ TEST() [48/48]

TEST ( OLhashTable  ,
Stress_WithAutoResize   
)

Definition at line 562 of file olhash.cc.

References Aleph::DynList< T >::insert(), Aleph::maps(), rng, Aleph::HTList::size(), and tbl.