|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
The search trees let through what their comparison throws, and keep their keys. More...
#include "search_trees_test_common.H"#include <gtest/gtest-spi.h>#include <climits>#include <stdexcept>#include <string>#include <utility>#include <ahFunction.H>#include <tpl_array.H>#include <tpl_binNodeXt.H>#include <tpl_binTreeOps.H>#include <tpl_dynMapTree.H>#include <tpl_dynSetTree.H>Go to the source code of this file.
Classes | |
| struct | ThrowingCompareTree< Kind > |
| struct | ThrowingCompareSet< Kind > |
| struct | ThrowingCompareMap< Kind > |
Macros | |
| #define | TREES_UNDER_TEST(X) |
| #define | DECLARE_TREE_KIND(T, Restructures, Noexcept) |
| #define | TREE_KIND_ENTRY(T, Restructures, Noexcept) , T##_Kind |
Functions | |
| TEST (ThrowingCompareHarness, AnExceptionThatTheOperationCatchesFailsTheTest) | |
| TYPED_TEST_SUITE (ThrowingCompareTree, Tree_Kinds, Kind_Names) | |
| TYPED_TEST (ThrowingCompareTree, IsNoexceptOnlyWithANothrowComparison) | |
| TYPED_TEST (ThrowingCompareTree, InsertionLetsTheExceptionThrough) | |
| TYPED_TEST (ThrowingCompareTree, SearchLetsTheExceptionThrough) | |
| TYPED_TEST (ThrowingCompareTree, RemovalLetsTheExceptionThrough) | |
| TYPED_TEST (ThrowingCompareTree, SplitLetsTheExceptionThrough) | |
| TYPED_TEST_SUITE (ThrowingCompareSet, Tree_Kinds, Kind_Names) | |
| TYPED_TEST (ThrowingCompareSet, LetsTheExceptionThrough) | |
| TYPED_TEST_SUITE (ThrowingCompareMap, Tree_Kinds, Kind_Names) | |
| TYPED_TEST (ThrowingCompareMap, LetsTheExceptionThrough) | |
| TEST (ThrowingCompareOperations, BinTreeOperationLeavesTheTreeAsItWas) | |
| TEST (ThrowingCompareOperations, BinTreeXtOperationLeavesTheTreeAsItWas) | |
| TEST (ThrowingCompareOperations, SplitsWithTheComparisonOfTheTree) | |
| TEST (ThrowingCompareOperations, SplayTreesKeepTheirNoexcept) | |
| TEST (ThrowingCompareOperations, TheConversionOfTheResultLetsTheExceptionThrough) | |
| TEST (ThrowingCompareOperations, TheConditionOnTheResultLetsTheExceptionThrough) | |
| TEST (ThrowingCompareOperations, AnOverloadForKeysNotConstantLetsTheExceptionThrough) | |
| TEST (ThrowingCompareOperations, TheSearchOfAMapComparesConstantKeys) | |
| TEST (ThrowingCompareOperations, TheCopyOfTheComparisonLetsTheExceptionThrough) | |
| TEST (ThrowingCompareOperations, RankedIteratorsLetTheExceptionThrough) | |
| TEST (ThrowingCompareOperations, AMapOnATreeThatGivesACopyOfItsComparison) | |
| TYPED_TEST (ThrowingCompareTree, TakesTheResultOfTheComparisonAsABool) | |
The search trees let through what their comparison throws, and keep their keys.
The comparison of a tree is code of the user, and it may throw. The operations of the trees that compare are noexcept only if it cannot: a noexcept function that lets an exception out ends the program (std::terminate()), where the user expects the exception.
Here the comparison throws at its k-th call, for every k up to the number of calls that an operation makes. Every search tree of the library but the splay trees is tested alone, in a DynSetTree and in a DynMapTree: each insertion, search, removal and split must let the exception through and leave a tree that verifies, with the keys and the size that it had. The trees that do not recolor or rotate on their way down are left exactly as they were. The operations of BinTree_Operation and BinTreeXt_Operation are tested in the same way.
The splay trees keep their noexcept: a splay relinks the tree as it compares, so their comparison must not throw.
Definition in file throwing_compare_test.cc.
| #define DECLARE_TREE_KIND | ( | T, | |
| Restructures, | |||
| Noexcept | |||
| ) |
Definition at line 390 of file throwing_compare_test.cc.
Definition at line 415 of file throwing_compare_test.cc.
| #define TREES_UNDER_TEST | ( | X | ) |
Definition at line 374 of file throwing_compare_test.cc.
| TEST | ( | ThrowingCompareHarness | , |
| AnExceptionThatTheOperationCatchesFailsTheTest | |||
| ) |
Definition at line 442 of file throwing_compare_test.cc.
| TEST | ( | ThrowingCompareOperations | , |
| AMapOnATreeThatGivesACopyOfItsComparison | |||
| ) |
Definition at line 1761 of file throwing_compare_test.cc.
References Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), and Aleph::DynMapTree< Key, Data, Tree, Compare >::search().
| TEST | ( | ThrowingCompareOperations | , |
| AnOverloadForKeysNotConstantLetsTheExceptionThrough | |||
| ) |
Definition at line 1688 of file throwing_compare_test.cc.
References Aleph::Less.
| TEST | ( | ThrowingCompareOperations | , |
| BinTreeOperationLeavesTheTreeAsItWas | |||
| ) |
Definition at line 1018 of file throwing_compare_test.cc.
References Aleph::check_bst(), k, KEY, RLINK, and Aleph::split().
| TEST | ( | ThrowingCompareOperations | , |
| BinTreeXtOperationLeavesTheTreeAsItWas | |||
| ) |
Definition at line 1186 of file throwing_compare_test.cc.
References Aleph::check_rank_tree(), l, r, and Aleph::split().
| TEST | ( | ThrowingCompareOperations | , |
| RankedIteratorsLetTheExceptionThrough | |||
| ) |
Definition at line 1746 of file throwing_compare_test.cc.
References Aleph::has_curr().
| TEST | ( | ThrowingCompareOperations | , |
| SplayTreesKeepTheirNoexcept | |||
| ) |
Definition at line 1317 of file throwing_compare_test.cc.
| TEST | ( | ThrowingCompareOperations | , |
| SplitsWithTheComparisonOfTheTree | |||
| ) |
Definition at line 1307 of file throwing_compare_test.cc.
| TEST | ( | ThrowingCompareOperations | , |
| TheConditionOnTheResultLetsTheExceptionThrough | |||
| ) |
Definition at line 1661 of file throwing_compare_test.cc.
References Aleph::has_curr(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), and Aleph::Less.
| TEST | ( | ThrowingCompareOperations | , |
| TheConversionOfTheResultLetsTheExceptionThrough | |||
| ) |
Definition at line 1616 of file throwing_compare_test.cc.
References Aleph::DynMapTree< Key, Data, Tree, Compare >::contains(), Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), k, Aleph::DynMapTree< Key, Data, Tree, Compare >::search(), and Aleph::search().
| TEST | ( | ThrowingCompareOperations | , |
| TheCopyOfTheComparisonLetsTheExceptionThrough | |||
| ) |
Definition at line 1728 of file throwing_compare_test.cc.
References Aleph::search().
| TEST | ( | ThrowingCompareOperations | , |
| TheSearchOfAMapComparesConstantKeys | |||
| ) |
Definition at line 1703 of file throwing_compare_test.cc.
References Aleph::DynMapTree< Key, Data, Tree, Compare >::contains(), Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), and Aleph::DynMapTree< Key, Data, Tree, Compare >::insert().
| TYPED_TEST | ( | ThrowingCompareMap | , |
| LetsTheExceptionThrough | |||
| ) |
Definition at line 866 of file throwing_compare_test.cc.
References Aleph::search().
| TYPED_TEST | ( | ThrowingCompareSet | , |
| LetsTheExceptionThrough | |||
| ) |
Definition at line 754 of file throwing_compare_test.cc.
References k, and Aleph::size().
| TYPED_TEST | ( | ThrowingCompareTree | , |
| InsertionLetsTheExceptionThrough | |||
| ) |
Definition at line 491 of file throwing_compare_test.cc.
References KEY.
| TYPED_TEST | ( | ThrowingCompareTree | , |
| IsNoexceptOnlyWithANothrowComparison | |||
| ) |
Definition at line 470 of file throwing_compare_test.cc.
References Aleph::remove(), and Aleph::search().
| TYPED_TEST | ( | ThrowingCompareTree | , |
| RemovalLetsTheExceptionThrough | |||
| ) |
Definition at line 605 of file throwing_compare_test.cc.
References KEY.
| TYPED_TEST | ( | ThrowingCompareTree | , |
| SearchLetsTheExceptionThrough | |||
| ) |
Definition at line 551 of file throwing_compare_test.cc.
| TYPED_TEST | ( | ThrowingCompareTree | , |
| SplitLetsTheExceptionThrough | |||
| ) |
Definition at line 716 of file throwing_compare_test.cc.
References Aleph::split().
| TYPED_TEST | ( | ThrowingCompareTree | , |
| TakesTheResultOfTheComparisonAsABool | |||
| ) |
Definition at line 1871 of file throwing_compare_test.cc.
| TYPED_TEST_SUITE | ( | ThrowingCompareMap | , |
| Tree_Kinds | , | ||
| Kind_Names | |||
| ) |
| TYPED_TEST_SUITE | ( | ThrowingCompareSet | , |
| Tree_Kinds | , | ||
| Kind_Names | |||
| ) |
| TYPED_TEST_SUITE | ( | ThrowingCompareTree | , |
| Tree_Kinds | , | ||
| Kind_Names | |||
| ) |