|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Tests for Lin Hash. More...
#include <gtest/gtest.h>#include <tpl_linHash.H>#include <random>#include <set>#include <vector>#include <algorithm>Go to the source code of this file.
Classes | |
| struct | ModCompare |
Typedefs | |
| using | Table = LinearHashTable< int > |
| using | Bucket = Table::Bucket |
Functions | |
| TEST (LinearHashTable, EmptyTableProperties) | |
| TEST (LinearHashTable, SearchOnEmptyTableReturnsNull) | |
| TEST (LinearHashTable, InsertSingleElement) | |
| TEST (LinearHashTable, InsertMultipleElements) | |
| TEST (LinearHashTable, InsertRejectsDuplicates) | |
| TEST (LinearHashTable, InsertManyElementsTriggersExpansion) | |
| TEST (LinearHashTable, SearchFindsExistingKey) | |
| TEST (LinearHashTable, SearchReturnsNullForMissingKey) | |
| TEST (LinearHashTable, SearchOrInsertReturnsExisting) | |
| TEST (LinearHashTable, SearchOrInsertInsertsNew) | |
| TEST (LinearHashTable, RemoveExistingKey) | |
| TEST (LinearHashTable, RemoveAllElements) | |
| TEST (LinearHashTable, RemoveManyElementsTriggersContraction) | |
| TEST (LinearHashTable, IteratorTraversesAllElements) | |
| TEST (LinearHashTable, IteratorOnEmptyTable) | |
| TEST (LinearHashTable, IteratorDel) | |
| TEST (LinearHashTable, IteratorGetPos) | |
| TEST (LinearHashTable, IteratorPrev) | |
| TEST (LinearHashTable, IteratorNoExceptMethods) | |
| TEST (LinearHashTable, SwapTables) | |
| TEST (LinearHashTable, EmptyMethodClearsTable) | |
| TEST (LinearHashTable, CurrentAlphaIsCorrect) | |
| size_t | mod_hash (const int &k) |
| TEST (LinearHashTable, CustomComparator) | |
| TEST (LinearHashTable, NegativeKeys) | |
| TEST (LinearHashTable, SingleElementOperations) | |
| TEST (LinearHashTable, ConstructorWithZeroLengthThrows) | |
| TEST (LinearHashTable, ConstructorWithInvalidAlphaThrows) | |
| TEST (LinearHashTable, RandomInsertSearchRemove) | |
| TEST (LinearHashTable, LargeTableOperations) | |
| TEST (LinearHashTableVtl, BasicOperations) | |
| TEST (LinearHashTable, SetHashFunction) | |
| TEST (LinearHashTable, GetHashFunction) | |
| TEST (LinearHashTable, GetCompare) | |
| TEST (LinearHashTable, ResizeReturnsCapacity) | |
Tests for Lin Hash.
Definition in file lin-hash.cc.
| using Bucket = Table::Bucket |
Definition at line 54 of file lin-hash.cc.
| using Table = LinearHashTable<int> |
Definition at line 53 of file lin-hash.cc.
| size_t mod_hash | ( | const int & | k | ) |
| TEST | ( | LinearHashTable | , |
| ConstructorWithInvalidAlphaThrows | |||
| ) |
Definition at line 536 of file lin-hash.cc.
References Aleph::maps().
| TEST | ( | LinearHashTable | , |
| ConstructorWithZeroLengthThrows | |||
| ) |
Definition at line 528 of file lin-hash.cc.
References Aleph::hash_default_lower_alpha, Aleph::hash_default_upper_alpha, and Aleph::maps().
| TEST | ( | LinearHashTable | , |
| CurrentAlphaIsCorrect | |||
| ) |
| TEST | ( | LinearHashTable | , |
| CustomComparator | |||
| ) |
Definition at line 472 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::maps(), mod_hash(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::search().
| TEST | ( | LinearHashTable | , |
| EmptyMethodClearsTable | |||
| ) |
Definition at line 427 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::empty(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::expansions(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::is_empty(), Aleph::maps(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::size().
| TEST | ( | LinearHashTable | , |
| EmptyTableProperties | |||
| ) |
Definition at line 60 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::busy_slots(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::capacity(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::expansions(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::is_empty(), Aleph::maps(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::size().
| TEST | ( | LinearHashTable | , |
| GetCompare | |||
| ) |
Definition at line 690 of file lin-hash.cc.
References cmp(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::get_compare(), and Aleph::maps().
| TEST | ( | LinearHashTable | , |
| GetHashFunction | |||
| ) |
Definition at line 682 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::get_hash_fct(), and Aleph::maps().
| TEST | ( | LinearHashTable | , |
| InsertManyElementsTriggersExpansion | |||
| ) |
Definition at line 128 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::capacity(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::expansions(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::maps(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::search(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::size().
| TEST | ( | LinearHashTable | , |
| InsertMultipleElements | |||
| ) |
Definition at line 97 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::maps(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::search(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::size().
| TEST | ( | LinearHashTable | , |
| InsertRejectsDuplicates | |||
| ) |
Definition at line 114 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::maps(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::size().
| TEST | ( | LinearHashTable | , |
| InsertSingleElement | |||
| ) |
Definition at line 84 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::busy_slots(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::is_empty(), Aleph::maps(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::size().
| TEST | ( | LinearHashTable | , |
| IteratorDel | |||
| ) |
| TEST | ( | LinearHashTable | , |
| IteratorGetPos | |||
| ) |
| TEST | ( | LinearHashTable | , |
| IteratorNoExceptMethods | |||
| ) |
| TEST | ( | LinearHashTable | , |
| IteratorOnEmptyTable | |||
| ) |
Definition at line 294 of file lin-hash.cc.
References Aleph::Dlink::Iterator::has_curr(), and Aleph::maps().
| TEST | ( | LinearHashTable | , |
| IteratorPrev | |||
| ) |
Definition at line 340 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::Iterator::get_pos(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::maps(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::Iterator::next(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::Iterator::prev().
| TEST | ( | LinearHashTable | , |
| IteratorTraversesAllElements | |||
| ) |
Definition at line 276 of file lin-hash.cc.
References Aleph::Dlink::Iterator::has_curr(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::DynList< T >::insert(), and Aleph::maps().
| TEST | ( | LinearHashTable | , |
| LargeTableOperations | |||
| ) |
Definition at line 610 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::maps(), N, Aleph::GenLinearHashTable< Key, BucketType, Cmp >::remove(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::search(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::size().
| TEST | ( | LinearHashTable | , |
| NegativeKeys | |||
| ) |
Definition at line 493 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::maps(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::search(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::size().
| TEST | ( | LinearHashTable | , |
| RandomInsertSearchRemove | |||
| ) |
Definition at line 554 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::DynList< T >::insert(), Aleph::maps(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::remove(), rng, Aleph::GenLinearHashTable< Key, BucketType, Cmp >::search(), Aleph::HTList::size(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::size().
| TEST | ( | LinearHashTable | , |
| RemoveAllElements | |||
| ) |
Definition at line 231 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::is_empty(), Aleph::maps(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::remove(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::search(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::size().
| TEST | ( | LinearHashTable | , |
| RemoveExistingKey | |||
| ) |
Definition at line 213 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::maps(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::remove(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::search(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::size().
| TEST | ( | LinearHashTable | , |
| RemoveManyElementsTriggersContraction | |||
| ) |
Definition at line 249 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::capacity(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::maps(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::remove(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::search(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::size().
| TEST | ( | LinearHashTable | , |
| ResizeReturnsCapacity | |||
| ) |
Definition at line 707 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::capacity(), Aleph::maps(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::resize().
| TEST | ( | LinearHashTable | , |
| SearchFindsExistingKey | |||
| ) |
Definition at line 151 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::maps(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::search().
| TEST | ( | LinearHashTable | , |
| SearchOnEmptyTableReturnsNull | |||
| ) |
Definition at line 71 of file lin-hash.cc.
References Aleph::maps(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::search().
| TEST | ( | LinearHashTable | , |
| SearchOrInsertInsertsNew | |||
| ) |
Definition at line 195 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::maps(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::search(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::search_or_insert(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::size().
| TEST | ( | LinearHashTable | , |
| SearchOrInsertReturnsExisting | |||
| ) |
| TEST | ( | LinearHashTable | , |
| SearchReturnsNullForMissingKey | |||
| ) |
Definition at line 166 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::maps(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::search().
| TEST | ( | LinearHashTable | , |
| SetHashFunction | |||
| ) |
| TEST | ( | LinearHashTable | , |
| SingleElementOperations | |||
| ) |
Definition at line 508 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::maps(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::remove(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::search(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::size().
| TEST | ( | LinearHashTable | , |
| SwapTables | |||
| ) |
Definition at line 385 of file lin-hash.cc.
References Aleph::hash_default_lower_alpha, Aleph::hash_default_upper_alpha, Aleph::DynList< T >::insert(), Aleph::maps(), Aleph::HTList::size(), and Aleph::DynList< T >::swap().
| TEST | ( | LinearHashTableVtl | , |
| BasicOperations | |||
| ) |
Definition at line 645 of file lin-hash.cc.
References Aleph::GenLinearHashTable< Key, BucketType, Cmp >::insert(), Aleph::maps(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::search(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::size().