|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
The noexcept of the constructions, moves and swaps that build, copy, move or swap a type of the user follows that type.
More...
#include <cstddef>#include <memory>#include <stdexcept>#include <string>#include <type_traits>#include <utility>#include <gtest/gtest.h>#include <ah-mapping.H>#include <htlist.H>#include <tpl_array.H>#include <tpl_avl.H>#include <tpl_avlRk.H>#include <tpl_binTree.H>#include <tpl_dynArrayHeap.H>#include <tpl_dynMapTree.H>#include <tpl_dynSetTree.H>#include <tpl_hRbTree.H>#include <tpl_hRbTreeRk.H>#include <tpl_odhash.H>#include <tpl_olhash.H>#include <tpl_rand_tree.H>#include <tpl_rbRk.H>#include <tpl_rb_tree.H>#include <tpl_splay_tree.H>#include <tpl_splay_treeRk.H>#include <tpl_tdRbTree.H>#include <tpl_tdRbTreeRk.H>#include <tpl_treap.H>#include <tpl_treapRk.H>Go to the source code of this file.
Functions | |
| TYPED_TEST (Noexcept_Construction, IsNoexceptWithTypesThatDoNotThrow) | |
| TYPED_TEST (Noexcept_Construction, ATreeIsMovedAndNotCopied) | |
| TYPED_TEST (Noexcept_Construction, FollowsTheDefaultConstructionOfTheKey) | |
| TYPED_TEST (Noexcept_Construction, TheMoveOfATreeBuildsNoKeyThatItCanTake) | |
| TYPED_TEST (Noexcept_Construction, FollowsTheCopyMoveAndSwapOfTheComparison) | |
| TYPED_TEST (Noexcept_Construction, TheMoveOfATreeFollowsTheCopyOfTheComparisonAlone) | |
| TYPED_TEST (Noexcept_Construction, LetsTheFailureOfTheKeyThrough) | |
| TYPED_TEST (Noexcept_Construction, LetsTheFailureOfTheComparisonThrough) | |
| TYPED_TEST (Noexcept_Construction, ASetAndAMapAreNoexceptWithTypesThatDoNotThrow) | |
| TYPED_TEST (Noexcept_Construction, TheMoveOfASetBuildsNoKeyThatItCanTake) | |
| TYPED_TEST (Noexcept_Construction, TheMoveOfASetBuildsNoComparisonByDefault) | |
| TYPED_TEST (Noexcept_Construction, TheMoveOfASetFollowsTheCopyOfTheComparison) | |
| TYPED_TEST (Noexcept_Construction, ASetBuiltByDefaultLetsTheFailureOfTheComparisonThrough) | |
| TYPED_TEST (Noexcept_Construction, ATreeBuiltByDefaultLetsTheFailureOfTheComparisonThrough) | |
| TYPED_TEST (Noexcept_Construction, ATreeBuiltFromAComparisonLetsTheFailureOfItsCopyThrough) | |
| TEST (Noexcept_Construction_Trees, TheTreesOfVirtualNodesLetTheFailureOfTheComparisonThrough) | |
| TYPED_TEST (Noexcept_Construction, AMoveOfASetThatThrowsLeavesItAsItWas) | |
| TYPED_TEST (Noexcept_Construction, AMoveOfAMapThatThrowsLeavesItAsItWas) | |
| TYPED_TEST (Noexcept_Construction, AMoveOfASetThatTakesItsKeysCannotFail) | |
| TEST (Noexcept_Construction_Nodes, TheKeyOfAMapIsSeenInItsMembers) | |
| TEST (Noexcept_Construction_Trees, TheTreeWithoutHeaderNodesLetsTheFailureOfItsComparisonThrough) | |
| TEST (Noexcept_Construction_Trees, TheCopyOfAComparisonTakenByValueIsFromOneThatIsNotConst) | |
| TEST (Noexcept_Construction_Maps, TheComparisonOfThePairsFollowsThatOfTheKeys) | |
| TEST (Noexcept_Construction_Maps, AMapOfContainersMovesAsTheyAreBuiltOrMoved) | |
| TEST (Noexcept_Construction_Maps, AMappingMovesAsItsMap) | |
| TEST (Noexcept_Construction_Hash, TheBucketsFollowTheDefaultConstructionOfTheKey) | |
| TEST (Noexcept_Construction_Heap, TheSiftsFollowTheComparison) | |
The noexcept of the constructions, moves and swaps that build, copy, move or swap a type of the user follows that type.
The Coverity Scan of 7.7.3 found constructors of the trees, of the buckets of the open hash tables and the sifts of DynArrayHeap declared noexcept without a condition, though they build the key of a header node, copy the comparison or call it: an exception of the user there ended the program (std::terminate()). This test checks the pattern on every tree, so that a new tree, or a constructor added to one, that repeats it fails here: with keys and comparisons that cannot throw, the operations are noexcept; with a key whose default construction may throw, or a comparison whose copy, move or swap may throw, they are not, and what the user type throws reaches the caller.
The splay trees keep their operations noexcept on purpose (see tpl_splay_tree.H); their constructors follow the pattern.
The Coverity Scan of 7.8.0 found the pattern one level up: the move of a DynSetTree, noexcept, built an empty tree for the set that it moved from, so that it stayed usable, and with it a key and a comparison by default. Since 7.9.0 the move of a tree builds nothing that it can take from the other tree: the key of a header node is that of the same header node of the other tree, moved, when building one by default may throw, and the comparison is a copy of that of the other tree. A set moves its tree, and a DynMapTree and an AHMapping move their set. The tests of the trees, the sets and the maps below check, on every tree, what a move still builds, and that its noexcept follows that.
Definition in file noexcept_construction_test.cc.
| TEST | ( | Noexcept_Construction_Hash | , |
| TheBucketsFollowTheDefaultConstructionOfTheKey | |||
| ) |
Definition at line 1021 of file noexcept_construction_test.cc.
| TEST | ( | Noexcept_Construction_Heap | , |
| TheSiftsFollowTheComparison | |||
| ) |
Definition at line 1036 of file noexcept_construction_test.cc.
References Aleph::DynArrayHeap< T, Compare >::getMin(), Aleph::DynArrayHeap< T, Compare >::insert(), Aleph::sift_down(), and Aleph::sift_up().
| TEST | ( | Noexcept_Construction_Maps | , |
| AMapOfContainersMovesAsTheyAreBuiltOrMoved | |||
| ) |
Definition at line 968 of file noexcept_construction_test.cc.
| TEST | ( | Noexcept_Construction_Maps | , |
| AMappingMovesAsItsMap | |||
| ) |
Definition at line 990 of file noexcept_construction_test.cc.
References Aleph::AHMapping< Key, ValueType >::insert(), Aleph::AHMapping< Key, ValueType >::size(), and value.
| TEST | ( | Noexcept_Construction_Maps | , |
| TheComparisonOfThePairsFollowsThatOfTheKeys | |||
| ) |
Definition at line 924 of file noexcept_construction_test.cc.
References cmp(), and Aleph::Less.
| TEST | ( | Noexcept_Construction_Nodes | , |
| TheKeyOfAMapIsSeenInItsMembers | |||
| ) |
Definition at line 867 of file noexcept_construction_test.cc.
| TEST | ( | Noexcept_Construction_Trees | , |
| TheCopyOfAComparisonTakenByValueIsFromOneThatIsNotConst | |||
| ) |
Definition at line 907 of file noexcept_construction_test.cc.
References Aleph::Less.
| TEST | ( | Noexcept_Construction_Trees | , |
| TheTreesOfVirtualNodesLetTheFailureOfTheComparisonThrough | |||
| ) |
Definition at line 738 of file noexcept_construction_test.cc.
| TEST | ( | Noexcept_Construction_Trees | , |
| TheTreeWithoutHeaderNodesLetsTheFailureOfItsComparisonThrough | |||
| ) |
Definition at line 893 of file noexcept_construction_test.cc.
| TYPED_TEST | ( | Noexcept_Construction | , |
| AMoveOfAMapThatThrowsLeavesItAsItWas | |||
| ) |
Definition at line 798 of file noexcept_construction_test.cc.
References Aleph::Value.
| TYPED_TEST | ( | Noexcept_Construction | , |
| AMoveOfASetThatTakesItsKeysCannotFail | |||
| ) |
Definition at line 843 of file noexcept_construction_test.cc.
| TYPED_TEST | ( | Noexcept_Construction | , |
| AMoveOfASetThatThrowsLeavesItAsItWas | |||
| ) |
Definition at line 761 of file noexcept_construction_test.cc.
References QuadTree::insert().
| TYPED_TEST | ( | Noexcept_Construction | , |
| ASetAndAMapAreNoexceptWithTypesThatDoNotThrow | |||
| ) |
Definition at line 558 of file noexcept_construction_test.cc.
| TYPED_TEST | ( | Noexcept_Construction | , |
| ASetBuiltByDefaultLetsTheFailureOfTheComparisonThrough | |||
| ) |
Definition at line 697 of file noexcept_construction_test.cc.
| TYPED_TEST | ( | Noexcept_Construction | , |
| ATreeBuiltByDefaultLetsTheFailureOfTheComparisonThrough | |||
| ) |
Definition at line 719 of file noexcept_construction_test.cc.
| TYPED_TEST | ( | Noexcept_Construction | , |
| ATreeBuiltFromAComparisonLetsTheFailureOfItsCopyThrough | |||
| ) |
Definition at line 728 of file noexcept_construction_test.cc.
| TYPED_TEST | ( | Noexcept_Construction | , |
| ATreeIsMovedAndNotCopied | |||
| ) |
Definition at line 427 of file noexcept_construction_test.cc.
| TYPED_TEST | ( | Noexcept_Construction | , |
| FollowsTheCopyMoveAndSwapOfTheComparison | |||
| ) |
Definition at line 498 of file noexcept_construction_test.cc.
| TYPED_TEST | ( | Noexcept_Construction | , |
| FollowsTheDefaultConstructionOfTheKey | |||
| ) |
Definition at line 441 of file noexcept_construction_test.cc.
| TYPED_TEST | ( | Noexcept_Construction | , |
| IsNoexceptWithTypesThatDoNotThrow | |||
| ) |
Definition at line 414 of file noexcept_construction_test.cc.
| TYPED_TEST | ( | Noexcept_Construction | , |
| LetsTheFailureOfTheComparisonThrough | |||
| ) |
Definition at line 547 of file noexcept_construction_test.cc.
References cmp().
| TYPED_TEST | ( | Noexcept_Construction | , |
| LetsTheFailureOfTheKeyThrough | |||
| ) |
Definition at line 535 of file noexcept_construction_test.cc.
| TYPED_TEST | ( | Noexcept_Construction | , |
| TheMoveOfASetBuildsNoComparisonByDefault | |||
| ) |
Definition at line 642 of file noexcept_construction_test.cc.
| TYPED_TEST | ( | Noexcept_Construction | , |
| TheMoveOfASetBuildsNoKeyThatItCanTake | |||
| ) |
Definition at line 582 of file noexcept_construction_test.cc.
| TYPED_TEST | ( | Noexcept_Construction | , |
| TheMoveOfASetFollowsTheCopyOfTheComparison | |||
| ) |
Definition at line 670 of file noexcept_construction_test.cc.
References Aleph::Less.
| TYPED_TEST | ( | Noexcept_Construction | , |
| TheMoveOfATreeBuildsNoKeyThatItCanTake | |||
| ) |
Definition at line 467 of file noexcept_construction_test.cc.
| TYPED_TEST | ( | Noexcept_Construction | , |
| TheMoveOfATreeFollowsTheCopyOfTheComparisonAlone | |||
| ) |
Definition at line 510 of file noexcept_construction_test.cc.