|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
The balanced trees and their iterators allocate nothing but their nodes: construction, move, iteration and the path stacks of the operations never allocate, so their noexcept specifications hold. More...
#include <gtest/gtest.h>#include <tpl_avl.H>#include <tpl_avlRk.H>#include <tpl_rb_tree.H>#include <tpl_rbRk.H>#include <tpl_hRbTree.H>#include <tpl_hRbTreeRk.H>#include <tpl_treap.H>#include <tpl_rand_tree.H>#include <tpl_splay_tree.H>#include <tpl_binNodeUtils.H>#include <tpl_dynBinHeap.H>#include <tpl_dynSetTree.H>#include <tpl_dynMapTree.H>#include <ah-zip.H>#include <ahFunctional.H>#include <cstdlib>#include <memory>#include <new>#include <type_traits>#include <utility>#include <vector>Go to the source code of this file.
Macros | |
| #define | COUNT_ALLOCATIONS 1 |
| #define | SKIP_UNLESS_COUNTING_ALLOCATIONS() |
| #define | ALEPH_TEST_NOINLINE |
Functions | |
| void * | operator new (std::size_t size) |
| void * | operator new[] (std::size_t size) |
| void * | operator new (std::size_t size, const std::nothrow_t &) noexcept |
| void * | operator new[] (std::size_t size, const std::nothrow_t &) noexcept |
| void | operator delete (void *p) noexcept |
| void | operator delete[] (void *p) noexcept |
| void | operator delete (void *p, std::size_t) noexcept |
| void | operator delete[] (void *p, std::size_t) noexcept |
| void | operator delete (void *p, const std::nothrow_t &) noexcept |
| void | operator delete[] (void *p, const std::nothrow_t &) noexcept |
| TEST (TreeAllocation, constructing_a_tree_does_not_allocate) | |
| TEST (TreeAllocation, moving_a_tree_does_not_allocate) | |
| TEST (TreeAllocation, insert_and_remove_allocate_only_the_node) | |
| TEST (TreeAllocation, iterating_does_not_allocate) | |
| TEST (TreeAllocation, advancing_on_a_deep_tree_allocates) | |
| TEST (TreeAllocation, adaptors_propagate_the_bad_alloc_of_a_deep_tree) | |
| TEST (TreeAllocation, noexcept_specifications_hold) | |
The balanced trees and their iterators allocate nothing but their nodes: construction, move, iteration and the path stacks of the operations never allocate, so their noexcept specifications hold.
The allocations are counted by replacing the global allocation functions. A sanitizer that brings its own allocator defines them in its runtime (ThreadSanitizer and MemorySanitizer link them into the program, so a second definition does not link): under one, the replacement is left out and the tests that count are skipped.
Definition in file tree_allocation_test.cc.
| #define ALEPH_TEST_NOINLINE |
Definition at line 93 of file tree_allocation_test.cc.
| #define COUNT_ALLOCATIONS 1 |
Definition at line 82 of file tree_allocation_test.cc.
| #define SKIP_UNLESS_COUNTING_ALLOCATIONS | ( | ) |
Definition at line 86 of file tree_allocation_test.cc.
|
noexcept |
Definition at line 174 of file tree_allocation_test.cc.
|
noexcept |
Definition at line 178 of file tree_allocation_test.cc.
|
noexcept |
Definition at line 176 of file tree_allocation_test.cc.
|
noexcept |
Definition at line 175 of file tree_allocation_test.cc.
|
noexcept |
Definition at line 179 of file tree_allocation_test.cc.
|
noexcept |
Definition at line 177 of file tree_allocation_test.cc.
| void * operator new | ( | std::size_t | size | ) |
Definition at line 147 of file tree_allocation_test.cc.
References Aleph::allocate(), and Aleph::size().
|
noexcept |
Definition at line 150 of file tree_allocation_test.cc.
References Aleph::allocate(), and Aleph::size().
| void * operator new[] | ( | std::size_t | size | ) |
Definition at line 148 of file tree_allocation_test.cc.
References Aleph::allocate(), and Aleph::size().
|
noexcept |
Definition at line 162 of file tree_allocation_test.cc.
References Aleph::allocate(), and Aleph::size().
| TEST | ( | TreeAllocation | , |
| adaptors_propagate_the_bad_alloc_of_a_deep_tree | |||
| ) |
Definition at line 362 of file tree_allocation_test.cc.
References Aleph::count(), Aleph::enum_zip_it(), Aleph::get_pair_it(), SKIP_UNLESS_COUNTING_ALLOCATIONS, and Aleph::zip_it().
| TEST | ( | TreeAllocation | , |
| advancing_on_a_deep_tree_allocates | |||
| ) |
Definition at line 348 of file tree_allocation_test.cc.
References Aleph::DynSetTree< Key, Tree, Compare >::Iterator::get_curr(), and SKIP_UNLESS_COUNTING_ALLOCATIONS.
| TEST | ( | TreeAllocation | , |
| constructing_a_tree_does_not_allocate | |||
| ) |
Definition at line 182 of file tree_allocation_test.cc.
References m, and SKIP_UNLESS_COUNTING_ALLOCATIONS.
| TEST | ( | TreeAllocation | , |
| insert_and_remove_allocate_only_the_node | |||
| ) |
Definition at line 247 of file tree_allocation_test.cc.
References Aleph::HtdRbTree< Key, Compare >::insert(), nodes, and SKIP_UNLESS_COUNTING_ALLOCATIONS.
| TEST | ( | TreeAllocation | , |
| iterating_does_not_allocate | |||
| ) |
Definition at line 271 of file tree_allocation_test.cc.
References Aleph::copy(), Aleph::count(), Aleph::GenBinHeap< NodeType, Key, Compare >::Iterator::has_curr(), Aleph::BinNodeInfixIterator< Node >::has_curr(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::DynBinHeap< T, Compare >::insert(), QuadTree::insert(), nodes, SKIP_UNLESS_COUNTING_ALLOCATIONS, and Aleph::sum().
| TEST | ( | TreeAllocation | , |
| moving_a_tree_does_not_allocate | |||
| ) |
Definition at line 203 of file tree_allocation_test.cc.
References OhashCommon< HashTbl, Key >::insert(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), m, Aleph::DynSetTree< Key, Tree, Compare >::size(), and SKIP_UNLESS_COUNTING_ALLOCATIONS.
| TEST | ( | TreeAllocation | , |
| noexcept_specifications_hold | |||
| ) |
Definition at line 405 of file tree_allocation_test.cc.
References Aleph::next_ne().